Line
Link Here
|
0 |
-- htpasswd.c~ 2004-09-26 20:01:11.927886608 +0200 |
0 |
++ htpasswd.c 2004-09-26 20:05:04.213573816 +0200 |
Lines 112-117
Link Here
|
112 |
} |
112 |
} |
113 |
} |
113 |
} |
114 |
|
114 |
|
|
|
115 |
static void generate_salt(char *s, size_t size) |
116 |
{ |
117 |
static unsigned char tbl[] = |
118 |
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; |
119 |
size_t i; |
120 |
for (i = 0; i < size; ++i) { |
121 |
int idx = (int) (64.0 * rand() / (RAND_MAX + 1.0)); |
122 |
s[i] = tbl[idx]; |
123 |
} |
124 |
} |
125 |
|
126 |
|
115 |
static void putline(apr_file_t *f, const char *l) |
127 |
static void putline(apr_file_t *f, const char *l) |
116 |
{ |
128 |
{ |
117 |
apr_file_puts(l, f); |
129 |
apr_file_puts(l, f); |
Lines 160-166
Link Here
|
160 |
|
172 |
|
161 |
case ALG_APMD5: |
173 |
case ALG_APMD5: |
162 |
(void) srand((int) time((time_t *) NULL)); |
174 |
(void) srand((int) time((time_t *) NULL)); |
163 |
to64(&salt[0], rand(), 8); |
175 |
generate_salt(&salt[0], 8); |
164 |
salt[8] = '\0'; |
176 |
salt[8] = '\0'; |
165 |
|
177 |
|
166 |
apr_md5_encode((const char *)pw, (const char *)salt, |
178 |
apr_md5_encode((const char *)pw, (const char *)salt, |