]> andersk Git - nss_nonlocal.git/blobdiff - nonlocal-shadow.c
Check that a nonlocal lookup by name returns the right name.
[nss_nonlocal.git] / nonlocal-shadow.c
index 6524ee884d3b7cfabaf64fb8dcc5bf57613f8ea9..f1e03a1602ba28fcd45fec419e90ca11112fd586 100644 (file)
@@ -33,6 +33,7 @@
 #include <string.h>
 #include <dlfcn.h>
 #include <stdio.h>
+#include <syslog.h>
 #include <errno.h>
 #include <shadow.h>
 #include <nss.h>
@@ -179,5 +180,13 @@ _nss_nonlocal_getspnam_r(const char *name, struct spwd *pwd,
        if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
            break;
     } while (__nss_next(&nip, fct_name, &fct.ptr, status, 0) == 0);
-    return status;
+    if (status != NSS_STATUS_SUCCESS)
+       return status;
+
+    if (strcmp(name, pwd->sp_namp) != 0) {
+       syslog(LOG_ERR, "nss_nonlocal: discarding shadow %s from lookup for shadow %s\n", pwd->sp_namp, name);
+       return NSS_STATUS_NOTFOUND;
+    }
+
+    return NSS_STATUS_SUCCESS;
 }
This page took 0.06449 seconds and 4 git commands to generate.