[dovecot-cvs] dovecot/src/auth passdb-passwd.c, 1.20, 1.21 passdb-shadow.c, 1.21, 1.22

tss at dovecot.org tss at dovecot.org
Mon Mar 26 19:15:07 EEST 2007


Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv2020

Modified Files:
	passdb-passwd.c passdb-shadow.c 
Log Message:
Verify the password with auth_request_password_verify() so passwd and shadow
can be used as master and deny passdbs.



Index: passdb-passwd.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-passwd.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- passdb-passwd.c	22 Mar 2007 01:36:45 -0000	1.20
+++ passdb-passwd.c	26 Mar 2007 16:15:05 -0000	1.21
@@ -6,7 +6,6 @@
 
 #include "safe-memset.h"
 #include "passdb.h"
-#include "mycrypt.h"
 
 #include <pwd.h>
 
@@ -18,7 +17,7 @@
 		    verify_plain_callback_t *callback)
 {
 	struct passwd *pw;
-	bool result;
+	int ret;
 
 	auth_request_log_debug(request, "passwd", "lookup");
 
@@ -41,13 +40,13 @@
 			       PASSWD_PASS_SCHEME);
 
 	/* check if the password is valid */
-	result = strcmp(mycrypt(password, pw->pw_passwd), pw->pw_passwd) == 0;
+	ret = auth_request_password_verify(request, password, pw->pw_passwd,
+					   PASSWD_PASS_SCHEME, "passwd");
 
 	/* clear the passwords from memory */
 	safe_memset(pw->pw_passwd, 0, strlen(pw->pw_passwd));
 
-	if (!result) {
-		auth_request_log_info(request, "passwd", "password mismatch");
+	if (ret <= 0) {
 		callback(PASSDB_RESULT_PASSWORD_MISMATCH, request);
 		return;
 	}

Index: passdb-shadow.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-shadow.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- passdb-shadow.c	22 Mar 2007 01:36:45 -0000	1.21
+++ passdb-shadow.c	26 Mar 2007 16:15:05 -0000	1.22
@@ -6,7 +6,6 @@
 
 #include "safe-memset.h"
 #include "passdb.h"
-#include "mycrypt.h"
 
 #include <shadow.h>
 
@@ -18,7 +17,7 @@
 		    verify_plain_callback_t *callback)
 {
 	struct spwd *spw;
-	bool result;
+	int ret;
 
 	auth_request_log_debug(request, "shadow", "lookup");
 
@@ -41,13 +40,13 @@
 			       SHADOW_PASS_SCHEME);
 
 	/* check if the password is valid */
-	result = strcmp(mycrypt(password, spw->sp_pwdp), spw->sp_pwdp) == 0;
+	ret = auth_request_password_verify(request, password, spw->sp_pwdp,
+					   SHADOW_PASS_SCHEME, "shadow");
 
 	/* clear the passwords from memory */
 	safe_memset(spw->sp_pwdp, 0, strlen(spw->sp_pwdp));
 
-	if (!result) {
-		auth_request_log_info(request, "shadow", "password mismatch");
+	if (ret <= 0) {
 		callback(PASSDB_RESULT_PASSWORD_MISMATCH, request);
 		return;
 	}



More information about the dovecot-cvs mailing list