diff svr-auth.c @ 57:3b2a5a1c4347 authpam

svr-authpam code merged and works. needs tidying a log
author Matt Johnston <matt@ucc.asn.au>
date Sun, 08 Aug 2004 16:57:37 +0000
parents 0ad5fb979f42
children 5312ca05ed48
line wrap: on
line diff
--- a/svr-auth.c	Sun Aug 08 16:57:00 2004 +0000
+++ b/svr-auth.c	Sun Aug 08 16:57:37 2004 +0000
@@ -57,7 +57,7 @@
 #ifdef DROPBEAR_PUBKEY_AUTH
 	ses.authstate.authtypes |= AUTH_TYPE_PUBKEY;
 #endif
-#ifdef DROPBEAR_PASSWORD_AUTH
+#if defined(DROPBEAR_PASSWORD_AUTH) || defined(DROPBEAR_PAM_AUTH)
 	if (!svr_opts.noauthpass) {
 		ses.authstate.authtypes |= AUTH_TYPE_PASSWORD;
 	}
@@ -156,6 +156,19 @@
 	}
 #endif
 
+#ifdef DROPBEAR_PAM_AUTH
+	if (!svr_opts.noauthpass &&
+			!(svr_opts.norootpass && ses.authstate.pw->pw_uid == 0) ) {
+		/* user wants to try password auth */
+		if (methodlen == AUTH_METHOD_PASSWORD_LEN &&
+				strncmp(methodname, AUTH_METHOD_PASSWORD,
+					AUTH_METHOD_PASSWORD_LEN) == 0) {
+			svr_auth_pam();
+			goto out;
+		}
+	}
+#endif
+
 #ifdef DROPBEAR_PUBKEY_AUTH
 	/* user wants to try pubkey auth */
 	if (methodlen == AUTH_METHOD_PUBKEY_LEN &&