- Timestamp:
- Jun 7, 2011, 12:58:14 PM (13 years ago)
- Location:
- branches/fc15-dev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/fc15-dev
- Property svn:mergeinfo changed
/trunk (added) merged: 1811,1813-1819,1821-1825,1838,1848-1856,1858-1872,1877
- Property svn:mergeinfo changed
-
branches/fc15-dev/server/common/oursrc/nss_nonlocal/nonlocal-shadow.c
r1553 r1878 40 40 41 41 42 static service_user * 43 nss_shadow_nonlocal_database(void) 42 static service_user *__nss_shadow_nonlocal_database; 43 44 static int 45 internal_function 46 __nss_shadow_nonlocal_lookup(service_user **ni, const char *fct_name, 47 void **fctp) 44 48 { 45 static service_user *nip = NULL; 46 if (nip == NULL) 47 __nss_database_lookup("shadow_nonlocal", NULL, "", &nip); 49 if (__nss_shadow_nonlocal_database == NULL 50 && __nss_database_lookup("shadow_nonlocal", NULL, NULL, 51 &__nss_shadow_nonlocal_database) < 0) 52 return -1; 48 53 49 return nip; 54 *ni = __nss_shadow_nonlocal_database; 55 56 *fctp = __nss_lookup_function(*ni, fct_name); 57 return 0; 50 58 } 51 59 52 60 53 static service_user *spent_ nip = NULL;61 static service_user *spent_startp, *spent_nip; 54 62 static void *spent_fct_start; 55 63 static union { … … 63 71 _nss_nonlocal_setspent(int stayopen) 64 72 { 65 static const char *fct_name = "setspent";66 static void *fct_start = NULL;67 73 enum nss_status status; 68 service_user *nip; 69 union { 70 enum nss_status (*l)(int stayopen); 71 void *ptr; 72 } fct; 73 74 nip = nss_shadow_nonlocal_database(); 75 if (nip == NULL) 76 return NSS_STATUS_UNAVAIL; 77 if (fct_start == NULL) 78 fct_start = __nss_lookup_function(nip, fct_name); 79 fct.ptr = fct_start; 80 do { 81 if (fct.ptr == NULL) 82 status = NSS_STATUS_UNAVAIL; 83 else 84 status = DL_CALL_FCT(fct.l, (stayopen)); 85 } while (__nss_next(&nip, fct_name, &fct.ptr, status, 0) == 0); 74 const struct walk_nss w = { 75 .lookup = &__nss_shadow_nonlocal_lookup, .fct_name = "setspent", 76 .status = &status 77 }; 78 const __typeof__(&_nss_nonlocal_setspent) self = NULL; 79 #define args (stayopen) 80 #include "walk_nss.h" 81 #undef args 86 82 if (status != NSS_STATUS_SUCCESS) 87 83 return status; 88 84 89 spent_nip = nip;90 85 if (spent_fct_start == NULL) 91 spent_fct_start = __nss_lookup_function(nip, spent_fct_name); 86 __nss_shadow_nonlocal_lookup(&spent_startp, spent_fct_name, 87 &spent_fct_start); 88 spent_nip = spent_startp; 92 89 spent_fct.ptr = spent_fct_start; 93 90 return NSS_STATUS_SUCCESS; … … 97 94 _nss_nonlocal_endspent(void) 98 95 { 99 static const char *fct_name = "endspent";100 static void *fct_start = NULL;101 96 enum nss_status status; 102 service_user *nip;103 union { 104 enum nss_status (*l)(void);105 void *ptr;106 } fct;97 const struct walk_nss w = { 98 .lookup = &__nss_shadow_nonlocal_lookup, .fct_name = "endspent", 99 .status = &status 100 }; 101 const __typeof__(&_nss_nonlocal_endspent) self = NULL; 107 102 108 103 spent_nip = NULL; 109 104 110 nip = nss_shadow_nonlocal_database(); 111 if (nip == NULL) 112 return NSS_STATUS_UNAVAIL; 113 if (fct_start == NULL) 114 fct_start = __nss_lookup_function(nip, fct_name); 115 fct.ptr = fct_start; 116 do { 117 if (fct.ptr == NULL) 118 status = NSS_STATUS_UNAVAIL; 119 else 120 status = DL_CALL_FCT(fct.l, ()); 121 } while (__nss_next(&nip, fct_name, &fct.ptr, status, 0) == 0); 105 #define args () 106 #include "walk_nss.h" 107 #undef args 122 108 return status; 123 109 } … … 154 140 char *buffer, size_t buflen, int *errnop) 155 141 { 156 static const char *fct_name = "getspnam_r";157 static void *fct_start = NULL;158 142 enum nss_status status; 159 service_user *nip; 160 union { 161 enum nss_status (*l)(const char *name, struct spwd *pwd, 162 char *buffer, size_t buflen, int *errnop); 163 void *ptr; 164 } fct; 165 166 nip = nss_shadow_nonlocal_database(); 167 if (nip == NULL) 168 return NSS_STATUS_UNAVAIL; 169 if (fct_start == NULL) 170 fct_start = __nss_lookup_function(nip, fct_name); 171 fct.ptr = fct_start; 172 do { 173 if (fct.ptr == NULL) 174 status = NSS_STATUS_UNAVAIL; 175 else 176 status = DL_CALL_FCT(fct.l, (name, pwd, buffer, buflen, errnop)); 177 if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE) 178 break; 179 } while (__nss_next(&nip, fct_name, &fct.ptr, status, 0) == 0); 143 const struct walk_nss w = { 144 .lookup = __nss_shadow_nonlocal_lookup, .fct_name = "getspnam_r", 145 .status = &status, .errnop = errnop 146 }; 147 const __typeof__(&_nss_nonlocal_getspnam_r) self = NULL; 148 #define args (name, pwd, buffer, buflen, errnop) 149 #include "walk_nss.h" 150 #undef args 180 151 if (status != NSS_STATUS_SUCCESS) 181 152 return status;
Note: See TracChangeset
for help on using the changeset viewer.