Commit | Line | Data |
---|---|---|
0756eb3c PH |
1 | /************************************************* |
2 | * Exim - an Internet mail transport agent * | |
3 | *************************************************/ | |
4 | ||
3386088d | 5 | /* Copyright (c) University of Cambridge 1995 - 2015 */ |
0756eb3c PH |
6 | /* See the file NOTICE for conditions of use and distribution. */ |
7 | ||
8 | #include "../exim.h" | |
0756eb3c PH |
9 | |
10 | ||
11 | ||
12 | /************************************************* | |
13 | * Open entry point * | |
14 | *************************************************/ | |
15 | ||
16 | /* See local README for interface description */ | |
17 | ||
e6d225ae | 18 | static void * |
0756eb3c PH |
19 | passwd_open(uschar *filename, uschar **errmsg) |
20 | { | |
21 | filename = filename; /* Keep picky compilers happy */ | |
22 | errmsg = errmsg; | |
23 | return (void *)(-1); /* Just return something non-null */ | |
24 | } | |
25 | ||
26 | ||
27 | ||
28 | ||
29 | /************************************************* | |
30 | * Find entry point for passwd * | |
31 | *************************************************/ | |
32 | ||
33 | /* See local README for interface description */ | |
34 | ||
e6d225ae | 35 | static int |
55414b25 | 36 | passwd_find(void *handle, uschar *filename, const uschar *keystring, int length, |
14b3c5bc | 37 | uschar **result, uschar **errmsg, uint *do_cache) |
0756eb3c PH |
38 | { |
39 | struct passwd *pw; | |
40 | ||
41 | handle = handle; /* Keep picky compilers happy */ | |
42 | filename = filename; | |
43 | length = length; | |
44 | errmsg = errmsg; | |
45 | do_cache = do_cache; | |
46 | ||
47 | if (!route_finduser(keystring, &pw, NULL)) return FAIL; | |
48 | *result = string_sprintf("*:%d:%d:%s:%s:%s", (int)pw->pw_uid, (int)pw->pw_gid, | |
49 | pw->pw_gecos, pw->pw_dir, pw->pw_shell); | |
50 | return OK; | |
51 | } | |
52 | ||
6545de78 PP |
53 | |
54 | ||
55 | /************************************************* | |
56 | * Version reporting entry point * | |
57 | *************************************************/ | |
58 | ||
59 | /* See local README for interface description. */ | |
60 | ||
61 | #include "../version.h" | |
62 | ||
63 | void | |
64 | passwd_version_report(FILE *f) | |
65 | { | |
66 | #ifdef DYNLOOKUP | |
67 | fprintf(f, "Library version: passwd: Exim version %s\n", EXIM_VERSION_STR); | |
68 | #endif | |
69 | } | |
70 | ||
e6d225ae DW |
71 | static lookup_info _lookup_info = { |
72 | US"passwd", /* lookup name */ | |
73 | lookup_querystyle, /* query-style lookup */ | |
74 | passwd_open, /* open function */ | |
75 | NULL, /* no check function */ | |
76 | passwd_find, /* find function */ | |
77 | NULL, /* no close function */ | |
78 | NULL, /* no tidy function */ | |
6545de78 PP |
79 | NULL, /* no quoting function */ |
80 | passwd_version_report /* version reporting */ | |
e6d225ae DW |
81 | }; |
82 | ||
83 | #ifdef DYNLOOKUP | |
84 | #define passwd_lookup_module_info _lookup_module_info | |
85 | #endif | |
86 | ||
87 | static lookup_info *_lookup_list[] = { &_lookup_info }; | |
88 | lookup_module_info passwd_lookup_module_info = { LOOKUP_MODULE_INFO_MAGIC, _lookup_list, 1 }; | |
89 | ||
0756eb3c | 90 | /* End of lookups/passwd.c */ |