diff src/auth/passdb-shadow.c @ 3656:fda241fa5d77 HEAD

Make auth caching work with non-sql/ldap passdbs too.
author Timo Sirainen <tss@iki.fi>
date Sun, 16 Oct 2005 15:49:14 +0300
parents c12df370e1b2
children 0c10475d9968
line wrap: on
line diff
--- a/src/auth/passdb-shadow.c	Sun Oct 16 15:03:37 2005 +0300
+++ b/src/auth/passdb-shadow.c	Sun Oct 16 15:49:14 2005 +0300
@@ -10,6 +10,9 @@
 
 #include <shadow.h>
 
+#define SHADOW_CACHE_KEY "%u"
+#define SHADOW_PASS_SCHEME "CRYPT"
+
 static void
 shadow_verify_plain(struct auth_request *request, const char *password,
 		    verify_plain_callback_t *callback)
@@ -31,6 +34,10 @@
 		return;
 	}
 
+	/* save the password so cache can use it */
+	auth_request_set_field(request, "password", spw->sp_pwdp,
+			       SHADOW_PASS_SCHEME);
+
 	/* check if the password is valid */
 	result = strcmp(mycrypt(password, spw->sp_pwdp), spw->sp_pwdp) == 0;
 
@@ -56,7 +63,9 @@
 
 struct passdb_module passdb_shadow = {
 	"shadow",
-	"%u", "CRYPT", FALSE,
+        SHADOW_CACHE_KEY,
+        SHADOW_PASS_SCHEME,
+	FALSE,
 
 	NULL, NULL,
 	shadow_deinit,