[Git][NTPsec/ntpsec][master] Add default to several switch-es to supress warnings.
Hal Murray
gitlab at mg.gitlab.com
Mon Jun 18 18:46:20 UTC 2018
Hal Murray pushed to branch master at NTPsec / ntpsec
Commits:
4dedbf9a by Hal Murray at 2018-06-18T07:40:34Z
Add default to several switch-es to supress warnings.
- - - - -
3 changed files:
- devel/hacking.txt
- libntp/authkeys.c
- libntp/authreadkeys.c
Changes:
=====================================
devel/hacking.txt
=====================================
--- a/devel/hacking.txt
+++ b/devel/hacking.txt
@@ -569,6 +569,7 @@ DNS:: DNS Lookup
MAC:: Message authentication hash computation
AUTH:: Authorization-key handling
ERR:: Low-level errors from resource-management libraries
+BUG:: Bugs in the code
LOG:: Log switching and debug levels
CLOCK:: Low-level clock manipulation and validation checks & leap-second code
CONFIG:: Configuration parsing and interpretation
=====================================
libntp/authkeys.c
=====================================
--- a/libntp/authkeys.c
+++ b/libntp/authkeys.c
@@ -300,6 +300,9 @@ alloc_auth_info(
auth->digest = NULL;
auth->cipher = EVP_get_cipherbyname(name);
break;
+ default:
+ msyslog(LOG_ERR, "BUG: alloc_auth_info: bogus type %u", type);
+ exit(1);
}
LINK_SLIST(*bucket, auth, hlink);
LINK_TAIL_DLIST(key_listhead, auth, llink);
@@ -448,6 +451,9 @@ auth_setkey(
auth->digest = NULL;
auth->cipher = EVP_get_cipherbyname(name);
break;
+ default:
+ msyslog(LOG_ERR, "BUG: auth_setkey: bogus type %u", type);
+ exit(1);
}
if (NULL != auth->key) {
memset(auth->key, '\0', auth->key_size);
@@ -536,8 +542,9 @@ authencrypt(
case AUTH_CMAC:
authcmacencrypt++;
return cmac_encrypt(auth, pkt, length);
- case AUTH_NONE:
- return 0;
+ default:
+ msyslog(LOG_ERR, "BUG: authencrypt: bogus type %u", auth->type);
+ exit(1);
}
return 0;
}
@@ -574,8 +581,9 @@ authdecrypt(
answer = cmac_decrypt(auth, pkt, length, size);
if (!answer) authcmacfail++;
return answer;
- case AUTH_NONE:
- return false;
+ default:
+ msyslog(LOG_ERR, "BUG: authdecrypt: bogus type %u", auth->type);
+ exit(1);
}
return false;
}
=====================================
libntp/authreadkeys.c
=====================================
--- a/libntp/authreadkeys.c
+++ b/libntp/authreadkeys.c
@@ -157,7 +157,7 @@ check_mac_length(
case AUTH_DIGEST:
check_digest_mac_length(keyno, name);
break;
- case AUTH_NONE:
+ default:
msyslog(LOG_ERR, "BUG: authreadkeys: unknown AUTH type for key %u, %s", keyno, upcased);
}
}
@@ -207,7 +207,7 @@ check_key_length(
case AUTH_DIGEST:
/* any length key works */
break;
- case AUTH_NONE:
+ default:
msyslog(LOG_ERR, "BUG: authreadkeys: unknown AUTH type for key %u", keyno);
}
return length;
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/4dedbf9a46d0722f5a94b3eb12287aa1d62c2f96
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/4dedbf9a46d0722f5a94b3eb12287aa1d62c2f96
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20180618/239258c1/attachment.html>
More information about the vc
mailing list