summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/libntp/authusekey.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2015-07-15 19:21:26 +0000
committerdelphij <delphij@FreeBSD.org>2015-07-15 19:21:26 +0000
commit2a25cee78ab1d37e7d2bc40ae675646974d99f56 (patch)
treeb0302ac4be59e104f4e1e54014561a1389397192 /contrib/ntp/libntp/authusekey.c
parenta0741a75537b2e0514472ac3b28afc55a7846c30 (diff)
downloadFreeBSD-src-2a25cee78ab1d37e7d2bc40ae675646974d99f56.zip
FreeBSD-src-2a25cee78ab1d37e7d2bc40ae675646974d99f56.tar.gz
MFC r280849,280915-280916,281015-281016,282097,282408,282415,283542,
284864,285169-285170,285435: ntp 4.2.8p3. Relnotes: yes Approved by: re (?)
Diffstat (limited to 'contrib/ntp/libntp/authusekey.c')
-rw-r--r--contrib/ntp/libntp/authusekey.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/contrib/ntp/libntp/authusekey.c b/contrib/ntp/libntp/authusekey.c
index 40dd373..c1d0813 100644
--- a/contrib/ntp/libntp/authusekey.c
+++ b/contrib/ntp/libntp/authusekey.c
@@ -1,6 +1,7 @@
/*
* authusekey - decode a key from ascii and use it
*/
+#include <config.h>
#include <stdio.h>
#include <ctype.h>
@@ -15,9 +16,6 @@
* high order bit of each byte a parity bit. "Ascii" means a 1-to-8
* character string whose ascii representation is used as the key.
*/
-
-#define KEY_TYPE_MD5 4
-
int
authusekey(
keyid_t keyno,
@@ -25,23 +23,12 @@ authusekey(
const u_char *str
)
{
- const u_char *cp;
int len;
- cp = str;
- len = strlen((const char *)cp);
- if (len == 0)
- return 0;
-
- switch(keytype) {
- case KEY_TYPE_MD5:
- MD5auth_setkey(keyno, str, (int)strlen((const char *)str));
- break;
-
- default:
- /* Oh, well */
+ len = strlen((const char *)str);
+ if (0 == len)
return 0;
- }
+ MD5auth_setkey(keyno, keytype, str, len);
return 1;
}
OpenPOWER on IntegriCloud