Пакет stunnel: Specfile

# Spec file for stunnel

%define version 3.26
%define release alt5


Name: stunnel
Version: %version
Release: %release.1

Summary: SSL-encrypting socket wrapper

License: GPL v.2
Group: System/Servers
URL: http://www.stunnel.org

Packager: Nikolay A. Fetisov <naf@altlinux.ru>

Source: %url/download/%name/src/%name-%version.tar.bz2
Source1: %name.cnf
Source2: README.Certificate-Creation
Source3: pop3-redirect_stunnel
Source4: pop3s_stunnel
Source5: imaps_stunnel
Source6: smtps_stunnel

Patch1: %name-3.26-rh-authpriv.patch
Patch2: %name-3.22-alt-nosdfhtml.patch
Patch3: %name-3.26-alt-const-warning.patch
Patch4: %name-3.26-alt-log-warning.patch
Patch5: %name-3.26-alt-newssl.patch
Patch6: %name-3.26-alt-gcc4.1.patch
Patch7: %name-3.26-alt-option_misspell.patch
Patch8: %name-3.26-alt-signal_pipe.patch
Patch9: %name-3.26-alt-warn_unused_result.patch

PreReq: coreutils, openssl

# Automatically added by buildreq on Wed Dec 10 2003
BuildRequires: libssl-devel libwrap-devel

%description
The stunnel program is designed to work as SSL encryption wrapper between
remote clients and local (inetd-startable) or remote servers.  The concept is
that having non-SSL aware daemons running on your system you can easily set
them up to communicate with clients over secure SSL channels.

stunnel can be used to add SSL functionality to commonly used inetd daemons
like POP-2, POP-3, and IMAP servers, to standalone daemons like NNTP, SMTP
and HTTP, and in tunneling PPP over network sockets without changes to the
source code.

%prep
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6
%patch7
%patch8
%patch9
%__install -p -m644 %SOURCE1 %SOURCE2 %SOURCE3 .

%build
%ifarch %intel
  %def_enable Werror
%endif

%add_optflags -DNO_RC5 -DNO_IDEA
%define _ssldir	%_var/lib/ssl
%define _pemdir	%_ssldir/certs

%configure \
	--with-ssl=%prefix \
	--with-pem-dir=%_pemdir \
	--with-cert-file=%_ssldir/cert.pem \
	--with-cert-dir=%_ssldir/trusted \
	--with-tcp-wrappers

touch %name.{pem,sdf}
%make_build piddir=%_var/run

%install
%makeinstall \
	ssldir=$RPM_BUILD_ROOT%_ssldir \
	man8dir=$RPM_BUILD_ROOT%_mandir/man8 \
	piddir=$RPM_BUILD_ROOT%_var/run \
	PEM_DIR=$RPM_BUILD_ROOT%_pemdir
%__install -p -m644 %name.cnf $RPM_BUILD_ROOT%_ssldir/

%__mkdir_p $RPM_BUILD_ROOT%_sysconfdir/xinetd.d
%__install -pD -m640 %SOURCE4 %SOURCE5 %SOURCE6 $RPM_BUILD_ROOT%_sysconfdir/xinetd.d/

%post
#%%post_ldconfig
cd %_pemdir
if [ ! -f %name.pem ]; then
	umask 037
	echo -e '\n.\n.\n.\n.\n.\n' |
		openssl req -newkey rsa:1024 -x509 -days 365 -nodes -config %_ssldir/%name.cnf \
		-keyout %name.pem -out %name.pem >/dev/null 2>&1
	chown :popa3d %name.pem 2>&1
fi

#%%postun -p %postun_ldconfig


%files
%doc BUGS FAQ HISTORY PORTS README TODO %name.html pop3-redirect_stunnel

%attr(755,root,root) %_sbindir/%name
%exclude %_libdir/%name.so*
%_man8dir/%name.*
%config(noreplace) %_sysconfdir/xinetd.d/*
%config(noreplace) %_ssldir/%name.cnf
%ghost %attr(640,root,popa3d) %config(noreplace,missingok) %_pemdir/*


%changelog
* Sat Aug 09 2008 ALT QA Team Robot <qa-robot@altlinux.org> 3.26-alt5.1
- Automated rebuild due to libssl.so.6 -> libssl.so.7 soname change.

* Tue Jan 09 2007 Nikolay A. Fetisov <naf@altlinux.ru> 3.26-alt5
- Fix building with enabled warn_unused_result flag

* Thu Oct 05 2006 Nikolay A. Fetisov <naf@altlinux.ru> 3.26-alt4
- Fix names for xinetd config files, #6350
- Adding sample xinetd config file for SSL-wrapped SMTP server
- Degrade run privileges in xinend config files from root to popa3d
- Fix misspelling variable declaration in stunnel.c
- Fix for build without linuxthreads
- Removing dummy stunnel.so from package

* Sat Sep 16 2006 Nikolay A. Fetisov <naf@altlinux.ru> 3.26-alt3
- Rebuild with GCC 4.1
-- Fix several data type declarations

* Wed May 12 2004 Alexey Voinov <voins@altlinux.ru> 3.26-alt2
- rebuild with new openssl (.newssl patch)

* Fri Jan 09 2004 Alexey Tourbin <at@altlinux.ru> 3.26-alt1.1
- prototypes.h: redefined log() to log_log() to workaround
  gcc bug c/9482 (math builtins are always visible)

* Wed Dec 10 2003 Alexey Tourbin <at@altlinux.ru> 3.26-alt1
- 3.26 (security update, CAN-2003-0740)
- rh-authpriv.patch updated
- rh-sigchld.patch merged upstream
- a warning fixed (alt-const-warning.patch), Werror mode enabled
- %_sbindir/%name permissions changed (711 -> 755)

* Mon Aug 04 2003 Dmitry V. Levin <ldv@altlinux.org> 3.22-alt3
- Applied SIGCHLD patch from RH.

* Fri Nov 22 2002 Rider <rider@altlinux.ru> 3.22-alt2
- rebuild (gcc 3.2)
- disable docs generation from sdf

* Thu Dec 27 2001 Dmitry V. Levin <ldv@alt-linux.org> 3.22-alt1
- 3.22 (security).
- Merged RH patches:
  - log using LOG_AUTHPRIV facility by default (#47289)
  - implicitly trust certificates in %%_ssldir/trusted (#24034)

* Mon Aug 13 2001 Dmitry V. Levin <ldv@altlinux.ru> 3.19-alt1
- 3.19

* Thu Aug 02 2001 Dmitry V. Levin <ldv@altlinux.ru> 3.18-alt1
- 3.18

* Tue Jul 31 2001 Dmitry V. Levin <ldv@altlinux.ru> 3.17-alt1
- 3.17

* Thu Jul 26 2001 Dmitry V. Levin <ldv@altlinux.ru> 3.16-alt1
- 3.16

* Sat Feb 24 2001 Dmitry V. Levin <ldv@fandra.org> 3.14-ipl1
- 3.14

* Fri Jan 26 2001 Dmitry V. Levin <ldv@fandra.org> 3.13-ipl1
- 3.13

* Wed Jan 10 2001 Dmitry V. Levin <ldv@fandra.org> 3.11-ipl1mdk
- Initial revision.