関数 | |
passwd * | tcopy_passwd (TALLOC_CTX *mem_ctx, const struct passwd *from) |
static void | init_pwnam_cache (void) |
void | flush_pwnam_cache (void) |
passwd * | getpwnam_alloc (TALLOC_CTX *mem_ctx, const char *name) |
passwd * | getpwuid_alloc (TALLOC_CTX *mem_ctx, uid_t uid) |
変数 | |
static struct passwd ** | pwnam_cache = NULL |
struct passwd* tcopy_passwd | ( | TALLOC_CTX * | mem_ctx, | |
const struct passwd * | from | |||
) |
参照先 talloc_strdup().
参照元 getpwnam_alloc()・getpwuid_alloc()・pdb_copy_sam_account()・samu_set_unix_internal().
00026 { 00027 struct passwd *ret = TALLOC_P(mem_ctx, struct passwd); 00028 if (!ret) { 00029 return NULL; 00030 } 00031 ret->pw_name = talloc_strdup(ret, from->pw_name); 00032 ret->pw_passwd = talloc_strdup(ret, from->pw_passwd); 00033 ret->pw_uid = from->pw_uid; 00034 ret->pw_gid = from->pw_gid; 00035 ret->pw_gecos = talloc_strdup(ret, from->pw_gecos); 00036 ret->pw_dir = talloc_strdup(ret, from->pw_dir); 00037 ret->pw_shell = talloc_strdup(ret, from->pw_shell); 00038 return ret; 00039 }
static void init_pwnam_cache | ( | void | ) | [static] |
参照先 pwnam_cache・smb_panic().
参照元 flush_pwnam_cache()・getpwnam_alloc().
00045 { 00046 if (pwnam_cache != NULL) 00047 return; 00048 00049 pwnam_cache = TALLOC_ZERO_ARRAY(NULL, struct passwd *, 00050 PWNAMCACHE_SIZE); 00051 if (pwnam_cache == NULL) { 00052 smb_panic("Could not init pwnam_cache\n"); 00053 } 00054 00055 return; 00056 }
void flush_pwnam_cache | ( | void | ) |
参照先 init_pwnam_cache()・pwnam_cache.
参照元 ldapsam_create_user()・ldapsam_delete_user()・ldapsam_set_primary_group()・pdb_default_create_user()・pdb_rename_sam_account()・smb_create_user()・smb_delete_user()・smb_set_primary_group().
00059 { 00060 TALLOC_FREE(pwnam_cache); 00061 pwnam_cache = NULL; 00062 init_pwnam_cache(); 00063 }
struct passwd* getpwnam_alloc | ( | TALLOC_CTX * | mem_ctx, | |
const char * | name | |||
) |
参照先 errno・init_pwnam_cache()・pwnam_cache・sys_getpwnam()・tcopy_passwd().
参照元 cgi_handle_authorization()・cgi_web_auth()・change_to_guest()・do_reseed()・Get_Pwnam_internals()・guest_user_info()・local_password_change()・lookup_unix_user_name()・main()・make_connection_snum()・make_server_info_sam()・nametouid()・net_sam_provision()・new_machine()・new_user()・pdb_default_enum_group_memberships()・register_vuid().
00066 { 00067 int i; 00068 00069 struct passwd *temp; 00070 00071 init_pwnam_cache(); 00072 00073 for (i=0; i<PWNAMCACHE_SIZE; i++) { 00074 if ((pwnam_cache[i] != NULL) && 00075 (strcmp(name, pwnam_cache[i]->pw_name) == 0)) { 00076 DEBUG(10, ("Got %s from pwnam_cache\n", name)); 00077 return (struct passwd *)talloc_reference(mem_ctx, pwnam_cache[i]); 00078 } 00079 } 00080 00081 temp = sys_getpwnam(name); 00082 00083 if (!temp) { 00084 #if 0 00085 if (errno == ENOMEM) { 00086 /* what now? */ 00087 } 00088 #endif 00089 return NULL; 00090 } 00091 00092 for (i=0; i<PWNAMCACHE_SIZE; i++) { 00093 if (pwnam_cache[i] == NULL) 00094 break; 00095 } 00096 00097 if (i == PWNAMCACHE_SIZE) 00098 i = rand() % PWNAMCACHE_SIZE; 00099 00100 if (pwnam_cache[i] != NULL) { 00101 TALLOC_FREE(pwnam_cache[i]); 00102 } 00103 00104 pwnam_cache[i] = tcopy_passwd(pwnam_cache, temp); 00105 if (pwnam_cache[i]!= NULL && mem_ctx != NULL) { 00106 return (struct passwd *)talloc_reference(mem_ctx, pwnam_cache[i]); 00107 } 00108 00109 return tcopy_passwd(NULL, pwnam_cache[i]); 00110 }
struct passwd* getpwuid_alloc | ( | TALLOC_CTX * | mem_ctx, | |
uid_t | uid | |||
) |
参照先 errno・sys_getpwuid()・tcopy_passwd().
参照元 create_token_from_username()・pdb_default_add_groupmem()・pdb_default_del_groupmem()・process_nonroot()・process_root()・uidtoname().
00113 { 00114 struct passwd *temp; 00115 00116 temp = sys_getpwuid(uid); 00117 00118 if (!temp) { 00119 #if 0 00120 if (errno == ENOMEM) { 00121 /* what now? */ 00122 } 00123 #endif 00124 return NULL; 00125 } 00126 00127 return tcopy_passwd(mem_ctx, temp); 00128 }
struct passwd** pwnam_cache = NULL [static] |