diff options
author | Ronnie Sahlberg <sahlberg@samba.org> | 2008-04-03 10:58:51 +1100 |
---|---|---|
committer | Ronnie Sahlberg <sahlberg@samba.org> | 2008-04-03 10:58:51 +1100 |
commit | 6b797f148c87c295765cb14aa128033237f3de05 (patch) | |
tree | 2b28f85fd282ae24d2acab3c97e56a71c870bd54 /ctdb/server/ctdb_daemon.c | |
parent | eaad3e18680e0827d90f6b357ab517a0a43c3804 (diff) | |
download | samba-6b797f148c87c295765cb14aa128033237f3de05.tar.gz samba-6b797f148c87c295765cb14aa128033237f3de05.tar.xz samba-6b797f148c87c295765cb14aa128033237f3de05.zip |
From Chris Cowan
Add support in AIX to track the PID of a client that connects to the unix domain socket
(This used to be ctdb commit 4c006c675d577d4a45f4db2929af6d50bc28dd9e)
Diffstat (limited to 'ctdb/server/ctdb_daemon.c')
-rw-r--r-- | ctdb/server/ctdb_daemon.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_daemon.c b/ctdb/server/ctdb_daemon.c index 900d4e83d3..3ba5998a5d 100644 --- a/ctdb/server/ctdb_daemon.c +++ b/ctdb/server/ctdb_daemon.c @@ -529,8 +529,13 @@ static void ctdb_accept_client(struct event_context *ev, struct fd_event *fde, int fd; struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context); struct ctdb_client *client; +#ifdef _AIX + struct peercred_struct cr; + socklen_t crl = sizeof(struct peercred_struct); +#else struct ucred cr; socklen_t crl = sizeof(struct ucred); +#endif memset(&addr, 0, sizeof(addr)); len = sizeof(addr); @@ -543,7 +548,11 @@ static void ctdb_accept_client(struct event_context *ev, struct fd_event *fde, set_close_on_exec(fd); client = talloc_zero(ctdb, struct ctdb_client); +#ifdef _AIX + if (getsockopt(fd, SOL_SOCKET, SO_PEERID, &cr, &crl) == 0) { +#else if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &crl) == 0) { +#endif talloc_asprintf(client, "struct ctdb_client: pid:%u", (unsigned)cr.pid); } |