Changeset 490:dc9ab0d247dc in roaraudio
- Timestamp:
- 08/14/08 05:02:17 (16 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
roard/network.c
r0 r490 25 25 int fh; 26 26 int client; 27 #ifdef SO_PEERCRED 28 struct roar_client * c; 29 struct ucred cred; 30 socklen_t cred_len = sizeof(cred); 31 #endif 27 32 28 33 fh = accept(g_listen_socket, NULL, NULL); … … 42 47 } 43 48 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 44 63 // close(fh); 45 64 -
roard/req.c
r486 r490 12 12 struct roar_client * c; 13 13 int max_len; 14 #ifdef SO_PEERCRED15 struct ucred cred;16 socklen_t cred_len = sizeof(cred);17 #endif18 14 19 15 if ( mes->datalen < 1 ) … … 23 19 24 20 if ( mes->data[0] == 1 ) { 25 #ifdef SO_PEERCRED26 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 #endif36 21 if ( c->pid == -1 ) { 37 22 c->pid = ROAR_NET2HOST32(*(uint32_t*)((mes->data)+1)); … … 420 405 } 421 406 422 if ( streams_get(mes->stream, ROAR_STREAM_SERVER(&s)) == -1 ) {407 if ( streams_get(mes->stream, (struct roar_stream_server **)&s) == -1 ) { 423 408 ROAR_WARN("req_on_get_stream_para(*): request on non existing (or other error?) stream %i", mes->stream); 424 409 return -1;
Note: See TracChangeset
for help on using the changeset viewer.