Debian Codegraph @

upstream/debian-unstable/man7/maildropgdbm.7

raw
1 '\" t
2 .\"<!-- Copyright 1998 - 2007 Double Precision, Inc. See COPYING for -->
3 .\"<!-- distribution information. -->
4 .\" Title: maildropgdbm
5 .\" Author: Sam Varshavchik
6 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
7 .\" Date: 11/04/2020
8 .\" Manual: Double Precision, Inc.
9 .\" Source: Courier Mail Server
10 .\" Language: English
11 .\"
12 .TH "MAILDROPGDBM" "7" "11/04/2020" "Courier Mail Server" "Double Precision, Inc\&."
13 .\" -----------------------------------------------------------------
14 .\" * Define some portability stuff
15 .\" -----------------------------------------------------------------
16 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
17 .\" http://bugs.debian.org/507673
18 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
19 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .ie \n(.g .ds Aq \(aq
21 .el .ds Aq '
22 .\" -----------------------------------------------------------------
23 .\" * set default formatting
24 .\" -----------------------------------------------------------------
25 .\" disable hyphenation
26 .nh
27 .\" disable justification (adjust text to left margin only)
28 .ad l
29 .\" -----------------------------------------------------------------
30 .\" * MAIN CONTENT STARTS HERE *
31 .\" -----------------------------------------------------------------
32 .SH "NAME"
33 maildropgdbm \- GDBM/DB support in maildrop
34 .SH "SYNOPSIS"
35 .sp
36 .nf
37 gdbmopen(filename, mode)
38
39 gdbmclose
40
41 gdbmfetch(key [,default])
42
43 gdbmstore(key,value)
44 .fi
45 .SH "DESCRIPTION"
46 .PP
47 The gdbm family of functions provides access to the GDBM library \- a library of routines that manage simple database files\&. The library provides a way of quickly storing and looking up key/data pairs\&.
48 .PP
49 GDBM support in
50 \fBmaildrop\fR
51 is optional, and may not be available to you\&.
52 .PP
53 GDBM support in
54 \fBmaildrop\fR
55 can optionally be implemented using the DB library\&. This option is selected by the system administrator\&. If this is the case, these functions still work exactly as described below, except that they will operate on DB hash files, instead of GDBM files\&.
56 .PP
57 To see whether GDBM or DB support is used, run the command "\fBmaildrop \-v"\fR\&.
58 .PP
59 GDBM support is minimal, and simplistic\&. A filter file may have only one gdbm file open at the same time\&. However, the filter file can close the current gdbm file, and open another one\&. If another filter file is included using the include statement, the included filter file may open its own, separate, gdbm file\&.
60 .PP
61 A GDBM file contains a list of key/value pairs\&. All keys in the GDBM file are unique\&. After storing an arbitrary key/value pair in the GDBM file, the value associated with the given key can be quickly located and retrieved\&.
62 .SS "gdbmclose \- close gdbm file"
63 .sp
64 .if n \{\
65 .RS 4
66 .\}
67 .nf
68 gdbmclose
69 .fi
70 .if n \{\
71 .RE
72 .\}
73 .PP
74 This function closes the current GDBM file\&.
75 .SS "gdbmfetch \- retrieve data"
76 .sp
77 .if n \{\
78 .RS 4
79 .\}
80 .nf
81 gdbmfetch (\fIkey\fR [, \fIoptions\fR] [, \fIdefault\fR])
82 .fi
83 .if n \{\
84 .RE
85 .\}
86 .PP
87 This function retrieves the data for the given key\&.
88 \fIkey\fR
89 is the key to retrieve\&. The
90 \fBgdbmfetch\fR
91 function returns the data associated with this key\&. If the key does not exist in the GDBM file,
92 \fBgdbmfetch\fR
93 returns the
94 \fBdefault\fR
95 argument\&. If the
96 \fBdefault\fR
97 argument is not specified,
98 \fBgdbmfetch\fR
99 returns empty text\&. Please note that the
100 \fBdefault\fR
101 argument is not actually evaluated unless the key does not exist in the GDBM file\&.
102 .PP
103 The
104 \fIoptions\fR
105 argument specifies additional
106 \fBmaildrop\fR
107 value\-added features\&. The following functionality is not available in the GDBM library, but is rather provided by
108 \fBmaildrop\fR\&.
109 .PP
110 If the
111 \fIoptions\fR
112 argument is set to "D", and the key could not be found in the GDBM database, and the key is of the form "user@domain",
113 \fBmaildrop\fR
114 will then attempt to look up the key "user@"\&. If that key is also not found,
115 \fBmaildrop\fR
116 finally looks up the key "domain"\&.
117 .PP
118 If "domain" is also not found, and domain is of the form "a\&.b\&.c\&.d\&.tld" (with variable number of period\-separated sections),
119 \fBmaildrop\fR
120 then attempts to look up the key "b\&.c\&.d\&.tld"\&. If that key is not found,
121 \fBmaildrop\fR
122 tries "c\&.d\&.tld", and so on, until a key is found, or there are no more subdomains to remove, at which point
123 \fBgdbmfetch\fR
124 will return either the
125 \fBdefault\fR
126 argument, or empty text\&.
127 .PP
128 If the
129 \fIoptions\fR
130 argument is set to "D", and the key could not be found in the GDBM database, and the key is of the form "a\&.b\&.c\&.d\&.tld" (with variable number of period\-separated sections),
131 \fBmaildrop\fR
132 will also attempt to look up keys for successive higher\-level domains in the GDBM database\&.
133 .if n \{\
134 .sp
135 .\}
136 .RS 4
137 .nr an-no-space-flag 1
138 .nr an-break-flag 1
139 .br
140 .ps +1
141 \fBNote\fR
142 .ps -1
143 .br
144 .PP
145 GDBM databases are case sensitive\&. Make sure that the GDBM database is created using lowercase letters only, and use the
146 \m[blue]\fB\fBtolower\fR\fR\m[]\&\s-2\u[1]\d\s+2
147 function to convert the key to lowercase\&.
148 .sp .5v
149 .RE
150 .PP
151 If the
152 \fIoptions\fR
153 argument is "I", and the key is not in the GDBM database, and the key is of the form "w\&.x\&.y\&.z" (with variable number of period\-separated sections),
154 \fBmaildrop\fR
155 then tries to look up the key "w\&.x\&.y", then "w\&.x", until a key is found, or there are no more sections to remove\&. Use this feature to look up IP\-address based GDBM lists\&.
156 .if n \{\
157 .sp
158 .\}
159 .RS 4
160 .nr an-no-space-flag 1
161 .nr an-break-flag 1
162 .br
163 .ps +1
164 \fBNote\fR
165 .ps -1
166 .br
167 .PP
168 These features are implemented by brute force: if the query doesn\*(Aqt succeed, try again\&. Take note of potential denial\-of\-service attacks where key is set to a long text string consisting mostly of periods, which will result in numerous GDBM queries that will take an excessive amount of time to complete\&.
169 .sp .5v
170 .RE
171 .SS "gdbmopen \- open gdbm file"
172 .sp
173 .if n \{\
174 .RS 4
175 .\}
176 .nf
177 gdbmopen (\fIfile\fR [, \fImode\fR])
178 .fi
179 .if n \{\
180 .RE
181 .\}
182 .PP
183 \fBgdbmopen\fR
184 opens the indicated GDBM file\&. The optional second argument specifies the following:
185 .PP
186 "R"
187 .RS 4
188 Open this GDBM file for reading\&.
189 .RE
190 .PP
191 "W"
192 .RS 4
193 Open this GDBM file for reading and writing\&.
194 .RE
195 .PP
196 "C"
197 .RS 4
198 Open this GDBM file for reading and writing\&. If the GBDM file doesn\*(Aqt exist, create it\&.
199 .RE
200 .PP
201 "N"
202 .RS 4
203 Create a new GDBM file\&. If the file exists, the existing file is deleted\&. The file is opened for reading and writing\&.
204 .RE
205 .PP
206 The
207 \fImode\fR
208 argument defaults to
209 "R"
210 is used\&. In embedded mode, only
211 "R"
212 is allowed\&.
213 .PP
214 The GDBM library allows multiple processes to read the same GDBM file at the same time, but it does not allow multiple access when the GDBM file is open for writing\&. Using
215 \m[blue]\fB\fBflock\fR\fR\m[]\&\s-2\u[2]\d\s+2
216 or
217 \m[blue]\fB\fBdotlock\fR\fR\m[]\&\s-2\u[3]\d\s+2
218 is highly recommended\&.
219 .PP
220 In delivery mode,
221 \fBmaildrop\fR
222 runs from the recipient\*(Aqs home directory\&. Keep that in mind while specifying the filename\&.
223 .PP
224 The gdbmopen function returns 0 if the GDBM file was successfully opened, non\-zero otherwise\&.
225 .SS "gdbmstore \- store data"
226 .sp
227 .if n \{\
228 .RS 4
229 .\}
230 .nf
231 gdbmstore(\fIkey\fR, \fIvalue\fR)
232 .fi
233 .if n \{\
234 .RE
235 .\}
236 .PP
237 \fIkey\fR
238 is the key value to store in the GDBM file\&.
239 \fIvalue\fR
240 is the value to store\&. If
241 \fIkey\fR
242 already exists in the GDBM file,
243 \fIvalue\fR
244 replacest the old value\&. The
245 \fBgdbmstore\fR
246 function is only permitted if the GDBM file is opened for writing\&. If
247 \fIgdbmopen\fR
248 opened the GDBM file for reading only,
249 \fBgdbmstore\fR
250 will return \-1\&. Otherwise,
251 \fBgdbmstore\fR
252 returns 0\&.
253 .SH "AUTHOR"
254 .PP
255 \fBSam Varshavchik\fR
256 .RS 4
257 Author
258 .RE
259 .SH "NOTES"
260 .IP " 1." 4
261 \fBtolower\fR
262 .RS 4
263 \%http://www.courier-mta.org/maildrop/maildropfilter.html#tolower
264 .RE
265 .IP " 2." 4
266 \fBflock\fR
267 .RS 4
268 \%http://www.courier-mta.org/maildrop/maildropfilter.html#flock
269 .RE
270 .IP " 3." 4
271 \fBdotlock\fR
272 .RS 4
273 \%http://www.courier-mta.org/maildrop/maildropfilter.html#dotlock
274 .RE