Changeset 228 for branches/samba-3.2.x/source/lib/util_pw.c
- Timestamp:
- May 26, 2009, 9:44:50 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.2.x/source/lib/util_pw.c
r133 r228 45 45 struct passwd *getpwnam_alloc(TALLOC_CTX *mem_ctx, const char *name) 46 46 { 47 struct passwd * temp, *cached;47 struct passwd *pw, *for_cache; 48 48 49 temp= (struct passwd *)memcache_lookup_talloc(49 pw = (struct passwd *)memcache_lookup_talloc( 50 50 NULL, GETPWNAM_CACHE, data_blob_string_const(name)); 51 if ( temp!= NULL) {52 return tcopy_passwd(mem_ctx, temp);51 if (pw != NULL) { 52 return tcopy_passwd(mem_ctx, pw); 53 53 } 54 54 55 temp= sys_getpwnam(name);56 if ( temp== NULL) {55 pw = sys_getpwnam(name); 56 if (pw == NULL) { 57 57 return NULL; 58 58 } 59 59 60 cached = tcopy_passwd(NULL, temp); 61 if (cached == NULL) { 62 /* 63 * Just don't add this into the cache, ignore the failure 64 */ 65 return temp; 60 for_cache = tcopy_passwd(NULL, pw); 61 if (for_cache == NULL) { 62 return NULL; 66 63 } 67 64 68 65 memcache_add_talloc(NULL, GETPWNAM_CACHE, data_blob_string_const(name), 69 cached); 70 return tcopy_passwd(mem_ctx, temp); 66 &for_cache); 67 68 return tcopy_passwd(mem_ctx, pw); 71 69 } 72 70
Note:
See TracChangeset
for help on using the changeset viewer.