[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
tss at dovecot.org
tss at dovecot.org
Fri Feb 16 17:23:00 UTC 2007
- Previous message: [dovecot-cvs] dovecot/src/auth checkpassword-reply.c,1.3,1.3.2.1
- Next message: [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
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/auth
In directory talvi:/tmp/cvs-serv13528
Modified Files:
Tag: branch_1_0
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.58.2.24
retrieving revision 1.58.2.25
diff -u -d -r1.58.2.24 -r1.58.2.25
--- auth-request.c 15 Feb 2007 11:51:31 -0000 1.58.2.24
+++ auth-request.c 16 Feb 2007 17:22:57 -0000 1.58.2.25
@@ -952,6 +952,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.27.2.4
retrieving revision 1.27.2.5
diff -u -d -r1.27.2.4 -r1.27.2.5
--- auth-request.h 15 Feb 2007 10:46:57 -0000 1.27.2.4
+++ auth-request.h 16 Feb 2007 17:22:57 -0000 1.27.2.5
@@ -127,6 +127,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.10.2.4
retrieving revision 1.10.2.5
diff -u -d -r1.10.2.4 -r1.10.2.5
--- passdb-blocking.c 6 Feb 2007 09:49:43 -0000 1.10.2.4
+++ passdb-blocking.c 16 Feb 2007 17:22:58 -0000 1.10.2.5
@@ -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.17.2.3
retrieving revision 1.17.2.4
diff -u -d -r1.17.2.3 -r1.17.2.4
--- passdb-cache.c 15 Feb 2007 11:51:31 -0000 1.17.2.3
+++ passdb-cache.c 16 Feb 2007 17:22:58 -0000 1.17.2.4
@@ -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 checkpassword-reply.c,1.3,1.3.2.1
- Next message: [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
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list