##VERSION: $Id: authmysqlrc,v 1.9 2002/01/08 05:01:22 mrsam Exp $
#
# Copyright 2000 Double Precision, Inc.  See COPYING for
# distribution information.
#
# Do not alter lines that begin with ##, they are used when upgrading
# this configuration.
#
# authmysqlrc created from authmysqlrc.dist by sysconftool
#
# DO NOT INSTALL THIS FILE with world read permissions.  This file
# might contain the MySQL admin password!
#
# Each line in this file must follow the following format:
#
# field[spaces|tabs]value
#
# That is, the name of the field, followed by spaces or tabs, followed by
# field value.  Trailing spaces are prohibited.


##NAME: LOCATION:0
#
# The server name, userid, and password used to log in.

MYSQL_SERVER		mysql.example.com
MYSQL_USERNAME		admin
MYSQL_PASSWORD		admin

##NAME: MYSQL_SOCKET:0
#
# MYSQL_SOCKET can be used with MySQL version 3.22 or later, it specifies the
# filesystem pipe used for the connection
#
# MYSQL_SOCKET		/var/mysql/mysql.sock

##NAME: MYSQL_PORT:0
#
# MYSQL_PORT can be used with MySQL version 3.22 or later to specify a port to
# connect to.

MYSQL_PORT		0

##NAME: MYSQL_OPT:0
#
# Leave MYSQL_OPT as 0, unless you know what you're doing.

MYSQL_OPT		0

##NAME: MYSQL_DATABASE:0
#
# The name of the MySQL database we will open:

MYSQL_DATABASE		mysql

##NAME: MYSQL_USER_TABLE:0
#
# The name of the table containing your user data.  See README.authmysqlrc
# for the required fields in this table.

MYSQL_USER_TABLE	passwd

##NAME: MYSQL_CRYPT_PWFIELD:0
#
# Either MYSQL_CRYPT_PWFIELD or MYSQL_CLEAR_PWFIELD must be defined.  Both
# are OK too. crypted passwords go into MYSQL_CRYPT_PWFIELD, cleartext
# passwords go into MYSQL_CLEAR_PWFIELD.  Cleartext passwords allow
# CRAM-MD5 authentication to be implemented.

MYSQL_CRYPT_PWFIELD	crypt

##NAME: MYSQL_CLEAR_PWFIELD:0
#
#
# MYSQL_CLEAR_PWFIELD	clear

##NAME: MYSQL_DEFAULT_DOMAIN:0
#
# If DEFAULT_DOMAIN is defined, and someone tries to log in as 'user',
# we will look up 'user@DEFAULT_DOMAIN' instead.
#
#
# DEFAULT_DOMAIN		example.com

##NAME: MYSQL_UID_FIELD:0
#
# Other fields in the mysql table:
#
# MYSQL_UID_FIELD - contains the numerical userid of the account
#
MYSQL_UID_FIELD		uid

##NAME: MYSQL_GID_FIELD:0
#
# Numerical groupid of the account

MYSQL_GID_FIELD		gid

##NAME: MYSQL_LOGIN_FIELD:0
#
# The login id, default is id.  Basically the query is:
#
#  SELECT MYSQL_UID_FIELD, MYSQL_GID_FIELD, ... WHERE id='loginid'
#

MYSQL_LOGIN_FIELD	id

##NAME: MYSQL_HOME_FIELD:0
#

MYSQL_HOME_FIELD	home

##NAME: MYSQL_NAME_FIELD:0
#
# The user's name (optional)

MYSQL_NAME_FIELD	name

##NAME: MYSQL_MAILDIR_FIELD:0
#
# This is an optional field, and can be used to specify an arbitrary
# location of the maildir for the account, which normally defaults to
# $HOME/Maildir (where $HOME is read from MYSQL_HOME_FIELD).
#
# You still need to provide a MYSQL_HOME_FIELD, even if you uncomment this
# out.
#
# MYSQL_MAILDIR_FIELD	maildir

##NAME: MYSQL_QUOTA_FIELD:0
#
# Define MYSQL_QUOTA_FIELD to be the name of the field that can optionally
# specify a maildir quota.  See README.maildirquota for more information 
#
# MYSQL_QUOTA_FIELD	quota

