Sophie

Sophie

distrib > Mandriva > 10.2 > x86_64 > by-pkgid > 84ced4b9e520907a0b74657fa9ad371c > files > 2

apache2-mod_suexec-2.0.53-7mdk.src.rpm

#Module-Specific definitions
%define apache_version 2.0.53
%define mod_name mod_suexec
%define mod_conf 69_%{mod_name}.conf
%define mod_so %{mod_name}.so
%define sourcename %{mod_name}-%{apache_version}

# Standard Module Definitions
%define name apache2-%{mod_name}
%define version %{apache_version}

Summary:	Allows CGI scripts to run as a specified user and Group
Name:		%{name}
Version:	%{version}
Release:	%mkrel 7
Group:		System/Servers
License:	Apache License
URL:		http://httpd.apache.org/docs/suexec.html
Source1:	%{mod_conf}.bz2
Prereq:		rpm-helper
Prereq:		apache2 >= %{apache_version}
Prereq:		apache-conf
BuildRequires:  apache2-devel >= %{apache_version}-1mdk
BuildRequires:  apache2-source >= %{apache_version}-1mdk
BuildRoot:	%{_tmppath}/%{name}-buildroot

%description
This module, in combination with the suexec support program
allows CGI scripts to run as a specified user and Group.

Normally, when a CGI or SSI program executes, it runs as the
same user who is running the web server.

%prep

%setup -c -T -n %{name}

