Changeset 4482:b93886d58180 in roaraudio for roard/roard.c


Ignore:
Timestamp:
10/11/10 16:54:35 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added options for auth

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/roard.c

    r4481 r4482  
    174174       ); 
    175175 
     176 printf("\nAuth Options:\n\n"); 
     177 printf( 
     178        " --guest-acclev ACCLEV - Sets the access level for guest access to ACCLEV\n" 
     179        " --trust-acclev ACCLEV - Sets the access level for trust-authed\n" 
     180        "                         connections to ACCLEV\n" 
     181        " --trust-root          - Trust root user\n" 
     182        " --no-trust-root       - Don't trust root user\n" 
     183       ); 
     184 
    176185 printf("\nPlugin Options:\n\n"); 
    177186 printf( 
     
    14001409 size_t i; 
    14011410 
    1402  if ( auth_addkey_anonymous(none_acclev) == -1 ) 
    1403   return -1; 
    1404  
    1405  if ( (key = auth_regkey_simple(ROAR_AUTH_T_TRUST, trust_acclev)) == NULL ) 
    1406   return -1; 
    1407  
    1408  // zerosize all counters. 
    1409  memset(key, 0, sizeof(union auth_typeunion)); 
    1410  
    1411  i = 0; 
    1412  
    1413  if ( trust_uid != -1 ) 
    1414   key->trust.uids[i++] = trust_uid; 
     1411 // Info: 
     1412 // if a authlevel is <= ACCLEV_IDENTED we do not need to add this to the keyring 
     1413 // as ACCLEV_IDENTED is already gained if IDENTIFY call was done correctly. 
     1414 
     1415 if ( !(none_acclev <= ACCLEV_IDENTED) ) { 
     1416  if ( auth_addkey_anonymous(none_acclev) == -1 ) 
     1417   return -1; 
     1418 } 
     1419 
     1420 if ( !(trust_acclev <= ACCLEV_IDENTED) ) { 
     1421  if ( (key = auth_regkey_simple(ROAR_AUTH_T_TRUST, trust_acclev)) == NULL ) 
     1422   return -1; 
     1423 
     1424  // zerosize all counters. 
     1425  memset(key, 0, sizeof(union auth_typeunion)); 
     1426 
     1427  i = 0; 
     1428 
     1429  if ( trust_uid != -1 ) 
     1430   key->trust.uids[i++] = trust_uid; 
    14151431 
    14161432#ifdef ROAR_ROOT_UID 
    1417  if ( trust_root ) 
    1418   key->trust.uids[i++] = ROAR_ROOT_UID; 
    1419 #endif 
    1420  
    1421  key->trust.uids_len = i; 
    1422  
    1423  i = 0; 
    1424  
    1425  if ( trust_gid != -1 ) 
    1426   key->trust.gids[i++] = trust_gid; 
    1427  
    1428  key->trust.gids_len = i; 
     1433  if ( trust_root ) 
     1434   key->trust.uids[i++] = ROAR_ROOT_UID; 
     1435#endif 
     1436 
     1437  key->trust.uids_len = i; 
     1438 
     1439  i = 0; 
     1440 
     1441  if ( trust_gid != -1 ) 
     1442   key->trust.gids[i++] = trust_gid; 
     1443 
     1444  key->trust.gids_len = i; 
     1445 } 
    14291446 
    14301447 return 0; 
     
    17791796   } 
    17801797 
     1798  } else if ( strcmp(k, "--guest-acclev") == 0 ) { 
     1799   _CKHAVEARGS(1); 
     1800   none_acclev = clients_str2acclev(argv[++i]); 
     1801  } else if ( strcmp(k, "--trust-acclev") == 0 ) { 
     1802   _CKHAVEARGS(1); 
     1803   trust_acclev = clients_str2acclev(argv[++i]); 
     1804  } else if ( strcmp(k, "--trust-root") == 0 ) { 
     1805   trust_root = 1; 
     1806  } else if ( strcmp(k, "--no-trust-root") == 0 ) { 
     1807   trust_root = 0; 
     1808 
    17811809  } else if ( strcmp(k, "--list-cf") == 0 ) { 
    17821810   print_codecfilterlist(); 
Note: See TracChangeset for help on using the changeset viewer.