##NAME: MYSQL_WHERE_CLAUSE:0
#
# This is optional, MYSQL_WHERE_CLAUSE can be basically set to an arbitrary
# fixed string that is appended to the WHERE clause of our query
#
# MYSQL_WHERE_CLAUSE	server='mailhost.example.com'

##NAME: USER_DOMAIN_SEPARATORS:0
#
# This is optional. Using this option you can set the set of characters
# which are treated as separators when splitting entered username into the
# local part and the domain name. If it's not set the defaults @% are used,
# so the user can authenticate using user@domain or user%domain form.
# See README.authmysql.myownquery for more information
#
# USER_DOMAIN_SEPARATORS	@%+

##NAME: MYSQL_SELECT_CLAUSE:0
#
# This is optional, MYSQL_SELECT_CLAUSE can be set when you have a database,
# which is structuraly different from proposed. You can type here your MySQL
# query, which will be used to fetch user's credentials, and which should
# return fields in order specified bellow:
#
# username, cryptpw, clearpw, uid, gid, home, maildir, quota, fullname
#
# Enabling this option causes ignorance of any other field-related options.
#
# There also are variables, which you can use. Substitution will be made
# for them, so you can pass currently entered username and a domain name
# up to the right place within your query. These variables are:
# $(local_part) , $(domain) , $(username)
#
# If a $(domain) is empty (not given by the remote user) the default domain
# name is used in its place. $(username) is a local part concatenated with
# domain name using symbol defined in USER_DOMAIN_CONCAT or '@' if this option
# is not set.
# See README.authmysql.myownquery for more information
#
# MYSQL_SELECT_CLAUSE SELECT					\
# users.username, users.cryptpw, users.clearpw,			\
# domains.uid, domains.gid,					\
# CONCAT_WS('/',domains.path_prefix,users.mailbox_path),	\
# '', domains.quota, ''						\
# FROM users, domains						\
#  WHERE domains.domain_name='$(domain)'			\
#    AND users.username='$(local_part)'				\
#    AND domains.domain_name=users.domain_name

##NAME: MYSQL_CHPASS_CLAUSE:0
#
# This is optional, MYSQL_CHPASS_CLAUSE can be set when you have a database,
# which is structuraly different from proposed. You can use it to set up
# a MySQL query used to change user's password.
#
# There are four variables, which you can use. Substitution will be made
# for them, so you can put the currently entered username and the domain name
# in the right place of your query. These variables are:
# $(local_part) , $(domain) , $(username) , $(newpass) , $(newpass_crypt)
#
# If a $(domain) is empty (not given by the remote user) the default domain
# name is used in its place. $(newpass) contains plain password and
# $(newpass_crypt) contains its crypted form.
# See README.authmysql.myownquery for more information
#
# MYSQL_CHPASS_CLAUSE UPDATE users		\
# SET clearpw='$(newpass)',			\
#     cryptpw='$(newpass_crypt)'		\
# WHERE username='$(local_part)'		\
# AND domain_name='$(domain)'

##NAME: ON_PASS_OK_CLAUSE:0
#
# This is optional, ON_PASS_OK_CLAUSE is a trigger -- the query
# is performed each time user has successfuly logged in.
# See README.authmysql.myownquery for more information
#
# ON_PASS_OK_CLAUSE		UPDATE users				\
#				SET last_ok=CURRENT_TIMESTAMP		\
#				WHERE username='$(local_part)'		\
#				AND domain_name='$(domain)'

##NAME: ON_PASS_FAIL_CLAUSE:0
#
# This is optional, ON_PASS_FAIL_CLAUSE is a trigger -- the query
# is performed each time user has NOT logged in, cause of bad password.
# See README.authmysql.myownquery for more information
#
# ON_PASS_FAIL_CLAUSE		UPDATE users				\
#				SET last_fail=CURRENT_TIMESTAMP		\
#				WHERE username='$(local_part)'		\
#				AND domain_name='$(domain)'

##NAME: ON_PASS_CHANGE_CLAUSE:0
#
# This is optional, ON_PASS_CHANGE_CLAUSE is a trigger -- the query
# is performed each time user has successfuly changed his password.
# See README.authmysql.myownquery for more information
#
# ON_PASS_CHANGE_CLAUSE		UPDATE users				\
#				SET pw_change=CURRENT_TIMESTAMP		\
#				WHERE username='$(local_part)'		\
#				AND domain_name='$(domain)'
