Changeset 490:dc9ab0d247dc in roaraudio


Ignore:
Timestamp:
08/14/08 05:02:17 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

corrected a cast and moved SO_PEERCRED code from req.c to network.c

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/network.c

    r0 r490  
    2525 int fh; 
    2626 int client; 
     27#ifdef SO_PEERCRED 
     28 struct roar_client * c; 
     29 struct ucred cred; 
     30 socklen_t cred_len = sizeof(cred); 
     31#endif 
    2732 
    2833 fh = accept(g_listen_socket, NULL, NULL); 
     
    4247 } 
    4348 
     49#ifdef SO_PEERCRED 
     50 if ( clients_get(client, &c) != -1 ) { 
     51  if (getsockopt(fh, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len) != -1) { 
     52   if ( cred.pid != 0 ) { 
     53    c->pid = cred.pid; 
     54    c->uid = cred.uid; 
     55    c->gid = cred.gid; 
     56   } 
     57  } else { 
     58   ROAR_DBG("req_on_identify(): Can't get creds via SO_PEERCRED: %s", strerror(errno)); 
     59  } 
     60 } 
     61#endif 
     62 
    4463// close(fh); 
    4564 
  • roard/req.c

    r486 r490  
    1212 struct roar_client * c; 
    1313 int max_len; 
    14 #ifdef SO_PEERCRED 
    15  struct ucred cred; 
    16  socklen_t cred_len = sizeof(cred); 
    17 #endif 
    1814 
    1915 if ( mes->datalen < 1 ) 
     
    2319 
    2420 if ( mes->data[0] == 1 ) { 
    25 #ifdef SO_PEERCRED 
    26   if (getsockopt(c->fh, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len) != -1) { 
    27    if ( cred.pid != 0 ) { 
    28     c->pid = cred.pid; 
    29     c->uid = cred.uid; 
    30     c->gid = cred.gid; 
    31    } 
    32   } else { 
    33    ROAR_DBG("req_on_identify(): Can't get creds via SO_PEERCRED: %s", strerror(errno)); 
    34   } 
    35 #endif 
    3621  if ( c->pid == -1 ) { 
    3722   c->pid       = ROAR_NET2HOST32(*(uint32_t*)((mes->data)+1)); 
     
    420405 } 
    421406 
    422  if ( streams_get(mes->stream, ROAR_STREAM_SERVER(&s)) == -1 ) { 
     407 if ( streams_get(mes->stream, (struct roar_stream_server **)&s) == -1 ) { 
    423408  ROAR_WARN("req_on_get_stream_para(*): request on non existing (or other error?) stream %i", mes->stream); 
    424409  return -1; 
Note: See TracChangeset for help on using the changeset viewer.