--- /dev/null
+--- mod_authn_pam.orig/src/mod_authn_pam.c 2003-11-11 10:16:17.000000000 +0100
++++ mod_authn_pam/src/mod_authn_pam.c 2006-04-26 19:05:21.000000000 +0200
+@@ -92,6 +92,7 @@
+
+ typedef struct {
+ int fail_delay; /* fail delay in ms -- needs library support */
++ const char *service; /* service name to use for PAM authentication */
+ } authn_pam_dir_config;
+
+ static
+@@ -114,6 +115,7 @@
+ (authn_pam_dir_config *) apr_palloc(p, sizeof(authn_pam_dir_config));
+
+ new->fail_delay = 0; /* 0 ms */
++ new->service = pam_servicename; /* httpd */
+ return new;
+ }
+
+@@ -125,6 +127,11 @@
+ "number of micro seconds to wait after failed authentication "
+ "attempt. (default is 0.)"),
+
++ AP_INIT_TAKE1("AuthnPAMService",
++ ap_set_string_slot, (void *) APR_OFFSETOF(authn_pam_dir_config, service),
++ OR_AUTHCFG,
++ "PAM service name to use for authentication. (default is httpd.)"),
++
+ {NULL}
+ };
+
+@@ -216,7 +223,7 @@
+ userinfo.name = (char*)user;
+ userinfo.pw = (char*)password;
+
+- if ((res = pam_start(pam_servicename,
++ if ((res = pam_start(conf->service,
+ userinfo.name,
+ &conv_info,
+ &pamh)) != PAM_SUCCESS) {
--- /dev/null
+%define mod_name authn_pam
+%define apxs /usr/sbin/apxs
+Summary: This is the PAM authentication module for Apache 2.2
+Summary(es): Este módulo proporciona autenticación PAM para Apache 2.2
+Summary(pl): Modu³ uwierzytelnienia PAM dla Apache
+Summary(pt_BR): Este módulo provê autenticação PAM para o Apache
+Name: apache-mod_%{mod_name}
+Version: 0.0.1
+Release: 1
+Epoch: 1
+License: Apache Group License
+Group: Networking/Daemons
+Source0: mod_%{mod_name}.tar.gz
+# Source0-md5: d7e2601f226c0319e3178f00406537b7
+Source1: apache-mod_authn_pam.conf
+Source2: httpd.pam
+Patch0: apache-mod_authn_pam-AuthnPAMService.patch
+URL: http://cvs.sourceforge.net/viewcvs.py/mod-auth/mod_authn_pam/
+BuildRequires: %{apxs}
+BuildRequires: apache-devel >= 2.2
+BuildRequires: pam-devel
+BuildRequires: rpmbuild(macros) >= 1.268
+Requires: apache >= 2.2
+Requires: apache(modules-api) = %apache_modules_api
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+Provides: apache-mod_auth_pam
+
+%define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
+%define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
+
+%description
+This is an authentication module for Apache that allows you to
+authenticate HTTP clients using PAM (pluggable authentication module).
+
+%description -l es
+Este módulo permite autenticar clientes HTTP usando el directorio PAM.
+
+%description -l pl
+To jest modu³ uwierzytelnienia dla Apache pozwalaj±cy na
+uwierzytelnianie klientów HTTP przez PAM.
+
+%description -l pt_BR
+Este módulo permite que você autentique clientes HTTP usando o
+diretório PAM.
+
+%prep
+%setup -q -n mod_%{mod_name}
+%patch0 -p1
+
+%build
+cd src
+%{apxs} -c mod_%{mod_name}.c -o mod_%{mod_name}.la -lpam
+
+%install
+cd src
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_pkglibdir},/etc/pam.d,%{_sysconfdir}/httpd.conf}
+
+install .libs/mod_*.so $RPM_BUILD_ROOT%{_pkglibdir}
+install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf/52_mod_authn_pam.conf
+install %{SOURCE2} $RPM_BUILD_ROOT/etc/pam.d/httpd
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post
+%service -q httpd restart
+
+%postun
+if [ "$1" = "0" ]; then
+ %service -q httpd restart
+fi
+
+%files
+%defattr(644,root,root,755)
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf/*_mod_authn_pam.conf
+%attr(755,root,root) %{_pkglibdir}/*.so
+%config(noreplace) /etc/pam.d/httpd