[dovecot-cvs] dovecot/src/util dovecotpw.c,1.7,1.8
tss at dovecot.org
tss at dovecot.org
Sun May 13 18:43:38 EEST 2007
Update of /var/lib/cvs/dovecot/src/util
In directory talvi:/tmp/cvs-serv17770
Modified Files:
dovecotpw.c
Log Message:
Fixed to use the new password scheme APIs
Index: dovecotpw.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/util/dovecotpw.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- dovecotpw.c 21 Dec 2006 21:25:25 -0000 1.7
+++ dovecotpw.c 13 May 2007 15:43:36 -0000 1.8
@@ -108,22 +108,21 @@
}
}
- if ((hash = password_generate(plaintext, user, scheme)) == NULL) {
- fprintf(stderr, "error generating password hash\n");
+ if (!password_generate_encoded(plaintext, user, scheme, &hash)) {
+ fprintf(stderr, "Unknown scheme: %s\n", scheme);
exit(1);
}
if (Vflag == 1) {
- const char *checkscheme, *checkpass;
-
- checkpass = t_strdup_printf("{%s}%s", scheme, hash);
- checkscheme = password_get_scheme(&checkpass);
+ const unsigned char *raw_password;
+ size_t size;
- if (strcmp(scheme, checkscheme) != 0) {
- fprintf(stderr, "reverse scheme lookup check failed\n");
+ if (password_decode(hash, scheme, &raw_password, &size) <= 0) {
+ fprintf(stderr, "reverse decode check failed\n");
exit(2);
}
- if (password_verify(plaintext, checkpass,
- checkscheme, user) != 1) {
+
+ if (password_verify(plaintext, user, scheme,
+ raw_password, size) != 1) {
fprintf(stderr,
"reverse password verification check failed\n");
exit(2);
More information about the dovecot-cvs
mailing list