GNU Mailutils |
|
General-Purpose Mail Package |
Official GNU Software |
sql
Statementsql { # Set SQL interface to use. interface ‘mysql|odbc|postgres’; # SQL server host name. host arg; # SQL user name. user arg; # Password for the SQL user. passwd arg; # SQL server port. port arg; # Database name. db arg; # Type of password returned by getpass query. password-type ‘plain | hash | scrambled’; # Set a field-map for parsing SQL replies. field-map list; # SQL query returning the user’s password. getpass query; # SQL query to use for getpwnam requests. getpwnam query; # SQL query to use for getpwuid requests. getpwuid query; }
The sql
statement configures access credentials to
SQL database and the queries for authentication and
authorization.
GNU Mailutils supports three types of SQL interfaces: MySQL, PostgreSQL and ODBC. The latter is a standard API for using database management systems, which can be used to communicate with a wide variety of DBMS.
Configures type of DBMS interface. Allowed values for type are:
Interface with a MySQL server (http://www.mysql.org).
Use ODBC interface. See http://www.unixodbc.org, for a detailed description of ODBC configuration.
Interface with a PostgreSQL server (http://www.postgres.org).
The database and database access credentials are configured using the following statements:
The host running the SQL server. The value can be either a host name or an IP address in dotted-quad notation, in which case an INET connection is used, or a full pathname to a file, in which case a connection to UNIX socket is used.
TCP port the server is listening on (for INET connections). This parameter is optional. Its default value depends on the type of database being used.
Name of the database.
SQL user name.
Password to access the database.
Defines type of encryption used by the password returned by
getpass
query (see below). Possible arguments are:
Password is in plain text.
Password is encrypted by system crypt
function
(see crypt in crypt(3) man page).
Password is encrypted by MySQL password
function.
Defines SQL query that returns information about the given user. The query is subject to variable expansion (see Variables). The only variable defined is ‘$user’, which expands to the user name.
The query should return a single row with the following columns:
User name.
User password.
UID of the user.
GID of the primary group.
Textual description of the user.
User’s home directory
User’s shell program.
The following columns are optional:
Full pathname of the user’s mailbox. If not returned or NULL, the mailbox is determined using the default algorithm (see Mailbox).
Upper limit on the size of the mailbox. The value is either an integer number optionally followed by one of the usual size suffixes: ‘K’, ‘M’, ‘G’, or ‘T’ (case-insensitive).
Defines SQL query that returns information about the given UID. The query is subject to variable expansion (see Variables). The only variable defined is ‘$user’, which expands to the UID.
The query should return a single row, as described for getpwnam
.
Defines SQL query that returns the password of the given user. The query is subject to variable expansion (see Variables). The only variable defined is ‘$user’, which expands to the user name.
The query should return a row with a single column, which gives the
password. The password can be encrypted as specified by the
password-encryption
statement.
Defines a translation map for column names. The list is a
list of mappings. Each mapping is a string
‘name=column’, where name is one of the names
described in getpw column names, and column is the name of
the column in the returned row that should be used instead. The effect of
this statement is similar to that of SQL AS
keyword. E.g. the
statement
field-map (uid=user_id);
has the same effect as using ‘SELECT user_id AS uid’ in the SQL statement.
This document was generated on January 2, 2022 using makeinfo.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.