cp %{_includedir}/apache2/* .
cp `apr-config --includedir`/* .
cp `apu-config --includedir`/* .

echo "#define AP_GID_MIN 100"  >> ap_config_auto.h
echo "#define AP_UID_MIN 100"  >> ap_config_auto.h
echo "#define AP_DOC_ROOT \"%{_var}/www\"" >> ap_config_auto.h
echo "#define AP_HTTPD_USER \"apache\""  >> ap_config_auto.h
echo "#define AP_LOG_EXEC \"%{_var}/log/httpd/suexec_log\""  >> ap_config_auto.h
echo "#define AP_SAFE_PATH \"/usr/local/bin:/usr/bin:/bin\""  >> ap_config_auto.h
echo "#define AP_SUEXEC_UMASK 0077"  >> ap_config_auto.h
echo "#define AP_USERDIR_SUFFIX \"public_html\""  >> ap_config_auto.h

cp %{_usrsrc}/apache2-%{version}/docs/man/suexec.8 .
cp %{_usrsrc}/apache2-%{version}/docs/manual/mod/mod_suexec.html.en mod_suexec.html
cp %{_usrsrc}/apache2-%{version}/docs/manual/programs/suexec.html.en programs-suexec.html
cp %{_usrsrc}/apache2-%{version}/docs/manual/suexec.html.en suexec.html
cp %{_usrsrc}/apache2-%{version}/modules/generators/mod_suexec.c .
cp %{_usrsrc}/apache2-%{version}/modules/generators/mod_suexec.h .
cp %{_usrsrc}/apache2-%{version}/support/suexec.c .
cp %{_usrsrc}/apache2-%{version}/support/suexec.h .

%build

gcc `%{_sbindir}/apxs2 -q CFLAGS -Wall` -I. -o suexec suexec.c

%{_sbindir}/apxs2 -I. -c %{mod_name}.c

%install
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

install -d %{buildroot}%{_libdir}/apache2-extramodules
install -d %{buildroot}%{_sysconfdir}/httpd/conf.d
install -d %{buildroot}%{_sbindir}
install -d %{buildroot}%{_mandir}/man8

install -m0755 suexec %{buildroot}%{_sbindir}/apache2-suexec
install suexec.8 %{buildroot}%{_mandir}/man8/apache2-suexec.8

install -m0755 .libs/*.so %{buildroot}%{_libdir}/apache2-extramodules/
bzcat %{SOURCE1} > %{buildroot}%{_sysconfdir}/httpd/conf.d/%{mod_conf}

install -d %{buildroot}%{_var}/www/html/addon-modules
ln -s ../../../..%{_docdir}/%{name}-%{version} %{buildroot}%{_var}/www/html/addon-modules/%{name}-%{version}

cat > README.MDK << EOF
#!/bin/sh
# 
# This file shows how you can build a customised %{_sbindir}/apache2-suexec binary.
#
# It requires that you have additional development packages installed:
# urpmi apache2-devel >= %{apache_version}-1mdk
# urpmi apache2-source >= %{apache_version}-1mdk

gcc \`%{_sbindir}/apxs2 -q CFLAGS -Wall\` -I%{_includedir}/apache2 -I%{_usrsrc}/apache2-%{version}/support \\
    \`apr-config --includes\` \`apu-config --includes\` \\
    -DAP_GID_MIN=100 -DAP_UID_MIN=100 -DAP_DOC_ROOT=\"/home\" -DAP_HTTPD_USER=\"apache\" \\
    -DAP_LOG_EXEC=\"%{_var}/log/httpd/suexec_log\" \\
    -DAP_SAFE_PATH=\"/usr/local/bin:/usr/bin:/bin\" \\
    -DAP_SUEXEC_UMASK=0077 -DAP_USERDIR_SUFFIX=\"public_html\" \\
    -o %{_sbindir}/apache2-suexec %{_usrsrc}/apache2-%{version}/support/suexec.c

chown root:apache %{_sbindir}/apache2-suexec
chmod 4710 %{_sbindir}/apache2-suexec
%{_sbindir}/apache2-suexec -V

EOF

%post
if [ -f %{_var}/lock/subsys/httpd ]; then
    %{_initrddir}/httpd restart 1>&2;
fi

%postun
if [ "$1" = "0" ]; then
    if [ -f %{_var}/lock/subsys/httpd ]; then
        %{_initrddir}/httpd restart 1>&2
    fi
fi

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc mod_suexec.html suexec.html README.MDK
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{mod_conf}
%attr(0755,root,root) %{_libdir}/apache2-extramodules/%{mod_so}
%{_var}/www/html/addon-modules/*
%attr(4710,root,apache) %{_sbindir}/apache2-suexec
%{_mandir}/man8/*

%changelog
* Wed Mar 30 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53-7mdk
- provide an example how to build a customised apache2-suexec binary

* Thu Mar 17 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53-6mdk
- use the %%mkrel macro

* Sun Feb 27 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53-5mdk
- fix %%post and %%postun to prevent double restarts

* Wed Feb 16 2005 Stefan van der Eijk <stefan@eijk.nu> 2.0.53-4mdk
- fix bug #6574
 
* Wed Feb 16 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53-3mdk
- fix deps

* Tue Feb 15 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53-2mdk
- spec file cleanups, remove the ADVX-build stuff

* Tue Feb  8 2005 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.53-1mdk
- rebuilt for apache 2.0.53

* Thu Sep 16 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.50-1mdk
- rebuilt

* Tue Aug 10 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.50-3mdk
- rebuilt

* Mon Jul 12 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.50-2mdk
- remove redundant provides

* Wed Jun 30 2004 Oden Eriksson <oeriksson@mandrakesoft.com> 2.0.50-1mdk
- built for apache 2.0.50

* Fri Jun 11 2004 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.49-1mdk
- rebuilt for apache v2.0.49
- use ap*-config --includedir to get headers

* Wed Nov 05 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.48-1mdk
- built for apache 2.0.48

* Mon Jul 21 2003 David Baudens <baudens@mandrakesoft.com> 2.0.47-2mdk
- Rebuild to fix bad signature

* Thu Jul 10 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.47-1mdk
- rebuilt against latest apache2, requires and buildrequires

* Fri May 30 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.46-1mdk
- rebuilt for apache v2.0.46
- buildrequires ADVX-build >= 9.2
- misc spec file fixes

* Fri Apr 11 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.45-1mdk
- cosmetic rebuild for apache v2.0.45
- fix one missing(?) ">" in buildrequires

* Sat Feb 22 2003 Jean-Michel Dault <jmdault@mandrakesoft.com> 2.0.44-2mdk
- fix versioning
- macroize a bit more
- test package

* Fri Feb 21 2003 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.44-1mdk
- 2.0.44
- also build the module

* Thu Aug 1 2002 Oden Eriksson <oden.eriksson@kvikkjokk.net> 2.0.40-0.20020731.1mdk
- first attempt at this based on ideas from the apache1 suexec spec file...