summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2002-11-16 22:31:56 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2002-11-16 22:31:56 +0000
commit88918d82e92c3e492a7bf27f456e87c86dc0bfa7 (patch)
treec729df6613523d244d388fb46054e092f286e487
parent8a43a885bd60ba04ad4e79c75c482d80e7ccb93f (diff)
Add a missing check for NULL keyfile in skeychallenge() that
caused a user w/o an S/Key to just get "permission denied" from login_skey instead of a fake challenge.
-rw-r--r--lib/libskey/skeylogin.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c
index b8533ca4fd6..3a34dc89703 100644
--- a/lib/libskey/skeylogin.c
+++ b/lib/libskey/skeylogin.c
@@ -10,7 +10,7 @@
*
* S/Key verification check, lookups, and authentication.
*
- * $OpenBSD: skeylogin.c,v 1.46 2002/06/22 02:13:10 deraadt Exp $
+ * $OpenBSD: skeylogin.c,v 1.47 2002/11/16 22:31:55 millert Exp $
*/
#include <sys/param.h>
@@ -64,8 +64,10 @@ skeychallenge(mp, name, ss)
return (0);
case 1: /* User not found */
- (void)fclose(mp->keyfile);
- mp->keyfile = NULL;
+ if (mp->keyfile) {
+ (void)fclose(mp->keyfile);
+ mp->keyfile = NULL;
+ }
/* FALLTHROUGH */
default: /* File error */