Changeset 4792:a9cb74d9acb5 in roaraudio


Ignore:
Timestamp:
03/14/11 14:17:01 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support to roard to load authfiles

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libroar/authfile.c

    r4790 r4792  
    239239  case ROAR_AUTHFILE_TYPE_ESD: 
    240240  case ROAR_AUTHFILE_TYPE_PULSE: 
    241     if ( type != ROAR_AUTH_T_COOKIE || minindex > 0 ) 
     241    if ( (type != ROAR_AUTH_T_COOKIE && type != ROAR_AUTH_T_AUTO) || minindex > 0 ) 
    242242     return NULL; 
    243243 
    244     if ( (ret = roar_authfile_key_new(type, 256, NULL)) == NULL ) 
     244    if ( (ret = roar_authfile_key_new(ROAR_AUTH_T_COOKIE, 256, NULL)) == NULL ) 
    245245     return NULL; 
    246246 
  • roard/roard.c

    r4790 r4792  
    196196        " --no-trust-root       - Don't trust root user\n" 
    197197        " --authfile-gen FILE   - Generate an new authfile\n" 
    198 //        " --authfile-load FILE  - Load an authfile\n" 
     198        " --authfile-load FILE  - Load an authfile\n" 
    199199        " --authfile-type TYPE  - Type of authfile\n" 
    200200        " --authfile-acclev ACCLEV\n" 
     
    13751375 int af_type = ROAR_AUTHFILE_TYPE_AUTO; 
    13761376 void * keydata; 
     1377 int i; 
    13771378 
    13781379 if ( type == NULL ) { 
     
    14421443    return 0; 
    14431444   break; 
     1445  case AF_MODE_LOAD: 
     1446    if ( (authfile = roar_authfile_open(af_type, file, 0, ROAR_AUTHFILE_VERSION_AUTO)) == NULL ) { 
     1447     return -1; 
     1448    } 
     1449 
     1450    for (i = 0; ; i++) { 
     1451     key = roar_authfile_lookup_key(authfile, ROAR_AUTH_T_AUTO, i, NULL); 
     1452     if ( key == NULL ) 
     1453      break; 
     1454 
     1455     if ( key->type == ROAR_AUTH_T_COOKIE ) { 
     1456      keydata = roar_mm_memdup(key->data, key->len); 
     1457 
     1458      if ( keydata == NULL ) { 
     1459       ROAR_WARN("add_authfile(*): Can not allocate memory for key."); 
     1460      } else if ( auth_addkey_cookie(acclev, keydata, key->len) == -1 ) { 
     1461       ROAR_WARN("add_authfile(*): Can not add key to internal key storage."); 
     1462      } 
     1463     } else { 
     1464      ROAR_WARN("add_authfile(*): Unknown key type: %i", key->type); 
     1465     } 
     1466 
     1467     roar_authfile_key_unref(key); 
     1468    } 
     1469 
     1470    if ( roar_authfile_close(authfile) != 0 ) 
     1471     return -1; 
     1472    return 0; 
     1473   break; 
    14441474 } 
    14451475 
Note: See TracChangeset for help on using the changeset viewer.