diff options
author | Joe Orton <jorton@redhat.com> | 2022-07-20 14:11:22 +0100 |
---|---|---|
committer | Joe Orton <jorton@redhat.com> | 2022-07-20 14:11:22 +0100 |
commit | 3cc1e6916bfba255ab7234ad32428b743b521b63 (patch) | |
tree | a139d54c5301052fad5f3d24a4483c5a7da824ef | |
parent | 2b8e2e4e3568d10cdb3ef07b3ae4c699540479ea (diff) | |
download | neon-git-3cc1e6916bfba255ab7234ad32428b743b521b63.tar.gz |
* src/ne_auth.c (get_cnonce): Stop using ne_md5* API, switch to
ne_strhash().
* src/ne_openssl.c, test/auth.c: Drop unused ne_md5.h include.
-rw-r--r-- | src/ne_auth.c | 24 | ||||
-rw-r--r-- | src/ne_openssl.c | 1 | ||||
-rw-r--r-- | test/auth.c | 1 |
3 files changed, 7 insertions, 19 deletions
diff --git a/src/ne_auth.c b/src/ne_auth.c index b3728e2..3a88924 100644 --- a/src/ne_auth.c +++ b/src/ne_auth.c @@ -57,7 +57,6 @@ #include <errno.h> #include <time.h> -#include "ne_md5.h" #include "ne_dates.h" #include "ne_request.h" #include "ne_auth.h" @@ -357,23 +356,17 @@ static char *get_cnonce(void) { /* Fallback sources of random data: all bad, but no good sources * are available. */ - struct ne_md5_ctx *hash; - char ret[33]; + ne_buffer *buf = ne_buffer_create(); + char *ret; - hash = ne_md5_create_ctx(); - - /* Uninitialized stack data; yes, happy valgrinders, this is - * supposed to be here. */ - ne_md5_process_bytes(data, sizeof data, hash); - { #ifdef HAVE_GETTIMEOFDAY struct timeval tv; if (gettimeofday(&tv, NULL) == 0) - ne_md5_process_bytes(&tv, sizeof tv, hash); + ne_buffer_snprintf(buf, 64, "%" NE_FMT_TIME_T ".%ld", + tv.tv_sec, (long)tv.tv_usec); #else /* HAVE_GETTIMEOFDAY */ - time_t t = time(NULL); - ne_md5_process_bytes(&t, sizeof t, hash); + ne_buffer_snprintf(buf, 64, "%" NE_FMT_TIME_T, time(NULL)); #endif } { @@ -382,13 +375,10 @@ static char *get_cnonce(void) #else pid_t pid = getpid(); #endif - ne_md5_process_bytes(&pid, sizeof pid, hash); + ne_buffer_snprintf(buf, 32, "%lu", (unsigned long) pid); } - ne_md5_finish_ascii(hash, ret); - ne_md5_destroy_ctx(hash); - - return ne_strdup(ret); + ret = ne_strhash(NE_HASH_MD5, buf->data); } } diff --git a/src/ne_openssl.c b/src/ne_openssl.c index c25c911..d13c25a 100644 --- a/src/ne_openssl.c +++ b/src/ne_openssl.c @@ -50,7 +50,6 @@ #include "ne_string.h" #include "ne_session.h" #include "ne_internal.h" -#include "ne_md5.h" #include "ne_private.h" #include "ne_privssl.h" diff --git a/test/auth.c b/test/auth.c index d0f1f8c..96474e3 100644 --- a/test/auth.c +++ b/test/auth.c @@ -29,7 +29,6 @@ #include <unistd.h> #endif -#include "ne_md5.h" #include "ne_string.h" #include "ne_request.h" #include "ne_auth.h" |