From a208292dd5867f1bb964c7c38585105d249bd9f4 Mon Sep 17 00:00:00 2001 From: Simon Wilkinson Date: Fri, 15 Feb 2013 16:13:20 +0000 Subject: [PATCH] asetkey: Handle unknown key types If the user tries to create a key which is not rxkad, error out rather than attempt to add a random blob of memory to the KeyFile. Caught by clang-analyzer Change-Id: Id2803fe29153f01ab352747caed31b0d0cb4f573 Reviewed-on: http://gerrit.openafs.org/9160 Tested-by: BuildBot Reviewed-by: Chas Williams - CONTRACTOR Reviewed-by: Derrick Brashear --- src/aklog/asetkey.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/aklog/asetkey.c b/src/aklog/asetkey.c index 2db399f69..e73fe57b3 100644 --- a/src/aklog/asetkey.c +++ b/src/aklog/asetkey.c @@ -183,6 +183,9 @@ addKey(struct afsconf_dir *dir, int argc, char **argv) { kvno = atoi(argv[3]); if (type == afsconf_rxkad) { typedKey = keyFromCommandLine(afsconf_rxkad, kvno, 0, argv[5], 8); + } else { + fprintf(stderr, "Unknown key type %s\n", argv[2]); + exit(1); } break; default: -- 2.39.5