Name:           vpnc
Version:        0.5.3
Release:        4%{?_dist_release}

Summary:        IPSec VPN client compatible with Cisco equipment
Summary(ja):    Cisco 機器互換の IPSec VPN クライアント

Group:          Applications/Internet
License:        GPLv2+
URL:            http://www.unix-ag.uni-kl.de/~massar/vpnc/
Source0:        http://www.unix-ag.uni-kl.de/~massar/vpnc/%{name}-%{version}.tar.gz
Source1:        generic-vpnc.conf
Source2:	vpnc.consolehelper
Source3:	vpnc-disconnect.consolehelper
Source4:	vpnc.pam
Source5:	vpnc-helper
Patch2:		vpnc-0.5.3-cloexec.patch
Patch3:		vpnc-0.5.1-dpd.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires:  libgcrypt-devel > 1.1.90
Requires:       iproute

Vendor: Project Vine
Distribution: Vine Linux

%description
A VPN client compatible with Cisco's EasyVPN equipment.

Supports IPSec (ESP) with Mode Configuration and Xauth.  Supports only
shared-secret IPSec authentication, 3DES, MD5, and IP tunneling.

%package consoleuser
Summary:	Allows console user to run the VPN client directly
Summary(ja):    コンソールユーザに直接VPNクライアントの実行許可を与える
Group:		Applications/Internet
Requires:	vpnc = %{version}-%{release}
Requires:	usermode

%description consoleuser
Allows the console user to run the IPSec VPN client directly without
switching to the root account.

%prep
%setup -q
%patch2 -p1 -b .cloexec
%patch3 -p1 -b .dpd

%build
CFLAGS="$RPM_OPT_FLAGS -fPIE" LDFLAGS="$RPM_OPT_FLAGS -pie" make PREFIX=/usr 

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR="$RPM_BUILD_ROOT" PREFIX=/usr
rm -f $RPM_BUILD_ROOT%{_bindir}/pcf2vpnc
chmod 0644 pcf2vpnc
rm -f $RPM_BUILD_ROOT%{_mandir}/man1/pcf2vpnc.1
chmod 0644 $RPM_BUILD_ROOT%{_mandir}/man8/vpnc.8
install -m 0600 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/vpnc/default.conf
mkdir -p $RPM_BUILD_ROOT%{_var}/run/vpnc
touch $RPM_BUILD_ROOT%{_var}/run/vpnc/pid \
      $RPM_BUILD_ROOT%{_var}/run/vpnc/defaultroute \
      $RPM_BUILD_ROOT%{_var}/run/vpnc/resolv.conf-backup
install -Dp -m 0644 %{SOURCE2} \
    $RPM_BUILD_ROOT%{_sysconfdir}/security/console.apps/vpnc
install -Dp -m 0644 %{SOURCE3} \
    $RPM_BUILD_ROOT%{_sysconfdir}/security/console.apps/vpnc-disconnect
install -Dp -m 0644 %{SOURCE4} \
    $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/vpnc
install -Dp -m 0644 %{SOURCE4} \
    $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/vpnc-disconnect
install -m 0755 %{SOURCE5} \
    $RPM_BUILD_ROOT%{_sbindir}/vpnc-helper
mkdir -p $RPM_BUILD_ROOT%{_bindir}
ln -sf consolehelper $RPM_BUILD_ROOT%{_bindir}/vpnc
ln -sf consolehelper $RPM_BUILD_ROOT%{_bindir}/vpnc-disconnect
rm -f $RPM_BUILD_ROOT%{_datadir}/doc/vpnc/COPYING

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc README COPYING pcf2vpnc pcf2vpnc.1

%dir %{_sysconfdir}/vpnc
%config(noreplace) %{_sysconfdir}/vpnc/vpnc-script
%config(noreplace) %{_sysconfdir}/vpnc/default.conf
%{_sbindir}/vpnc
%{_bindir}/cisco-decrypt
%{_sbindir}/vpnc-disconnect
%{_mandir}/man8/vpnc.*
%{_mandir}/man1/cisco-decrypt.*
%dir %{_var}/run/vpnc
%ghost %verify(not md5 size mtime) %{_var}/run/vpnc/pid
%ghost %verify(not md5 size mtime) %{_var}/run/vpnc/defaultroute
%ghost %verify(not md5 size mtime) %{_var}/run/vpnc/resolv.conf-backup

%files consoleuser
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/security/console.apps/vpnc*
%config(noreplace) %{_sysconfdir}/pam.d/vpnc*
%{_bindir}/vpnc*
%{_sbindir}/vpnc-helper

%changelog
* Sat Dec  6 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 0.5.3-4
- rebuilt with libgcrypt 1.6.0

* Sun Dec 29 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.5.3-3
- rebuild with VineSeed environment

* Fri Aug 17 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.5.3-2
- rebuild with VineSeed environment

