--- /dev/null
+=head1 NAME
+
+authenumerate - Fetches all known users from the authentication modules
+
+=head1 SYNOPSIS
+
+authenumerate [ -m MODULE ]
+
+=head1 DESCRIPTION
+
+B<authenumerate> lists all known users from the authentication modules,
+including uid, gid and home directory. Its use is documented in
+F</usr/share/doc/courier-base/README.sharedfolders.txt.gz>.
+It may also be useful to test the authentication modules.
+
+=head1 SEE ALSO
+
+L<courierauthtest>(8)
+
+=head1 AUTHOR
+
+This manual page was written by Willi Mann <willi@wm1.at>
+for the Debian GNU/Linux system.
+
--- /dev/null
+courier-authlib (0.59.3-1) unstable; urgency=low
+
+ * new upstream release
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Mon, 23 Apr 2007 10:18:17 +0200
+
+courier-authlib (0.59.1-0.1) experimental; urgency=low
+
+ * new upstream release
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Wed, 17 Jan 2007 11:58:29 +0100
+
+courier-authlib (0.58-5) unstable; urgency=low
+
+ * added dependency and build dependency on expect (Closes: #400812,
+ thanks to Peter Troeger <peter@troeger.eu> for the report)
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Wed, 29 Nov 2006 11:42:45 +0100
+
+courier-authlib (0.58-4) unstable; urgency=medium
+
+ * call dh_makeshlibs during binary-arch target in order to get proper shlib
+ information for libcourierauth.so (Closes: #378249, thanks to Charles
+ Fry <cfry@debian.org> for the report and Steinar H. Gunderson
+ <sesse@debian.org> for the patch)
+ * ensure that courier-authdaemon is upgraded when switching to courier-authlib
+ * switch to lsb logging functions (Closes: #384823, thanks to David Härdeman
+ <david@2gen.com> for the patch)
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Sat, 9 Sep 2006 17:37:11 +0200
+
+courier-authlib (0.58-3.1) unstable; urgency=medium
+
+ * Non-Maintainer Upload to fix security bug, caused by
+ /var/run/courier/authdaemon being world executable. Thanks to Martin
+ Ferrari for the fix. (Closes: #378571)
+
+ -- Margarita Manterola <marga@debian.org> Tue, 1 Aug 2006 16:45:07 -0300
+
+courier-authlib (0.58-3) unstable; urgency=low
+
+ * remove all Courier runtime files on purge of courier-authdaemon
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Tue, 6 Jun 2006 04:48:20 +0200
+
+courier-authlib (0.58-2) unstable; urgency=low
+
+ * set ownership of /var/run/courier and /var/run/courier/authdaemon to
+ daemon.daemon (Closes: #368358, #368360)
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Tue, 23 May 2006 09:43:15 +0200
+
+courier-authlib (0.58-1.0) unstable; urgency=low
+
+ * first upload to unstable
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Fri, 12 May 2006 16:53:38 +0200
+
+courier-authlib (0.58-0.4) experimental; urgency=low
+
+ * changed alternative dependency for libmysqlclient-dev to
+ libmysqlclient15-dev (Closes: #356728, thanks to Stefan Huehner
+ <huehner@unix-ag.uni-kl.de> for the report)
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Tue, 14 Mar 2006 11:14:11 +0100
+
+courier-authlib (0.58-0.3) experimental; urgency=low
+
+ * courier-authlib-userdb conflicts with pre-authlib courier-base package
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Wed, 11 Jan 2006 09:33:10 +0100
+
+courier-authlib (0.58-0.2) experimental; urgency=low
+
+ * updated config.{guess,sub} to avoid FTBFS on some architectures
+ (Closes: #346105, thanks to Petr Salinger
+ <Petr.Salinger@t-systems.cz>)
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Fri, 6 Jan 2006 11:13:19 +0100
+
+courier-authlib (0.58-0.1) experimental; urgency=low
+
+ * new upstream release
+ * transition to new PostgreSQL architecture (Closes: #339297, thanks to
+ Martin Pitt <mpitt@debian.org> for the report and the patch)
+ * added courier-authlib-mysql/postgresql prerm/postinst scripts to
+ restart courier-authdaemon
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Thu, 5 Jan 2006 14:58:19 +0100
+
+courier-authlib (0.57.20051004-2) experimental; urgency=low
+
+ * ship configuration files with sane ownership/permissions
+ * restoring call to pam_acct_mgmt
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Fri, 11 Nov 2005 00:49:19 +0100
+
+courier-authlib (0.57.20051004-1) experimental; urgency=low
+
+ * new upstream release:
+ - contains authtest manual page and authpasswd script
+ * keep authtest name instead of renaming to courierauthtest, there are
+ currently no conflicts with other binaries
+ * separate package courier-authlib-pipe for authpipe module
+ * revive courier-authdaemon package to allow seamless upgrades from sarge
+ * changed FSF address in copyright file
+ * changed BuildDepends from libmysqlclient10-dev to libmysqlclient14-dev
+ * use DH_COMPAT=4
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Tue, 25 Oct 2005 11:04:45 +0200
+
+courier-authlib (0.56-0.5) experimental; urgency=low
+
+ * added build dependency on procps (Closes: #311976, thanks to Kurt
+ Roeckx <kurt@roeckx.be> for the report)
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Sat, 4 Jun 2005 22:03:43 +0200
+
+courier-authlib (0.56-0.4) experimental; urgency=low
+
+ * provide proper LDAP configuration file instead of an empty one (thanks
+ to Peter Mann <Peter.Mann@tuke.sk> for the report)
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Tue, 31 May 2005 14:48:04 +0200
+
+courier-authlib (0.56-0.3) experimental; urgency=low
+
+ * added dependency to courier-authlib-dev on courier-authlib
+ * versioned dependencies for courier-authlib-* packages
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Tue, 31 May 2005 11:13:01 +0200
+
+courier-authlib (0.56-0.2) experimental; urgency=low
+
+ * removed check for openssl binary (Closes: #311175, thanks to Kenshi
+ Muto <kmuto@debian.org> for the report)
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Mon, 30 May 2005 13:23:02 +0200
+
+courier-authlib (0.56-0.1) experimental; urgency=low
+
+ * initial release
+
+ -- Stefan Hornburg (Racke) <racke@linuxia.de> Fri, 27 May 2005 23:20:21 +0200
+
--- /dev/null
+Source: courier-authlib
+Section: mail
+Priority: optional
+Maintainer: Stefan Hornburg (Racke) <racke@linuxia.de>
+Standards-Version: 3.6.1.1
+Build-Depends: libmysqlclient-dev | libmysqlclient15-dev, libpam0g-dev, libgdbm-dev | libgdbmg1-dev, debhelper (>= 4.1.16), libldap-dev, libsasl2-dev | libsasl-dev, libpq-dev | postgresql-dev, libtool, libltdl3-dev, procps, expect
+
+Package: courier-authlib
+Architecture: any
+Depends: ${shlibs:Depends}, expect
+Conflicts: courier-base (<< 0.48), courier-authdaemon (<< 0.58), courier-authmysql, courier-authpostgresql
+Description: Courier authentication library
+ The Courier authentication library provides authentication services for
+ other Courier applications.
+
+Package: courier-authdaemon
+Architecture: any
+Depends: ${shlibs:Depends}, courier-authlib (>= ${RELUP}), lsb-base (>= 3.0-10)
+Description: Courier authentication daemon
+ This package contains the authentication daemon for the Courier applications.
+
+Package: courier-authlib-dev
+Architecture: any
+Depends: ${shlibs:Depends}, courier-authlib (>= ${RELUP})
+Conflicts: courier-base (<< 0.48)
+Description: Development libraries for the Courier authentication library
+ This package contains the development libraries and files needed to compile
+ Courier packages that use the Courier authentication library.
+
+Package: courier-authlib-userdb
+Architecture: any
+Depends: ${shlibs:Depends}, courier-authlib (>= ${RELUP})
+Conflicts: courier-base (<< 0.48)
+Description: userdb support for the Courier authentication library
+ This package contains the userdb support for the Courier authentication
+ library. Userdb is a simple way to manage virtual mail accounts using
+ a GDBM-based database file.
+
+Package: courier-authlib-mysql
+Architecture: any
+Depends: ${shlibs:Depends}, courier-authlib (>= ${RELUP})
+Conflicts: courier-authmysql
+Replaces: courier-authmysql
+Description: MySQL support for the Courier authentication library
+ This package contains the MySQL support for the Courier authentication library.
+
+Package: courier-authlib-postgresql
+Architecture: any
+Depends: ${shlibs:Depends}, courier-authlib (>= ${RELUP})
+Conflicts: courier-authpostgresql
+Replaces: courier-authpostgresql
+Description: PostgreSQL support for the Courier authentication library
+ This package contains the PostgreSQL support for the Courier authentication
+ library.
+
+Package: courier-authlib-ldap
+Architecture: any
+Depends: ${shlibs:Depends}, courier-authlib (>= ${RELUP})
+Description: LDAP support for the Courier authentication library
+ This package contains the LDAP support for the Courier authentication library.
+
+Package: courier-authlib-pipe
+Architecture: any
+Depends: ${shlibs:Depends}, courier-authlib (>= ${RELUP})
+Description: External authentication support for the Courier authentication library
+ This package contains external authentication support via pipes for the
+ Courier authentication library. The authpipe module is a generic plugin
+ that enables authentication requests to be serviced by an external
+ program, then communicates through messages on stdin and stdout.
--- /dev/null
+This package was debianized by Stefan Hornburg (Racke) <racke@linuxia.de> on
+Fri Oct 29 10:59:13 2004 CEST.
+
+It was downloaded from:
+ftp://courier.sourceforge.net/pub/courier/courier/
+
+Upstream Author:
+
+Sam Varshavchik <mrsam@courier-mta.com>
+Double Precision, Inc.
+PO Box 668
+Greenwood Lake, NY 10925
+
+Copyright:
+
+This software is released under the GPL, version 2.
+Additionally, compiling, linking, and/or using the OpenSSL toolkit in
+conjunction with this software is allowed.
+
+A copy of the GNU General Public License is available as
+/usr/share/common-licenses/GPL in the Debian GNU/Linux distribution or on the
+World Wide Web at http://www.gnu.org/copyleft/gpl.html. You can also
+obtain it by writing to the Free Software Foundation, Inc., 51 Franklin St,
+Fifth Floor, Boston, MA 02110-1301, USA.
+
--- /dev/null
+/var/run/courier/authdaemon
--- /dev/null
+/etc/courier/authdaemonrc
+/usr/sbin/authdaemond
+/var/run/courier/authdaemon
--- /dev/null
+#! /bin/sh -e
+
+prefix="/usr"
+exec_prefix=${prefix}
+sysconfdir="/etc/courier"
+sbindir="${exec_prefix}/sbin"
+daemonscript="${sbindir}/authdaemond"
+
+. /lib/lsb/init-functions
+
+# Check for a leftover init script
+if [ ! -x $daemonscript ]; then
+ exit 0
+fi
+
+case "$1" in
+start)
+ # Start daemon.
+ cd /
+ log_daemon_msg "Starting Courier authentication services" "authdaemond"
+ $daemonscript start
+ log_end_msg 0
+ ;;
+stop)
+ # Stop daemon.
+ cd /
+ log_daemon_msg "Stopping Courier authentication services" "authdaemond"
+ $daemonscript stop
+ log_end_msg 0
+ ;;
+restart|reload|force-reload)
+ $0 stop
+ $0 start
+ ;;
+*)
+ echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
+ exit 2
+ ;;
+esac
+exit 0
--- /dev/null
+#! /bin/sh -e
+#
+# Copyright 2000,2001,2006 by Stefan Hornburg (Racke) <racke@linuxia.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA.
+
+if [ "$1" = "purge" ]; then
+ # remove runtime files
+ rm -rf /var/run/courier
+fi
+
+#DEBHELPER#
--- /dev/null
+/usr/bin/courierauthconfig
+/usr/include
+/usr/lib/courier-authlib/*.a
+/usr/lib/courier-authlib/*.la
+/usr/share/man/man3
+
--- /dev/null
+README.ldap
+authldap.schema
\ No newline at end of file
--- /dev/null
+/etc/courier/authldaprc
+/usr/lib/courier-authlib/libauthldap.so*
\ No newline at end of file
--- /dev/null
+README.authmysql.html
--- /dev/null
+/etc/courier/authmysqlrc
+/usr/lib/courier-authlib/libauthmysql.so*
\ No newline at end of file
--- /dev/null
+#! /bin/sh -e
+#
+# Copyright 2000,2001,2005 by Stefan Hornburg (Racke) <racke@linuxia.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA.
+
+
+if [ "$1" = "configure" ]; then
+ if [ -z "$2" ]; then
+ # initial install of authmysql, we need to restart authdaemon
+ if [ -x /usr/sbin/authdaemond ]; then
+ /usr/sbin/authdaemond restart
+ fi
+ fi
+fi
+
+#DEBHELPER#
--- /dev/null
+#! /bin/sh -e
+#
+# Copyright 2000,2005 by Stefan Hornburg <racke@linuxia.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA.
+
+# we need to restart authdaemon
+if [ -x /usr/sbin/authdaemond ]; then
+ /usr/sbin/authdaemond restart
+fi
+
+#DEBHELPER#
--- /dev/null
+/usr/lib/courier-authlib/libauthpipe*.so*
+
--- /dev/null
+README.authmysql.html
+README.authpostgres.html
\ No newline at end of file
--- /dev/null
+/etc/courier/authpgsqlrc
+/usr/lib/courier-authlib/libauthpgsql.so*
--- /dev/null
+#! /bin/sh -e
+#
+# Copyright 2001,2005 by Stefan Hornburg (Racke) <racke@linuxia.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA.
+
+
+if [ "$1" = "configure" ]; then
+ if [ -z "$2" ]; then
+ # initial install of authpostgresql, we need to restart authdaemon
+ if [ -x /usr/sbin/authdaemond ]; then
+ /usr/sbin/authdaemond restart
+ fi
+ fi
+fi
+
+#DEBHELPER#
--- /dev/null
+#! /bin/sh -e
+#
+# Copyright 2001,2005 by Stefan Hornburg <racke@linuxia.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA.
+
+# we need to restart authdaemon
+if [ -x /usr/sbin/authdaemond ]; then
+ /usr/sbin/authdaemond restart
+fi
+
+#DEBHELPER#
--- /dev/null
+/usr/lib/courier-authlib/libauthuserdb.so
+/usr/lib/courier-authlib/libauthuserdb.so.0
+/usr/lib/courier-authlib/libauthuserdb.so.0.0.0
+/usr/sbin/makeuserdb
+/usr/sbin/pw2userdb
+/usr/sbin/vchkpw2userdb
+/usr/sbin/userdb
+/usr/sbin/userdbpw
+/usr/sbin/userdb-test-cram-md5
+/usr/share/man/man8/makeuserdb.8
+/usr/share/man/man8/pw2userdb.8.gz
+/usr/share/man/man8/vchkpw2userdb.8.gz
+/usr/share/man/man8/userdb.8
+/usr/share/man/man8/userdbpw.8
+
+
+
+
--- /dev/null
+README.authdebug.html
--- /dev/null
+/usr/lib/courier/courier-authlib/
+/usr/lib/courier-authlib/libcourierauth*.so*
+/usr/lib/courier-authlib/libauthcustom*.so*
+/usr/lib/courier-authlib/libauthpam*.so*
+/usr/sbin/authenumerate
+/usr/sbin/authpasswd
+/usr/sbin/authtest
+/usr/sbin/courierlogger
+/usr/share/man/man1/authpasswd.1
+/usr/share/man/man1/authtest.1
+/usr/share/man/man1/courierlogger.1
+/usr/share/man/man8/authenumerate.8
+
+
--- /dev/null
+#! /bin/sh -e
+#
+# Copyright 2000,2001 by Stefan Hornburg (Racke) <racke@linuxia.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA.
+
+if [ "$1" = "purge" ]; then
+ # remove runtime files
+ rm -rf /var/run/courier/authdaemon
+fi
+
+#DEBHELPER#
--- /dev/null
+#!/usr/bin/perl -w
+
+=head1 NAME
+
+dh_perms - set some special permissions after dh_fixperms
+
+=cut
+
+use strict;
+use Debian::Debhelper::Dh_Lib;
+
+=head1 SYNOPSIS
+
+B<dh_perms> [S<I<debhelper options>>]
+
+=head1 DESCRIPTION
+
+dh_perms is a debhelper program that is responsible for setting the
+permissions of files and directories according to the information in
+debian/permissions. It is intended to be run after dh_fixperms.
+
+The file debian/permissions is a tab seperated file where the first column
+contains a filename, the second one the permissions in octal format, the
+third one the owner and the fourth one the group. A dash in columns 2 to 4
+means that this information will not be modified.
+
+=head1 OPTIONS
+
+=over 4
+
+None except the standard debhelper options.
+
+=back
+
+=cut
+
+init();
+
+my %perms;
+my %owners;
+my %groups;
+
+# TODO: There should be a way to change this by command-line
+my $permfile = "debian/permissions";
+
+open PERMFILE, $permfile or exit 0; #print "could not open permfile\n";
+while (my $curline = <PERMFILE>)
+{
+ #NOTE: Broken lines are not always detected. (e.g. not defining anything valid)
+
+ # remove lineend
+ chomp($curline);
+ # skip comments/empty lines
+ next if $curline =~ /^#/ || $curline !~ /\S/;
+ (my $filename, my $octmode, my $owner, my $group) = split (/\s+/, $curline);
+
+ die qq{$0: could not accept "$curline": wrong octmode $octmode\n} unless $octmode =~ /^[0-7]{3,4}$/;
+ $perms{$filename} = $octmode unless $octmode eq "-" or not defined $octmode;
+
+ $owner = getpwnam($owner) if defined getpwnam($owner);
+ $owners{$filename} = $owner unless $owner eq "-" or not defined $owner;
+
+ $group = getgrnam($group) if defined getpwnam($group);
+ $groups{$filename} = $group unless $group eq "-" or not defined $group;
+
+}
+close PERMFILE;
+
+
+foreach my $package (@{$dh{DOPACKAGES}}) {
+ my $tmp=tmpdir($package);
+ foreach my $file (keys %owners)
+ {
+ next unless -e $tmp.$file;
+ chown $owners{$file}, -1, $tmp.$file or die "failed to chown $file";
+ verbose_print "chowned file $file to $owners{$file}";
+ }
+ foreach my $file (keys %groups)
+ {
+ next unless -e $tmp.$file;
+ chown -1, $groups{$file}, $tmp.$file or die "failed to chgrp $file";
+ verbose_print "chgrped file $file to $groups{$file}";
+ }
+ foreach my $file (keys %perms)
+ {
+ next unless -e $tmp.$file;
+ my $nummod = oct("0".$perms{$file});
+ chmod $nummod, $tmp.$file or die "failed to chmod $file";
+ verbose_print "chmoded file $file to ".sprintf("0%o", $nummod);
+ }
+
+}
+
+=head1 SEE ALSO
+
+L<debhelper(7)>
+
+This program is not yet part of debhelper.
+
+=head1 AUTHOR
+
+Willi Mann <willi@wm1.at>
+
+=cut
+
--- /dev/null
+/etc/courier/authldaprc 660 daemon daemon
+/etc/courier/authpgsqlrc 660 daemon daemon
+/etc/courier/authmysqlrc 660 daemon daemon
+/etc/courier/authdaemonrc 660 daemon daemon
+/var/run/courier 755 daemon daemon
+/var/run/courier/authdaemon 750 daemon daemon
+
+
+
--- /dev/null
+#!/usr/bin/make -f
+#
+# Copyright 2004,2005 by Stefan Hornburg (Racke) <racke@linuxia.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with this program; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA.
+
+BUILD=$(shell pwd)/debian/tmp
+RELUP=$(shell dpkg-parsechangelog | perl -ne 'print $$1 if /^Version: (.*?)-(.*)$$/')
+
+# Uncomment this to turn on verbose mode.
+# export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=4
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+# Common configuration options
+NONSSL_CONFOPTS=--without-certdb --without-authpgsql
+
+COMMON_CONFOPTS=--prefix=/usr --mandir=\$${prefix}/share/man \
+ --with-authdaemonvar=/var/run/courier/authdaemon \
+ --sysconfdir=/etc/courier \
+ --with-pkgconfdir=/etc/courier \
+ --libexecdir=\$${prefix}/lib/courier \
+ --datadir=\$${prefix}/lib/courier \
+ --localstatedir=/var/lib/courier \
+ --sbindir=\$${exec_prefix}/sbin \
+ --with-mailuser=daemon \
+ --with-mailgroup=daemon \
+ --without-socks \
+ --with-authpam \
+ --with-authpipe \
+ --without-authpwd \
+ --with-authmysql \
+ --with-mysql-includes=/usr/include/mysql \
+ --with-mysql-libs=/usr/lib \
+ --with-authmysqlrc=/etc/courier/authmysqlrc \
+ --with-authpgsql \
+ --with-pgsql-includes=`pg_config --includedir` \
+ --with-pgsql-libs=/usr/lib \
+ --with-authpgsqlrc=/etc/courier/authpgsqlrc \
+ --without-authshadow \
+ --without-authvchkpw \
+ --with-authdaemonvar=/var/run/courier/authdaemon \
+ --with-authldap \
+ --with-authldaprc=/etc/courier/authldaprc \
+ --with-authcram \
+ --with-db=gdbm \
+ --without-fcgi \
+ --with-htmllibdir=/usr/share/sqwebmail \
+ --with-ispell=/usr/bin/ispell \
+ --enable-userdb \
+ --enable-syslog=1 \
+ --disable-root-check
+
+check:
+ dh_testdir
+
+# check umask
+ if [ `umask` != "0022" ]; then echo "You need to set umask to 022 in order to compile/build courier"; exit 1; fi
+ chmod +x debian/courier_perms
+
+build: check
+# create a list of files that currently exists
+ if [ ! -f stamp-build ]; then \
+ if [ -d /usr/include/postgresql/8.0/libpq_fe.h ]; then \
+ LDFLAGS=-lcrypt ./configure $(COMMON_CONFOPTS) \
+ --with-postgresql-includes=/usr/include/postgresql/8.0 \
+ && $(MAKE) && touch stamp-build; \
+ else \
+ LDFLAGS=-lcrypt ./configure $(COMMON_CONFOPTS) \
+ --with-postgresql-includes=/usr/include/postgresql \
+ && $(MAKE) && touch stamp-build; \
+ fi \
+ fi
+
+stamp-build: build
+
+clean: check
+ dh_testroot
+ rm -f stamp-build stamp-install
+
+# Add here commands to clean up after the build process.
+ -$(MAKE) clean
+ dh_clean
+
+install: check stamp-build
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+# Add here commands to install the package into debian/tmp.
+ $(MAKE) DESTDIR=$(BUILD) install
+
+# (cd $(BUILD)/usr/lib/courier/courier-authlib/changepwd; ln -fs ../../authsystem.passwd ./authsystem.passwd)
+
+# Install authentification test program
+# mv $(BUILD)/usr/sbin/authtest $(BUILD)/usr/sbin/courierauthtest
+
+# Additional manpages
+ pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/authenumerate.pod > $(BUILD)/usr/share/man/man8/authenumerate.8
+# pod2man --center='Debian GNU/Linux Documentation' --release='Debian GNU/Linux '`cat /etc/debian_version` --section=8 debian/courierauthtest.pod > $(BUILD)/usr/share/man/man8/courierauthtest.8
+
+# Symlinks for userdb manpages
+ (cd $(BUILD)/usr/share/man/man8 && ln -s makeuserdb.8.gz pw2userdb.8.gz && ln -s makeuserdb.8.gz vchkpw2userdb.8.gz)
+
+ dh_installdocs
+# - change authentification default settings
+ perl -pe 's/^authmodulelist=".*?"/authmodulelist="authpam"/' $(BUILD)/etc/courier/authdaemonrc.dist > $(BUILD)/etc/courier/authdaemonrc
+# - change default LDAP server
+ perl -pe 's/^(LDAP_SERVER\s+)ldap.example.com/$$1localhost/' $(BUILD)/etc/courier/authldaprc.dist > $(BUILD)/etc/courier/authldaprc
+# - change default MySQL server
+ perl -pe 's/^(MYSQL_SERVER\s+)mysql.example.com/$$1localhost/;s%^(#?\s*MYSQL_SOCKET\s+)/.*%$$1/var/run/mysqld/mysqld.sock%' $(BUILD)/etc/courier/authmysqlrc.dist > $(BUILD)/etc/courier/authmysqlrc
+ mv $(BUILD)/etc/courier/authpgsqlrc.dist $(BUILD)/etc/courier/authpgsqlrc
+ rm $(BUILD)/etc/courier/*.dist
+
+# This seems to be necessary for building in fakeroot
+# environment (otherwise dh_strip fails)
+# set all binaries to 755, by checking if user has x-bit
+# debian/courier_perms will set the right permissions
+ find $(BUILD) -perm -u+x -type f | xargs chmod u+rwx,go+rx
+
+ dh_movefiles
+
+# Check if all files have moved out
+ if [ `find $(BUILD) -not -type d | wc -l` -ne 0 ]; then find $(BUILD) -not -type d; echo "File(s) found not belonging to any package, please contact maintainer"; exit 1; fi
+
+ touch stamp-install
+
+stamp-install: install
+
+# Build architecture-independent files here.
+binary-indep: stamp-build stamp-install
+ dh_testdir
+ dh_testroot
+# dh_installdebconf -i
+ dh_installexamples -i
+ dh_installmenu -i
+ dh_installinit -i
+ dh_installinfo -i
+ dh_installchangelogs -i
+ dh_strip -i
+ dh_link -i
+ dh_compress -i
+ dh_fixperms -i
+ debian/courier_perms -i
+ dh_installdeb -i
+ dh_perl -i
+ dh_shlibdeps -i
+ dh_gencontrol -i
+ dh_md5sums -i
+ dh_builddeb -i
+
+# Build architecture-dependent files here.
+binary-arch: stamp-build stamp-install
+ dh_testdir
+ dh_testroot
+# dh_installdebconf -a
+ dh_installexamples -a
+ dh_installmenu -a
+ dh_installinit -a
+ dh_installcron -a
+ dh_installinfo -a
+ dh_installchangelogs -a
+ dh_strip -a
+ dh_link -a
+ dh_compress -a
+ dh_fixperms -a
+ debian/courier_perms -a
+ dh_installdeb -a
+ dh_perl -a
+ dh_makeshlibs -a
+ dh_shlibdeps -a
+ dh_gencontrol -- -VRELUP="$(RELUP)"
+ dh_md5sums -a
+ dh_builddeb -a
+
+binary: binary-arch
+
+.PHONY: check build clean binary-arch binary install