[dovecot-cvs] dovecot/src/auth auth-request.c, 1.85, 1.86 auth-request.h, 1.32, 1.33 passdb-blocking.c, 1.15, 1.16 passdb-cache.c, 1.20, 1.21
tss at dovecot.org
tss at dovecot.org
Fri Feb 16 17:23:04 UTC 2007
- Previous message: [dovecot-cvs] dovecot/src/auth auth-request.c, 1.58.2.24, 1.58.2.25 auth-request.h, 1.27.2.4, 1.27.2.5 passdb-blocking.c, 1.10.2.4, 1.10.2.5 passdb-cache.c, 1.17.2.3, 1.17.2.4
- Next message: [dovecot-cvs] dovecot/src/auth passdb-checkpassword.c, 1.18.2.10, 1.18.2.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv13532
Modified Files:
auth-request.c auth-request.h passdb-blocking.c passdb-cache.c
Log Message:
Added auth_request_set_fields() and used it instead of duplicating the code
in multiple places.
Index: auth-request.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-request.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -d -r1.85 -r1.86
--- auth-request.c 15 Feb 2007 11:51:33 -0000 1.85
+++ auth-request.c 16 Feb 2007 17:23:01 -0000 1.86
@@ -980,6 +980,27 @@
}
}
+void auth_request_set_fields(struct auth_request *request,
+ const char *const *fields,
+ const char *default_scheme)
+{
+ const char *key, *value;
+
+ t_push();
+ for (; *fields != NULL; fields++) {
+ value = strchr(*fields, '=');
+ if (value == NULL) {
+ key = *fields;
+ value = "";
+ } else {
+ key = t_strdup_until(*fields, value);
+ value++;
+ }
+ auth_request_set_field(request, key, value, default_scheme);
+ }
+ t_pop();
+}
+
int auth_request_password_verify(struct auth_request *request,
const char *plain_password,
const char *crypted_password,
Index: auth-request.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/auth-request.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- auth-request.h 15 Feb 2007 10:47:01 -0000 1.32
+++ auth-request.h 16 Feb 2007 17:23:01 -0000 1.33
@@ -128,6 +128,9 @@
void auth_request_set_field(struct auth_request *request,
const char *name, const char *value,
const char *default_scheme);
+void auth_request_set_fields(struct auth_request *request,
+ const char *const *fields,
+ const char *default_scheme);
int auth_request_password_verify(struct auth_request *request,
const char *plain_password,
Index: passdb-blocking.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-blocking.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- passdb-blocking.c 6 Feb 2007 09:49:46 -0000 1.15
+++ passdb-blocking.c 16 Feb 2007 17:23:01 -0000 1.16
@@ -90,16 +90,7 @@
i_assert(auth_stream_is_empty(request->extra_fields) ||
request->master_user != NULL);
- for (tmp = t_strsplit(reply, "\t"); *tmp != NULL; tmp++) {
- p = strchr(*tmp, '=');
- if (p == NULL)
- p = "";
- else {
- *tmp = t_strdup_until(*tmp, p);
- p++;
- }
- auth_request_set_field(request, *tmp, p, NULL);
- }
+ auth_request_set_fields(request, t_strsplit(reply, "\t"), NULL);
}
return 0;
}
Index: passdb-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/auth/passdb-cache.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- passdb-cache.c 15 Feb 2007 11:51:33 -0000 1.20
+++ passdb-cache.c 16 Feb 2007 17:23:01 -0000 1.21
@@ -9,26 +9,6 @@
struct auth_cache *passdb_cache = NULL;
-static void list_save(struct auth_request *request, const char *const *list)
-{
- const char *name, *value;
-
- for (; *list != NULL; list++) {
- t_push();
- value = strchr(*list, '=');
- if (value == NULL) {
- name = *list;
- value = "";
- } else {
- name = t_strcut(*list, '=');
- value++;
- }
-
- auth_request_set_field(request, name, value, NULL);
- t_pop();
- }
-}
-
bool passdb_cache_verify_plain(struct auth_request *request, const char *key,
const char *password,
enum passdb_result *result_r, int use_expired)
@@ -78,7 +58,7 @@
/* save the extra_fields only after we know we're using the
cached data */
- list_save(request, list + 1);
+ auth_request_set_fields(request, list + 1, NULL);
*result_r = ret > 0 ? PASSDB_RESULT_OK :
PASSDB_RESULT_PASSWORD_MISMATCH;
@@ -111,7 +91,7 @@
}
list = t_strsplit(value, "\t");
- list_save(request, list + 1);
+ auth_request_set_fields(request, list + 1, NULL);
*result_r = PASSDB_RESULT_OK;
*password_r = list[0];
- Previous message: [dovecot-cvs] dovecot/src/auth auth-request.c, 1.58.2.24, 1.58.2.25 auth-request.h, 1.27.2.4, 1.27.2.5 passdb-blocking.c, 1.10.2.4, 1.10.2.5 passdb-cache.c, 1.17.2.3, 1.17.2.4
- Next message: [dovecot-cvs] dovecot/src/auth passdb-checkpassword.c, 1.18.2.10, 1.18.2.11
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list