Mercurial > dovecot > original-hg > dovecot-1.2
annotate src/auth/userdb-passwd-file.c @ 6411:6a64e64fa3a3 HEAD
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 16 Sep 2007 11:40:56 +0300 |
parents | 9e74c008484a |
children | 65c69a53a7be |
rev | line source |
---|---|
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
1 /* Copyright (C) 2002-2003 Timo Sirainen */ |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
2 |
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
|
3 #include "common.h" |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
4 |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
5 #ifdef USERDB_PASSWD_FILE |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
6 |
3158
8849f2e380d1
userdb can now return extra parameters to master. Removed special handling
Timo Sirainen <tss@iki.fi>
parents:
3127
diff
changeset
|
7 #include "str.h" |
4955
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
8 #include "auth-cache.h" |
4034
b533c52196e3
Updated passwd-file format to allow specifying any key=value fields. Since the value fields may contain ':' characters, this changes the file format a bit. Previously the last two fields were "flags" and "mail". Flags has been empty for last 3 years however, so the new format is used if the flags field contains something. In that case there is no separate mail field, it can instead be specified by adding userdb_mail=<mail> parameter.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3891
diff
changeset
|
9 #include "var-expand.h" |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
10 #include "userdb.h" |
1062
0522a0315d2f
Cleanups, LDAP support compiles again and generally looks ok, even if it
Timo Sirainen <tss@iki.fi>
parents:
1046
diff
changeset
|
11 #include "db-passwd-file.h" |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
12 |
4955
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
13 #define PASSWD_FILE_CACHE_KEY "%u" |
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
14 |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
15 struct passwd_file_userdb_module { |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
16 struct userdb_module module; |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
17 |
3891
2d0859490a2f
If debug is enabled, tell how many users are found from passwd-file whenever
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
18 struct auth *auth; |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
19 struct db_passwd_file *pwf; |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
20 }; |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
21 |
2057
5e0167577399
Fixed var_expand() to take a table of variables rather than a few predefined
Timo Sirainen <tss@iki.fi>
parents:
1443
diff
changeset
|
22 static void passwd_file_lookup(struct auth_request *auth_request, |
3166
e6a487d80288
Restructuring of auth code. Balancer auth processes were a bad idea. Usually
Timo Sirainen <tss@iki.fi>
parents:
3158
diff
changeset
|
23 userdb_callback_t *callback) |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
24 { |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
25 struct userdb_module *_module = auth_request->userdb->userdb; |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
26 struct passwd_file_userdb_module *module = |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
27 (struct passwd_file_userdb_module *)_module; |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
28 struct passwd_user *pu; |
5306
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
29 const struct var_expand_table *table; |
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
30 string_t *str; |
4034
b533c52196e3
Updated passwd-file format to allow specifying any key=value fields. Since the value fields may contain ':' characters, this changes the file format a bit. Previously the last two fields were "flags" and "mail". Flags has been empty for last 3 years however, so the new format is used if the flags field contains something. In that case there is no separate mail field, it can instead be specified by adding userdb_mail=<mail> parameter.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3891
diff
changeset
|
31 const char *key, *value; |
b533c52196e3
Updated passwd-file format to allow specifying any key=value fields. Since the value fields may contain ':' characters, this changes the file format a bit. Previously the last two fields were "flags" and "mail". Flags has been empty for last 3 years however, so the new format is used if the flags field contains something. In that case there is no separate mail field, it can instead be specified by adding userdb_mail=<mail> parameter.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3891
diff
changeset
|
32 char **p; |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
33 |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
34 pu = db_passwd_file_lookup(module->pwf, auth_request); |
1046
561da07883b6
Async userdb and passdb interface.
Timo Sirainen <tss@iki.fi>
parents:
1035
diff
changeset
|
35 if (pu == NULL) { |
5872
93bd157917ca
Changed userdb callback API. Don't require uid/gid to be returned by userdb.
Timo Sirainen <tss@iki.fi>
parents:
5306
diff
changeset
|
36 callback(USERDB_RESULT_USER_UNKNOWN, auth_request); |
1046
561da07883b6
Async userdb and passdb interface.
Timo Sirainen <tss@iki.fi>
parents:
1035
diff
changeset
|
37 return; |
561da07883b6
Async userdb and passdb interface.
Timo Sirainen <tss@iki.fi>
parents:
1035
diff
changeset
|
38 } |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
39 |
5872
93bd157917ca
Changed userdb callback API. Don't require uid/gid to be returned by userdb.
Timo Sirainen <tss@iki.fi>
parents:
5306
diff
changeset
|
40 auth_request_init_userdb_reply(auth_request); |
5875
cda9824bab63
Allow passwd-file ti contain empty uid/gid fields.
Timo Sirainen <tss@iki.fi>
parents:
5872
diff
changeset
|
41 if (pu->uid != (uid_t)-1) { |
cda9824bab63
Allow passwd-file ti contain empty uid/gid fields.
Timo Sirainen <tss@iki.fi>
parents:
5872
diff
changeset
|
42 auth_request_set_userdb_field(auth_request, "uid", |
cda9824bab63
Allow passwd-file ti contain empty uid/gid fields.
Timo Sirainen <tss@iki.fi>
parents:
5872
diff
changeset
|
43 dec2str(pu->uid)); |
cda9824bab63
Allow passwd-file ti contain empty uid/gid fields.
Timo Sirainen <tss@iki.fi>
parents:
5872
diff
changeset
|
44 } |
cda9824bab63
Allow passwd-file ti contain empty uid/gid fields.
Timo Sirainen <tss@iki.fi>
parents:
5872
diff
changeset
|
45 if (pu->gid != (gid_t)-1) { |
cda9824bab63
Allow passwd-file ti contain empty uid/gid fields.
Timo Sirainen <tss@iki.fi>
parents:
5872
diff
changeset
|
46 auth_request_set_userdb_field(auth_request, "gid", |
cda9824bab63
Allow passwd-file ti contain empty uid/gid fields.
Timo Sirainen <tss@iki.fi>
parents:
5872
diff
changeset
|
47 dec2str(pu->gid)); |
cda9824bab63
Allow passwd-file ti contain empty uid/gid fields.
Timo Sirainen <tss@iki.fi>
parents:
5872
diff
changeset
|
48 } |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
49 |
3158
8849f2e380d1
userdb can now return extra parameters to master. Removed special handling
Timo Sirainen <tss@iki.fi>
parents:
3127
diff
changeset
|
50 if (pu->home != NULL) |
5872
93bd157917ca
Changed userdb callback API. Don't require uid/gid to be returned by userdb.
Timo Sirainen <tss@iki.fi>
parents:
5306
diff
changeset
|
51 auth_request_set_userdb_field(auth_request, "home", pu->home); |
4034
b533c52196e3
Updated passwd-file format to allow specifying any key=value fields. Since the value fields may contain ':' characters, this changes the file format a bit. Previously the last two fields were "flags" and "mail". Flags has been empty for last 3 years however, so the new format is used if the flags field contains something. In that case there is no separate mail field, it can instead be specified by adding userdb_mail=<mail> parameter.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3891
diff
changeset
|
52 |
4035
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
53 if (pu->extra_fields != NULL) { |
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
54 t_push(); |
5306
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
55 str = t_str_new(512); |
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
56 table = auth_request_get_var_expand_table(auth_request, NULL); |
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
57 |
4035
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
58 for (p = pu->extra_fields; *p != NULL; p++) { |
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
59 if (strncmp(*p, "userdb_", 7) != 0) |
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
60 continue; |
4034
b533c52196e3
Updated passwd-file format to allow specifying any key=value fields. Since the value fields may contain ':' characters, this changes the file format a bit. Previously the last two fields were "flags" and "mail". Flags has been empty for last 3 years however, so the new format is used if the flags field contains something. In that case there is no separate mail field, it can instead be specified by adding userdb_mail=<mail> parameter.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3891
diff
changeset
|
61 |
4035
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
62 key = *p + 7; |
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
63 value = strchr(key, '='); |
5306
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
64 if (value != NULL) { |
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
65 key = t_strdup_until(key, value); |
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
66 str_truncate(str, 0); |
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
67 var_expand(str, value + 1, table); |
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
68 value = str_c(str); |
1c6c3d9494fb
Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents:
5304
diff
changeset
|
69 } |
5872
93bd157917ca
Changed userdb callback API. Don't require uid/gid to be returned by userdb.
Timo Sirainen <tss@iki.fi>
parents:
5306
diff
changeset
|
70 auth_request_set_userdb_field(auth_request, key, value); |
4034
b533c52196e3
Updated passwd-file format to allow specifying any key=value fields. Since the value fields may contain ':' characters, this changes the file format a bit. Previously the last two fields were "flags" and "mail". Flags has been empty for last 3 years however, so the new format is used if the flags field contains something. In that case there is no separate mail field, it can instead be specified by adding userdb_mail=<mail> parameter.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3891
diff
changeset
|
71 } |
4035
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
72 t_pop(); |
4034
b533c52196e3
Updated passwd-file format to allow specifying any key=value fields. Since the value fields may contain ':' characters, this changes the file format a bit. Previously the last two fields were "flags" and "mail". Flags has been empty for last 3 years however, so the new format is used if the flags field contains something. In that case there is no separate mail field, it can instead be specified by adding userdb_mail=<mail> parameter.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
3891
diff
changeset
|
73 } |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
74 |
5872
93bd157917ca
Changed userdb callback API. Don't require uid/gid to be returned by userdb.
Timo Sirainen <tss@iki.fi>
parents:
5306
diff
changeset
|
75 callback(USERDB_RESULT_OK, auth_request); |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
76 } |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
77 |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
78 static struct userdb_module * |
4035
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
79 passwd_file_preinit(struct auth_userdb *auth_userdb, const char *args) |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
80 { |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
81 struct passwd_file_userdb_module *module; |
6394
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
82 const char *format = PASSWD_FILE_DEFAULT_USERNAME_FORMAT; |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
83 const char *p; |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
84 |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
85 if (strncmp(args, "username_format=", 16) == 0) { |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
86 args += 16; |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
87 p = strchr(args, ' '); |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
88 if (p == NULL) { |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
89 format = args; |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
90 args = ""; |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
91 } else { |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
92 format = p_strdup_until(auth_userdb->auth->pool, |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
93 args, p); |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
94 args = p + 1; |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
95 } |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
96 } |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
97 |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
98 module = p_new(auth_userdb->auth->pool, |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
99 struct passwd_file_userdb_module, 1); |
3891
2d0859490a2f
If debug is enabled, tell how many users are found from passwd-file whenever
Timo Sirainen <tss@iki.fi>
parents:
3879
diff
changeset
|
100 module->auth = auth_userdb->auth; |
6394
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
101 module->pwf = db_passwd_file_init(args, format, TRUE, |
9e74c008484a
Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents:
5875
diff
changeset
|
102 module->auth->verbose_debug); |
4955
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
103 |
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
104 if (!module->pwf->vars) |
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
105 module->module.cache_key = PASSWD_FILE_CACHE_KEY; |
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
106 else { |
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
107 module->module.cache_key = |
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
108 auth_cache_parse_key(auth_userdb->auth->pool, |
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
109 t_strconcat(PASSWD_FILE_CACHE_KEY, |
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
110 module->pwf->path, |
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
111 NULL)); |
f0cc5486696e
Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents:
4880
diff
changeset
|
112 } |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
113 return &module->module; |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
114 } |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
115 |
4035
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
116 static void passwd_file_init(struct userdb_module *_module, |
6411
6a64e64fa3a3
Renamed __attr_*__ to ATTR_*. Renamed __attrs_used__ to ATTRS_DEFINED.
Timo Sirainen <tss@iki.fi>
parents:
6394
diff
changeset
|
117 const char *args ATTR_UNUSED) |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
118 { |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
119 struct passwd_file_userdb_module *module = |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
120 (struct passwd_file_userdb_module *)_module; |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
121 |
4035
335ac59efffd
If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents:
4034
diff
changeset
|
122 db_passwd_file_parse(module->pwf); |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
123 } |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
124 |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
125 static void passwd_file_deinit(struct userdb_module *_module) |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
126 { |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
127 struct passwd_file_userdb_module *module = |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
128 (struct passwd_file_userdb_module *)_module; |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
129 |
3879
928229f8b3e6
deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents:
3658
diff
changeset
|
130 db_passwd_file_unref(&module->pwf); |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
131 } |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
132 |
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
133 struct userdb_module_interface userdb_passwd_file = { |
2942
c7d426f8cb58
Added name variable for userdb_module and passdb_module and changed their
Timo Sirainen <tss@iki.fi>
parents:
2648
diff
changeset
|
134 "passwd-file", |
c7d426f8cb58
Added name variable for userdb_module and passdb_module and changed their
Timo Sirainen <tss@iki.fi>
parents:
2648
diff
changeset
|
135 |
3658
fc4622b1c1ef
Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents:
3657
diff
changeset
|
136 passwd_file_preinit, |
1035
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
137 passwd_file_init, |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
138 passwd_file_deinit, |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
139 |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
140 passwd_file_lookup |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
141 }; |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
142 |
fe49ece0f3ea
We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff
changeset
|
143 #endif |