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