From e92544b91d5037be2b22f3ce46ea5efd47ad871e Mon Sep 17 00:00:00 2001 From: Scott Shambarger Date: Tue, 15 Sep 2015 15:01:23 -0700 Subject: [PATCH 1/4] Fixed conditional in spec file --- mod_auth_tkt.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod_auth_tkt.spec b/mod_auth_tkt.spec index a7306e8..6e9f63b 100644 --- a/mod_auth_tkt.spec +++ b/mod_auth_tkt.spec @@ -2,7 +2,7 @@ # Use "--define='apache 1'" to build a 'mod_auth_tkt1' package for apache1 %define httpd httpd %define name mod_auth_tkt -%if %{rhel} < 7 +%if 0%{?rhel} && 0%{?rhel} < 7 %define apxs /usr/sbin/apxs %else %define apxs /usr/bin/apxs From 6bd3fa5fd2f343d35889f5a03c8c4c175ce153b9 Mon Sep 17 00:00:00 2001 From: Scott Shambarger Date: Mon, 16 Nov 2015 17:47:02 -0800 Subject: [PATCH 2/4] Cleanup spec and configure files to correctly locate mandir, docdir, and http modules and config --- configure | 29 +++++++++++++++--------- mod_auth_tkt.spec | 57 ++++++++++++++++++++++++++--------------------- 2 files changed, 50 insertions(+), 36 deletions(-) diff --git a/configure b/configure index d1ed77f..1a39b75 100755 --- a/configure +++ b/configure @@ -14,8 +14,20 @@ if [ $DIR = '.' ]; then DIR=`pwd` fi +# find default MANDIR +if [ -d /usr/share/man ]; then + MANDIR=/usr/share/man +elif [ -d /usr/man ]; then + MANDIR=/usr/man +elif [ "$MANPATH" != "" ]; then + # choose first dir in MANPATH + MANDIR="${MANPATH%%:*}" +else + MANDIR=/usr/share/man +fi + usage() { - echo "usage: $ME [--apxs=/path/to/apxs] [--apachever=<1|2|2.2>] [--debug]" + echo "usage: $ME [--apxs=${APXS:-/path/to/apxs}] [--apachever=<1|2|2.2|2.4>] [--mandir=$MANDIR] [--debug]" } die() { echo $* @@ -38,6 +50,10 @@ do APXS=$ac_optarg ;; --apxs) ac_prev=APXS ;; + --mandir=*) + MANDIR=$ac_optarg ;; + --mandir) + ac_prev=MANDIR ;; --apachever=*) VERSION=$ac_optarg ;; --debug) @@ -94,16 +110,7 @@ else echo "TARGET = mod_auth_tkt.la" >> Makedefs fi echo "BASEDIR = $DIR" >> Makedefs - -if [ "$MANPATH" != "" ]; then - echo "MANPATH = $MANPATH" >> Makedefs -else - if [ -d /usr/share/man ]; then - echo "MANPATH = /usr/share/man" >> Makedefs - else - echo "MANPATH = /usr/man" >> Makedefs - fi -fi +echo "MANPATH = $MANDIR" >> Makedefs MAT_VERSION=`cat VERSION` echo "MAT_VERSION = $MAT_VERSION" >> Makedefs diff --git a/mod_auth_tkt.spec b/mod_auth_tkt.spec index 6e9f63b..371c6b8 100644 --- a/mod_auth_tkt.spec +++ b/mod_auth_tkt.spec @@ -2,21 +2,25 @@ # Use "--define='apache 1'" to build a 'mod_auth_tkt1' package for apache1 %define httpd httpd %define name mod_auth_tkt +%{!?_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} %if 0%{?rhel} && 0%{?rhel} < 7 -%define apxs /usr/sbin/apxs +%global apxs /usr/sbin/apxs %else -%define apxs /usr/bin/apxs +%global apxs /usr/bin/apxs %endif +%{?_httpd_apxs:%global apxs %{_httpd_apxs}} %{?apache:%define httpd apache} %{?apache:%define name mod_auth_tkt1} %{?apache:%define apxs /usr/sbin/apxs1} +%{!?_httpd_confdir:%global _httpd_confdir %{_sysconfdir}/%{httpd}/conf.d} +%{!?_httpd_moddir:%global _httpd_moddir %{_libdir}/%{httpd}/modules} %define perl_vendorlib %(eval "`perl -V:installvendorlib`"; echo $installvendorlib) Summary: Lightweight ticket-based authentication module for Apache. Name: %{name} Version: 2.3.99b1 -Release: 1%{?org_tag}%{?dist} +Release: 2%{?org_tag}%{?dist} License: Apache Group: Applications/System Source: http://www.openfusion.com.au/labs/dist/mod_auth_tkt-%{version}.tar.gz @@ -33,7 +37,7 @@ authentication requires a user-supplied CGI or script of some kind - see the mod_auth_tkt-cgi package for perl cgi versions. %package cgi -Release: 1%{?org_tag}%{?dist} +Release: 2%{?org_tag}%{?dist} Summary: CGI scripts for mod_auth_tkt apache authentication modules. Group: Applications/System Requires: %{name} = %{version} @@ -49,37 +53,37 @@ Perl CGI scripts for use with mod_auth_tkt. test %{debug} == 1 && DEBUG='--debug' MOD_PERL=`rpm -q mod_perl | grep '^mod_perl' || /bin/true` if [ -n "$MOD_PERL" -a %{test} == 1 ]; then - ./configure --apxs=%{apxs} --test $DEBUG + ./configure --apxs=%{apxs} --mandir=%{_mandir} --test $DEBUG make make test else - ./configure --apxs=%{apxs} $DEBUG + ./configure --apxs=%{apxs} --mandir=%{_mandir} $DEBUG make fi %install test "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_libdir}/%{httpd}/modules -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/%{httpd}/conf.d -#mkdir -p $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version}/cgi -mkdir -p $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version}/contrib +mkdir -p $RPM_BUILD_ROOT%{_httpd_moddir} +mkdir -p $RPM_BUILD_ROOT%{_httpd_confdir} +#mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/cgi +mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/contrib mkdir -p $RPM_BUILD_ROOT/var/www/auth #mkdir -p $RPM_BUILD_ROOT/%{perl_vendorlib}/Apache if [ %{httpd} == apache ]; then - %{apxs} -i -n "auth_tkt" -S LIBEXECDIR=$RPM_BUILD_ROOT%{_libdir}/%{httpd}/modules src/mod_auth_tkt.so + %{apxs} -i -n "auth_tkt" -S LIBEXECDIR=$RPM_BUILD_ROOT%{_httpd_moddir} src/mod_auth_tkt.so else - %{apxs} -i -n "auth_tkt" -S LIBEXECDIR=$RPM_BUILD_ROOT%{_libdir}/%{httpd}/modules src/mod_auth_tkt.la + %{apxs} -i -n "auth_tkt" -S LIBEXECDIR=$RPM_BUILD_ROOT%{_httpd_moddir} src/mod_auth_tkt.la fi -install -m 644 conf/02_auth_tkt.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{httpd}/conf.d/ -install -m 644 conf/auth_tkt_cgi.conf $RPM_BUILD_ROOT%{_sysconfdir}/%{httpd}/conf.d/ +install -m 644 conf/02_auth_tkt.conf $RPM_BUILD_ROOT%{_httpd_confdir} +install -m 644 conf/auth_tkt_cgi.conf $RPM_BUILD_ROOT%{_httpd_confdir} #cp cgi/Apache/* $RPM_BUILD_ROOT/%{perl_vendorlib}/Apache -#cp -pr cgi/* $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version}/cgi -#rm -rf $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version}/cgi/Apache +#cp -pr cgi/* $RPM_BUILD_ROOT%{_pkgdocdir}/cgi +#rm -rf $RPM_BUILD_ROOT%{_pkgdocdir}/cgi/Apache cp -pr cgi/* $RPM_BUILD_ROOT/var/www/auth rm -rf $RPM_BUILD_ROOT/var/www/auth/Apache -cp -pr contrib/* $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version}/contrib -rm -rf $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version}/contrib/t -cp -pr README* INSTALL LICENSE CREDITS $RPM_BUILD_ROOT/usr/share/doc/%{name}-%{version} +cp -pr contrib/* $RPM_BUILD_ROOT%{_pkgdocdir}/contrib +rm -rf $RPM_BUILD_ROOT%{_pkgdocdir}/contrib/t +cp -pr README* INSTALL LICENSE CREDITS $RPM_BUILD_ROOT%{_pkgdocdir} cd doc make DESTDIR=$RPM_BUILD_ROOT install @@ -88,20 +92,23 @@ test "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) -%{_libdir}/%{httpd} +%{_httpd_moddir}/* #%{perl_vendorlib}/Apache/AuthTkt.pm -%doc /usr/share/doc/%{name}-%{version} -%attr(0640,root,apache) %config(noreplace) %{_sysconfdir}/%{httpd}/conf.d/02_auth_tkt.conf -/usr/share/man/*/* +%doc %{_pkgdocdir} +%attr(0640,root,apache) %config(noreplace) %{_httpd_confdir}/02_auth_tkt.conf +%{_mandir}/*/* %files cgi %defattr(-,root,root) -%attr(0640,root,apache) %config(noreplace) %{_sysconfdir}/%{httpd}/conf.d/auth_tkt_cgi.conf +%attr(0640,root,apache) %config(noreplace) %{_httpd_confdir}/auth_tkt_cgi.conf %config(noreplace)/var/www/auth/AuthTktConfig.pm %config(noreplace)/var/www/auth/tkt.css /var/www/auth/*.cgi %changelog +* Mon Nov 16 2015 Scott Shambarger 2.3.99b1-2 +- Cleanup spec and configure files + * Fri Jul 31 2015 Gavin Carr 2.3.99b1-1 - Update to version 2.3.99b1, 2.4 release beta1. @@ -133,7 +140,7 @@ test "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT - Factor out cgi config settings into AuthTktConfig.pm. - Bump to version 2.0.0rc3. -* Wed Nov 28 2006 Gavin Carr 2.0.0rc2 +* Tue Nov 28 2006 Gavin Carr 2.0.0rc2 - Bump to version 2.0.0rc2. * Wed Nov 01 2006 Charlie Brady 2.0.0rc1-2 From fc35e8743732ed4a68693c147e204a7f45d29a0c Mon Sep 17 00:00:00 2001 From: Scott Shambarger Date: Tue, 8 Jan 2019 21:41:36 -0800 Subject: [PATCH 3/4] Correctly clear the context in sha2.c --- src/sha2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sha2.c b/src/sha2.c index f0811f4..feca32e 100644 --- a/src/sha2.c +++ b/src/sha2.c @@ -562,7 +562,7 @@ void mat_SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { } /* Clean up state data: */ - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); usedspace = 0; } @@ -584,7 +584,7 @@ char *mat_SHA256_End(SHA256_CTX* context, char buffer[]) { } *b = (char)0; } else { - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH); return buffer; @@ -895,7 +895,7 @@ void mat_SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { } /* Zero out state data */ - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } char *mat_SHA512_End(SHA512_CTX* context, char buffer[]) { @@ -916,7 +916,7 @@ char *mat_SHA512_End(SHA512_CTX* context, char buffer[]) { } *b = (char)0; } else { - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH); return buffer; @@ -971,7 +971,7 @@ void mat_SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { } /* Zero out state data */ - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } char *mat_SHA384_End(SHA384_CTX* context, char buffer[]) { @@ -992,7 +992,7 @@ char *mat_SHA384_End(SHA384_CTX* context, char buffer[]) { } *b = (char)0; } else { - MEMSET_BZERO(context, sizeof(context)); + MEMSET_BZERO(context, sizeof(*context)); } MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH); return buffer; From 41002b235f4b57ee769da5b6be3385d1021c2b6e Mon Sep 17 00:00:00 2001 From: Scott Shambarger Date: Tue, 8 Jan 2019 21:45:08 -0800 Subject: [PATCH 4/4] Apply Redhat packaging guidelines to spec file --- mod_auth_tkt.spec | 107 ++++++++++++++++++++-------------------------- 1 file changed, 47 insertions(+), 60 deletions(-) diff --git a/mod_auth_tkt.spec b/mod_auth_tkt.spec index 371c6b8..f5b850a 100644 --- a/mod_auth_tkt.spec +++ b/mod_auth_tkt.spec @@ -1,33 +1,26 @@ -# Use "--define='apache 1'" to build a 'mod_auth_tkt1' package for apache1 -%define httpd httpd -%define name mod_auth_tkt -%{!?_pkgdocdir:%global _pkgdocdir %{_docdir}/%{name}-%{version}} -%if 0%{?rhel} && 0%{?rhel} < 7 -%global apxs /usr/sbin/apxs -%else -%global apxs /usr/bin/apxs -%endif -%{?_httpd_apxs:%global apxs %{_httpd_apxs}} -%{?apache:%define httpd apache} -%{?apache:%define name mod_auth_tkt1} -%{?apache:%define apxs /usr/sbin/apxs1} -%{!?_httpd_confdir:%global _httpd_confdir %{_sysconfdir}/%{httpd}/conf.d} -%{!?_httpd_moddir:%global _httpd_moddir %{_libdir}/%{httpd}/modules} - -%define perl_vendorlib %(eval "`perl -V:installvendorlib`"; echo $installvendorlib) +%{!?_httpd_apxs: %{expand: %%global _httpd_apxs %%{_sbindir}/apxs}} +%{!?_httpd_confdir: %{expand: %%global _httpd_confdir %%{_sysconfdir}/httpd/conf.d}} +%{!?_httpd_moddir: %{expand: %%global _httpd_moddir %%{_libdir}/httpd/modules}} + +%global name mod_auth_tkt + +%global _hardened_build 1 Summary: Lightweight ticket-based authentication module for Apache. Name: %{name} Version: 2.3.99b1 -Release: 2%{?org_tag}%{?dist} +Release: 3%{?dist} License: Apache Group: Applications/System -Source: http://www.openfusion.com.au/labs/dist/mod_auth_tkt-%{version}.tar.gz +Source: https://github.com/gavincarr/mod_auth_tkt/archive/%{version}/%{name}-%{version}.tar.gz URL: http://www.openfusion.com.au/labs/mod_auth_tkt/ -Buildroot: %_tmppath/%{name}-%{version} -Requires: %{httpd} -BuildRequires: %{httpd}-devel +BuildRequires: httpd +BuildRequires: httpd-devel +BuildRequires: make +BuildRequires: gcc +BuildRequires: perl-podlators +Requires: httpd %description mod_auth_tkt provides lightweight, repository-agnostic, ticket-based @@ -37,75 +30,69 @@ authentication requires a user-supplied CGI or script of some kind - see the mod_auth_tkt-cgi package for perl cgi versions. %package cgi -Release: 2%{?org_tag}%{?dist} +Release: 3%{?dist} Summary: CGI scripts for mod_auth_tkt apache authentication modules. Group: Applications/System -Requires: %{name} = %{version} +BuildRequires: perl-generators +Requires: %{name}%{?_isa} = %{version}-%{release} %description cgi Perl CGI scripts for use with mod_auth_tkt. - %prep -%setup -n mod_auth_tkt-%{version} +%setup -q %build test %{debug} == 1 && DEBUG='--debug' +./configure --apxs=%{_httpd_apxs} --mandir=%{_mandir} $DEBUG +make + +%install +mkdir -p %{buildroot}%{_httpd_moddir} \ + %{buildroot}%{_httpd_confdir} \ + %{buildroot}%{_pkgdocdir}/contrib \ + %{buildroot}/var/www/auth \ + %{buildroot}/%{perl_vendorlib}/Apache +%{_httpd_apxs} -i -n "auth_tkt" -S LIBEXECDIR=%{buildroot}%{_httpd_moddir} src/mod_auth_tkt.la +install -m 644 conf/02_auth_tkt.conf %{buildroot}%{_httpd_confdir} +install -m 644 conf/auth_tkt_cgi.conf %{buildroot}%{_httpd_confdir} +cp cgi/Apache/* %{buildroot}/%{perl_vendorlib}/Apache +cp -pr cgi/* %{buildroot}/var/www/auth +rm -rf %{buildroot}/var/www/auth/Apache +cp -pr contrib/* %{buildroot}%{_pkgdocdir}/contrib +rm -rf %{buildroot}%{_pkgdocdir}/contrib/t +cp -pr README* INSTALL LICENSE CREDITS %{buildroot}%{_pkgdocdir} +cd doc +%make_install + +%check MOD_PERL=`rpm -q mod_perl | grep '^mod_perl' || /bin/true` if [ -n "$MOD_PERL" -a %{test} == 1 ]; then - ./configure --apxs=%{apxs} --mandir=%{_mandir} --test $DEBUG - make make test -else - ./configure --apxs=%{apxs} --mandir=%{_mandir} $DEBUG - make -fi - -%install -test "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{_httpd_moddir} -mkdir -p $RPM_BUILD_ROOT%{_httpd_confdir} -#mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/cgi -mkdir -p $RPM_BUILD_ROOT%{_pkgdocdir}/contrib -mkdir -p $RPM_BUILD_ROOT/var/www/auth -#mkdir -p $RPM_BUILD_ROOT/%{perl_vendorlib}/Apache -if [ %{httpd} == apache ]; then - %{apxs} -i -n "auth_tkt" -S LIBEXECDIR=$RPM_BUILD_ROOT%{_httpd_moddir} src/mod_auth_tkt.so -else - %{apxs} -i -n "auth_tkt" -S LIBEXECDIR=$RPM_BUILD_ROOT%{_httpd_moddir} src/mod_auth_tkt.la fi -install -m 644 conf/02_auth_tkt.conf $RPM_BUILD_ROOT%{_httpd_confdir} -install -m 644 conf/auth_tkt_cgi.conf $RPM_BUILD_ROOT%{_httpd_confdir} -#cp cgi/Apache/* $RPM_BUILD_ROOT/%{perl_vendorlib}/Apache -#cp -pr cgi/* $RPM_BUILD_ROOT%{_pkgdocdir}/cgi -#rm -rf $RPM_BUILD_ROOT%{_pkgdocdir}/cgi/Apache -cp -pr cgi/* $RPM_BUILD_ROOT/var/www/auth -rm -rf $RPM_BUILD_ROOT/var/www/auth/Apache -cp -pr contrib/* $RPM_BUILD_ROOT%{_pkgdocdir}/contrib -rm -rf $RPM_BUILD_ROOT%{_pkgdocdir}/contrib/t -cp -pr README* INSTALL LICENSE CREDITS $RPM_BUILD_ROOT%{_pkgdocdir} -cd doc -make DESTDIR=$RPM_BUILD_ROOT install %clean -test "$RPM_BUILD_ROOT" != "/" && rm -rf $RPM_BUILD_ROOT +rm -rf %{buildroot} %files %defattr(-,root,root) %{_httpd_moddir}/* -#%{perl_vendorlib}/Apache/AuthTkt.pm %doc %{_pkgdocdir} %attr(0640,root,apache) %config(noreplace) %{_httpd_confdir}/02_auth_tkt.conf -%{_mandir}/*/* +%{_mandir}/man3/*.3* %files cgi %defattr(-,root,root) +%{perl_vendorlib}/Apache/AuthTkt.pm %attr(0640,root,apache) %config(noreplace) %{_httpd_confdir}/auth_tkt_cgi.conf %config(noreplace)/var/www/auth/AuthTktConfig.pm %config(noreplace)/var/www/auth/tkt.css /var/www/auth/*.cgi %changelog +* Tue Jan 08 2019 Scott Shambarger 2.3.99b1-3 +- Apply some Redhat packaging guidelines to spec + * Mon Nov 16 2015 Scott Shambarger 2.3.99b1-2 - Cleanup spec and configure files