Debian Codegraph @

upstream/debian-trixie/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 .it 1 an-trap
138 .nr an-no-space-flag 1
139 .nr an-break-flag 1
140 .br
141 .ps +1
142 \fBNote\fR
143 .ps -1
144 .br
145 .PP
146 GDBM databases are case sensitive\&. Make sure that the GDBM database is created using lowercase letters only, and use the
147 \m[blue]\fB\fBtolower\fR\fR\m[]\&\s-2\u[1]\d\s+2
148 function to convert the key to lowercase\&.
149 .sp .5v
150 .RE
151 .PP
152 If the
153 \fIoptions\fR
154 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),
155 \fBmaildrop\fR
156 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\&.
157 .if n \{\
158 .sp
159 .\}
160 .RS 4
161 .it 1 an-trap
162 .nr an-no-space-flag 1
163 .nr an-break-flag 1
164 .br
165 .ps +1
166 \fBNote\fR
167 .ps -1
168 .br
169 .PP
170 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\&.
171 .sp .5v
172 .RE
173 .SS "gdbmopen \- open gdbm file"
174 .sp
175 .if n \{\
176 .RS 4
177 .\}
178 .nf
179 gdbmopen (\fIfile\fR [, \fImode\fR])
180 .fi
181 .if n \{\
182 .RE
183 .\}
184 .PP
185 \fBgdbmopen\fR
186 opens the indicated GDBM file\&. The optional second argument specifies the following:
187 .PP
188 "R"
189 .RS 4
190 Open this GDBM file for reading\&.
191 .RE
192 .PP
193 "W"
194 .RS 4
195 Open this GDBM file for reading and writing\&.
196 .RE
197 .PP
198 "C"
199 .RS 4
200 Open this GDBM file for reading and writing\&. If the GBDM file doesn\*(Aqt exist, create it\&.
201 .RE
202 .PP
203 "N"
204 .RS 4
205 Create a new GDBM file\&. If the file exists, the existing file is deleted\&. The file is opened for reading and writing\&.
206 .RE
207 .PP
208 The
209 \fImode\fR
210 argument defaults to
211 "R"
212 is used\&. In embedded mode, only
213 "R"
214 is allowed\&.
215 .PP
216 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
217 \m[blue]\fB\fBflock\fR\fR\m[]\&\s-2\u[2]\d\s+2
218 or
219 \m[blue]\fB\fBdotlock\fR\fR\m[]\&\s-2\u[3]\d\s+2
220 is highly recommended\&.
221 .PP
222 In delivery mode,
223 \fBmaildrop\fR
224 runs from the recipient\*(Aqs home directory\&. Keep that in mind while specifying the filename\&.
225 .PP
226 The gdbmopen function returns 0 if the GDBM file was successfully opened, non\-zero otherwise\&.
227 .SS "gdbmstore \- store data"
228 .sp
229 .if n \{\
230 .RS 4
231 .\}
232 .nf
233 gdbmstore(\fIkey\fR, \fIvalue\fR)
234 .fi
235 .if n \{\
236 .RE
237 .\}
238 .PP
239 \fIkey\fR
240 is the key value to store in the GDBM file\&.
241 \fIvalue\fR
242 is the value to store\&. If
243 \fIkey\fR
244 already exists in the GDBM file,
245 \fIvalue\fR
246 replacest the old value\&. The
247 \fBgdbmstore\fR
248 function is only permitted if the GDBM file is opened for writing\&. If
249 \fIgdbmopen\fR
250 opened the GDBM file for reading only,
251 \fBgdbmstore\fR
252 will return \-1\&. Otherwise,
253 \fBgdbmstore\fR
254 returns 0\&.
255 .SH "AUTHOR"
256 .PP
257 \fBSam Varshavchik\fR
258 .RS 4
259 Author
260 .RE
261 .SH "NOTES"
262 .IP " 1." 4
263 \fBtolower\fR
264 .RS 4
265 \%http://www.courier-mta.org/maildrop/maildropfilter.html#tolower
266 .RE
267 .IP " 2." 4
268 \fBflock\fR
269 .RS 4
270 \%http://www.courier-mta.org/maildrop/maildropfilter.html#flock
271 .RE
272 .IP " 3." 4
273 \fBdotlock\fR
274 .RS 4
275 \%http://www.courier-mta.org/maildrop/maildropfilter.html#dotlock
276 .RE