Reads Postfix lookup tables, for Sovite.Core.Postfix.Migration.
A table is named type:name:
hash:,btree:,lmdb:,cdb:,dbm:,sdbm:- indexed files built withpostmapfrom a text file. The text file is read (hash:/etc/postfix/virtualreads/etc/postfix/virtual, notvirtual.db).texthash:is the text file itself.proxy:TYPE:name- one of the above throughproxymap(8); the file is read as withoutproxy:.inline:{ key=value, { key = text } }andstatic:value- the entries are in the name.
Other types (mysql:, pgsql:, ldap:, regexp:, pcre:, cidr:,
sqlite:, memcache:, socketmap:, tcp:, unionmap:, ...) cannot
be read: they are reported as unsupported.
Text files have one key value entry per logical line (see
Sovite.Core.Postfix.MainCf.logical_lines/1). Keys are lower-cased,
as postmap does. Alias files (aliases(5)) are name: dest, dest.
Summary
Types
Why a table could not be read.
Reads a file: File.read/1, or a function that maps paths first.
Where a table's entries come from.
Functions
Describes a read error for the report.
Splits a list of destinations on commas, keeping quoted ones (such as
"|command with args") whole and removing the quotes.
Parses a postmap source file.
Parses an aliases(5) file: name: destination, destination. Names
may be quoted.
Reads the entries of table name as {key, value} pairs, in file
order. read reads a file.
Reads alias table name as {name, destinations} pairs. See read/2.
Parses a table name.
Types
Functions
Describes a read error for the report.
Splits a list of destinations on commas, keeping quoted ones (such as
"|command with args") whole and removing the quotes.
Parses a postmap source file.
iex> Sovite.Core.Postfix.Table.parse("# comment\nAlice@Example.com alice@example.org,\n bob@example.org\n")
[{"alice@example.com", "alice@example.org, bob@example.org"}]
Parses an aliases(5) file: name: destination, destination. Names
may be quoted.
iex> Sovite.Core.Postfix.Table.parse_aliases(~s(postmaster: root\n"x y": a@example.com, "|/bin/prog arg"\n))
[{"postmaster", ["root"]}, {"x y", ["a@example.com", "|/bin/prog arg"]}]
Reads the entries of table name as {key, value} pairs, in file
order. read reads a file.
Reads alias table name as {name, destinations} pairs. See read/2.
Parses a table name.
iex> Sovite.Core.Postfix.Table.source("hash:/etc/postfix/virtual")
{:file, "hash", "/etc/postfix/virtual"}
iex> Sovite.Core.Postfix.Table.source("mysql:/etc/postfix/mysql.cf")
{:unsupported, "mysql"}