Changeset 427 for vendor/current/source3/passdb/passdb.c
- Timestamp:
- Apr 9, 2010, 3:20:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/passdb/passdb.c
r414 r427 123 123 } 124 124 125 static int count_commas(const char *str) 126 { 127 int num_commas = 0; 128 const char *comma = str; 129 130 while ((comma = strchr(comma, ',')) != NULL) { 131 comma += 1; 132 num_commas += 1; 133 } 134 return num_commas; 135 } 136 125 137 /********************************************************************* 126 138 Initialize a struct samu from a struct passwd including the user … … 133 145 const char *guest_account = lp_guestaccount(); 134 146 const char *domain = global_myname(); 147 char *fullname; 135 148 uint32 urid; 136 149 … … 142 155 143 156 pdb_set_username(user, pwd->pw_name, PDB_SET); 144 pdb_set_fullname(user, pwd->pw_gecos, PDB_SET); 157 158 fullname = NULL; 159 160 if (count_commas(pwd->pw_gecos) == 3) { 161 /* 162 * Heuristic: This seems to be a gecos field that has been 163 * edited by chfn(1). Only use the part before the first 164 * comma. Fixes bug 5198. 165 */ 166 fullname = talloc_strndup( 167 talloc_tos(), pwd->pw_gecos, 168 strchr(pwd->pw_gecos, ',') - pwd->pw_gecos); 169 } 170 171 if (fullname != NULL) { 172 pdb_set_fullname(user, fullname, PDB_SET); 173 } else { 174 pdb_set_fullname(user, pwd->pw_gecos, PDB_SET); 175 } 176 TALLOC_FREE(fullname); 177 145 178 pdb_set_domain (user, get_global_sam_name(), PDB_DEFAULT); 146 179 #if 0
Note:
See TracChangeset
for help on using the changeset viewer.