Revert "preauthuserdbcommon.c: Move token-getting code to below callback."
[hcoop/debian/courier-authlib.git] / authpgsqlrc
CommitLineData
d9898ee8 1##VERSION: $Id: authpgsqlrc,v 1.12 2004/11/25 15:08:27 mrsam Exp $
2#
3# Copyright 2000-2004 Double Precision, Inc. See COPYING for
4# distribution information.
5#
6# Do not alter lines that begin with ##, they are used when upgrading
7# this configuration.
8#
9# authpgsqlrc created from authpgsqlrc.dist by sysconftool
10#
11# DO NOT INSTALL THIS FILE with world read permissions. This file
12# might contain the PostgreSQL admin password!
13#
14# Each line in this file must follow the following format:
15#
16# field[spaces|tabs]value
17#
18# That is, the name of the field, followed by spaces or tabs, followed by
19# field value. Trailing spaces are prohibited.
20
21
22##NAME: LOCATION:0
23#
24# The server hostname, port, userid, and password used to log in.
25#
26# To connect to a filesystem socket, delete PGSQL_HOST, and set PGSQL_PORT to
27# the socket's last component. So, if your pg socket is /tmp/.s.PGSQL.5400
28# set PGSQL_PORT to 5400.
29
30PGSQL_HOST pgsql.example.com
31PGSQL_PORT 5400
32PGSQL_USERNAME admin
33PGSQL_PASSWORD admin
34
35
36##NAME: PGSQL_OPT:0
37#
38# PGSQL_OPT specifies the connection debug options to PQsetdbLogin().
39# Don't bother with this setting unless you know what you're doing
40#
41# PGSQL_OPT
42
43##NAME: PGSQL_DATABASE:0
44#
45# The name of the PostgreSQL database we will open:
46
47PGSQL_DATABASE template1
48
49##NAME: PGSQL_USER_TABLE:0
50#
51# The name of the table containing your user data. See README.authmysqlrc
52# for the required fields in this table (both MySQL and Postgress use the
53# same suggested layout.
54
55PGSQL_USER_TABLE passwd
56
57##NAME: PGSQL_CRYPT_PWFIELD:0
58#
59# Either PGSQL_CRYPT_PWFIELD or PGSQL_CLEAR_PWFIELD must be defined. Both
60# are OK too. crypted passwords go into PGSQL_CRYPT_PWFIELD, cleartext
61# passwords go into PGSQL_CLEAR_PWFIELD. Cleartext passwords allow
62# CRAM-MD5 authentication to be implemented.
63
64PGSQL_CRYPT_PWFIELD crypt
65
66##NAME: PGSQL_CLEAR_PWFIELD:0
67#
68#
69# PGSQL_CLEAR_PWFIELD clear
70
71##NAME: PGSQL_DEFAULT_DOMAIN:0
72#
73# If DEFAULT_DOMAIN is defined, and someone tries to log in as 'user',
74# we will look up 'user@DEFAULT_DOMAIN' instead.
75#
76#
77# DEFAULT_DOMAIN example.com
78
79##NAME: PGSQL_UID_FIELD:0
80#
81# Other fields in the mysql table:
82#
83# PGSQL_UID_FIELD - contains the numerical userid of the account
84#
85PGSQL_UID_FIELD uid
86
87##NAME: PGSQL_GID_FIELD:0
88#
89# Numerical groupid of the account
90
91PGSQL_GID_FIELD gid
92
93##NAME: PGSQL_LOGIN_FIELD:0
94#
95# The login id, default is id. Basically the query is:
96#
97# SELECT PGSQL_UID_FIELD, PGSQL_GID_FIELD, ... WHERE id='loginid'
98#
99
100PGSQL_LOGIN_FIELD id
101
102##NAME: PGSQL_HOME_FIELD:0
103#
104
105PGSQL_HOME_FIELD home
106
107##NAME: PGSQL_NAME_FIELD:0
108#
109# The user's name (optional)
110
111PGSQL_NAME_FIELD name
112
113##NAME: PGSQL_MAILDIR_FIELD:0
114#
115# This is an optional field, and can be used to specify an arbitrary
116# location of the maildir for the account, which normally defaults to
117# $HOME/Maildir (where $HOME is read from PGSQL_HOME_FIELD).
118#
119# You still need to provide a PGSQL_HOME_FIELD, even if you uncomment this
120# out.
121#
122# PGSQL_MAILDIR_FIELD maildir
123
124##NAME: PGSQL_DEFAULTDELIVERY:0
125#
126# Courier mail server only: optional field specifies custom mail delivery
127# instructions for this account (if defined) -- essentially overrides
128# DEFAULTDELIVERY from ${sysconfdir}/courierd
129#
130# PGSQL_DEFAULTDELIVERY defaultDelivery
131
132##NAME: PGSQL_QUOTA_FIELD:0
133#
134# Define PGSQL_QUOTA_FIELD to be the name of the field that can optionally
135# specify a maildir quota. See README.maildirquota for more information
136#
137# PGSQL_QUOTA_FIELD quota
138
139##NAME: PGSQL_AUXOPTIONS:0
140#
141# Auxiliary options. The PGSQL_AUXOPTIONS field should be a char field that
142# contains a single string consisting of comma-separated "ATTRIBUTE=NAME"
143# pairs. These names are additional attributes that define various per-account
144# "options", as given in INSTALL's description of the "Account OPTIONS"
145# setting.
146#
147# PGSQL_AUXOPTIONS_FIELD auxoptions
148#
149# You might want to try something like this, if you'd like to use a bunch
150# of individual fields, instead of a single text blob:
151#
152# PGSQL_AUXOPTIONS_FIELD 'disableimap=' || disableimap || ',disablepop3=' || disablepop3 || ',disablewebmail=' || disablewebmail || ',sharedgroup=' || sharedgroup
153#
154# This will let you define fields called "disableimap", etc, with the end result
155# being something that the OPTIONS parser understands.
156
157##NAME: PGSQL_WHERE_CLAUSE:0
158#
159# This is optional, PGSQL_WHERE_CLAUSE can be basically set to an arbitrary
160# fixed string that is appended to the WHERE clause of our query
161#
162# PGSQL_WHERE_CLAUSE server='mailhost.example.com'
163
164##NAME: PGSQL_SELECT_CLAUSE:0
165#
166# (EXPERIMENTAL)
167# This is optional, PGSQL_SELECT_CLAUSE can be set when you have a database,
168# which is structuraly different from proposed. The fixed string will
169# be used to do a SELECT operation on database, which should return fields
170# in order specified bellow:
171#
172# username, cryptpw, clearpw, uid, gid, home, maildir, quota, fullname, options
173#
174# Enabling this option causes ignorance of any other field-related
175# options, excluding default domain.
176#
177# There are two variables, which you can use. Substitution will be made
178# for them, so you can put entered username (local part) and domain name
179# in the right place of your query. These variables are:
180# $(local_part), $(domain), and $(service)
181#
182# If a $(domain) is empty (not given by the remote user) the default domain
183# name is used in its place.
184#
185# $(service) will expand out to the service being authenticated: imap, imaps,
186# pop3 or pop3s. Courier mail server only: service will also expand out to
187# "courier", when searching for local mail account's location. In this case,
188# if the "maildir" field is not empty it will be used in place of
189# DEFAULTDELIVERY. Courier mail server will also use esmtp when doing
190# authenticated ESMTP.
191#
192# This example is a little bit modified adaptation of vmail-sql
193# database scheme:
194#
195# PGSQL_SELECT_CLAUSE SELECT popbox.local_part, \
196# '{MD5}' || popbox.password_hash, \
197# popbox.clearpw, \
198# domain.uid, \
199# domain.gid, \
200# domain.path || '/' || popbox.mbox_name), \
201# '', \
202# domain.quota, \
203# '', \
204# FROM popbox, domain \
205# WHERE popbox.local_part = '$(local_part)' \
206# AND popbox.domain_name = '$(domain)' \
207# AND popbox.domain_name = domain.domain_name
208
209
210##NAME: PGSQL_ENUMERATE_CLAUSE:1
211#
212# {EXPERIMENTAL}
213# Optional custom SQL query used to enumerate accounts for authenumerate,
214# in order to compile a list of accounts for shared folders. The query
215# should return the following fields: name, uid, gid, homedir, maildir, options
216#
217# Example:
218# PGSQL_ENUMERATE_CLAUSE SELECT popbox.local_part || '@' || popbox.domain_name, \
219# domain.uid, \
220# domain.gid, \
221# domain.path || '/' || popbox.mbox_name, \
222# '', \
223# 'sharedgroup=' || sharedgroup \
224# FROM popbox, domain \
225# WHERE popbox.local_part = '$(local_part)' \
226# AND popbox.domain_name = '$(domain)' \
227# AND popbox.domain_name = domain.domain_name
228
229
230##NAME: PGSQL_CHPASS_CLAUSE:0
231#
232# (EXPERIMENTAL)
233# This is optional, PGSQL_CHPASS_CLAUSE can be set when you have a database,
234# which is structuraly different from proposed. The fixed string will
235# be used to do an UPDATE operation on database. In other words, it is
236# used, when changing password.
237#
238# There are four variables, which you can use. Substitution will be made
239# for them, so you can put entered username (local part) and domain name
240# in the right place of your query. There variables are:
241# $(local_part) , $(domain) , $(newpass) , $(newpass_crypt)
242#
243# If a $(domain) is empty (not given by the remote user) the default domain
244# name is used in its place.
245# $(newpass) contains plain password
246# $(newpass_crypt) contains its crypted form
247#
248# PGSQL_CHPASS_CLAUSE UPDATE popbox \
249# SET clearpw='$(newpass)', \
250# password_hash='$(newpass_crypt)' \
251# WHERE local_part='$(local_part)' \
252# AND domain_name='$(domain)'
253#