lists.arthurdejong.org
RSS feed

nss-pam-ldapd branch master updated. 0.9.10-2-g06ee886

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd branch master updated. 0.9.10-2-g06ee886



This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "nss-pam-ldapd".

The branch, master has been updated
       via  06ee88605e176c77eda2dc0a5499e2baef65e8f1 (commit)
      from  bfcf0025b6ba264e6c0c1899d9de2bad8f39ee1a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://arthurdejong.org/git/nss-pam-ldapd/commit/?id=06ee88605e176c77eda2dc0a5499e2baef65e8f1

commit 06ee88605e176c77eda2dc0a5499e2baef65e8f1
Author: Arthur de Jong <arthur@arthurdejong.org>
Date:   Sat Sep 8 15:18:37 2018 +0200

    Avoid logging unknown socket peer information
    
    This avoids logging the client PID when the underlying socker layer
    cannot provide the relevant information.

diff --git a/nslcd/nslcd.c b/nslcd/nslcd.c
index be14ac9..67875c5 100644
--- a/nslcd/nslcd.c
+++ b/nslcd/nslcd.c
@@ -353,15 +353,27 @@ static void handleconnection(int sock, MYLDAP_SESSION 
*session)
 {
   TFILE *fp;
   int32_t action;
+  pid_t pid = (pid_t)-1;
   uid_t uid = (uid_t)-1;
   gid_t gid = (gid_t)-1;
-  pid_t pid = (pid_t)-1;
+  char peerinfo[80];
   /* log connection */
   if (getpeercred(sock, &uid, &gid, &pid))
     log_log(LOG_DEBUG, "connection from unknown client: %s", strerror(errno));
   else
-    log_log(LOG_DEBUG, "connection from pid=%lu uid=%lu gid=%lu",
-            (unsigned long int)pid, (unsigned long int)uid, (unsigned long 
int)gid);
+  {
+    peerinfo[0] = '\0';
+    if (pid != (pid_t)-1)
+      mysnprintf(peerinfo + strlen(peerinfo), sizeof(peerinfo) - 
strlen(peerinfo) - 1,
+                 " pid=%lu", (unsigned long int)pid);
+    if (uid != (uid_t)-1)
+      mysnprintf(peerinfo + strlen(peerinfo), sizeof(peerinfo) - 
strlen(peerinfo) - 1,
+                 " uid=%lu", (unsigned long int)uid);
+    if (gid != (gid_t)-1)
+      mysnprintf(peerinfo + strlen(peerinfo), sizeof(peerinfo) - 
strlen(peerinfo) - 1,
+                 " gid=%lu", (unsigned long int)gid);
+    log_log(LOG_DEBUG, "connection from %s", (peerinfo[0] == '\0') ? "unknown" 
: peerinfo);
+  }
   /* create a stream object */
   if ((fp = tio_fdopen(sock, READ_TIMEOUT, WRITE_TIMEOUT,
                        READBUFFER_MINSIZE, READBUFFER_MAXSIZE,

-----------------------------------------------------------------------

Summary of changes:
 nslcd/nslcd.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
nss-pam-ldapd
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
https://lists.arthurdejong.org/nss-pam-ldapd-commits/