1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sasl/sasl.spec Mon Apr 06 20:29:28 2009 +0200 1.3 @@ -0,0 +1,446 @@ 1.4 +## 1.5 +## sasl.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/> 1.7 +## 1.8 +## Permission to use, copy, modify, and distribute this software for 1.9 +## any purpose with or without fee is hereby granted, provided that 1.10 +## the above copyright notice and this permission notice appear in all 1.11 +## copies. 1.12 +## 1.13 +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 1.14 +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 1.15 +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 1.16 +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR 1.17 +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 1.18 +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 1.19 +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 1.20 +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 1.21 +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 1.22 +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 1.23 +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 1.24 +## SUCH DAMAGE. 1.25 +## 1.26 + 1.27 +# package information 1.28 +Name: sasl 1.29 +Summary: Simple Authentication and Security Layer (SASL) 1.30 +URL: http://asg.web.cmu.edu/sasl/ 1.31 +Vendor: Cyrus Project, CMU 1.32 +Packager: OpenPKG Foundation e.V. 1.33 +Distribution: OpenPKG Community 1.34 +Class: BASE 1.35 +Group: Cryptography 1.36 +License: BSD 1.37 +Version: 2.1.22 1.38 +Release: 20090207 1.39 + 1.40 +# package options 1.41 +%option with_fsl yes 1.42 +%option with_sasldb yes 1.43 +%option with_pam no 1.44 +%option with_login no 1.45 +%option with_ldap no 1.46 +%option with_mysql no 1.47 +%option with_pgsql no 1.48 +%option with_sqlite no 1.49 +%option with_ntlm no 1.50 +%option with_otp no 1.51 +%option with_srp no 1.52 +%option with_kerberos no 1.53 + 1.54 +# list of sources 1.55 +Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-sasl-%{version}.tar.gz 1.56 +Source1: rc.sasl 1.57 +Source2: fsl.sasl 1.58 +Source3: saslauthd.conf 1.59 +Source4: sasl.pc 1.60 +Patch0: sasl.patch 1.61 + 1.62 +# build information 1.63 +Prefix: %{l_prefix} 1.64 +BuildRoot: %{l_buildroot} 1.65 +BuildPreReq: OpenPKG, openpkg >= 20060823, gcc, make, groff 1.66 +PreReq: OpenPKG, openpkg >= 20060823 1.67 +BuildPreReq: db >= 4.1.24, openssl 1.68 +PreReq: db >= 4.1.24, openssl 1.69 +%if "%{with_fsl}" == "yes" 1.70 +BuildPreReq: fsl 1.71 +PreReq: fsl 1.72 +%endif 1.73 +%if "%{with_pam}" == "yes" 1.74 +BuildPreReq: PAM 1.75 +PreReq: PAM 1.76 +%endif 1.77 +%if "%{with_ldap}" == "yes" 1.78 +BuildPreReq: openldap 1.79 +PreReq: openldap 1.80 +%endif 1.81 +%if "%{with_mysql}" == "yes" 1.82 +BuildPreReq: mysql 1.83 +PreReq: mysql 1.84 +%endif 1.85 +%if "%{with_pgsql}" == "yes" 1.86 +BuildPreReq: postgresql 1.87 +PreReq: postgresql 1.88 +%endif 1.89 +%if "%{with_sqlite}" == "yes" 1.90 +BuildPreReq: sqlite 1.91 +PreReq: sqlite 1.92 +%endif 1.93 +%if "%{with_otp}" == "yes" 1.94 +BuildPreReq: opie 1.95 +PreReq: opie 1.96 +%endif 1.97 +%if "%{with_kerberos}" == "yes" 1.98 +BuildPreReq: KERBEROS 1.99 +PreReq: KERBEROS 1.100 +%endif 1.101 +AutoReq: no 1.102 +AutoReqProv: no 1.103 + 1.104 +%description 1.105 + SASL is the Simple Authentication and Security Layer, a method 1.106 + for adding authentication support to connection-based protocols. 1.107 + To use SASL, a protocol includes a command for identifying and 1.108 + authenticating a user to a server and for optionally negotiating 1.109 + protection of subsequent protocol interactions. If its use is 1.110 + negotiated, a security layer is inserted between the protocol and 1.111 + the connection. 1.112 + 1.113 +%track 1.114 + prog sasl = { 1.115 + version = %{version} 1.116 + url = ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ 1.117 + regex = cyrus-sasl-(\d+\.\d+\.\d+)\.tar\.gz 1.118 + } 1.119 + 1.120 +%prep 1.121 + %setup -q -n cyrus-sasl-%{version} 1.122 + %patch -p0 1.123 + 1.124 +%build 1.125 + # ensure the OpenPKG Berkeley-DB is picked up only 1.126 + %{l_shtool} subst \ 1.127 + -e 's;for dbname in db-.*db$;for dbname in db;' \ 1.128 + saslauthd/configure configure 1.129 + 1.130 + # disable some unwanted configure checks 1.131 + %{l_shtool} subst \ 1.132 + -e 's;\(SASL_DB_UTILS="saslpasswd2 sasldblistusers2\);\1 dbconverter-2;' \ 1.133 + -e "s;javac;javac-xxx;g" \ 1.134 + -e "s;javah;javah-xxx;g" \ 1.135 + -e "s;javadoc;javadoc-xxx;g" \ 1.136 + configure 1.137 + 1.138 + # fix OpenLDAP support 1.139 +%if "%{with_ldap}" == "yes" 1.140 + echo 'ac_cv_lib_ldap_ldap_initialize=yes' >config.cache 1.141 + %{l_shtool} subst \ 1.142 + -e "s;\(\$LDAP_LIBS\) *\(-lcrypto\);\1 -lssl -lcrypto \2;" \ 1.143 + saslauthd/configure 1.144 +%endif 1.145 + 1.146 + # fix GSS/Kerberos support 1.147 +%if "%{with_kerberos}" == "yes" 1.148 + %{l_shtool} subst \ 1.149 + -e 's;\(-lk5crypto\);\1 -lkrb5support;' \ 1.150 + configure 1.151 +%endif 1.152 + 1.153 + # enforce disabled Kerberos 5 support in saslauthd 1.154 + echo 'ac_cv_header_krb5_h=no' >config.cache 1.155 + 1.156 + # configure path to sasl-server config files 1.157 + %{l_shtool} subst \ 1.158 + -e 's;@l_sysconfdir@;%{l_prefix}/etc/sasl/sasl.d;g' \ 1.159 + lib/server.c 1.160 + 1.161 + # determine build flags 1.162 + cflags="%{l_cflags -O} %{l_cppflags}" 1.163 + ldflags="%{l_ldflags} %{l_fsl_ldflags}" 1.164 + libs="-ldb %{l_fsl_libs}" 1.165 +%if "%{with_ldap}" == "yes" 1.166 + cflags="$cflags -DAUTH_LDAP" 1.167 +%endif 1.168 +%if "%{with_mysql}" == "yes" 1.169 + libs="$libs -lz -lm" 1.170 +%endif 1.171 +%if "%{with_pgsql}" == "yes" 1.172 + cflags="$cflags -I%{l_cppflags postgresql}" 1.173 + libs="$libs -lssl -lcrypto -lcrypt" 1.174 +%endif 1.175 +%if "%{with_kerberos}" == "yes" 1.176 + cflags="$cflags `krb5-config --cflags gssapi`" 1.177 + libs="$libs `krb5-config --libs gssapi`" 1.178 +%endif 1.179 + case "%{l_platform -t}" in 1.180 + *-sunos* ) libs="$libs -lrt" ;; 1.181 + esac 1.182 + 1.183 + # configure package 1.184 + CC="%{l_cc}" \ 1.185 + CFLAGS="$cflags" \ 1.186 + CPPFLAGS="%{l_cppflags}" \ 1.187 + LDFLAGS="$ldflags" \ 1.188 + LIBS="$libs" \ 1.189 + ./configure \ 1.190 + --cache-file=./config.cache \ 1.191 + --prefix=%{l_prefix} \ 1.192 + --sysconfdir=%{l_prefix}/etc/sasl \ 1.193 + --with-configdir=%{l_prefix}/etc/sasl/sasl.d \ 1.194 + --with-plugindir=%{l_prefix}/lib/sasl \ 1.195 + --with-saslauthd=%{l_prefix}/var/sasl/run/saslauthd \ 1.196 + --enable-digest \ 1.197 + --enable-cram \ 1.198 + --enable-anon \ 1.199 +%if "%{with_sasldb}" == "yes" 1.200 + --enable-auth-sasldb \ 1.201 + --with-dbpath=%{l_prefix}/var/sasl/run/sasl.db \ 1.202 + --with-dblib=berkeley \ 1.203 + --with-bdb-incdir=%{l_prefix}/include \ 1.204 + --with-bdb-libdir=%{l_prefix}/lib \ 1.205 +%else 1.206 + --with-dblib=none \ 1.207 +%endif 1.208 + --with-openssl=%{l_prefix} \ 1.209 +%if "%{with_pam}" == "yes" 1.210 + --with-pam \ 1.211 +%else 1.212 + --without-pam \ 1.213 +%endif 1.214 +%if "%{with_login}" == "yes" 1.215 + --enable-login \ 1.216 +%else 1.217 + --disable-login \ 1.218 +%endif 1.219 +%if "%{with_ldap}" == "yes" 1.220 + --with-ldap=%{l_prefix} \ 1.221 +%else 1.222 + --without-ldap \ 1.223 +%endif 1.224 +%if "%{with_otp}" == "yes" 1.225 + --enable-otp \ 1.226 + --with-opie=%{l_prefix} \ 1.227 +%else 1.228 + --disable-otp \ 1.229 + --without-opie \ 1.230 +%endif 1.231 +%if "%{with_srp}" == "yes" 1.232 + --enable-srp \ 1.233 +%else 1.234 + --disable-srp \ 1.235 +%endif 1.236 +%if "%{with_kerberos}" == "yes" 1.237 + --enable-gssapi \ 1.238 + --with-gss_impl=`if [ -d %{l_prefix}/include/heimdal ]; then echo "heimdal"; else echo "mit"; fi` \ 1.239 +%else 1.240 + --disable-gssapi \ 1.241 + --without-gss_impl \ 1.242 +%endif 1.243 +%if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" 1.244 + --enable-sql \ 1.245 +%if "%{with_mysql}" == "yes" 1.246 + --with-mysql=%{l_prefix} \ 1.247 +%else 1.248 + --without-mysql \ 1.249 +%endif 1.250 +%if "%{with_pgsql}" == "yes" 1.251 + --with-pgsql=%{l_prefix} \ 1.252 +%else 1.253 + --without-pgsql \ 1.254 +%endif 1.255 +%if "%{with_sqlite}" == "yes" 1.256 + --with-sqlite=%{l_prefix} \ 1.257 +%else 1.258 + --without-sqlite \ 1.259 +%endif 1.260 +%endif 1.261 +%if "%{with_ntlm}" == "yes" 1.262 + --enable-ntlm \ 1.263 +%else 1.264 + --disable-ntlm \ 1.265 +%endif 1.266 + --enable-shared \ 1.267 + --enable-static \ 1.268 + --enable-staticdlopen \ 1.269 + --enable-sample \ 1.270 + --disable-java \ 1.271 + --disable-krb4 \ 1.272 + --without-des 1.273 + 1.274 + # post adjustment: trust me, libtool, I know what I am doing 1.275 + %{l_shtool} subst \ 1.276 + -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \ 1.277 + -e 's/\(eval libobjs=.*$whole_archive_flag_spec.*\)$/case $archive_cmds in \\$LD* ) wl= ;; esac; \1/' \ 1.278 + libtool 1.279 + 1.280 + # post adjustment: do not reference static plugins 1.281 + %{l_shtool} subst \ 1.282 + -e '58s;.*;#define PIC;' \ 1.283 + lib/dlopen.c 1.284 + 1.285 + # post adjustment: do not pull static plugins into static library 1.286 + %{l_shtool} subst \ 1.287 + -e 's;-ln -s $(SASL_STATIC_SRCS) .;-ln ../sasldb/*.o ../plugins/*.o $(SASL_STATIC_SRCS) .;' \ 1.288 + lib/Makefile 1.289 + 1.290 + # post adjustment: build utils against static library 1.291 + %{l_shtool} subst \ 1.292 + -e 's;\(\$(CCLD)\);\1 -static;' \ 1.293 + -e 's;\(noinst.*=\) *dbconverter.*;\1;' \ 1.294 + utils/Makefile \ 1.295 + sample/Makefile 1.296 + 1.297 + # post adjustment: fix OpenLDAP support 1.298 +%if "%{with_ldap}" == "yes" 1.299 + %{l_shtool} subst \ 1.300 + -e "s;^\(saslauthd_LDADD[ ]*=[ ]*[^\\]*\);\1 -lcrypt -lldap -llber -lssl -lcrypto ;" \ 1.301 + saslauthd/Makefile 1.302 +%endif 1.303 + 1.304 + # build package 1.305 + %{l_make} %{l_mflags} 1.306 + ( cd saslauthd 1.307 + %{l_make} %{l_mflags} testsaslauthd 1.308 + ) || exit $? 1.309 + ( cd sample 1.310 + %{l_make} %{l_mflags} sample-client sample-server 1.311 + ) || exit $? 1.312 + 1.313 +%install 1.314 + rm -rf $RPM_BUILD_ROOT 1.315 + 1.316 + # install package 1.317 + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" 1.318 + 1.319 + # remove libtool cruft 1.320 + rm -f \ 1.321 + $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \ 1.322 + $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol] \ 1.323 + $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].* \ 1.324 + $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a 1.325 + 1.326 + # post-adjust installation 1.327 + mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \ 1.328 + $RPM_BUILD_ROOT%{l_prefix}/lib/sasl 1.329 + mv $RPM_BUILD_ROOT%{l_prefix}/sbin/testsaslauthd \ 1.330 + $RPM_BUILD_ROOT%{l_prefix}/sbin/saslauthd-test 1.331 + mv $RPM_BUILD_ROOT%{l_prefix}/sbin/pluginviewer \ 1.332 + $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-pluginviewer 1.333 + mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/pluginviewer.8 \ 1.334 + $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasl-pluginviewer.8 1.335 + mv $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd2 \ 1.336 + $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd 1.337 + mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd2.8 \ 1.338 + $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd.8 1.339 + mv $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers2 \ 1.340 + $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers 1.341 + mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers2.8 \ 1.342 + $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers.8 1.343 + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dbconverter-2 1.344 + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true 1.345 + 1.346 + # install sample client/server programs 1.347 + %{l_shtool} install -c -m 755 \ 1.348 + sample/sample-client \ 1.349 + $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-client 1.350 + %{l_shtool} install -c -m 755 \ 1.351 + sample/sample-server \ 1.352 + $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-server 1.353 + 1.354 + # install saslauthd default configuration 1.355 + %{l_shtool} mkdir -f -p -m 755 \ 1.356 + $RPM_BUILD_ROOT%{l_prefix}/etc/sasl 1.357 + %{l_shtool} install -c -m 755 \ 1.358 + %{SOURCE saslauthd.conf} \ 1.359 + $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/ 1.360 + 1.361 + # create necessary additional directories 1.362 + %{l_shtool} mkdir -f -p -m 755 \ 1.363 + $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \ 1.364 + $RPM_BUILD_ROOT%{l_prefix}/var/sasl/run/saslauthd \ 1.365 + $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/sasl.d 1.366 + 1.367 + # install run-command script 1.368 +%if "%{with_pam}" == "yes" 1.369 + l_authmech="pam" 1.370 +%else 1.371 + case "%{l_platform -t}" in 1.372 + *-linux* | *-sunos* ) l_authmech="shadow" ;; 1.373 + * ) l_authmech="getpwent" ;; 1.374 + esac 1.375 +%endif 1.376 + %{l_shtool} mkdir -f -p -m 755 \ 1.377 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.378 + %{l_shtool} install -c -m 755 \ 1.379 + -e "s;@l_authmech@;${l_authmech};g" %{l_value -s -a} \ 1.380 + %{SOURCE rc.sasl} \ 1.381 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.382 + 1.383 + # install OSSP fsl configuration 1.384 + %{l_shtool} mkdir -f -p -m 755 \ 1.385 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.386 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.387 + %{SOURCE fsl.sasl} \ 1.388 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.389 + 1.390 + # install pkg-config configuration 1.391 + libs="-lsasl2" 1.392 + case "%{l_platform -t}" in 1.393 + *-linux* ) libs="$libs -ldl" ;; 1.394 + esac 1.395 + %{l_shtool} mkdir -f -p -m 755 \ 1.396 + $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig 1.397 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.398 + -e "s;@version@;%{version};" \ 1.399 + -e "s;@libs@;$libs;" \ 1.400 + %{SOURCE sasl.pc} \ 1.401 + $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/ 1.402 + 1.403 + # determine installation files 1.404 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.405 + %{l_files_std} \ 1.406 + '%config %{l_prefix}/etc/fsl/fsl.sasl' \ 1.407 + '%config %{l_prefix}/etc/sasl/saslauthd.conf' \ 1.408 + '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \ 1.409 + '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run' \ 1.410 + '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run/saslauthd' \ 1.411 + '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log' 1.412 + 1.413 +%files -f files 1.414 + 1.415 +%clean 1.416 + rm -rf $RPM_BUILD_ROOT 1.417 + 1.418 +%pre 1.419 + # before upgrade, save status and stop service 1.420 + [ $1 -eq 2 ] || exit 0 1.421 + eval `%{l_rc} sasl status 2>/dev/null | tee %{l_tmpfile}` 1.422 + %{l_rc} sasl stop 2>/dev/null 1.423 + exit 0 1.424 + 1.425 +%post 1.426 +%if "%{with_pam}" == "yes" 1.427 + if [ $1 -eq 1 ]; then 1.428 + # after install, add PAM configuration entry 1.429 + $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sasl 1.430 + fi 1.431 +%endif 1.432 + if [ $1 -eq 2 ]; then 1.433 + # after upgrade, restore status 1.434 + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} 1.435 + [ ".$sasl_active" = .yes ] && %{l_rc} sasl start 1.436 + fi 1.437 + exit 0 1.438 + 1.439 +%preun 1.440 + # before erase, stop service and remove log files 1.441 + [ $1 -eq 0 ] || exit 0 1.442 + %{l_rc} sasl stop 2>/dev/null 1.443 + rm -f $RPM_INSTALL_PREFIX/var/sasl/log/*.log* >/dev/null 2>&1 || true 1.444 +%if "%{with_pam}" == "yes" 1.445 + # remove PAM configuration entry 1.446 + $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sasl 1.447 +%endif 1.448 + exit 0 1.449 +