diff options
| -rw-r--r-- | usr/src/cmd/keyserv/chkey.c | 15 | ||||
| -rw-r--r-- | usr/src/cmd/keyserv/keylogin.c | 15 | ||||
| -rw-r--r-- | usr/src/cmd/keyserv/keyserv.c | 16 |
3 files changed, 30 insertions, 16 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 */ diff --git a/usr/src/cmd/keyserv/keylogin.c b/usr/src/cmd/keyserv/keylogin.c index 2b1adbf206..d42595ccd9 100644 --- a/usr/src/cmd/keyserv/keylogin.c +++ b/usr/src/cmd/keyserv/keylogin.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. */ @@ -160,7 +159,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)) { - (void) 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 */ diff --git a/usr/src/cmd/keyserv/keyserv.c b/usr/src/cmd/keyserv/keyserv.c index 0adc9e5140..1c5804142d 100644 --- a/usr/src/cmd/keyserv/keyserv.c +++ b/usr/src/cmd/keyserv/keyserv.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. */ @@ -523,8 +522,13 @@ getotherrootkeys(char *name) while (fgets_ignorenul(line, MAXROOTKEY_LINE_LEN, rootkey)) { debug(KEYSERV_DEBUG0, ("ROOTKEY %d: %s\n", count, line)); count++; - sscanf(line, "%s %d", key, &algtype); - + if (sscanf(line, "%s %d", key, &algtype) < 2) { + /* + * No encryption algorithm found in the file + * (algtype) so default to DES. + */ + algtype = AUTH_DES_ALGTYPE; + } if (!strlen(key)) continue; addmasterkey(key, name, algtype); |
