]> andersk Git - nss_nonlocal.git/commitdiff
Merge version 1.7.
authorAnders Kaseorg <andersk@mit.edu>
Tue, 29 Jul 2008 10:57:34 +0000 (06:57 -0400)
committerAnders Kaseorg <andersk@mit.edu>
Tue, 29 Jul 2008 10:57:42 +0000 (06:57 -0400)
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Makefile [deleted file]
Makefile.am [new file with mode: 0644]
configure.ac [new file with mode: 0644]
libnss_nonlocal.map [deleted file]
nonlocal-group.c
nonlocal-passwd.c
nonlocal.h
nsswitch-internal.h

diff --git a/Makefile b/Makefile
deleted file mode 100644 (file)
index 19c766e..0000000
--- a/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-exec_prefix = /
-libdir = $(exec_prefix)/lib
-
-INSTALL = install
-CC = gcc
-CFLAGS = -O2 -Wall
-
-ALL_CFLAGS = $(CFLAGS) -fPIC
-ALL_LDFLAGS = $(LDFLAGS) -shared -Wl,-x
-
-all: libnss_nonlocal.so.2 linktest
-
-OBJS = nonlocal-passwd.o nonlocal-group.o nonlocal-shadow.o
-
-libnss_nonlocal.so.2: $(OBJS) libnss_nonlocal.map
-       $(CC) -o $@ $(ALL_LDFLAGS) -Wl,-soname,$@ -Wl,--version-script=libnss_nonlocal.map $(OBJS) $(LOADLIBES) $(LDLIBS)
-
-%.o: %.c
-       $(CC) -c $(ALL_CFLAGS) $(CPPFLAGS) $<
-
-nonlocal-passwd.o: nonlocal-passwd.c nsswitch-internal.h nonlocal.h
-nonlocal-group.o: nonlocal-group.c nsswitch-internal.h nonlocal.h
-nonlocal-shadow.o: nonlocal-shadow.c nsswitch-internal.h nonlocal.h
-
-linktest: libnss_nonlocal.so.2
-       $(CC) $(LDFLAGS) -nostdlib -Wl,--entry=0 -o /dev/null $^
-
-install: libnss_nonlocal.so.2
-       $(INSTALL) -d $(DESTDIR)$(libdir)
-       $(INSTALL) -m a+r,u+w $< $(DESTDIR)$(libdir)/
-
-clean:
-       rm -f *.so.* *.o
-
-.PHONY: all linktest install clean
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..e67c2d5
--- /dev/null
@@ -0,0 +1,16 @@
+lib_LTLIBRARIES = libnss_nonlocal.la
+libnss_nonlocal_la_SOURCES = \
+    nonlocal-passwd.c nonlocal-group.c nonlocal-shadow.c \
+    nonlocal.h nsswitch-internal.h
+libnss_nonlocal_la_LDFLAGS = \
+    -version-info 2:0:0 \
+    -export-symbols-regex '^_nss_nonlocal_'
+
+noinst_PROGRAMS = .linktest
+_linktest_SOURCES =
+_linktest_LDADD = libnss_nonlocal.la
+_linktest_LDFLAGS = -nostdlib -entry=0
+
+install-exec-hook:
+       rm -f $(DESTDIR)$(libdir)/libnss_nonlocal.so
+       rm -f $(DESTDIR)$(libdir)/libnss_nonlocal.la
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..5940f39
--- /dev/null
@@ -0,0 +1,20 @@
+AC_INIT([nss_nonlocal], [1.7], [andersk@mit.edu])
+AC_CANONICAL_TARGET
+AM_INIT_AUTOMAKE([-Wall -Werror foreign])
+
+AC_PREFIX_DEFAULT([/])
+AC_DISABLE_STATIC
+AC_PROG_CC
+AC_PROG_INSTALL
+AC_PROG_LIBTOOL
+
+case "$target_cpu" in
+    i386 | i486 | i586 | i686 | i786)
+       AC_DEFINE([USE_REGPARMS], [],
+                 [Define if the regparm attribute shall be used for local functions (gcc on ix86 only).])
+       ;;
+esac
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/libnss_nonlocal.map b/libnss_nonlocal.map
deleted file mode 100644 (file)
index 9082d5d..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-GLIBC_2.0 {
-  global:
-    _nss_nonlocal_setpwent;
-    _nss_nonlocal_endpwent;
-    _nss_nonlocal_getpwent_r;
-    _nss_nonlocal_getpwuid_r;
-    _nss_nonlocal_getpwnam_r;
-
-    _nss_nonlocal_setspent;
-    _nss_nonlocal_endspent;
-    _nss_nonlocal_getspent_r;
-    _nss_nonlocal_getspnam_r;
-
-    _nss_nonlocal_setgrent;
-    _nss_nonlocal_endgrent;
-    _nss_nonlocal_getgrent_r;
-    _nss_nonlocal_getgrgid_r;
-    _nss_nonlocal_getgrnam_r;
-
-    _nss_nonlocal_initgroups_dyn;
-
-  local:
-    *;
-};
index f202927c67b0167d6b409ef434e98c3690aaf275..9d2bfa040439a5db3d6945e79446a12a9f65d7d3 100644 (file)
 #include "nsswitch-internal.h"
 #include "nonlocal.h"
 
