Changeset 745 for trunk/server/source3/winbindd/nss_info.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/winbindd/nss_info.c
r414 r745 21 21 22 22 #include "includes.h" 23 #include "ads.h" 23 24 #include "nss_info.h" 24 25 … … 88 89 { 89 90 char *p; 90 char *q;91 int len;92 91 93 92 *backend = *domain = NULL; … … 111 110 } 112 111 113 len = PTR_DIFF(p,config)+1; 114 if ( (q = SMB_MALLOC_ARRAY( char, len )) == NULL ) { 115 SAFE_FREE( *backend ); 116 return False; 117 } 118 119 StrnCpy( q, config, len-1); 120 q[len-1] = '\0'; 121 *backend = q; 122 123 return True; 112 *backend = SMB_STRNDUP(config, PTR_DIFF(p, config)); 113 return (*backend != NULL); 124 114 } 125 115 … … 165 155 *******************************************************************/ 166 156 167 NTSTATUS nss_init( const char **nss_list)157 static NTSTATUS nss_init(const char **nss_list) 168 158 { 169 159 NTSTATUS status; 170 static NTSTATUS nss_initialized = NT_STATUS_UNSUCCESSFUL;160 static bool nss_initialized = false; 171 161 int i; 172 162 char *backend, *domain; … … 175 165 /* check for previous successful initializations */ 176 166 177 if ( NT_STATUS_IS_OK(nss_initialized) )167 if (nss_initialized) { 178 168 return NT_STATUS_OK; 179 180 /* The "template" backend should alqays be registered as it 169 } 170 171 /* The "template" backend should always be registered as it 181 172 is a static module */ 182 173 183 if ( (nss_backend = nss_get_backend( "template" )) == NULL ) { 174 nss_backend = nss_get_backend("template"); 175 if (nss_backend == NULL) { 184 176 static_init_nss_info; 185 177 } … … 201 193 /* validate the backend */ 202 194 203 if ( (nss_backend = nss_get_backend( backend )) == NULL ) { 195 nss_backend = nss_get_backend(backend); 196 if (nss_backend == NULL) { 197 /* 198 * This is a freaking hack. We don't have proper 199 * modules for nss_info backends. Right now we have 200 * our standard nss_info backends in the ad backend. 201 */ 202 status = smb_probe_module("idmap", "ad"); 203 if ( !NT_STATUS_IS_OK(status) ) { 204 continue; 205 } 206 } 207 208 nss_backend = nss_get_backend(backend); 209 if (nss_backend == NULL) { 204 210 /* attempt to register the backend */ 205 211 status = smb_probe_module( "nss_info", backend ); … … 207 213 continue; 208 214 } 209 210 /* try again */ 211 if ( (nss_backend = nss_get_backend( backend )) == NULL ) { 212 DEBUG(0,("nss_init: unregistered backend %s!. Skipping\n", 213 backend)); 214 continue; 215 } 215 } 216 217 /* try again */ 218 nss_backend = nss_get_backend(backend); 219 if (nss_backend == NULL) { 220 DEBUG(0, ("nss_init: unregistered backend %s!. " 221 "Skipping\n", backend)); 222 continue; 216 223 } 217 224 … … 242 249 243 250 244 /* we shou ild default to use template here */245 } 246 247 nss_initialized = NT_STATUS_OK;251 /* we should default to use template here */ 252 } 253 254 nss_initialized = true; 248 255 249 256 return NT_STATUS_OK; … … 260 267 status = nss_init( lp_winbind_nss_info() ); 261 268 if ( !NT_STATUS_IS_OK(status) ) { 262 DEBUG(4,(" nss_get_info: Failed to init nss_info API (%s)!\n",263 nt_errstr(status)));269 DEBUG(4,("find_nss_domain: Failed to init nss_info API " 270 "(%s)!\n", nt_errstr(status))); 264 271 return NULL; 265 272 } … … 300 307 *******************************************************************/ 301 308 302 NTSTATUS nss_get_info( const char *domain, const DOM_SID*user_sid,309 NTSTATUS nss_get_info( const char *domain, const struct dom_sid *user_sid, 303 310 TALLOC_CTX *ctx, 304 ADS_STRUCT *ads, LDAPMessage *msg,305 311 const char **homedir, const char **shell, 306 312 const char **gecos, gid_t *p_gid) … … 320 326 m = p->backend->methods; 321 327 322 return m->get_nss_info( p, user_sid, ctx, ads, msg,328 return m->get_nss_info( p, user_sid, ctx, 323 329 homedir, shell, gecos, p_gid ); 324 330 }
Note:
See TracChangeset
for help on using the changeset viewer.