nss-pam-ldapd commit: r1640 - nss-pam-ldapd/pynslcd
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1640 - nss-pam-ldapd/pynslcd
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd commit: r1640 - nss-pam-ldapd/pynslcd
- Date: Fri, 16 Mar 2012 13:48:28 +0100 (CET)
Author: arthur
Date: Fri Mar 16 13:48:28 2012
New Revision: 1640
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1640&view=revision
Log:
implement a getpeercred() function
Modified:
nss-pam-ldapd/pynslcd/pynslcd.py
Modified: nss-pam-ldapd/pynslcd/pynslcd.py
==============================================================================
--- nss-pam-ldapd/pynslcd/pynslcd.py Fri Mar 16 10:46:34 2012 (r1639)
+++ nss-pam-ldapd/pynslcd/pynslcd.py Fri Mar 16 13:48:28 2012 (r1640)
@@ -169,8 +169,13 @@
def getpeercred(fd):
- return (None, None, None)
- # FIXME: implement and return uid, gid, pid
+ """Return uid, gid and pid of calling application."""
+ import struct
+ import socket
+ SO_PEERCRED = 17
+ creds = fd.getsockopt(socket.SOL_SOCKET, SO_PEERCRED,
struct.calcsize('3i'))
+ pid, uid, gid = struct.unpack('3i',creds)
+ return uid, gid, pid
handlers = {}
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/
- nss-pam-ldapd commit: r1640 - nss-pam-ldapd/pynslcd,
Commits of the nss-pam-ldapd project