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 * |
d447dbd1 | 19 | passwd_open(const uschar * filename, uschar ** errmsg) |
0756eb3c PH |
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 |
d447dbd1 | 36 | passwd_find(void * handle, const uschar * filename, const uschar * keystring, |
67a57a5a JH |
37 | int length, uschar ** result, uschar ** errmsg, uint * do_cache, |
38 | const uschar * opts) | |
0756eb3c PH |
39 | { |
40 | struct passwd *pw; | |
41 | ||
42 | handle = handle; /* Keep picky compilers happy */ | |
43 | filename = filename; | |
44 | length = length; | |
45 | errmsg = errmsg; | |
46 | do_cache = do_cache; | |
47 | ||
48 | if (!route_finduser(keystring, &pw, NULL)) return FAIL; | |
49 | *result = string_sprintf("*:%d:%d:%s:%s:%s", (int)pw->pw_uid, (int)pw->pw_gid, | |
50 | pw->pw_gecos, pw->pw_dir, pw->pw_shell); | |
51 | return OK; | |
52 | } | |
53 | ||
6545de78 PP |
54 | |
55 | ||
56 | /************************************************* | |
57 | * Version reporting entry point * | |
58 | *************************************************/ | |
59 | ||
60 | /* See local README for interface description. */ | |
61 | ||
62 | #include "../version.h" | |
63 | ||
64 | void | |
65 | passwd_version_report(FILE *f) | |
66 | { | |
67 | #ifdef DYNLOOKUP | |
68 | fprintf(f, "Library version: passwd: Exim version %s\n", EXIM_VERSION_STR); | |
69 | #endif | |
70 | } | |
71 | ||
e6d225ae | 72 | static lookup_info _lookup_info = { |
9f400174 JH |
73 | .name = US"passwd", /* lookup name */ |
74 | .type = lookup_querystyle, /* query-style lookup */ | |
75 | .open = passwd_open, /* open function */ | |
76 | .check = NULL, /* no check function */ | |
77 | .find = passwd_find, /* find function */ | |
78 | .close = NULL, /* no close function */ | |
79 | .tidy = NULL, /* no tidy function */ | |
80 | .quote = NULL, /* no quoting function */ | |
81 | .version_report = passwd_version_report /* version reporting */ | |
e6d225ae DW |
82 | }; |
83 | ||
84 | #ifdef DYNLOOKUP | |
85 | #define passwd_lookup_module_info _lookup_module_info | |
86 | #endif | |
87 | ||
88 | static lookup_info *_lookup_list[] = { &_lookup_info }; | |
89 | lookup_module_info passwd_lookup_module_info = { LOOKUP_MODULE_INFO_MAGIC, _lookup_list, 1 }; | |
90 | ||
0756eb3c | 91 | /* End of lookups/passwd.c */ |