1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/sasl/sasl.spec Fri Oct 05 22:37:14 2012 +0200 1.3 @@ -0,0 +1,440 @@ 1.4 +## 1.5 +## sasl.spec -- OpenPKG RPM Package Specification 1.6 +## Copyright (c) 2000-2010 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://www.cyrusimap.org/ 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.23 1.38 +Release: 20101020 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.cyrusimap.org/cyrus-sasl/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 +BuildPreReq: OpenPKG, openpkg >= 20100101, gcc, make, groff 1.64 +PreReq: OpenPKG, openpkg >= 20100101 1.65 +BuildPreReq: db >= 4.1.24, openssl 1.66 +PreReq: db >= 4.1.24, openssl 1.67 +%if "%{with_fsl}" == "yes" 1.68 +BuildPreReq: fsl 1.69 +PreReq: fsl 1.70 +%endif 1.71 +%if "%{with_pam}" == "yes" 1.72 +BuildPreReq: PAM 1.73 +PreReq: PAM 1.74 +%endif 1.75 +%if "%{with_ldap}" == "yes" 1.76 +BuildPreReq: openldap 1.77 +PreReq: openldap 1.78 +%endif 1.79 +%if "%{with_mysql}" == "yes" 1.80 +BuildPreReq: mysql 1.81 +PreReq: mysql 1.82 +%endif 1.83 +%if "%{with_pgsql}" == "yes" 1.84 +BuildPreReq: postgresql 1.85 +PreReq: postgresql 1.86 +%endif 1.87 +%if "%{with_sqlite}" == "yes" 1.88 +BuildPreReq: sqlite 1.89 +PreReq: sqlite 1.90 +%endif 1.91 +%if "%{with_otp}" == "yes" 1.92 +BuildPreReq: opie 1.93 +PreReq: opie 1.94 +%endif 1.95 +%if "%{with_kerberos}" == "yes" 1.96 +BuildPreReq: KERBEROS 1.97 +PreReq: KERBEROS 1.98 +%endif 1.99 + 1.100 +%description 1.101 + SASL is the Simple Authentication and Security Layer, a method 1.102 + for adding authentication support to connection-based protocols. 1.103 + To use SASL, a protocol includes a command for identifying and 1.104 + authenticating a user to a server and for optionally negotiating 1.105 + protection of subsequent protocol interactions. If its use is 1.106 + negotiated, a security layer is inserted between the protocol and 1.107 + the connection. 1.108 + 1.109 +%track 1.110 + prog sasl = { 1.111 + version = %{version} 1.112 + url = ftp://ftp.cyrusimap.org/cyrus-sasl/ 1.113 + regex = cyrus-sasl-(\d+\.\d+\.\d+)\.tar\.gz 1.114 + } 1.115 + 1.116 +%prep 1.117 + %setup -q -n cyrus-sasl-%{version} 1.118 + %patch -p0 1.119 + 1.120 +%build 1.121 + # ensure the OpenPKG Berkeley-DB is picked up only 1.122 + %{l_shtool} subst \ 1.123 + -e 's;for dbname in db-.*db$;for dbname in db;' \ 1.124 + saslauthd/configure configure 1.125 + 1.126 + # disable some unwanted configure checks 1.127 + %{l_shtool} subst \ 1.128 + -e 's;\(SASL_DB_UTILS="saslpasswd2 sasldblistusers2\);\1 dbconverter-2;' \ 1.129 + -e "s;javac;javac-xxx;g" \ 1.130 + -e "s;javah;javah-xxx;g" \ 1.131 + -e "s;javadoc;javadoc-xxx;g" \ 1.132 + configure 1.133 + 1.134 + # fix OpenLDAP support 1.135 +%if "%{with_ldap}" == "yes" 1.136 + echo 'ac_cv_lib_ldap_ldap_initialize=yes' >config.cache 1.137 + %{l_shtool} subst \ 1.138 + -e "s;\(\$LDAP_LIBS\) *\(-lcrypto\);\1 -lssl -lcrypto \2;" \ 1.139 + saslauthd/configure 1.140 +%endif 1.141 + 1.142 + # fix GSS/Kerberos support 1.143 +%if "%{with_kerberos}" == "yes" 1.144 + %{l_shtool} subst \ 1.145 + -e 's;\(-lk5crypto\);\1 -lkrb5support;' \ 1.146 + configure 1.147 +%endif 1.148 + 1.149 + # enforce disabled Kerberos 5 support in saslauthd 1.150 + echo 'ac_cv_header_krb5_h=no' >config.cache 1.151 + 1.152 + # configure path to sasl-server config files 1.153 + %{l_shtool} subst \ 1.154 + -e 's;@l_sysconfdir@;%{l_prefix}/etc/sasl/sasl.d;g' \ 1.155 + lib/server.c 1.156 + 1.157 + # determine build flags 1.158 + cflags="%{l_cflags -O} %{l_cppflags}" 1.159 + ldflags="%{l_ldflags} %{l_fsl_ldflags}" 1.160 + libs="-ldb %{l_fsl_libs}" 1.161 +%if "%{with_ldap}" == "yes" 1.162 + cflags="$cflags -DAUTH_LDAP" 1.163 +%endif 1.164 +%if "%{with_mysql}" == "yes" 1.165 + libs="$libs -lz -lm" 1.166 +%endif 1.167 +%if "%{with_pgsql}" == "yes" 1.168 + cflags="$cflags -I%{l_cppflags postgresql}" 1.169 + libs="$libs -lssl -lcrypto -lcrypt" 1.170 +%endif 1.171 +%if "%{with_kerberos}" == "yes" 1.172 + cflags="$cflags `krb5-config --cflags gssapi`" 1.173 + libs="$libs `krb5-config --libs gssapi`" 1.174 +%endif 1.175 + case "%{l_platform -t}" in 1.176 + *-sunos* ) libs="$libs -lrt" ;; 1.177 + esac 1.178 + 1.179 + # configure package 1.180 + CC="%{l_cc}" \ 1.181 + CFLAGS="$cflags" \ 1.182 + CPPFLAGS="%{l_cppflags}" \ 1.183 + LDFLAGS="$ldflags" \ 1.184 + LIBS="$libs" \ 1.185 + ./configure \ 1.186 + --cache-file=./config.cache \ 1.187 + --prefix=%{l_prefix} \ 1.188 + --sysconfdir=%{l_prefix}/etc/sasl \ 1.189 + --with-configdir=%{l_prefix}/etc/sasl/sasl.d \ 1.190 + --with-plugindir=%{l_prefix}/lib/sasl \ 1.191 + --with-saslauthd=%{l_prefix}/var/sasl/run/saslauthd \ 1.192 + --enable-digest \ 1.193 + --enable-cram \ 1.194 + --enable-anon \ 1.195 +%if "%{with_sasldb}" == "yes" 1.196 + --enable-auth-sasldb \ 1.197 + --with-dbpath=%{l_prefix}/var/sasl/run/sasl.db \ 1.198 + --with-dblib=berkeley \ 1.199 + --with-bdb-incdir=%{l_prefix}/include \ 1.200 + --with-bdb-libdir=%{l_prefix}/lib \ 1.201 +%else 1.202 + --with-dblib=none \ 1.203 +%endif 1.204 + --with-openssl=%{l_prefix} \ 1.205 +%if "%{with_pam}" == "yes" 1.206 + --with-pam \ 1.207 +%else 1.208 + --without-pam \ 1.209 +%endif 1.210 +%if "%{with_login}" == "yes" 1.211 + --enable-login \ 1.212 +%else 1.213 + --disable-login \ 1.214 +%endif 1.215 +%if "%{with_ldap}" == "yes" 1.216 + --with-ldap=%{l_prefix} \ 1.217 +%else 1.218 + --without-ldap \ 1.219 +%endif 1.220 +%if "%{with_otp}" == "yes" 1.221 + --enable-otp \ 1.222 + --with-opie=%{l_prefix} \ 1.223 +%else 1.224 + --disable-otp \ 1.225 + --without-opie \ 1.226 +%endif 1.227 +%if "%{with_srp}" == "yes" 1.228 + --enable-srp \ 1.229 +%else 1.230 + --disable-srp \ 1.231 +%endif 1.232 +%if "%{with_kerberos}" == "yes" 1.233 + --enable-gssapi \ 1.234 + --with-gss_impl=`if [ -d %{l_prefix}/include/heimdal ]; then echo "heimdal"; else echo "mit"; fi` \ 1.235 +%else 1.236 + --disable-gssapi \ 1.237 + --without-gss_impl \ 1.238 +%endif 1.239 +%if "%{with_mysql}" == "yes" || "%{with_pgsql}" == "yes" || "%{with_sqlite}" == "yes" 1.240 + --enable-sql \ 1.241 +%if "%{with_mysql}" == "yes" 1.242 + --with-mysql=%{l_prefix} \ 1.243 +%else 1.244 + --without-mysql \ 1.245 +%endif 1.246 +%if "%{with_pgsql}" == "yes" 1.247 + --with-pgsql=%{l_prefix} \ 1.248 +%else 1.249 + --without-pgsql \ 1.250 +%endif 1.251 +%if "%{with_sqlite}" == "yes" 1.252 + --with-sqlite=%{l_prefix} \ 1.253 +%else 1.254 + --without-sqlite \ 1.255 +%endif 1.256 +%endif 1.257 +%if "%{with_ntlm}" == "yes" 1.258 + --enable-ntlm \ 1.259 +%else 1.260 + --disable-ntlm \ 1.261 +%endif 1.262 + --enable-shared \ 1.263 + --enable-static \ 1.264 + --enable-staticdlopen \ 1.265 + --enable-sample \ 1.266 + --disable-java \ 1.267 + --disable-krb4 \ 1.268 + --without-des 1.269 + 1.270 + # post adjustment: trust me, libtool, I know what I am doing 1.271 + %{l_shtool} subst \ 1.272 + -e 's;^\(deplibs_check_method=\).*;\1"pass_all";' \ 1.273 + -e 's/\(eval libobjs=.*$whole_archive_flag_spec.*\)$/case $archive_cmds in \\$LD* ) wl= ;; esac; \1/' \ 1.274 + libtool 1.275 + 1.276 + # post adjustment: do not reference static plugins 1.277 + %{l_shtool} subst \ 1.278 + -e '58s;.*;#define PIC;' \ 1.279 + lib/dlopen.c 1.280 + 1.281 + # post adjustment: do not pull static plugins into static library 1.282 + %{l_shtool} subst \ 1.283 + -e 's;-ln -s $(SASL_STATIC_SRCS) .;-ln ../sasldb/*.o ../plugins/*.o $(SASL_STATIC_SRCS) .;' \ 1.284 + lib/Makefile 1.285 + 1.286 + # post adjustment: build utils against static library 1.287 + %{l_shtool} subst \ 1.288 + -e 's;\(\$(CCLD)\);\1 -static;' \ 1.289 + -e 's;\(noinst.*=\) *dbconverter.*;\1;' \ 1.290 + utils/Makefile \ 1.291 + sample/Makefile 1.292 + 1.293 + # post adjustment: fix OpenLDAP support 1.294 +%if "%{with_ldap}" == "yes" 1.295 + %{l_shtool} subst \ 1.296 + -e "s;^\(saslauthd_LDADD[ ]*=[ ]*[^\\]*\);\1 -lcrypt -lldap -llber -lssl -lcrypto ;" \ 1.297 + saslauthd/Makefile 1.298 +%endif 1.299 + 1.300 + # build package 1.301 + %{l_make} %{l_mflags} 1.302 + ( cd saslauthd 1.303 + %{l_make} %{l_mflags} testsaslauthd 1.304 + ) || exit $? 1.305 + ( cd sample 1.306 + %{l_make} %{l_mflags} sample-client sample-server 1.307 + ) || exit $? 1.308 + 1.309 +%install 1.310 + 1.311 + # install package 1.312 + %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT" 1.313 + 1.314 + # remove libtool cruft 1.315 + rm -f \ 1.316 + $RPM_BUILD_ROOT%{l_prefix}/lib/*.la \ 1.317 + $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol] \ 1.318 + $RPM_BUILD_ROOT%{l_prefix}/lib/*.s[ol].* \ 1.319 + $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2/*.a 1.320 + 1.321 + # post-adjust installation 1.322 + mv $RPM_BUILD_ROOT%{l_prefix}/lib/sasl2 \ 1.323 + $RPM_BUILD_ROOT%{l_prefix}/lib/sasl 1.324 + mv $RPM_BUILD_ROOT%{l_prefix}/sbin/testsaslauthd \ 1.325 + $RPM_BUILD_ROOT%{l_prefix}/sbin/saslauthd-test 1.326 + mv $RPM_BUILD_ROOT%{l_prefix}/sbin/pluginviewer \ 1.327 + $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-pluginviewer 1.328 + mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/pluginviewer.8 \ 1.329 + $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasl-pluginviewer.8 1.330 + mv $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd2 \ 1.331 + $RPM_BUILD_ROOT%{l_prefix}/sbin/saslpasswd 1.332 + mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd2.8 \ 1.333 + $RPM_BUILD_ROOT%{l_prefix}/man/man8/saslpasswd.8 1.334 + mv $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers2 \ 1.335 + $RPM_BUILD_ROOT%{l_prefix}/sbin/sasldblistusers 1.336 + mv $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers2.8 \ 1.337 + $RPM_BUILD_ROOT%{l_prefix}/man/man8/sasldblistusers.8 1.338 + rm -f $RPM_BUILD_ROOT%{l_prefix}/sbin/dbconverter-2 1.339 + strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true 1.340 + 1.341 + # install sample client/server programs 1.342 + %{l_shtool} install -c -m 755 \ 1.343 + sample/sample-client \ 1.344 + $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-client 1.345 + %{l_shtool} install -c -m 755 \ 1.346 + sample/sample-server \ 1.347 + $RPM_BUILD_ROOT%{l_prefix}/sbin/sasl-sample-server 1.348 + 1.349 + # install saslauthd default configuration 1.350 + %{l_shtool} mkdir -f -p -m 755 \ 1.351 + $RPM_BUILD_ROOT%{l_prefix}/etc/sasl 1.352 + %{l_shtool} install -c -m 755 \ 1.353 + %{SOURCE saslauthd.conf} \ 1.354 + $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/ 1.355 + 1.356 + # create necessary additional directories 1.357 + %{l_shtool} mkdir -f -p -m 755 \ 1.358 + $RPM_BUILD_ROOT%{l_prefix}/var/sasl/log \ 1.359 + $RPM_BUILD_ROOT%{l_prefix}/var/sasl/run/saslauthd \ 1.360 + $RPM_BUILD_ROOT%{l_prefix}/etc/sasl/sasl.d 1.361 + 1.362 + # install run-command script 1.363 +%if "%{with_pam}" == "yes" 1.364 + l_authmech="pam" 1.365 +%else 1.366 + case "%{l_platform -t}" in 1.367 + *-linux* | *-sunos* ) l_authmech="shadow" ;; 1.368 + * ) l_authmech="getpwent" ;; 1.369 + esac 1.370 +%endif 1.371 + %{l_shtool} mkdir -f -p -m 755 \ 1.372 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d 1.373 + %{l_shtool} install -c -m 755 \ 1.374 + -e "s;@l_authmech@;${l_authmech};g" %{l_value -s -a} \ 1.375 + %{SOURCE rc.sasl} \ 1.376 + $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/ 1.377 + 1.378 + # install OSSP fsl configuration 1.379 + %{l_shtool} mkdir -f -p -m 755 \ 1.380 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl 1.381 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.382 + %{SOURCE fsl.sasl} \ 1.383 + $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/ 1.384 + 1.385 + # install pkg-config configuration 1.386 + libs="-lsasl2" 1.387 + case "%{l_platform -t}" in 1.388 + *-linux* ) libs="$libs -ldl" ;; 1.389 + esac 1.390 + %{l_shtool} mkdir -f -p -m 755 \ 1.391 + $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig 1.392 + %{l_shtool} install -c -m 644 %{l_value -s -a} \ 1.393 + -e "s;@version@;%{version};" \ 1.394 + -e "s;@libs@;$libs;" \ 1.395 + %{SOURCE sasl.pc} \ 1.396 + $RPM_BUILD_ROOT%{l_prefix}/lib/pkgconfig/ 1.397 + 1.398 + # determine installation files 1.399 + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \ 1.400 + %{l_files_std} \ 1.401 + '%config %{l_prefix}/etc/fsl/fsl.sasl' \ 1.402 + '%config %{l_prefix}/etc/sasl/saslauthd.conf' \ 1.403 + '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl' \ 1.404 + '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run' \ 1.405 + '%dir %attr(0755,%{l_musr},%{l_rgrp}) %{l_prefix}/var/sasl/run/saslauthd' \ 1.406 + '%dir %attr(0700,%{l_susr},%{l_sgrp}) %{l_prefix}/var/sasl/log' 1.407 + 1.408 +%files -f files 1.409 + 1.410 +%clean 1.411 + 1.412 +%pre 1.413 + # before upgrade, save status and stop service 1.414 + [ $1 -eq 2 ] || exit 0 1.415 + eval `%{l_rc} sasl status 2>/dev/null | tee %{l_tmpfile}` 1.416 + %{l_rc} sasl stop 2>/dev/null 1.417 + exit 0 1.418 + 1.419 +%post 1.420 +%if "%{with_pam}" == "yes" 1.421 + if [ $1 -eq 1 ]; then 1.422 + # after install, add PAM configuration entry 1.423 + $RPM_INSTALL_PREFIX/sbin/pamtool --add --smart --name=sasl 1.424 + fi 1.425 +%endif 1.426 + if [ $1 -eq 2 ]; then 1.427 + # after upgrade, restore status 1.428 + eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile} 1.429 + [ ".$sasl_active" = .yes ] && %{l_rc} sasl start 1.430 + fi 1.431 + exit 0 1.432 + 1.433 +%preun 1.434 + # before erase, stop service and remove log files 1.435 + [ $1 -eq 0 ] || exit 0 1.436 + %{l_rc} sasl stop 2>/dev/null 1.437 + rm -f $RPM_INSTALL_PREFIX/var/sasl/log/*.log* >/dev/null 2>&1 || true 1.438 +%if "%{with_pam}" == "yes" 1.439 + # remove PAM configuration entry 1.440 + $RPM_INSTALL_PREFIX/sbin/pamtool --remove --smart --name=sasl 1.441 +%endif 1.442 + exit 0 1.443 +