* Tue May 26 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.5.3-1
- initial build for Vine Linux

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.5.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Thu Nov 20 2008 Tomas Mraz <tmraz@redhat.com> - 0.5.3-2
- upgrade to new version
- fix race in vpnc-cleanup (#465315)

* Thu Jul 24 2008 Tomas Mraz <tmraz@redhat.com> - 0.5.1-6
- do not modify domain in resolv.conf (#446404)
- clean up modified resolv.conf on startup (#455899)

* Sat Apr  5 2008 Michal Schmidt <mschmidt@redhat.com> - 0.5.1-5
- vpnc-script: fix 'ip link ...' syntax.

* Thu Apr  3 2008 Tomas Mraz <tmraz@redhat.com> - 0.5.1-4
- drop autogenerated perl requires (#440304)
- compute MTU based on default route device (#433846)

* Wed Feb 20 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 0.5.1-3
- Autorebuild for GCC 4.3

* Tue Nov 13 2007 Tomas Mraz <tmraz@redhat.com> - 0.5.1-2
- try to make DPD less sensitive (#345281)

* Thu Sep 20 2007 Tomas Mraz <tmraz@redhat.com> - 0.5.1-1
- upgrade to latest upstream

* Mon Sep  3 2007 Tomas Mraz <tmraz@redhat.com> - 0.4.0-4
- fix long standing bug causing problems on x86_64 (#232565) now for real

* Wed Aug 22 2007 Tomas Mraz <tmraz@redhat.com> - 0.4.0-3
- license tag fix

* Tue Mar 20 2007 Tomas Mraz <tmraz@redhat.com> - 0.4.0-2
- -fstack-protector miscompilation on x86_64 is back (#232565)

* Mon Feb 26 2007 Tomas Mraz <tmraz@redhat.com> - 0.4.0-1
- upgrade to new upstream version

* Wed Jan 17 2007 Tomas Mraz <tmraz@redhat.com> - 0.3.3-15
- do not overwrite personalized vpnc scripts (#195842)
- we must not allow commandline options to vpnc when run through consolehelper

* Wed Jan 17 2007 Tomas Mraz <tmraz@redhat.com> - 0.3.3-14
- add consoleuser subpackage (#160571)
- fix permissions on manpage (#222578)

* Tue Nov  7 2006 Tomas Mraz <tmraz@redhat.com> - 0.3.3-13
- don't leak socket fds

* Tue Sep 12 2006 Tomas Mraz <tmraz@redhat.com> - 0.3.3-12
- drop hoplimit from ip route output (#205923)
- let's try enabling -fstack-protector again, seems to work now

* Thu Sep  7 2006 Tomas Mraz <tmraz@redhat.com> - 0.3.3-11
- rebuilt for FC6

* Wed Jun  7 2006 Tomas Mraz <tmraz@redhat.com> 0.3.3-9
- drop the -fstack-protector not -f-stack-protector

* Tue May 30 2006 Tomas Mraz <tmraz@redhat.com> 0.3.3-8
- drop -fstack-protector from x86_64 build (workaround for #172145)
- make rekeying a little bit better

* Thu Mar  9 2006 Tomas Mraz <tmraz@redhat.com> 0.3.3-7
- add basic rekeying support (the patch includes NAT keepalive support
  by Brian Downing)
- dropped disconnect patch (solved differently)

* Wed Feb 15 2006 Tomas Mraz <tmraz@redhat.com> 0.3.3-6
- rebuild with new gcc

* Tue Jan 24 2006 Tomas Mraz <tmraz@redhat.com> 0.3.3-5
- send the disconnect packet properly (patch by Laurence Moindrot)

* Thu Sep 22 2005 Tomas Mraz <tmraz@redhat.com> 0.3.3-4
- improve compatibility with some Ciscos

* Wed Jun 15 2005 Tomas Mraz <tmraz@redhat.com> 0.3.3-3
- improve fix_ip_get_output in vpnc-script (#160364)

* Mon May 30 2005 Tomas Mraz <tmraz@redhat.com> 0.3.3-2
- package /var/run/vpnc and ghost files it can contain (#159015)
- add /sbin /usr/sbin to the path in vpnc-script (#159099)

* Mon May 16 2005 Tomas Mraz <tmraz@redhat.com> 0.3.3-1
- new upstream version

* Thu Apr  7 2005 Michael Schwendt <mschwendt[AT]users.sf.net>
- rebuilt

* Wed Jan 05 2005 Warren Togami <wtogami@redhat.com> 0.3.2-3
- Fix 64bit

* Thu Dec 23 2004 Warren Togami <wtogami@redhat.com> 0.3.2-2
- make PIE (davej)

* Mon Dec 20 2004 Warren Togami <wtogami@redhat.com> 0.3.2-1
- 0.3.2
