--with-ldap Build with LDAP support
--with-vpopmail Build with vpopmail support (default)
--with-static-userdb Build with static userdb support (default)
+ --with-pgsql Build with PostgreSQL support
Specify which authentication modules to use. Disabling them give you a few
bytes smaller binary, but not much else.
db-ldap.c userdb-ldap.c passdb-ldap.c -o ldap.so \
../lib-settings/libsettings.a -lldap
+gcc -shared -fPIC -DUSERDB_PGSQL -DPASSDB_PGSQL \
+-I../.. -I../lib -I../lib-settings -I/usr/include/postgresql \
+db-pgsql.c userdb-pgsql.c passdb-pgsql.c -o pgsql.so \
+../lib-settings/libsettings.a -L/usr/lib/postgresql -lpq
+
gcc -shared -fPIC -DUSERDB_VPOPMAIL -DPASSDB_VPOPMAIL -I../.. -I../lib \
userdb-vpopmail.c passdb-vpopmail.c -o vpopmail.so -lvpopmail
-Including libsettings.a in ldap.so is kind of annoying, but it's not
-currently needed elsewhere in dovecot-auth.
+Including libsettings.a in ldap.so and pgsql.so is kind of annoying, but it's
+not needed elsewhere in dovecot-auth.
fi,
want_static_userdb=yes)
+AC_ARG_WITH(pgsql,
+[ --with-pgsql Build with PostgreSQL support],
+ if test x$withval = xno; then
+ want_pgsql=no
+ else
+ want_pgsql=yes
+ fi,
+ want_pgsql=no)
+
AC_ARG_WITH(cyrus-sasl2,
[ --with-cyrus-sasl2 Build with Cyrus SASL 2 library support],
if test x$withval = xno; then
])
fi
+if test $want_pgsql = yes; then
+ # based on code from PHP
+ for i in /usr /usr/local /usr/local/pgsql; do
+ for j in include include/pgsql include/postgres include/postgresql ""; do
+ if test -r "$i/$j/libpq-fe.h"; then
+ PGSQL_INC_BASE=$i
+ PGSQL_INCLUDE=$i/$j
+ fi
+ done
+ for j in lib lib/pgsql lib/postgres lib/postgresql ""; do
+ if test -f "$i/$j/libpq.so" || test -f "$i/$j/libpq.a"; then
+ PGSQL_LIBDIR=$i/$j
+ fi
+ done
+ done
+
+ old_LIBS=$LIBS
+ LIBS="$LIBS -L$PGSQL_LIBDIR"
+
+ AC_CHECK_LIB(pq, PQconnectdb, [
+ AC_CHECK_HEADER($PGSQL_INCLUDE/libpq-fe.h, [
+ AUTH_CFLAGS="$AUTH_CFLAGS -I$PGSQL_INCLUDE"
+ PASSDB_LIBS="$PASSDB_LIBS -L$PGSQL_LIBDIR -lpq"
+ AC_DEFINE(USERDB_PGSQL,, Build with PostgreSQL support)
+ AC_DEFINE(PASSDB_PGSQL,, Build with PostgreSQL support)
+ userdb="$userdb pgsql"
+ passdb="$passdb pgsql"
+ ])
+ ])
+ LIBS=$old_LIBS
+fi
+
if test $want_vpopmail = yes; then
vpopmail_home="`echo ~vpopmail`"
vpop_libdeps="$vpopmail_home/etc/lib_deps"
AM_CONDITIONAL(AUTH_MODULES, test "$auth_modules" = "yes")
+AC_SUBST(AUTH_CFLAGS)
AC_SUBST(PASSDB_LIBS)
dnl **
- passwd-file: /etc/passwd-like file in specified location
- ldap: Lightweight Directory Access Protocol
- vpopmail: External software used to handle virtual domains
+ - pgsql: A PostgreSQL database.
Currently supported user databases:
- ldap: Lightweight Directory Access Protocol
- vpopmail: External software used to handle virtual domains
- static: Static UID and GID, home directory from given template
+ - pgsql: A PostgreSQL database.
Most password databases support only plaintext authentication. passwd-file
and LDAP exceptions since they support multiple password schemes.
%n and %d variables, see default_mail_env description in dovecot-example.conf.
+PostgreSQL
+----------
+
+See dovecot-pgsql.conf for more information. Password and user databases may
+use different configuration files to keep the information in separate
+locations. If both refer to same file, they share the same PostgreSQL
+connection.
+
+
Generating passwords
--------------------
# Password for LDAP server
#dnpass =
+# LDAP protocol version to use. Likely 2 or 3.
+#ldap_version = 2
+
# LDAP base
base = uid=someone, dc=foo, dc=bar, dc=org
# static uid=<uid> gid=<gid> home=<dir template>: static settings
# vpopmail: vpopmail library
# ldap <config path>: LDAP, see doc/dovecot-ldap.conf
+# pgsql <config path>: a PostgreSQL database, see doc/dovecot-pgsql.conf
auth_userdb = passwd
# Where password database is kept:
# passwd-file <path>: passwd-like file with specified location
# vpopmail: vpopmail authentication
# ldap <config path>: LDAP, see doc/dovecot-ldap.conf
+# pgsql <config path>: a PostgreSQL database, see doc/dovecot-pgsql.conf
auth_passdb = pam
# Executable location
-I$(top_srcdir)/src/lib \
-I$(top_srcdir)/src/lib-settings \
-DAUTH_MODULE_DIR=\""$(libdir)/dovecot/auth"\" \
+ $(AUTH_CFLAGS) \
$(VPOPMAIL_CFLAGS)
dovecot_auth_LDADD = \
dovecot_auth_SOURCES = \
auth-module.c \
db-ldap.c \
+ db-pgsql.c \
db-passwd-file.c \
login-connection.c \
main.c \
passdb-pam.c \
passdb-shadow.c \
passdb-vpopmail.c \
+ passdb-pgsql.c \
password-scheme.c \
userdb.c \
userdb-ldap.c \
userdb-passwd.c \
userdb-passwd-file.c \
userdb-static.c \
- userdb-vpopmail.c
+ userdb-vpopmail.c \
+ userdb-pgsql.c
noinst_HEADERS = \
auth-login-interface.h \
auth-mech-desc.h \
auth-module.h \
db-ldap.h \
+ db-pgsql.h \
db-passwd-file.h \
common.h \
login-connection.h \
if (strcasecmp(name, "ldap") == 0)
passdb = &passdb_ldap;
#endif
+#ifdef PASSDB_PGSQL
+ if (strcasecmp(name, "pgsql") == 0)
+ passdb = &passdb_pgsql;
+#endif
#ifdef AUTH_MODULES
passdb_module = auth_module_open(name);
if (passdb_module != NULL) {
extern struct passdb_module passdb_pam;
extern struct passdb_module passdb_vpopmail;
extern struct passdb_module passdb_ldap;
+extern struct passdb_module passdb_pgsql;
void passdb_init(void);
void passdb_deinit(void);
if (strcasecmp(name, "ldap") == 0)
userdb = &userdb_ldap;
#endif
+#ifdef USERDB_PGSQL
+ if (strcasecmp(name, "pgsql") == 0)
+ userdb = &userdb_pgsql;
+#endif
#ifdef AUTH_MODULES
userdb_module = auth_module_open(name);
if (userdb_module != NULL) {
extern struct userdb_module userdb_passwd_file;
extern struct userdb_module userdb_vpopmail;
extern struct userdb_module userdb_ldap;
+extern struct userdb_module userdb_pgsql;
void userdb_init(void);
void userdb_deinit(void);