annotate src/auth/userdb-passwd-file.c @ 9415:2a48aa6e2bce HEAD

Added signature for changeset 609fe4268f40
author Timo Sirainen <tss@iki.fi>
date Mon, 05 Oct 2009 19:52:13 -0400
parents b9faf4db2a9f
children 4b0ec8160ff4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8590
b9faf4db2a9f Updated copyright notices to include year 2009.
Timo Sirainen <tss@iki.fi>
parents: 8217
diff changeset
1 /* Copyright (c) 2002-2009 Dovecot authors, see the included COPYING file */
1035
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"
8217
c47b78e843aa Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.
Timo Sirainen <tss@iki.fi>
parents: 7086
diff changeset
4 #include "userdb.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
5
fe49ece0f3ea We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
6 #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
7
3158
8849f2e380d1 userdb can now return extra parameters to master. Removed special handling
Timo Sirainen <tss@iki.fi>
parents: 3127
diff changeset
8 #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
9 #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
10 #include "var-expand.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) {
5306
1c6c3d9494fb Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents: 5304
diff changeset
54 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
55 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
56
4035
335ac59efffd If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents: 4034
diff changeset
57 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
58 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
59 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
60
4035
335ac59efffd If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents: 4034
diff changeset
61 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
62 value = strchr(key, '=');
5306
1c6c3d9494fb Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents: 5304
diff changeset
63 if (value != NULL) {
1c6c3d9494fb Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents: 5304
diff changeset
64 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
65 str_truncate(str, 0);
1c6c3d9494fb Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents: 5304
diff changeset
66 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
67 value = str_c(str);
1c6c3d9494fb Reverted the last change, it was originally correct after all.
Timo Sirainen <tss@iki.fi>
parents: 5304
diff changeset
68 }
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
69 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
70 }
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 }
1035
fe49ece0f3ea We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
72
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
73 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
74 }
fe49ece0f3ea We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
75
3658
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
76 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
77 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
78 {
3658
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
79 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
80 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
81 const char *p;
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
82
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
83 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
84 args += 16;
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
85 p = strchr(args, ' ');
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
86 if (p == NULL) {
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
87 format = args;
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
88 args = "";
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
89 } else {
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
90 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
91 args, p);
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
92 args = p + 1;
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
93 }
9e74c008484a Added username_format parameter for passwd-file passdb and userdb.
Timo Sirainen <tss@iki.fi>
parents: 5875
diff changeset
94 }
3658
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
95
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
96 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
97 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
98 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
99 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
100 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
101
f0cc5486696e Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4880
diff changeset
102 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
103 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
104 else {
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 =
f0cc5486696e Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4880
diff changeset
106 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
107 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
108 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
109 NULL));
f0cc5486696e Authentication cache caches now also userdb data. Code by Tommi Saviranta.
Timo Sirainen <timo.sirainen@movial.fi>
parents: 4880
diff changeset
110 }
3658
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
111 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
112 }
fe49ece0f3ea We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
113
4035
335ac59efffd If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents: 4034
diff changeset
114 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
115 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
116 {
3658
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
117 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
118 (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
119
4035
335ac59efffd If passwd-file is being used as userdb, complain immediately if some entries
Timo Sirainen <tss@iki.fi>
parents: 4034
diff changeset
120 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
121 }
fe49ece0f3ea We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
122
3658
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
123 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
124 {
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
125 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
126 (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
127
3879
928229f8b3e6 deinit, unref, destroy, close, free, etc. functions now take a pointer to
Timo Sirainen <tss@iki.fi>
parents: 3658
diff changeset
128 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
129 }
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
130
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
131 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
132 "passwd-file",
c7d426f8cb58 Added name variable for userdb_module and passdb_module and changed their
Timo Sirainen <tss@iki.fi>
parents: 2648
diff changeset
133
3658
fc4622b1c1ef Separated userdb_module's interface and the actual data struct.
Timo Sirainen <tss@iki.fi>
parents: 3657
diff changeset
134 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
135 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
136 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
137
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_lookup
fe49ece0f3ea We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
139 };
8217
c47b78e843aa Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.
Timo Sirainen <tss@iki.fi>
parents: 7086
diff changeset
140 #else
c47b78e843aa Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.
Timo Sirainen <tss@iki.fi>
parents: 7086
diff changeset
141 struct userdb_module_interface userdb_passwd_file = {
c47b78e843aa Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.
Timo Sirainen <tss@iki.fi>
parents: 7086
diff changeset
142 MEMBER(name) "passwd-file"
c47b78e843aa Separate "unknown passdb/userdb X" and "support for X not compiled in" error messages.
Timo Sirainen <tss@iki.fi>
parents: 7086
diff changeset
143 };
1035
fe49ece0f3ea We have now separate "userdb" and "passdb". They aren't tied to each others
Timo Sirainen <tss@iki.fi>
parents:
diff changeset
144 #endif