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"; |
40 |
} |
} |
41 |
} |
} |
42 |
|
|
43 |
static pthread_mutex_t crypt_mutex = PTHREAD_MUTEX_INITIALIZER; |
LOCK_DECLARE(lock) |
44 |
|
|
45 |
/* |
/* |
46 |
* UNIX password |
* UNIX password |
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 |
|
|