aboutsummaryrefslogtreecommitdiff
path: root/ntpq/ntpq.c
diff options
context:
space:
mode:
Diffstat (limited to 'ntpq/ntpq.c')
-rw-r--r--ntpq/ntpq.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/ntpq/ntpq.c b/ntpq/ntpq.c
index 1a0e9b1a6867..56ff4e50e9eb 100644
--- a/ntpq/ntpq.c
+++ b/ntpq/ntpq.c
@@ -25,13 +25,9 @@
#include <isc/result.h>
#include "ntpq.h"
-#include "ntp_assert.h"
-#include "ntp_stdlib.h"
#include "ntp_unixtime.h"
#include "ntp_calendar.h"
#include "ntp_select.h"
-#include "ntp_assert.h"
-#include "lib_strbuf.h"
#include "ntp_lineedit.h"
#include "ntp_debug.h"
#ifdef OPENSSL
@@ -3941,31 +3937,25 @@ list_md_fn(const EVP_MD *m, const char *from, const char *to, void *arg)
size_t len, n;
const char *name, **seen;
struct hstate *hstate = arg;
- const char *cp;
/* m is MD obj, from is name or alias, to is base name for alias */
- if (!m || !from || to)
+ if (!m || !from || to) {
return; /* Ignore aliases */
+ }
/* Discard MACs that NTP won't accept. */
/* Keep this consistent with keytype_from_text() in ssl_init.c. */
- if (EVP_MD_size(m) > (MAX_MAC_LEN - sizeof(keyid_t)))
+ if (EVP_MD_size(m) > MAX_MDG_LEN) {
return;
+ }
name = EVP_MD_name(m);
-
- /* Lowercase names aren't accepted by keytype_from_text in ssl_init.c */
-
- for (cp = name; *cp; cp++)
- if (islower((unsigned char)*cp))
- return;
-
- len = (cp - name) + 1;
+ len = strlen(name) + 1;
/* There are duplicates. Discard if name has been seen. */
for (seen = hstate->seen; *seen; seen++)
- if (!strcmp(*seen, name))
+ if (!strcasecmp(*seen, name))
return;
n = (seen - hstate->seen) + 2;
@@ -4057,11 +4047,12 @@ insert_cmac(char *list)
/* No - end of list */
if (!delim && !last_nl) {
delim = list + len;
- } else
+ } else {
/* New line and no delim or before delim? */
if (last_nl && (!delim || last_nl < delim)) {
delim = last_nl;
}
+ }
/* Found insertion point where CMAC before entry? */
if (strncmp(CMAC, point, delim - point) < 0) {