-#define MAGIC_LOCAL_GR_BUFLEN (sysconf(_SC_GETGR_R_SIZE_MAX) + 7)
 #define MAGIC_NONLOCAL_GROUPNAME "nss-nonlocal-users"
 #define MAGIC_LOCAL_GROUPNAME "nss-local-users"
 
 
+enum nss_status
+_nss_nonlocal_getgrnam_r(const char *name, struct group *grp,
+                        char *buffer, size_t buflen, int *errnop);
+
+enum nss_status
+_nss_nonlocal_getgrgid_r(gid_t gid, struct group *grp,
+                        char *buffer, size_t buflen, int *errnop);
+
+
 static service_user *
 nss_group_nonlocal_database(void)
 {
@@ -60,89 +68,131 @@ nss_group_nonlocal_database(void)
 enum nss_status
 check_nonlocal_gid(const char *user, gid_t gid, int *errnop)
 {
-    enum nss_status status = NSS_STATUS_SUCCESS;
+    static const char *fct_name = "getgrgid_r";
+    static service_user *startp = NULL;
+    static void *fct_start = NULL;
+    enum nss_status status;
+    service_user *nip;
+    union {
+       enum nss_status (*l)(gid_t gid, struct group *grp,
+                            char *buffer, size_t buflen, int *errnop);
+       void *ptr;
+    } fct;
     struct group gbuf;
-    struct group *gbufp = &gbuf;
-    int ret;
     int old_errno = errno;
-    int buflen = MAGIC_LOCAL_GR_BUFLEN;
+
+    int buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
     char *buf = malloc(buflen);
     if (buf == NULL) {
        *errnop = ENOMEM;
        errno = old_errno;
        return NSS_STATUS_TRYAGAIN;
     }
-    errno = 0;
-    ret = getgrgid_r(gid, gbufp, buf, buflen, &gbufp);
-    if (ret != 0) {
-       *errnop = old_errno;
-       status = NSS_STATUS_TRYAGAIN;
-    } else if (gbufp != NULL) {
+
+    if (fct_start == NULL &&
+       __nss_group_lookup(&startp, fct_name, &fct_start) != 0) {
+       free(buf);
+       return NSS_STATUS_UNAVAIL;
+    }
+    nip = startp;
+    fct.ptr = fct_start;
+    do {
+       if (fct.l == _nss_nonlocal_getgrgid_r)
+           status = NSS_STATUS_NOTFOUND;
+       else
+           status = DL_CALL_FCT(fct.l, (gid, &gbuf, buf, buflen, errnop));
+       if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
+           break;
+    } while (__nss_next(&nip, fct_name, &fct.ptr, status, 0) == 0);
+
+    if (status == NSS_STATUS_SUCCESS) {
        syslog(LOG_WARNING, "nss_nonlocal: removing local group %u (%s) from non-local user %s\n", gbuf.gr_gid, gbuf.gr_name, user);
        status = NSS_STATUS_NOTFOUND;
+    } else if (status != NSS_STATUS_TRYAGAIN) {
+       status = NSS_STATUS_SUCCESS;
     }
+
     free(buf);
-    errno = old_errno;
     return status;
 }
 
 enum nss_status
 get_local_group(const char *name, struct group *grp, char *buffer, size_t buflen, int *errnop)
 {
-    enum nss_status status = NSS_STATUS_NOTFOUND;
+    static const char *fct_name = "getgrnam_r";
+    static service_user *startp = NULL;
+    static void *fct_start = NULL;
+    enum nss_status status;
+    service_user *nip;
+    union {
+       enum nss_status (*l)(const char *name, struct group *grp,
+                            char *buffer, size_t buflen, int *errnop);
+       void *ptr;
+    } fct;
     struct group gbuf;
-    struct group *gbufp = &gbuf;
-    int ret, n;
+    int n;
     int old_errno = errno;
-    int len = MAGIC_LOCAL_GR_BUFLEN;
+
+    int len = sysconf(_SC_GETGR_R_SIZE_MAX);
     char *buf = malloc(len);
     if (buf == NULL) {
        *errnop = ENOMEM;
        errno = old_errno;
        return NSS_STATUS_TRYAGAIN;
     }
-    errno = 0;
-    ret = getgrnam_r(name, gbufp, buf, len, &gbufp);
-    if (ret != 0) {
-       *errnop = old_errno;
+
+    if (fct_start == NULL &&
+       __nss_group_lookup(&startp, fct_name, &fct_start) != 0) {
+       free(buf);
+       return NSS_STATUS_UNAVAIL;
+    }
+    nip = startp;
+    fct.ptr = fct_start;
+    do {
+       if (fct.l == _nss_nonlocal_getgrnam_r)
+           status = NSS_STATUS_NOTFOUND;
+       else
+           status = DL_CALL_FCT(fct.l, (name, &gbuf, buf, buflen, errnop));
+       if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
+           break;
+    } while (__nss_next(&nip, fct_name, &fct.ptr, status, 0) == 0);
+
+    if (status != NSS_STATUS_SUCCESS)
+       goto get_local_group_done;
+
+    n = snprintf(buffer, buflen, "%s", gbuf.gr_name);
+    if (n < 0 || n >= buflen) {
+       *errnop = ERANGE;
        status = NSS_STATUS_TRYAGAIN;
-    } else if (gbufp != NULL) {
-       status = NSS_STATUS_SUCCESS;
+       goto get_local_group_done;
+    }
+    grp->gr_name = buffer;
+    buffer += n;
+    buflen -= n;
 
-       n = snprintf(buffer, buflen, "%s", gbufp->gr_name);
-       if (n < 0 || n >= buflen) {
-           *errnop = ERANGE;
-           status = NSS_STATUS_TRYAGAIN;
-           goto get_local_group_done;
-       }
-       grp->gr_name = buffer;
-       buffer += n;
-       buflen -= n;
-
-       n = snprintf(buffer, buflen, "%s", gbufp->gr_passwd);
-       if (n < 0 || n >= buflen) {
-           *errnop = ERANGE;
-           status = NSS_STATUS_TRYAGAIN;
-           goto get_local_group_done;
-       }
-       grp->gr_passwd = buffer;
-       buffer += n;
-       buflen -= n;
+    n = snprintf(buffer, buflen, "%s", gbuf.gr_passwd);
+    if (n < 0 || n >= buflen) {
+       *errnop = ERANGE;
+       status = NSS_STATUS_TRYAGAIN;
+       goto get_local_group_done;
+    }
+    grp->gr_passwd = buffer;
+    buffer += n;
+    buflen -= n;
 
-       grp->gr_gid = gbufp->gr_gid;
+    grp->gr_gid = gbuf.gr_gid;
 
-       if (buflen < sizeof(void *)) {
-           *errnop = ERANGE;
-           status = NSS_STATUS_TRYAGAIN;
-           goto get_local_group_done;
-       }
-       *(void **)buffer = NULL;
-       buffer += sizeof(void *);
-       buflen -= sizeof(void *);
+    if (buflen < sizeof(void *)) {
+       *errnop = ERANGE;
+       status = NSS_STATUS_TRYAGAIN;
+       goto get_local_group_done;
     }
+    *(void **)buffer = NULL;
+    buffer += sizeof(void *);
+    buflen -= sizeof(void *);
+
  get_local_group_done:
     free(buf);
-    errno = old_errno;
     return status;
 }
 
@@ -225,8 +275,7 @@ _nss_nonlocal_getgrent_r(struct group *grp, char *buffer, size_t buflen,
     enum nss_status status;
 
     char *nonlocal_ignore = getenv(NONLOCAL_IGNORE_ENV);
-    if (buflen == MAGIC_LOCAL_GR_BUFLEN ||
-       (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0'))
+    if (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0')
        return NSS_STATUS_UNAVAIL;
 
     if (grent_nip == NULL) {
@@ -271,8 +320,7 @@ _nss_nonlocal_getgrnam_r(const char *name, struct group *grp,
     } fct;
 
     char *nonlocal_ignore = getenv(NONLOCAL_IGNORE_ENV);
-    if (buflen == MAGIC_LOCAL_GR_BUFLEN ||
-       (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0'))
+    if (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0')
        return NSS_STATUS_UNAVAIL;
 
     nip = nss_group_nonlocal_database();
@@ -310,8 +358,7 @@ _nss_nonlocal_getgrgid_r(gid_t gid, struct group *grp,
     } fct;
 
     char *nonlocal_ignore = getenv(NONLOCAL_IGNORE_ENV);
-    if (buflen == MAGIC_LOCAL_GR_BUFLEN ||
-       (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0'))
+    if (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0')
        return NSS_STATUS_UNAVAIL;
 
     nip = nss_group_nonlocal_database();
@@ -358,10 +405,10 @@ _nss_nonlocal_initgroups_dyn(const char *user, gid_t group, long int *start,
 
     /* Check that the user is a nonlocal user before adding any groups. */
     status = check_nonlocal_user(user, errnop);
-    if (status == NSS_STATUS_NOTFOUND)
-       is_local = 1;
-    else if (status != NSS_STATUS_SUCCESS)
+    if (status == NSS_STATUS_TRYAGAIN)
        return status;
+    else if (status != NSS_STATUS_SUCCESS)
+       is_local = 1;
 
     int old_errno = errno;
 
@@ -374,14 +421,16 @@ _nss_nonlocal_initgroups_dyn(const char *user, gid_t group, long int *start,
     }
     status = get_local_group(MAGIC_LOCAL_GROUPNAME,
                             &local_users_group, buffer, buflen, errnop);
-    if (status == NSS_STATUS_NOTFOUND) {
+    if (status == NSS_STATUS_SUCCESS) {
+       local_users_gid = local_users_group.gr_gid;
+    } else if (status == NSS_STATUS_TRYAGAIN) {
+       free(buffer);
+       return status;
+    } else {
        syslog(LOG_WARNING, "nss_nonlocal: Group %s does not exist locally!",
               MAGIC_LOCAL_GROUPNAME);
        local_users_gid = -1;
-    } else if (status != NSS_STATUS_SUCCESS) {
-       return status;
-    } else
-       local_users_gid = local_users_group.gr_gid;
+    }
     free(buffer);
 
     if (is_local) {
@@ -396,15 +445,16 @@ _nss_nonlocal_initgroups_dyn(const char *user, gid_t group, long int *start,
        }
        status = get_local_group(MAGIC_NONLOCAL_GROUPNAME,
                                 &nonlocal_users_group, buffer, buflen, errnop);
-       if (status == NSS_STATUS_NOTFOUND) {
+       if (status == NSS_STATUS_SUCCESS) {
+           gid = nonlocal_users_group.gr_gid;
+       } else if (status == NSS_STATUS_TRYAGAIN) {
+           free(buffer);
+           return status;
+       } else {
            syslog(LOG_WARNING, "nss_nonlocal: Group %s does not exist locally!",
                   MAGIC_NONLOCAL_GROUPNAME);
            gid = -1;
-       } else if (status != NSS_STATUS_SUCCESS) {
-           errno = old_errno;
-           return status;
-       } else
-           gid = nonlocal_users_group.gr_gid;
+       }
        free(buffer);
     }
 
@@ -436,8 +486,6 @@ _nss_nonlocal_initgroups_dyn(const char *user, gid_t group, long int *start,
        }
     }
 
-    errno = old_errno;
-
     if (is_local)
        return NSS_STATUS_SUCCESS;
 
@@ -480,7 +528,7 @@ _nss_nonlocal_initgroups_dyn(const char *user, gid_t group, long int *start,
        status = check_nonlocal_gid(user, (*groupsp)[in], &nonlocal_errno);
        if (status == NSS_STATUS_SUCCESS) {
            (*groupsp)[out++] = (*groupsp)[in];
-       } else if (status != NSS_STATUS_NOTFOUND) {
+       } else if (status == NSS_STATUS_TRYAGAIN) {
            *start = out;
            *errnop = nonlocal_errno;
            return status;
index 40811f9e68ee26ba1d9fa6c13f8b19136afdd8b5..80708dc1f8d62ba4d6d270dc2cf2b5c48b3476c1 100644 (file)
 #include "nsswitch-internal.h"
 #include "nonlocal.h"
 
-#define MAGIC_LOCAL_PW_BUFLEN (sysconf(_SC_GETPW_R_SIZE_MAX) + 7)
+
+enum nss_status
+_nss_nonlocal_getpwuid_r(uid_t uid, struct passwd *pwd,
+                        char *buffer, size_t buflen, int *errnop);
+enum nss_status
+_nss_nonlocal_getpwnam_r(const char *name, struct passwd *pwd,
+                        char *buffer, size_t buflen, int *errnop);
 
 
 static service_user *
@@ -60,57 +66,100 @@ nss_passwd_nonlocal_database(void)
 enum nss_status
 check_nonlocal_uid(const char *user, uid_t uid, int *errnop)
 {
-    enum nss_status status = NSS_STATUS_SUCCESS;
+    static const char *fct_name = "getpwuid_r";
+    static service_user *startp = NULL;
+    static void *fct_start = NULL;
+    enum nss_status status;
+    service_user *nip;
+    union {
+       enum nss_status (*l)(uid_t uid, struct passwd *pwd,
+                            char *buffer, size_t buflen, int *errnop);
+       void *ptr;
+    } fct;
     struct passwd pwbuf;
-    struct passwd *pwbufp = &pwbuf;
-    int ret;
     int old_errno = errno;
-    int buflen = MAGIC_LOCAL_PW_BUFLEN;
+
+    int buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
     char *buf = malloc(buflen);
     if (buf == NULL) {
        *errnop = ENOMEM;
        errno = old_errno;
        return NSS_STATUS_TRYAGAIN;
     }
-    errno = 0;
-    ret = getpwuid_r(uid, pwbufp, buf, buflen, &pwbufp);
-    if (ret != 0) {
-       *errnop = errno;
-       status = NSS_STATUS_TRYAGAIN;
-    } else if (pwbufp != NULL) {
+
+    if (fct_start == NULL &&
+       __nss_passwd_lookup(&startp, fct_name, &fct_start) != 0) {
+       free(buf);
+       return NSS_STATUS_UNAVAIL;
+    }
+    nip = startp;
+    fct.ptr = fct_start;
+    do {
+       if (fct.l == _nss_nonlocal_getpwuid_r)
+           status = NSS_STATUS_NOTFOUND;
+       else
+           status = DL_CALL_FCT(fct.l, (uid, &pwbuf, buf, buflen, errnop));
+       if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
+           break;
+    } while (__nss_next(&nip, fct_name, &fct.ptr, status, 0) == 0);
+
+    if (status == NSS_STATUS_SUCCESS) {
        syslog(LOG_ERR, "nss_nonlocal: possible spoofing attack: non-local user %s has same UID as local user %s!\n", user, pwbuf.pw_name);
        status = NSS_STATUS_NOTFOUND;
+    } else if (status != NSS_STATUS_TRYAGAIN) {
+       status = NSS_STATUS_SUCCESS;
     }
+
     free(buf);
-    errno = old_errno;
     return status;
 }
 
 enum nss_status
 check_nonlocal_user(const char *user, int *errnop)
 {
-    enum nss_status status = NSS_STATUS_SUCCESS;
+    static const char *fct_name = "getpwnam_r";
+    static service_user *startp = NULL;
+    static void *fct_start = NULL;
+    enum nss_status status;
+    service_user *nip;
+    union {
+       enum nss_status (*l)(const char *name, struct passwd *pwd,
+                            char *buffer, size_t buflen, int *errnop);
+       void *ptr;
+    } fct;
     struct passwd pwbuf;
-    struct passwd *pwbufp = &pwbuf;
-    int ret;
     int old_errno = errno;
-    int buflen = MAGIC_LOCAL_PW_BUFLEN;
+
+    int buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
     char *buf = malloc(buflen);
     if (buf == NULL) {
        *errnop = ENOMEM;
        errno = old_errno;
        return NSS_STATUS_TRYAGAIN;
     }
-    errno = 0;
-    ret = getpwnam_r(user, pwbufp, buf, buflen, &pwbufp);
-    if (ret != 0) {
-       *errnop = errno;
-       status = NSS_STATUS_TRYAGAIN;
-    } else if (pwbufp != NULL) {
-       status = NSS_STATUS_NOTFOUND;
+
+    if (fct_start == NULL &&
+       __nss_passwd_lookup(&startp, fct_name, &fct_start) != 0) {
+       free(buf);
+       return NSS_STATUS_UNAVAIL;
     }
+    nip = startp;
+    fct.ptr = fct_start;
+    do {
+       if (fct.l == _nss_nonlocal_getpwnam_r)
+           status = NSS_STATUS_NOTFOUND;
+       else
+           status = DL_CALL_FCT(fct.l, (user, &pwbuf, buf, buflen, errnop));
+       if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
+           break;
+    } while (__nss_next(&nip, fct_name, &fct.ptr, status, 0) == 0);
+
+    if (status == NSS_STATUS_SUCCESS)
+       status = NSS_STATUS_NOTFOUND;
+    else if (status != NSS_STATUS_TRYAGAIN)
+       status = NSS_STATUS_SUCCESS;
+
     free(buf);
-    errno = old_errno;
     return status;
 }
 
@@ -194,8 +243,7 @@ _nss_nonlocal_getpwent_r(struct passwd *pwd, char *buffer, size_t buflen,
     enum nss_status status;
 
     char *nonlocal_ignore = getenv(NONLOCAL_IGNORE_ENV);
-    if (buflen == MAGIC_LOCAL_PW_BUFLEN ||
-       (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0'))
+    if (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0')
        return NSS_STATUS_UNAVAIL;
 
     if (pwent_nip == NULL) {
@@ -241,8 +289,7 @@ _nss_nonlocal_getpwnam_r(const char *name, struct passwd *pwd,
     int group_errno;
 
     char *nonlocal_ignore = getenv(NONLOCAL_IGNORE_ENV);
-    if (buflen == MAGIC_LOCAL_PW_BUFLEN ||
-       (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0'))
+    if (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0')
        return NSS_STATUS_UNAVAIL;
 
     nip = nss_passwd_nonlocal_database();
@@ -288,8 +335,7 @@ _nss_nonlocal_getpwuid_r(uid_t uid, struct passwd *pwd,
     int group_errno;
 
     char *nonlocal_ignore = getenv(NONLOCAL_IGNORE_ENV);
-    if (buflen == MAGIC_LOCAL_PW_BUFLEN ||
-       (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0'))
+    if (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0')
        return NSS_STATUS_UNAVAIL;
 
     nip = nss_passwd_nonlocal_database();
index f6a2453f9240e47aef3c045010906a6c77ee29cb..df772dd9d4ed53e3e363f5e421c9831566e05815 100644 (file)
@@ -1,7 +1,12 @@
 #ifndef NONLOCAL_H
 #define NONLOCAL_H
+
+#include "config.h"
+
 enum nss_status check_nonlocal_uid(const char *user, uid_t uid, int *errnop);
 enum nss_status check_nonlocal_gid(const char *user, gid_t gid, int *errnop);
 enum nss_status check_nonlocal_user(const char *user, int *errnop);
+
 #define NONLOCAL_IGNORE_ENV "NSS_NONLOCAL_IGNORE"
+
 #endif /* NON_LOCAL_H */
index 94ed968cba2b393cd16664de3c6baf78f2d59c41..4a2e91dcf6e1c8bd8bc64007c2f9d51459051055 100644 (file)
@@ -6,21 +6,29 @@
 #ifndef NSSWITCH_INTERNAL_H
 #define NSSWITCH_INTERNAL_H
 
-typedef struct service_user service_user;
+#include "config.h"
 
-extern int
-__nss_next (service_user **ni, const char *fct_name, void **fctp, int status,
-            int all_values);
+/* glibc/config.h.in */
+#if defined USE_REGPARMS && !defined PROF && !defined __BOUNDED_POINTERS__
+# define internal_function __attribute__ ((regparm (3), stdcall))
+#else
+# define internal_function
+#endif
 
-extern int
-__nss_database_lookup (const char *database,
-                      const char *alternative_name,
-                      const char *defconfig, service_user **ni);
+/* glibc/nss/nsswitch.h */
+typedef struct service_user service_user;
 
-extern int
-__nss_configure_lookup (const char *dbname, const char *service_line);
+extern int __nss_next (service_user **ni, const char *fct_name, void **fctp,
+                      int status, int all_values);
+extern int __nss_database_lookup (const char *database,
+                                 const char *alternative_name,
+                                 const char *defconfig, service_user **ni);
+extern void *__nss_lookup_function (service_user *ni, const char *fct_name);
 
-extern void
-*__nss_lookup_function (service_user *ni, const char *fct_name);
+/* glibc/nss/XXX-lookup.c */
+extern int __nss_passwd_lookup (service_user **ni, const char *fct_name,
+                               void **fctp) internal_function;
+extern int __nss_group_lookup (service_user **ni, const char *fct_name,
+                               void **fctp) internal_function;
 
 #endif /* NSSWITCH_INTERNAL_H */
This page took 0.102526 seconds and 5 git commands to generate.