summaryrefslogtreecommitdiff
path: root/usr/src/cmd/keyserv/chkey.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src/cmd/keyserv/chkey.c')
-rw-r--r--usr/src/cmd/keyserv/chkey.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/usr/src/cmd/keyserv/chkey.c b/usr/src/cmd/keyserv/chkey.c
index 1662749211..d0e39aa6eb 100644
--- a/usr/src/cmd/keyserv/chkey.c
+++ b/usr/src/cmd/keyserv/chkey.c
@@ -2,9 +2,8 @@
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License"). You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -777,7 +776,13 @@ write_rootkey(char *secret, char *flavor, keylen_t keylen, algtype_t algtype)
hexkeybytes = ((keylen + 7) / 8) * 2;
while (fgets_ignorenul(line, MAXROOTKEY_LINE_LEN, bakfile)) {
- sscanf(line, "%s %d", keyent, &atent);
+ if (sscanf(line, "%s %d", keyent, &atent) < 2) {
+ /*
+ * No encryption algorithm found in the file
+ * (atent) so default to DES.
+ */
+ atent = AUTH_DES_ALGTYPE;
+ }
/*
* 192-bit keys always go on the first line
*/