=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/auth2-pubkey.c,v retrieving revision 1.2.8.2 retrieving revision 1.3 diff -u -r1.2.8.2 -r1.3 --- src/usr.bin/ssh/auth2-pubkey.c 2004/03/04 18:18:15 1.2.8.2 +++ src/usr.bin/ssh/auth2-pubkey.c 2003/04/08 20:21:28 1.3 @@ -23,7 +23,7 @@ */ #include "includes.h" -RCSID("$OpenBSD: auth2-pubkey.c,v 1.2.8.2 2004/03/04 18:18:15 brad Exp $"); +RCSID("$OpenBSD: auth2-pubkey.c,v 1.3 2003/04/08 20:21:28 itojun Exp $"); #include "ssh2.h" #include "xmalloc.h" @@ -44,7 +44,7 @@ /* import */ extern ServerOptions options; extern u_char *session_id2; -extern u_int session_id2_len; +extern int session_id2_len; static int userauth_pubkey(Authctxt *authctxt) @@ -123,9 +123,9 @@ authenticated = 0; if (PRIVSEP(user_key_allowed(authctxt->pw, key)) && PRIVSEP(key_verify(key, sig, slen, buffer_ptr(&b), - buffer_len(&b))) == 1) + buffer_len(&b))) == 1) authenticated = 1; - buffer_free(&b); + buffer_clear(&b); xfree(sig); } else { debug("test whether pkalg/pkblob are acceptable"); @@ -170,6 +170,9 @@ struct stat st; Key *found; char *fp; + + if (pw == NULL) + return 0; /* Temporarily use the user's uid. */ temporarily_use_uid(pw);