Changeset 5146:716400712348 in roaraudio for roard


Ignore:
Timestamp:
10/15/11 12:48:07 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Moved error frame handling into proto functions (pr0)

Location:
roard
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • roard/auth.c

    r4745 r5146  
    127127 for (i = 0; i < AUTH_KEYRING_LEN; i++) { 
    128128  if ( (key = &(g_auth_keyring[i]))->type == authmes->type ) { 
    129     ret = -1; 
     129   ROAR_DBG("auth_client_ckeck(cs=%p, authmes=%p, next=%p{%i}): key=%p{.type=%i, ...}", cs, authmes, next, *next, key, key->type); 
     130   ret = -1; 
    130131   switch (key->type) { 
    131132    case ROAR_AUTH_T_NONE: 
  • roard/clients.c

    r4947 r5146  
    10281028   return _g_acclevs[i].acclev; 
    10291029 
    1030  return -1; 
     1030 return ACCLEV_ERROR; 
    10311031} 
    10321032 
  • roard/include/client.h

    r4708 r5146  
    4949// access level: 
    5050enum roard_client_acclev { 
    51  ACCLEV_NONE     = 0, // only very basic commands like NOOP and IDENTIFY 
    52  ACCLEV_IDENTED,      // same as NONE but INDENTIFY worked. 
    53  ACCLEV_CONCTL,       // only allowed to do basic connection things. 
    54  ACCLEV_GUEST,        // guest connection (read only) 
    55  ACCLEV_USER,         // normal user connect (read write) 
    56  ACCLEV_PWRUSER,      // power user, may access other user's clients 
    57  ACCLEV_ALL           // full (admin) access (read write ctl) 
     51 ACCLEV_ERROR    = -1, // used as erorr return value. 
     52 ACCLEV_NONE     =  0, // only very basic commands like NOOP and IDENTIFY 
     53 ACCLEV_IDENTED,       // same as NONE but INDENTIFY worked. 
     54 ACCLEV_CONCTL,        // only allowed to do basic connection things. 
     55 ACCLEV_GUEST,         // guest connection (read only) 
     56 ACCLEV_USER,          // normal user connect (read write) 
     57 ACCLEV_PWRUSER,       // power user, may access other user's clients 
     58 ACCLEV_ALL            // full (admin) access (read write ctl) 
    5859}; 
    5960 
  • roard/req.c

    r5065 r5146  
    141141                           client, roar_autht2str(authmes.type), authmes.type, (long long unsigned int)authmes.len); 
    142142 
     143 ROAR_DBG("req_on_auth(client=%i,...): CALL auth_client_ckeck(cs=%p, &authmes=%p, &next=%p)", client, cs, &authmes, &next); 
    143144 ret = auth_client_ckeck(cs, &authmes, &next); 
     145 ROAR_DBG("req_on_auth(client=%i,...): RET %i // next=%s(%i)", client, ret, roar_autht2str(next), next); 
    144146 
    145147 if ( ret != 1 ) { 
     148  ROAR_DBG("req_on_auth(client=%i,...) = ?", client); 
     149 
    146150  if ( next != -1 ) { 
     151   ROAR_DBG("req_on_auth(client=%i,...) = ?", client); 
    147152   memset(&authmes, 0, sizeof(authmes)); 
    148153 
     
    152157    return -1; 
    153158 
    154    if ( roar_err_int(&error_frame) == -1 ) 
    155     return -1; 
     159   ROAR_DBG("req_on_auth(client=%i,...) = ?", client); 
     160 
     161   if ( roar_err_init(&error_frame) == -1 ) 
     162    return -1; 
     163 
     164   ROAR_DBG("req_on_auth(client=%i,...) = ?", client); 
    156165 
    157166   error_frame.ra_errno = ROAR_ERROR_PERM; 
     
    159168 
    160169   error_data   = roar_err_buildmsg(mes, &error_frame); 
     170   ROAR_DBG("req_on_auth(client=%i,...): error_data=%p", client, error_data); 
    161171 
    162172   memcpy(error_data, error_mes.data, error_mes.datalen); 
     
    164174   mes->cmd     = ROAR_CMD_ERROR; 
    165175   mes->pos     = g_pos; 
     176 
     177   ROAR_DBG("req_on_auth(client=%i,...): mes=%p{.datalen=%i}", client, mes, (int)mes->datalen); 
     178   ROAR_DBG("req_on_auth(client=%i,...) = 0 // cmd=ERROR", client); 
    166179   return 0; 
    167180  } 
    168181 
     182  ROAR_DBG("req_on_auth(client=%i,...) = 0", client); 
    169183  return -1; 
    170184 } 
     
    173187 mes->pos     = g_pos; 
    174188 mes->datalen = 0; 
     189 
     190 ROAR_DBG("req_on_auth(client=%i,...) = 0", client); 
    175191 return 0; 
    176192} 
  • roard/roard.c

    r5103 r5146  
    217217 printf("\nAuth Options:\n\n"); 
    218218 printf( 
    219         " --guest-acclev ACCLEV - Sets the access level for guest access to ACCLEV\n" 
     219        " --guest-acclev ACCLEV - Sets the access level for guest access to ACCLEV,\n" 
     220        "                         Use \"none\" to disable guest access.\n" 
    220221        " --trust-acclev ACCLEV - Sets the access level for trust-authed\n" 
    221         "                         connections to ACCLEV\n" 
     222        "                         connections to ACCLEV. Use \"none\" to disable trust auth.\n" 
    222223        " --trust-root          - Trust root user\n" 
    223224        " --no-trust-root       - Don't trust root user\n" 
     
    16791680   _CKHAVEARGS(1); 
    16801681   none_acclev = clients_str2acclev(argv[++i]); 
     1682   if ( none_acclev == -1 ) { 
     1683    ROAR_ERR("Invalid access level: %s", argv[i]); 
     1684    return 1; 
     1685   } 
    16811686  } else if ( strcmp(k, "--trust-acclev") == 0 ) { 
    16821687   _CKHAVEARGS(1); 
    16831688   trust_acclev = clients_str2acclev(argv[++i]); 
     1689   if ( trust_acclev == -1 ) { 
     1690    ROAR_ERR("Invalid access level: %s", argv[i]); 
     1691    return 1; 
     1692   } 
    16841693  } else if ( strcmp(k, "--trust-root") == 0 ) { 
    16851694   trust_root = 1; 
Note: See TracChangeset for help on using the changeset viewer.