diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2002-07-10 08:21:02 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2002-07-10 08:21:02 +0000 |
commit | c4c6aec59a47a1438ea06f45792a39816b70f644 (patch) | |
tree | b22a78e82cdf8faee9fc4b9e313e2900cb26766d /usr.sbin/httpd | |
parent | 091694c2fbaad9313bc33c297464ac610759ff27 (diff) |
use arc4random() from libc instead of reading /dev/arandom; allows chroot; ok henning@
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r-- | usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c b/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c index f1b8efaf29a..f6d7c3e384b 100644 --- a/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c +++ b/usr.sbin/httpd/src/modules/experimental/mod_auth_digest.c @@ -291,6 +291,24 @@ static void cleanup_tables(void *not_used) } #endif /* HAVE_SHMEM_MM */ +#ifdef __OpenBSD__ +static void initialize_secret(server_rec *s) +{ + u_int32_t rnd = 0, i; + + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, s, + "Digest: generating secret for digest authentication ..."); + + for (i = 0; i < sizeof(secret); i++) { + if (i % 4 == 0) + rnd = arc4random(); + secret[i] = rnd; + rnd >>= 8; + } + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, s, + "Digest: done"); +} +#else #ifdef WIN32 /* TODO: abstract out the random number generation. APR? */ static void initialize_secret(server_rec *s) @@ -358,6 +376,7 @@ static void initialize_secret(server_rec *s) ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, s, "Digest: done"); } #endif +#endif #ifdef HAVE_SHMEM_MM static void initialize_tables(server_rec *s) |