1MAILDROPGDBM(7)             Double Precision, Inc.             MAILDROPGDBM(7)
2
3
4

NAME

6       maildropgdbm - GDBM/DB support in maildrop
7

SYNOPSIS

9       gdbmopen(filename, mode)
10
11       gdbmclose
12
13       gdbmfetch(key [,default])
14
15       gdbmstore(key,value)
16

DESCRIPTION

18       The gdbm family of functions provides access to the GDBM library - a
19       library of routines that manage simple database files. The library
20       provides a way of quickly storing and looking up key/data pairs.
21
22       GDBM support in maildrop is optional, and may not be available to you.
23
24       GDBM support in maildrop can optionally be implemented using the DB
25       library. This option is selected by the system administrator. If this
26       is the case, these functions still work exactly as described below,
27       except that they will operate on DB hash files, instead of GDBM files.
28
29       To see whether GDBM or DB support is used, run the command "maildrop
30       -v".
31
32       GDBM support is minimal, and simplistic. A filter file may have only
33       one gdbm file open at the same time. However, the filter file can close
34       the current gdbm file, and open another one. If another filter file is
35       included using the include statement, the included filter file may open
36       its own, separate, gdbm file.
37
38       A GDBM file contains a list of key/value pairs. All keys in the GDBM
39       file are unique. After storing an arbitrary key/value pair in the GDBM
40       file, the value associated with the given key can be quickly located
41       and retrieved.
42
43   gdbmclose - close gdbm file
44           gdbmclose
45
46       This function closes the current GDBM file.
47
48   gdbmfetch - retrieve data
49           gdbmfetch (key [, options] [, default])
50
51       This function retrieves the data for the given key.  key is the key to
52       retrieve. The gdbmfetch function returns the data associated with this
53       key. If the key does not exist in the GDBM file, gdbmfetch returns the
54       default argument. If the default argument is not specified, gdbmfetch
55       returns empty text. Please note that the default argument is not
56       actually evaluated unless the key does not exist in the GDBM file.
57
58       The options argument specifies additional maildrop value-added
59       features. The following functionality is not available in the GDBM
60       library, but is rather provided by maildrop.
61
62       If the options argument is set to "D", and the key could not be found
63       in the GDBM database, and the key is of the form "user@domain",
64       maildrop will then attempt to look up the key "user@". If that key is
65       also not found, maildrop finally looks up the key "domain".
66
67       If "domain" is also not found, and domain is of the form "a.b.c.d.tld"
68       (with variable number of period-separated sections), maildrop then
69       attempts to look up the key "b.c.d.tld". If that key is not found,
70       maildrop tries "c.d.tld", and so on, until a key is found, or there are
71       no more subdomains to remove, at which point gdbmfetch will return
72       either the default argument, or empty text.
73
74       If the options argument is set to "D", and the key could not be found
75       in the GDBM database, and the key is of the form "a.b.c.d.tld" (with
76       variable number of period-separated sections), maildrop will also
77       attempt to look up keys for successive higher-level domains in the GDBM
78       database.
79
80           Note
81           GDBM databases are case sensitive. Make sure that the GDBM database
82           is created using lowercase letters only, and use the tolower[1]
83           function to convert the key to lowercase.
84
85       If the options argument is "I", and the key is not in the GDBM
86       database, and the key is of the form "w.x.y.z" (with variable number of
87       period-separated sections), maildrop then tries to look up the key
88       "w.x.y", then "w.x", until a key is found, or there are no more
89       sections to remove. Use this feature to look up IP-address based GDBM
90       lists.
91
92           Note
93           These features are implemented by brute force: if the query doesn't
94           succeed, try again. Take note of potential denial-of-service
95           attacks where key is set to a long text string consisting mostly of
96           periods, which will result in numerous GDBM queries that will take
97           an excessive amount of time to complete.
98
99   gdbmopen - open gdbm file
100           gdbmopen (file [, mode])
101
102       gdbmopen opens the indicated GDBM file. The optional second argument
103       specifies the following:
104
105       "R"
106           Open this GDBM file for reading.
107
108       "W"
109           Open this GDBM file for reading and writing.
110
111       "C"
112           Open this GDBM file for reading and writing. If the GBDM file
113           doesn't exist, create it.
114
115       "N"
116           Create a new GDBM file. If the file exists, the existing file is
117           deleted. The file is opened for reading and writing.
118
119       The mode argument defaults to "R" is used. In embedded mode, only "R"
120       is allowed.
121
122       The GDBM library allows multiple processes to read the same GDBM file
123       at the same time, but it does not allow multiple access when the GDBM
124       file is open for writing. Using flock[2] or dotlock[3] is highly
125       recommended.
126
127       In delivery mode, maildrop runs from the recipient's home directory.
128       Keep that in mind while specifying the filename.
129
130       The gdbmopen function returns 0 if the GDBM file was successfully
131       opened, non-zero otherwise.
132
133   gdbmstore - store data
134           gdbmstore(key, value)
135
136       key is the key value to store in the GDBM file.  value is the value to
137       store. If key already exists in the GDBM file, value replacest the old
138       value. The gdbmstore function is only permitted if the GDBM file is
139       opened for writing. If gdbmopen opened the GDBM file for reading only,
140       gdbmstore will return -1. Otherwise, gdbmstore returns 0.
141

AUTHOR

143       Sam Varshavchik
144           Author
145

NOTES

147        1. tolower
148           http://www.courier-mta.org/maildrop/maildropfilter.html#tolower
149
150        2. flock
151           http://www.courier-mta.org/maildrop/maildropfilter.html#flock
152
153        3. dotlock
154           http://www.courier-mta.org/maildrop/maildropfilter.html#dotlock
155
156
157
158Courier Mail Server               06/20/2015                   MAILDROPGDBM(7)
Impressum