MAKEDAT(1)

πŸ“¦
version 3.1.0 Β· 2 versions
, in epel 9, fedora 43, fedora 44, nixos 26.05

✨ MAKEDAT(1) ✨ β€” like, the manual page, but make it make sense πŸ’…

okay bestie, sit down, we're learning makedat(1) today. Double Precision, Inc. made this one. it's giving ✨database✨, it's giving ✨blacklist✨, let's go πŸ¦‹


🌸 NAME 🌸

makedat β€” create GDBM/DB files for maildrop. that's it, that's the whole job, she's a one-trick pony and she ate πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

makedat {-src=textfile} {-tmp=tmpfile} {-file=gdbmfile} [-cidr]

literally exactly that. don't freestyle it πŸ™ˆ


πŸ’œ DESCRIPTION πŸ’œ

so the gdbm family of functions in maildrop gives you access to GDBM/DB databases β€” which are, bestie, just simple database files. and what do they do? they give you a way of quickly storing and looking up key/data pairs. fast. efficient. main character energy πŸ‘‘

ngl you can use any program you want to create GDBM/DB database files. but makedat is the quick little utility that creates GDBM or DB files from plain text files. it's the shortcut. the cheat code. the girl who does the group project in one night πŸ”₯

here's the thing though β€” your system administrator is the one who picks whether maildrop uses GDBM or DB database files, and also whether makedat creates GDBM or DB database files. so it's giving ✨her choice, her rules✨

⚠️ also, the makedat command may not even be available to you!! GDBM/DB support in maildrop is optional, and the system administrator may choose not to install GDBM/DB support and the makedat command. so if you can't find her... she might just not be invited to this party 😭

wanna know which one you're running? run this:

maildrop -v

that tells you whether GDBM or DB support is being used. vibe check complete βœ…


🧚 the textfile argument 🧚

the textfile argument is a plain text file containing key/value pairs. each line in the text file has a key value, followed by a tab and a data value. the data value may be omitted β€” and if you do that, it defaults to "1". no cap.

for example, these three lines:

example.com
domain.com<tab>ok
foo.domain.com<tab>bad

create three key/value pairs:

  • example.com with value "1"
  • domain.com with value "ok"
  • foo.domain.com with value "bad"

iconic. three lines, three pairs, no drama ✨

empty lines in textfile, and lines starting with the # character, are ignored. so go ahead, leave yourself little notes, she won't read them πŸ’…

and plot twist: textfile can be -, in which case standard input is used. very flexible of her 🫢


πŸŽ€ the gdbmfile argument πŸŽ€

gdbmfile is the GDBM/DB file to create. if this file already exists, its existing contents are replaced. gone. bye. not sorry. πŸ’€


🌈 the tmpfile argument 🌈

tmpfile is a name of a temporary file in the same directory as gdbmfile. makedat uses tmpfile to create the GDBM file, and then tmpfile gets renamed to gdbmfile. sneaky? no, genius. ✨

this approach foregoes any need for locking in order to be able to dynamically update GDBM/DB files used by maildrop's gdbm functions. that's the whole point of the little rename dance 🧚

⚠️ BUT. and this is a big but. makedat does not use any locks on tmpfile, so multiple instances of makedat using the same tmpfile are prohibited. do not do it. do not try it. do not text your friend "watch this" πŸ“΅

πŸ’… the -cidr flag πŸ’…

the -cidr flag specifies that the key is an IP netblock in CIDR notation.

heads up though: this flag requires the Net::CIDR Perl module to be installed separately. download Net::CIDR from http://www.cpan.org. go get her, she's free 🎁


πŸ’€ BUGS πŸ’€

there are historical reasons why database functions in maildrop are called gdbm functions. the initial implementation used GDBM functions exclusively. the ability to use the DB library instead of the GDBM library has been added later. so it's a naming thing. a legacy thing. a "we've been calling it that for years and we're not stopping now" thing πŸ™ˆ


⭐ EXAMPLE ⭐

makedat blacklist /etc/mail/blacklist.tmp /etc/mail/blacklist.dat

takes blacklist, and creates /etc/mail/blacklist.dat, using /etc/mail/blacklist.tmp as a temporary file. slay. that's it. that's the whole thing πŸ‘‘


πŸ¦‹ SEE ALSO πŸ¦‹


πŸ‘‘ AUTHOR πŸ‘‘

Sam Varshavchik

  • Author

(the one, the only, the legend herself 🫢)


πŸ’– NOTES πŸ’–

  1. maildrop(1) http://www.courier-mta.org/maildrop/maildrop.html
  2. maildropgdbm(5) http://www.courier-mta.org/maildrop/maildropgdbm.html

and that's the whole page bestie!! this one came out of the Courier Mail Server, dated 11/04/2020, and yeah the manpage header says MAKEDAT(1) three times because that's just how manpages are, she's a little extra like that πŸ’…βœ¨ stay slaying, go build your databases, and don't share your tmpfile πŸ’–

πŸ“¦ where this page comes from