Commit b5dea458fed6cb8f59617ceabbc9c14554a9fe3f

Authored by Benjamin Renard
1 parent ea9068c7
Exists in ubuntu

Fix bug with crypt function

Showing 1 changed file with 6 additions and 2 deletions   Show diff stats
src/SERVER/DD_Access_sr.c
... ... @@ -188,7 +188,7 @@ int CheckTicket(char *NameUsr, char *Ticket)
188 188 int i=0;
189 189 int DD_id;
190 190 int Right = NOPERMISSION;
191   - char salt[2],newkey[USRLENGTH];
  191 + char salt[16],newkey[USRLENGTH];
192 192  
193 193 int UsrRefID; /* ID of reference file which consists description of all users */
194 194 char *ddbase;
... ... @@ -253,9 +253,13 @@ int CheckTicket(char *NameUsr, char *Ticket)
253 253 NameUsr[strlen(NameUsr)]='\0';
254 254 newkey[PasswdLength-1]='\0';
255 255  
  256 + memset(salt,0, 16*sizeof(char));
256 257 strncpy(salt,PasChar,2);
257 258  
258   - strcpy(newkey,(char *)crypt(Ticket,salt));
  259 + struct crypt_data data;
  260 + data.initialized = 0;
  261 + char *hashedpwd = crypt_r(Ticket, salt, &data);
  262 + strcpy(newkey,hashedpwd);
259 263  
260 264 if(strcmp(PasChar,newkey) == 0)
261 265 {
... ...