GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Programs   Up: mailutils dbm   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index

3.17.12.6 Dump Formats

As of version 3.6, mailutils dbm supports two formats for dumping DBM databases. Both formats are line-oriented. Comments are introduced with a sharp (‘#’) sign in the column 0 of a line, followed by at least one white space character (space or tab). Sharp sign followed by a colon (‘#:’) introduces a pragmatic comment, which carries some additional information to the loader.

The version 0.0 format is suitable for databases whose records contain only ASCII data. In this format, each record occupies a separate line, which consists of the key and value separated by a single TAB character. Empty lines are ignored. For example:

$ mailutils list /etc/mail/users.db
root    guessme
smith   pAssword
qed     fooBar

The output in version 0.0 format is human readable and can be used as input to the popauth utility (see popauth. However, version 0.0 has serious drawbacks. First of all, it is not suitable for databases that contain binary data. Secondly, it cannot properly handle keys beginning with a sharp sign or containing TAB. The version 1.0 format is free from these drawbacks.

The version 1.0 dump format begins with a header containing important information about the file, such as its file name, ownership and file mode. This information is stored in pragmatic comments and allows mailutils dbm load to easily recreate an exact copy of the file. The following comments are defined:

#:version=1.0

Indicates that the data that follow are in version 1.0 format.

#:filename=s

Original database file name, without directory parts.

#:uid=n

Owner UID.

#:user=s

Owner name.

#:gid=n

Owner GID

#:group=s

Owner group name.

#:mode=o

File mode in octal

Following this header are actual data. Each record is output in two parts: key and value. Each part begins with a ‘#:len=n’ construct on a line by itself, where n is the length of the data in decimal. This line is followed by one or more lines of the actual data, encoded in base64. The data are formatted so that each line does not exceed 76 bytes in length (not counting the terminating newline). An example of this format follows:

# Database dump file created by GNU Mailutils 2.99.93 on
# Tue Nov  1 13:28:03 2011
#:version=1.0
#:file=users.db
#:uid=0,user=root,gid=25,group=mail,mode=640
#:len=6
c21pdGgA
#:len=9
cEFzc3dvcmQA
#:len=5
cm9vdAA=
#:len=8
Z3Vlc3NtZQA=
#:len=4
cWVkAA==
#:len=7
Zm9vQmFyAA==

GNU Mailutils Manual (split by node):   Section:   Chapter:FastBack: Programs   Up: mailutils dbm   FastForward: Libraries   Contents: Table of ContentsIndex: Function Index