Changeset 2434 for branches/fc19-dev/server/common/oursrc/nss_nonlocal
- Timestamp:
- Jun 14, 2013, 12:50:47 PM (11 years ago)
- Location:
- branches/fc19-dev
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/fc19-dev
- Property svn:mergeinfo changed
/trunk (added) merged: 2405-2421,2425-2428,2432-2433
- Property svn:mergeinfo changed
-
branches/fc19-dev/server/common/oursrc/nss_nonlocal/Makefile.am
r1825 r2434 2 2 libnss_nonlocal_la_SOURCES = \ 3 3 nonlocal-passwd.c nonlocal-group.c nonlocal-shadow.c \ 4 nonlocal.h nsswitch-internal.h 4 nonlocal.h nsswitch-internal.h walk_nss.h 5 5 libnss_nonlocal_la_LDFLAGS = \ 6 6 -version-info 2:0:0 \ … … 11 11 rm -f $(DESTDIR)$(libdir)/libnss_nonlocal.so 12 12 rm -f $(DESTDIR)$(libdir)/libnss_nonlocal.la 13 14 uninstall-local: 15 rm -f $(DESTDIR)$(libdir)/libnss_nonlocal.so.* -
branches/fc19-dev/server/common/oursrc/nss_nonlocal/configure.ac
r1825 r2434 1 AC_INIT([nss_nonlocal], [2. 0], [andersk@mit.edu])1 AC_INIT([nss_nonlocal], [2.1], [andersk@mit.edu]) 2 2 AC_CANONICAL_TARGET 3 3 AM_INIT_AUTOMAKE([-Wall -Werror foreign]) … … 7 7 AC_DISABLE_STATIC 8 8 AC_PROG_CC 9 AC_PROG_INSTALL 9 m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) 10 10 AC_PROG_LIBTOOL 11 11 -
branches/fc19-dev/server/common/oursrc/nss_nonlocal/nonlocal-group.c
r1825 r2434 25 25 26 26 #define _GNU_SOURCE 27 27 28 #include <sys/types.h> 28 #include <unistd.h>29 #include <stdlib.h>30 #include <stdint.h>31 #include <string.h>32 29 #include <dlfcn.h> 33 #include <stdio.h>34 #include <syslog.h>35 30 #include <errno.h> 36 #include <pwd.h>37 31 #include <grp.h> 38 32 #include <nss.h> 33 #include <pwd.h> 34 #include <stdbool.h> 35 #include <stddef.h> 36 #include <stdlib.h> 37 #include <string.h> 38 #include <syslog.h> 39 #include <unistd.h> 40 39 41 #include "nsswitch-internal.h" 40 42 #include "nonlocal.h" … … 170 172 } 171 173 174 static bool grent_initialized = false; 172 175 static service_user *grent_startp, *grent_nip; 173 176 static void *grent_fct_start; … … 194 197 return status; 195 198 196 if ( grent_fct_start == NULL)199 if (!grent_initialized) { 197 200 __nss_group_nonlocal_lookup(&grent_startp, grent_fct_name, 198 201 &grent_fct_start); 202 __sync_synchronize(); 203 grent_initialized = true; 204 } 199 205 grent_nip = grent_startp; 200 206 grent_fct.ptr = grent_fct_start; … … 208 214 const struct walk_nss w = { 209 215 .lookup = &__nss_group_nonlocal_lookup, .fct_name = "endgrent", 210 .status = &status 216 .status = &status, .all_values = 1, 211 217 }; 212 218 const __typeof__(&_nss_nonlocal_endgrent) self = NULL; … … 356 362 const struct walk_nss w = { 357 363 .lookup = &__nss_group_nonlocal_lookup, .fct_name = "initgroups_dyn", 358 .status = &status, . errnop = errnop364 .status = &status, .all_values = 1, .errnop = errnop 359 365 }; 360 366 const __typeof__(&_nss_nonlocal_initgroups_dyn) self = NULL; … … 445 451 #include "walk_nss.h" 446 452 #undef args 447 if (status != NSS_STATUS_SUCCESS) 453 if (status == NSS_STATUS_NOTFOUND || status == NSS_STATUS_UNAVAIL) 454 return NSS_STATUS_SUCCESS; 455 else if (status != NSS_STATUS_SUCCESS) 448 456 return status; 449 457 -
branches/fc19-dev/server/common/oursrc/nss_nonlocal/nonlocal-passwd.c
r1825 r2434 26 26 27 27 #define _GNU_SOURCE 28 28 29 #include <sys/types.h> 30 #include <dlfcn.h> 31 #include <errno.h> 32 #include <nss.h> 33 #include <pwd.h> 34 #include <stdbool.h> 35 #include <stddef.h> 36 #include <stdlib.h> 37 #include <string.h> 38 #include <syslog.h> 29 39 #include <unistd.h> 30 #include <stdlib.h> 31 #include <stdint.h> 32 #include <string.h> 33 #include <dlfcn.h> 34 #include <stdio.h> 35 #include <syslog.h> 36 #include <errno.h> 37 #include <pwd.h> 38 #include <grp.h> 39 #include <nss.h> 40 40 41 #include "nsswitch-internal.h" 41 42 #include "nonlocal.h" … … 162 163 163 164 165 static bool pwent_initialized = false; 164 166 static service_user *pwent_startp, *pwent_nip; 165 167 static void *pwent_fct_start; … … 186 188 return status; 187 189 188 if ( pwent_fct_start == NULL)190 if (!pwent_initialized) { 189 191 __nss_passwd_nonlocal_lookup(&pwent_startp, pwent_fct_name, 190 192 &pwent_fct_start); 193 __sync_synchronize(); 194 pwent_initialized = true; 195 } 191 196 pwent_nip = pwent_startp; 192 197 pwent_fct.ptr = pwent_fct_start; … … 200 205 const struct walk_nss w = { 201 206 .lookup = &__nss_passwd_nonlocal_lookup, .fct_name = "endpwent", 202 .status = &status 207 .status = &status, .all_values = 1, 203 208 }; 204 209 const __typeof__(&_nss_nonlocal_endpwent) self = NULL; -
branches/fc19-dev/server/common/oursrc/nss_nonlocal/nonlocal-shadow.c
r1825 r2434 24 24 25 25 #define _GNU_SOURCE 26 26 27 #include <sys/types.h> 27 #include <unistd.h> 28 #include <dlfcn.h> 29 #include <errno.h> 30 #include <nss.h> 31 #include <shadow.h> 32 #include <stdbool.h> 33 #include <stddef.h> 28 34 #include <stdlib.h> 29 #include <stdint.h>30 35 #include <string.h> 31 #include <dlfcn.h>32 #include <stdio.h>33 36 #include <syslog.h> 34 #include <errno.h>35 #include <shadow.h>36 #include <nss.h>37 37 38 38 #include "nsswitch-internal.h" … … 59 59 60 60 61 static bool spent_initialized = false; 61 62 static service_user *spent_startp, *spent_nip; 62 63 static void *spent_fct_start; … … 83 84 return status; 84 85 85 if ( spent_fct_start == NULL)86 if (!spent_initialized) { 86 87 __nss_shadow_nonlocal_lookup(&spent_startp, spent_fct_name, 87 88 &spent_fct_start); 89 __sync_synchronize(); 90 spent_initialized = true; 91 } 88 92 spent_nip = spent_startp; 89 93 spent_fct.ptr = spent_fct_start; … … 114 118 { 115 119 enum nss_status status; 120 121 char *nonlocal_ignore = getenv(NONLOCAL_IGNORE_ENV); 122 if (nonlocal_ignore != NULL && nonlocal_ignore[0] != '\0') 123 return NSS_STATUS_UNAVAIL; 124 116 125 if (spent_nip == NULL) { 117 126 status = _nss_nonlocal_setspent(0); -
branches/fc19-dev/server/common/oursrc/nss_nonlocal/nonlocal.h
r1825 r2434 50 50 struct walk_nss { 51 51 enum nss_status *status; 52 int all_values; 52 53 int (*lookup)(service_user **ni, const char *fct_name, 53 54 void **fctp) internal_function; -
branches/fc19-dev/server/common/oursrc/nss_nonlocal/walk_nss.h
r1825 r2434 1 /* 2 * walk_nss.h 3 * NSS walking template for nss_nonlocal proxy 4 * 5 * Copyright © 2011 Anders Kaseorg <andersk@mit.edu> and Tim Abbott 6 * <tabbott@mit.edu> 7 * 8 * This file is part of nss_nonlocal. 9 * 10 * nss_nonlocal is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Lesser General Public License 12 * as published by the Free Software Foundation; either version 2.1 of 13 * the License, or (at your option) any later version. 14 * 15 * nss_nonlocal is distributed in the hope that it will be useful, but 16 * WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 * 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with nss_nonlocal; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 23 * 02110-1301 USA 24 */ 25 1 26 { 2 static service_user *startp = NULL; 3 static void *fct_start = NULL; 27 static bool initialized = false; 28 static service_user *startp; 29 static void *fct_start; 4 30 5 31 service_user *nip; … … 10 36 int old_errno = errno; 11 37 12 if (fct_start == NULL && 13 w.lookup(&startp, w.fct_name, &fct_start) != 0) { 14 *w.status = NSS_STATUS_UNAVAIL; 15 goto walk_nss_out; 38 if (!initialized) { 39 if (w.lookup(&startp, w.fct_name, &fct_start) != 0) { 40 *w.status = NSS_STATUS_UNAVAIL; 41 goto walk_nss_out; 42 } 43 __sync_synchronize(); 44 initialized = true; 16 45 } 17 46 … … 51 80 goto walk_nss_morebuf; 52 81 } 53 } while (__nss_next(&nip, w.fct_name, &fct.ptr, *w.status, 0) == 0); 82 } while (__nss_next(&nip, w.fct_name, &fct.ptr, *w.status, w.all_values) == 83 0); 54 84 55 85 if (w.buf != NULL && *w.status != NSS_STATUS_SUCCESS) {
Note: See TracChangeset
for help on using the changeset viewer.