Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/auth/passdb-checkpassword.c @ 9608:f30e6a345d73 HEAD
Added tag 1.2.14 for changeset eb04e2b13e3d
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 24 Aug 2010 18:10:29 +0100 |
parents | 00cd9aacd03c |
children |
rev | line source |
---|---|
9532
00cd9aacd03c
Updated copyright notices to include year 2010.
Timo Sirainen <tss@iki.fi>
parents:
8663
diff
changeset
|
1 /* Copyright (c) 2004-2010 Dovecot authors, see the included COPYING file */ |
3474
9096b7957413
Removed direct config.h including. I'm not sure why it was done before,
Timo Sirainen <tss@iki.fi>
parents:
3166
diff
changeset
|
2 |
9096b7957413
Removed direct config.h including. I'm not sure why it was done before,
Timo Sirainen <tss@iki.fi>
parents:
3166
diff
changeset
|
3 #include "common.h" |
8217
c47b78e843aa
Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.
Timo Sirainen <tss@iki.fi>
parents:
8057
diff
changeset
|
4 #include "passdb.h" |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
5 |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
6 #ifdef PASSDB_CHECKPASSWORD |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
7 |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
8 #include "db-checkpassword.h" |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
9 |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
10 struct checkpassword_passdb_module { |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
11 struct passdb_module module; |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
12 |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
13 const char *checkpassword_path, *checkpassword_reply_path; |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
14 struct hash_table *clients; |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
15 }; |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
16 |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
17 static struct child_wait *checkpassword_passdb_children = NULL; |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
18 |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
19 static void checkpassword_request_finish(struct chkpw_auth_request *request, |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
20 enum passdb_result result) |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
21 { |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
22 struct passdb_module *_module = request->request->passdb->passdb; |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
23 struct checkpassword_passdb_module *module = |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
24 (struct checkpassword_passdb_module *)_module; |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
25 verify_plain_callback_t *callback = |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
26 (verify_plain_callback_t *)request->callback; |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
27 |
8573
f9166a09423a
Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h
Timo Sirainen <tss@iki.fi>
parents:
8307
diff
changeset
|
28 hash_table_remove(module->clients, POINTER_CAST(request->pid)); |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
29 |
3063
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
30 if (result == PASSDB_RESULT_OK) { |
5089 | 31 if (strchr(str_c(request->input_buf), '\n') != NULL) { |
32 auth_request_log_error(request->request, | |
33 "checkpassword", | |
34 "LF characters in checkpassword reply"); | |
35 result = PASSDB_RESULT_INTERNAL_FAILURE; | |
36 } else { | |
5154
b9cb27ecee98
Use auth_request_set_fields() to set the fields returned by checkpassword
Timo Sirainen <tss@iki.fi>
parents:
5089
diff
changeset
|
37 auth_request_set_fields(request->request, |
b9cb27ecee98
Use auth_request_set_fields() to set the fields returned by checkpassword
Timo Sirainen <tss@iki.fi>
parents:
5089
diff
changeset
|
38 t_strsplit(str_c(request->input_buf), "\t"), |
b9cb27ecee98
Use auth_request_set_fields() to set the fields returned by checkpassword
Timo Sirainen <tss@iki.fi>
parents:
5089
diff
changeset
|
39 NULL); |
5089 | 40 } |
3063
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
41 } |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
42 |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
43 callback(result, request->request); |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
44 |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
45 auth_request_unref(&request->request); |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
46 checkpassword_request_free(request); |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
47 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
48 |
3063
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
49 static void |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
50 checkpassword_request_half_finish(struct chkpw_auth_request *request) |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
51 { |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
52 if (!request->exited || request->fd_in != -1) |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
53 return; |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
54 |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
55 switch (request->exit_status) { |
4835
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
56 /* vpopmail exit codes: */ |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
57 case 3: /* password fail / vpopmail user not found */ |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
58 case 12: /* null user name given */ |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
59 case 13: /* null password given */ |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
60 case 15: /* user has no password */ |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
61 case 20: /* invalid user/domain characters */ |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
62 case 21: /* system user not found */ |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
63 case 22: /* system user shadow entry not found */ |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
64 case 23: /* system password fail */ |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
65 |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
66 /* standard checkpassword exit codes: */ |
4429
c58659bf7ca5
Return value 1 from checkpassword can mean either password mismatch or unknown user. Treat it as password mismatch instead of as unknown user.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4032
diff
changeset
|
67 case 1: |
4835
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
68 /* (1 is additionally defined in vpopmail for |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
69 "pop/smtp/webmal/ imap/access denied") */ |
4429
c58659bf7ca5
Return value 1 from checkpassword can mean either password mismatch or unknown user. Treat it as password mismatch instead of as unknown user.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4032
diff
changeset
|
70 auth_request_log_info(request->request, "checkpassword", |
4835
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
71 "Login failed (status=%d)", |
f36357d3969d
Handle vpopmail's nonstandard exit codes.
Timo Sirainen <tss@iki.fi>
parents:
4823
diff
changeset
|
72 request->exit_status); |
4429
c58659bf7ca5
Return value 1 from checkpassword can mean either password mismatch or unknown user. Treat it as password mismatch instead of as unknown user.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4032
diff
changeset
|
73 checkpassword_request_finish(request, |
c58659bf7ca5
Return value 1 from checkpassword can mean either password mismatch or unknown user. Treat it as password mismatch instead of as unknown user.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4032
diff
changeset
|
74 PASSDB_RESULT_PASSWORD_MISMATCH); |
c58659bf7ca5
Return value 1 from checkpassword can mean either password mismatch or unknown user. Treat it as password mismatch instead of as unknown user.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4032
diff
changeset
|
75 break; |
3063
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
76 case 0: |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
77 if (request->input_buf != NULL) { |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
78 checkpassword_request_finish(request, PASSDB_RESULT_OK); |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
79 break; |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
80 } |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
81 /* missing input - fall through */ |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
82 case 2: |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
83 /* checkpassword is called with wrong |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
84 parameters? unlikely */ |
8663
011a1fb49cfd
Give a better error message when userdb-only checkpassword program is used with passdb checkpassword.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
85 auth_request_log_error(request->request, "checkpassword", |
011a1fb49cfd
Give a better error message when userdb-only checkpassword program is used with passdb checkpassword.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
86 "Child %s exited with status 2 (tried to use " |
011a1fb49cfd
Give a better error message when userdb-only checkpassword program is used with passdb checkpassword.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
87 "userdb-only checkpassword program for passdb?)", |
011a1fb49cfd
Give a better error message when userdb-only checkpassword program is used with passdb checkpassword.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
88 dec2str(request->pid)); |
011a1fb49cfd
Give a better error message when userdb-only checkpassword program is used with passdb checkpassword.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
89 checkpassword_request_finish(request, |
011a1fb49cfd
Give a better error message when userdb-only checkpassword program is used with passdb checkpassword.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
90 PASSDB_RESULT_INTERNAL_FAILURE); |
011a1fb49cfd
Give a better error message when userdb-only checkpassword program is used with passdb checkpassword.
Timo Sirainen <tss@iki.fi>
parents:
8590
diff
changeset
|
91 break; |
3063
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
92 case 111: |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
93 /* temporary problem, treat as internal error */ |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
94 default: |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
95 /* whatever error.. */ |
3730 | 96 auth_request_log_error(request->request, "checkpassword", |
97 "Child %s exited with status %d", | |
3063
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
98 dec2str(request->pid), request->exit_status); |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
99 checkpassword_request_finish(request, |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
100 PASSDB_RESULT_INTERNAL_FAILURE); |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
101 break; |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
102 } |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
103 } |
a0fbf92b41c3
userdb = passdb works now with checkpassword passdb.
Timo Sirainen <tss@iki.fi>
parents:
2942
diff
changeset
|
104 |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
105 static void sigchld_handler(const struct child_wait_status *status, |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
106 struct checkpassword_passdb_module *module) |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
107 { |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
108 struct chkpw_auth_request *request = |
8573
f9166a09423a
Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h
Timo Sirainen <tss@iki.fi>
parents:
8307
diff
changeset
|
109 hash_table_lookup(module->clients, POINTER_CAST(status->pid)); |
4430
94b3bb847f39
If checkpassword lookup failed, we crashed. auth_debug logged checkpassword's exit_status wrong.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4429
diff
changeset
|
110 |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
111 switch (checkpassword_sigchld_handler(status, request)) { |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
112 case SIGCHLD_RESULT_UNKNOWN_CHILD: |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
113 case SIGCHLD_RESULT_DEAD_CHILD: |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
114 break; |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
115 case SIGCHLD_RESULT_UNKNOWN_ERROR: |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
116 checkpassword_request_finish(request, |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
117 PASSDB_RESULT_INTERNAL_FAILURE); |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
118 break; |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
119 case SIGCHLD_RESULT_OK: |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
120 checkpassword_request_half_finish(request); |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
121 request = NULL; |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
122 break; |
4584
62e735bfb00d
If master db has extra fields set, send them to checkpassword in
Timo Sirainen <tss@iki.fi>
parents:
4581
diff
changeset
|
123 } |
62e735bfb00d
If master db has extra fields set, send them to checkpassword in
Timo Sirainen <tss@iki.fi>
parents:
4581
diff
changeset
|
124 } |
62e735bfb00d
If master db has extra fields set, send them to checkpassword in
Timo Sirainen <tss@iki.fi>
parents:
4581
diff
changeset
|
125 |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
5259
diff
changeset
|
126 static void ATTR_NORETURN |
3730 | 127 checkpassword_verify_plain_child(struct auth_request *request, |
128 struct checkpassword_passdb_module *module, | |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
129 int fd_in, int fd_out) |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
130 { |
3939
8ccd711c93db
Allow parameters to be passed to checkpassword.
Timo Sirainen <tss@iki.fi>
parents:
3938
diff
changeset
|
131 const char *cmd, *const *args; |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
132 |
3730 | 133 if (dup2(fd_out, 3) < 0 || dup2(fd_in, 4) < 0) { |
134 auth_request_log_error(request, "checkpassword", | |
135 "dup2() failed: %m"); | |
136 } else { | |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
137 checkpassword_setup_env(request); |
5259 | 138 /* very simple argument splitting. */ |
139 cmd = t_strconcat(module->checkpassword_path, " ", | |
140 module->checkpassword_reply_path, NULL); | |
3730 | 141 auth_request_log_debug(request, "checkpassword", |
5259 | 142 "execute: %s", cmd); |
3730 | 143 |
5259 | 144 args = t_strsplit(cmd, " "); |
3939
8ccd711c93db
Allow parameters to be passed to checkpassword.
Timo Sirainen <tss@iki.fi>
parents:
3938
diff
changeset
|
145 execv(args[0], (char **)args); |
3730 | 146 auth_request_log_error(request, "checkpassword", |
3939
8ccd711c93db
Allow parameters to be passed to checkpassword.
Timo Sirainen <tss@iki.fi>
parents:
3938
diff
changeset
|
147 "execv(%s) failed: %m", args[0]); |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
148 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
149 exit(2); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
150 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
151 |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
152 static void |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
153 checkpassword_verify_plain(struct auth_request *request, const char *password, |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
154 verify_plain_callback_t *callback) |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
155 { |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
156 struct passdb_module *_module = request->passdb->passdb; |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
157 struct checkpassword_passdb_module *module = |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
158 (struct checkpassword_passdb_module *)_module; |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
159 struct chkpw_auth_request *chkpw_auth_request; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
160 int fd_in[2], fd_out[2]; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
161 pid_t pid; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
162 |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
163 fd_in[0] = -1; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
164 if (pipe(fd_in) < 0 || pipe(fd_out) < 0) { |
3069 | 165 auth_request_log_error(request, "checkpassword", |
166 "pipe() failed: %m"); | |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
167 callback(PASSDB_RESULT_INTERNAL_FAILURE, request); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
168 if (fd_in[0] != -1) { |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
169 (void)close(fd_in[0]); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
170 (void)close(fd_in[1]); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
171 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
172 return; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
173 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
174 |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
175 pid = fork(); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
176 if (pid == -1) { |
3069 | 177 auth_request_log_error(request, "checkpassword", |
178 "fork() failed: %m"); | |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
179 callback(PASSDB_RESULT_INTERNAL_FAILURE, request); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
180 (void)close(fd_in[0]); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
181 (void)close(fd_in[1]); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
182 (void)close(fd_out[0]); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
183 (void)close(fd_out[1]); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
184 return; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
185 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
186 |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
187 if (pid == 0) { |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
188 (void)close(fd_in[0]); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
189 (void)close(fd_out[1]); |
3730 | 190 checkpassword_verify_plain_child(request, module, |
191 fd_in[1], fd_out[0]); | |
192 /* not reached */ | |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
193 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
194 |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
195 if (close(fd_in[1]) < 0) { |
3069 | 196 auth_request_log_error(request, "checkpassword", |
197 "close(fd_in[1]) failed: %m"); | |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
198 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
199 if (close(fd_out[0]) < 0) { |
3069 | 200 auth_request_log_error(request, "checkpassword", |
201 "close(fd_out[0]) failed: %m"); | |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
202 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
203 |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
204 auth_request_ref(request); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
205 chkpw_auth_request = i_new(struct chkpw_auth_request, 1); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
206 chkpw_auth_request->fd_in = fd_in[0]; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
207 chkpw_auth_request->fd_out = fd_out[1]; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
208 chkpw_auth_request->pid = pid; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
209 chkpw_auth_request->password = i_strdup(password); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
210 chkpw_auth_request->request = request; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
211 chkpw_auth_request->callback = callback; |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
212 chkpw_auth_request->half_finish_callback = |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
213 checkpassword_request_half_finish; |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
214 chkpw_auth_request->finish_callback = |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
215 checkpassword_request_finish; |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
216 chkpw_auth_request->internal_failure_code = |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
217 PASSDB_RESULT_INTERNAL_FAILURE; |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
218 |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
219 chkpw_auth_request->io_in = |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
220 io_add(fd_in[0], IO_READ, checkpassword_child_input, |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
221 chkpw_auth_request); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
222 chkpw_auth_request->io_out = |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
223 io_add(fd_out[1], IO_WRITE, checkpassword_child_output, |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
224 chkpw_auth_request); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
225 |
8573
f9166a09423a
Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h
Timo Sirainen <tss@iki.fi>
parents:
8307
diff
changeset
|
226 hash_table_insert(module->clients, POINTER_CAST(pid), |
f9166a09423a
Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h
Timo Sirainen <tss@iki.fi>
parents:
8307
diff
changeset
|
227 chkpw_auth_request); |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
228 |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
229 if (checkpassword_passdb_children != NULL) |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
230 child_wait_add_pid(checkpassword_passdb_children, pid); |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
231 else { |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
232 checkpassword_passdb_children = |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
233 child_wait_new_with_pid(pid, sigchld_handler, module); |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
234 } |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
235 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
236 |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
237 static struct passdb_module * |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
238 checkpassword_preinit(struct auth_passdb *auth_passdb, const char *args) |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
239 { |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
240 struct checkpassword_passdb_module *module; |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
241 |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
242 module = p_new(auth_passdb->auth->pool, |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
243 struct checkpassword_passdb_module, 1); |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
244 module->checkpassword_path = p_strdup(auth_passdb->auth->pool, args); |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
245 module->checkpassword_reply_path = |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
246 PKG_LIBEXECDIR"/checkpassword-reply"; |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
247 |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
248 module->clients = |
8573
f9166a09423a
Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h
Timo Sirainen <tss@iki.fi>
parents:
8307
diff
changeset
|
249 hash_table_create(default_pool, default_pool, 0, NULL, NULL); |
4564
6012b0978d2c
Use SIGCHLD handler to check for killed child processes instead of a timeout
Timo Sirainen <tss@iki.fi>
parents:
4531
diff
changeset
|
250 |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
251 return &module->module; |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
252 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
253 |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
254 static void checkpassword_deinit(struct passdb_module *_module) |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
255 { |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
256 struct checkpassword_passdb_module *module = |
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
257 (struct checkpassword_passdb_module *)_module; |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
258 struct hash_iterate_context *iter; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
259 void *key, *value; |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
260 |
8573
f9166a09423a
Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h
Timo Sirainen <tss@iki.fi>
parents:
8307
diff
changeset
|
261 iter = hash_table_iterate_init(module->clients); |
f9166a09423a
Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h
Timo Sirainen <tss@iki.fi>
parents:
8307
diff
changeset
|
262 while (hash_table_iterate(iter, &key, &value)) { |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
263 checkpassword_request_finish(value, |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
264 PASSDB_RESULT_INTERNAL_FAILURE); |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
265 } |
8573
f9166a09423a
Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h
Timo Sirainen <tss@iki.fi>
parents:
8307
diff
changeset
|
266 hash_table_iterate_deinit(&iter); |
f9166a09423a
Renamed hash_*() to hash_table_*() to avoid conflicts with OSX's strhash.h
Timo Sirainen <tss@iki.fi>
parents:
8307
diff
changeset
|
267 hash_table_destroy(&module->clients); |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
268 |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
269 if (checkpassword_passdb_children != NULL) |
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
270 child_wait_free(&checkpassword_passdb_children); |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
271 } |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
272 |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
273 struct passdb_module_interface passdb_checkpassword = { |
2942
c7d426f8cb58
Added name variable for userdb_module and passdb_module and changed their
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
274 "checkpassword", |
c7d426f8cb58
Added name variable for userdb_module and passdb_module and changed their
Timo Sirainen <tss@iki.fi>
parents:
2708
diff
changeset
|
275 |
3657
0c10475d9968
Separated passdb_module's interface and the actual data struct. Now it's
Timo Sirainen <tss@iki.fi>
parents:
3520
diff
changeset
|
276 checkpassword_preinit, |
8307
33eae1ca0be0
Added support for userdb checkpassword. Patch by Sascha Wilde.
Timo Sirainen <tss@iki.fi>
parents:
8217
diff
changeset
|
277 NULL, |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
278 checkpassword_deinit, |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
279 |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
280 checkpassword_verify_plain, |
4782
2c1cc5bbc260
Added auth_request_set_credentials() to modify credentials in passdb and
Timo Sirainen <tss@iki.fi>
parents:
4732
diff
changeset
|
281 NULL, |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
282 NULL |
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
283 }; |
8217
c47b78e843aa
Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.
Timo Sirainen <tss@iki.fi>
parents:
8057
diff
changeset
|
284 #else |
c47b78e843aa
Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.
Timo Sirainen <tss@iki.fi>
parents:
8057
diff
changeset
|
285 struct passdb_module_interface passdb_checkpassword = { |
c47b78e843aa
Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.
Timo Sirainen <tss@iki.fi>
parents:
8057
diff
changeset
|
286 MEMBER(name) "checkpassword" |
c47b78e843aa
Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.
Timo Sirainen <tss@iki.fi>
parents:
8057
diff
changeset
|
287 }; |
2162
95b2a6abc01e
Added checkpassword passdb. userdb has only beginnings.
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
288 #endif |