3
3
.\" <!-- distribution information. -->
4
4
.\" Title: maildropgdbm
6
.\" Generator: DocBook XSL Stylesheets v1.72.0 <http://docbook.sf.net/>
6
.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
8
8
.\" Manual: Double Precision, Inc.
9
9
.\" Source: Double Precision, Inc.
11
.TH "MAILDROPGDBM" "7" "04/22/2007" "Double Precision, Inc." "Double Precision, Inc."
11
.TH "MAILDROPGDBM" "7" "08/24/2008" "Double Precision, Inc." "Double Precision, Inc."
12
12
.\" disable hyphenation
14
14
.\" disable justification (adjust text to left margin only)
17
maildropgdbm \- GDBM/DB support in maildrop
17
maildropgdbm - GDBM/DB support in maildrop
33
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.
37
is optional, and may not be available to you.
41
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.
43
To see whether GDBM or DB support is used, run the command "\fBmaildrop \-v"\fR.
45
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.
47
A GDBM file contains a list of key/value pairs. All keys in the GDBM file are unique. After storing an arbitary key/value pair in the GDBM file, the value associated with the given key can be quickly located and retrieved.
33
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\.
37
is optional, and may not be available to you\.
41
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\.
43
To see whether GDBM or DB support is used, run the command "\fBmaildrop \-v"\fR\.
45
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\.
47
A GDBM file contains a list of key/value pairs\. All keys in the GDBM file are unique\. After storing an arbitary key/value pair in the GDBM file, the value associated with the given key can be quickly located and retrieved\.
48
48
.SS "gdbmclose \- close gdbm file"
65
This function retrieves the data for the given key.
65
This function retrieves the data for the given key\.
67
is the key to retrieve. The
67
is the key to retrieve\. The
69
function returns the data associated with this key. If the key does not exist in the GDBM file,
69
function returns the data associated with this key\. If the key does not exist in the GDBM file,
75
75
argument is not specified,
77
returns empty text. Please note that the
77
returns empty text\. Please note that the
79
argument is not actually evaluated unless the key does not exist in the GDBM file.
79
argument is not actually evaluated unless the key does not exist in the GDBM file\.
83
83
argument specifies additional
85
value\-added features. The following functionality is not available in the GDBM library, but is rather provided by
85
value\-added features\. The following functionality is not available in the GDBM library, but is rather provided by
90
90
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",
92
will then attempt to look up the key "user@". If that key is also not found,
92
will then attempt to look up the key "user@"\. If that key is also not found,
94
finally looks up the key "domain".
94
finally looks up the key "domain"\.
96
If "domain" is also not found, and domain is of the form "a.b.c.d.tld" (with variable number of period\-separated sections),
98
then attempts to look up the key "b.c.d.tld". If that key is not found,
100
tries "c.d.tld", and so on, until a key is found, or there are no more subdomains to remove, at which point
96
If "domain" is also not found, and domain is of the form "a\.b\.c\.d\.tld" (with variable number of period\-separated sections),
98
then attempts to look up the key "b\.c\.d\.tld"\. If that key is not found,
100
tries "c\.d\.tld", and so on, until a key is found, or there are no more subdomains to remove, at which point
102
102
will return either the
104
argument, or empty text.
104
argument, or empty text\.
108
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),
108
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),
110
will also attempt to look up keys for successive higher\-level domains in the GDBM database.
110
will also attempt to look up keys for successive higher\-level domains in the GDBM database\.
113
113
.nr an-no-space-flag 1
114
114
.nr an-break-flag 1
118
GDBM databases are case sensitive. Make sure that the GDBM database is created using lowercase letters only, and use the
118
GDBM databases are case sensitive\. Make sure that the GDBM database is created using lowercase letters only, and use the
119
119
\fI\fBtolower\fR\fR\&[1]
120
function to convert the key to lowercase.
120
function to convert the key to lowercase\.
124
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),
124
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),
126
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.
126
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\.
129
129
.nr an-no-space-flag 1
130
130
.nr an-break-flag 1
134
These features are implemented by brute force: if the query doesn't 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.
134
These features are implemented by brute force: if the query doesn\'t 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\.
135
135
.SS "gdbmopen \- open gdbm file"
145
opens the indicated GDBM file. The optional second argument specifies the following:
145
opens the indicated GDBM file\. The optional second argument specifies the following:
149
Open this GDBM file for reading.
149
Open this GDBM file for reading\.
154
Open this GDBM file for reading and writing.
154
Open this GDBM file for reading and writing\.
159
Open this GDBM file for reading and writing. If the GBDM file doesn't exist, create it.
159
Open this GDBM file for reading and writing\. If the GBDM file doesn\'t exist, create it\.
164
Create a new GDBM file. If the file exists, the existing file is deleted. The file is opened for reading and writing.
164
Create a new GDBM file\. If the file exists, the existing file is deleted\. The file is opened for reading and writing\.
169
169
argument defaults to
171
is used. In embedded mode, only
171
is used\. In embedded mode, only
175
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
175
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
176
176
\fI\fBflock\fR\fR\&[2]
178
178
\fI\fBdotlock\fR\fR\&[3]
179
is highly recommended.
179
is highly recommended\.
181
181
In delivery mode,
183
runs from the recipient's home directory. Keep that in mind while specifying the filename.
183
runs from the recipient\'s home directory\. Keep that in mind while specifying the filename\.
185
The gdbmopen function returns 0 if the GDBM file was succesfully opened, non\-zero otherwise.
185
The gdbmopen function returns 0 if the GDBM file was succesfully opened, non\-zero otherwise\.
186
186
.SS "gdbmstore \- store data"
196
is the key value to store in the GDBM file.
196
is the key value to store in the GDBM file\.
198
is the value to store. If
198
is the value to store\. If
200
200
already exists in the GDBM file,
202
replacest the old value. The
202
replacest the old value\. The
204
function is only permitted if the GDBM file is opened for writing. If
204
function is only permitted if the GDBM file is opened for writing\. If
206
206
opened the GDBM file for reading only,
208
will return \-1. Otherwise,
208
will return \-1\. Otherwise,