/[radius]/radius/lib/md5crypt.c
ViewVC logotype

Diff of /radius/lib/md5crypt.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by gray, Wed Jun 12 16:09:59 2002 UTC revision 1.3 by gray, Fri Apr 18 05:27:09 2003 UTC
# Line 22  static char rcsid[] = "$Id$"; Line 22  static char rcsid[] = "$Id$";
22  #include <stdio.h>  #include <stdio.h>
23  #include <sysdep.h>  #include <sysdep.h>
24  #include <md5.h>  #include <md5.h>
 #include <pthread.h>  
25    
26  static unsigned char itoa64[] =         /* 0 ... 63 => ascii - 64 */  static unsigned char itoa64[] =         /* 0 ... 63 => ascii - 64 */
27          "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";          "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
# Line 41  to64(s, v, n) Line 40  to64(s, v, n)
40          }          }
41  }  }
42    
43  static pthread_mutex_t crypt_mutex = PTHREAD_MUTEX_INITIALIZER;  LOCK_DECLARE(lock)
44    
45  /*  /*
46   * UNIX password   * UNIX password
# Line 75  md5crypt(pw, salt, passwd, size) Line 74  md5crypt(pw, salt, passwd, size)
74          if (!strncmp(sp, magic, strlen(magic)))          if (!strncmp(sp, magic, strlen(magic)))
75                  sp += strlen(magic);                  sp += strlen(magic);
76          else {          else {
77                  pthread_mutex_lock(&crypt_mutex);                  LOCK_SET(lock);
78                  strncpy(passwd, crypt(pw, salt), size);                  strncpy(passwd, crypt(pw, salt), size);
79                  pthread_mutex_unlock(&crypt_mutex);                  LOCK_RELEASE(lock);
80                  return passwd;                  return passwd;
81          }          }
82                                    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26