diff --git a/pptp-1.7.2-compat.patch b/pptp-1.7.2-compat.patch index 15f4759..0ea1551 100644 --- a/pptp-1.7.2-compat.patch +++ b/pptp-1.7.2-compat.patch @@ -1,10 +1,71 @@ ---- pptp-1.7.2/pptp_compat.c 2008-05-14 07:33:55.000000000 +0100 -+++ pptp-1.7.2/pptp_compat.c 2008-05-14 12:34:46.000000000 +0100 -@@ -7,7 +7,6 @@ +Index: pptp_compat.c +=================================================================== +RCS file: /cvsroot/pptpclient/pptp-linux/pptp_compat.c,v +retrieving revision 1.1 +retrieving revision 1.3 +diff -u -r1.1 -r1.3 +--- pptp_compat.c 19 Feb 2008 21:43:28 -0000 1.1 ++++ pptp_compat.c 25 Jul 2008 00:13:56 -0000 1.3 +@@ -7,14 +7,15 @@ #include #include #include -#include #include ++#if defined (__SVR4) && defined (__sun) /* Solaris */ ++#include ++#endif #include #include "pptp_compat.h" + #include + #include "util.h" + +- + #if defined (__SVR4) && defined (__sun) /* Solaris */ + /* + * daemon implementation from uClibc +Index: pptp.c +=================================================================== +RCS file: /cvsroot/pptpclient/pptp-linux/pptp.c,v +retrieving revision 1.49 +retrieving revision 1.51 +diff -u -r1.49 -r1.51 +--- pptp.c 14 May 2008 06:32:52 -0000 1.49 ++++ pptp.c 24 Jul 2008 05:53:05 -0000 1.51 +@@ -61,9 +61,8 @@ + #include "version.h" + #if defined(__linux__) + #include +-#else +-#include "inststr.h" + #endif ++#include "inststr.h" + #include "util.h" + #include "pptp_quirks.h" + #include "pqueue.h" +@@ -129,7 +128,7 @@ + } + + #if defined (__SVR4) && defined (__sun) +-struct in_addr localbind = { INADDR_ANY }; ++struct in_addr localbind = { .s_addr = INADDR_ANY }; + #else + struct in_addr localbind = { INADDR_NONE }; + #endif +@@ -183,6 +182,7 @@ + struct in_addr inetaddr; + volatile int callmgr_sock = -1; + char ttydev[PATH_MAX]; ++ char *tty_name; + int pty_fd, tty_fd, gre_fd, rc; + volatile pid_t parent_pid, child_pid; + u_int16_t call_id, peer_call_id; +@@ -391,7 +391,7 @@ + file2fd("/dev/null", "wb", STDERR_FILENO); + } + +- char *tty_name = ttyname(tty_fd); ++ tty_name = ttyname(tty_fd); + snprintf(buf, sizeof(buf), "pptp: GRE-to-PPP gateway on %s", + tty_name ? tty_name : "(null)"); + #ifdef PR_SET_NAME diff --git a/pptp-1.7.2-ip-path.patch b/pptp-1.7.2-ip-path.patch index f62d5b9..b0c1be1 100644 --- a/pptp-1.7.2-ip-path.patch +++ b/pptp-1.7.2-ip-path.patch @@ -1,28 +1,186 @@ ---- pptp-1.7.2/routing.c 2008-05-14 07:33:55.000000000 +0100 -+++ pptp-1.7.2/routing.c 2008-05-19 14:21:39.000000000 +0100 -@@ -55,7 +55,7 @@ +Index: routing.c +=================================================================== +RCS file: /cvsroot/pptpclient/pptp-linux/routing.c,v +retrieving revision 1.1 +diff -u -r1.1 routing.c +--- routing.c 2 Aug 2006 07:07:37 -0000 1.1 ++++ routing.c 25 Mar 2009 13:58:28 -0000 +@@ -23,9 +23,26 @@ + #include + #include + #include "routing.h" ++#include "config.h" + ++#if defined (__SVR4) && defined (__sun) /* Solaris */ ++#include ++#include ++#include ++#include ++#include ++#include "util.h" ++/* PF_ROUTE socket*/ ++int rts; ++/* Destination and gateway addresses */ ++struct sockaddr_in rdst, rgw; ++/* Request sequence */ ++int rseq; ++int dorouting; ++#else /* Solaris */ + /* route to the server */ + char *route; ++#endif /* Solaris */ + + /* + +@@ -54,26 +71,113 @@ + */ void routing_init(char *ip) { ++#if defined (__SVR4) && defined (__sun) /* Solaris */ ++ rdst.sin_family = AF_INET; ++ if ( ! inet_pton(AF_INET, ip, &rdst.sin_addr) ) { ++ log("Cannot convert address: %s", strerror(errno)); ++ return; ++ } ++ ++ if ( (rts = socket(PF_ROUTE, SOCK_RAW, AF_INET )) < 0 ) { ++ log("Cannot open routing socket: %s", strerror(errno)); ++ return; ++ } ++ ++ struct rt_msg rtm = { ++ .hdr.rtm_msglen = sizeof(struct rt_msg), ++ .hdr.rtm_version = RTM_VERSION, ++ .hdr.rtm_type = RTM_GET, ++ .hdr.rtm_addrs = RTA_DST, ++ .hdr.rtm_pid = getpid(), ++ .hdr.rtm_seq = ++rseq, ++ .addrs[RTAX_DST] = rdst ++ }; ++ ++ if ( write(rts, &rtm, rtm.hdr.rtm_msglen) != rtm.hdr.rtm_msglen ) { ++ log("Error writing to routing socket: %s", strerror(errno)); ++ close(rts); ++ return; ++ } ++ ++ while ( read(rts, &rtm, sizeof(struct rt_msg)) > 0 ) ++ if ( rtm.hdr.rtm_pid == getpid() && rtm.hdr.rtm_seq == rseq) { ++ /* Check if host route already present */ ++ if ( ( rtm.hdr.rtm_flags & RTF_HOST ) != RTF_HOST ) { ++ rgw = rtm.addrs[RTAX_GATEWAY]; ++ dorouting = 1; ++ } ++ break; ++ } ++#else /* Solaris */ char buf[256]; - snprintf(buf, 255, "/bin/ip route get %s", ip); -+ snprintf(buf, 255, "/sbin/ip route get %s", ip); - FILE *p = popen(buf, "r"); +- FILE *p = popen(buf, "r"); ++ FILE *p; ++ ++ snprintf(buf, 255, "%s route get %s", IP_BINARY, ip); ++ p = popen(buf, "r"); fgets(buf, 255, p); /* TODO: check for failure of fgets */ -@@ -66,14 +66,14 @@ + route = strdup(buf); + pclose(p); + /* TODO: check for failure of command */ ++#endif /* Solaris */ + } void routing_start() { ++#if defined (__SVR4) && defined (__sun) /* Solaris */ ++ if ( ! dorouting ) ++ return; ++ ++ struct rt_msg rtm = { ++ .hdr.rtm_msglen = sizeof(struct rt_msg), ++ .hdr.rtm_version = RTM_VERSION, ++ .hdr.rtm_type = RTM_ADD, ++ .hdr.rtm_flags = RTF_HOST | RTF_GATEWAY | RTF_STATIC, ++ .hdr.rtm_addrs = RTA_DST | RTA_GATEWAY, ++ .hdr.rtm_pid = getpid(), ++ .hdr.rtm_seq = ++rseq, ++ .addrs[RTAX_DST] = rdst, ++ .addrs[RTAX_GATEWAY] = rgw ++ }; ++ ++ if ( write(rts, &rtm, rtm.hdr.rtm_msglen) != rtm.hdr.rtm_msglen ) { ++ log("Error adding route: %s", strerror(errno)); ++ } ++#else /* Solaris */ char buf[256]; - snprintf(buf, 255, "/bin/ip route replace %s", route); -+ snprintf(buf, 255, "/sbin/ip route replace %s", route); - FILE *p = popen(buf, "r"); +- FILE *p = popen(buf, "r"); ++ FILE *p; ++ ++ snprintf(buf, 255, "%s route replace %s", IP_BINARY, route); ++ p = popen(buf, "r"); pclose(p); ++#endif /* Solaris */ } void routing_end() { ++#if defined (__SVR4) && defined (__sun) /* Solaris */ ++ if ( ! dorouting) ++ return; ++ ++ struct rt_msg rtm = { ++ .hdr.rtm_msglen = sizeof(struct rt_msg), ++ .hdr.rtm_version = RTM_VERSION, ++ .hdr.rtm_type = RTM_DELETE, ++ .hdr.rtm_flags = RTF_HOST | RTF_GATEWAY | RTF_STATIC, ++ .hdr.rtm_addrs = RTA_DST | RTA_GATEWAY, ++ .hdr.rtm_pid = getpid(), ++ .hdr.rtm_seq = ++rseq, ++ .addrs[RTAX_DST] = rdst, ++ .addrs[RTAX_GATEWAY] = rgw ++ }; ++ ++ if ( write(rts, &rtm, rtm.hdr.rtm_msglen) != rtm.hdr.rtm_msglen ) { ++ log("Error deleting route: %s", strerror(errno)); ++ } ++#else /* Solaris */ char buf[256]; - snprintf(buf, 255, "/bin/ip route delete %s", route); -+ snprintf(buf, 255, "/sbin/ip route delete %s", route); - FILE *p = popen(buf, "r"); +- FILE *p = popen(buf, "r"); ++ FILE *p; ++ ++ snprintf(buf, 255, "%s route delete %s", IP_BINARY, route); ++ p = popen(buf, "r"); pclose(p); ++#endif /* Solaris */ } +Index: Makefile +=================================================================== +RCS file: /cvsroot/pptpclient/pptp-linux/Makefile,v +retrieving revision 1.47 +retrieving revision 1.49 +diff -u -r1.47 -r1.49 +--- Makefile 14 May 2008 06:32:52 -0000 1.47 ++++ Makefile 24 Jul 2008 05:37:47 -0000 1.49 +@@ -1,10 +1,13 @@ +-# $Id: pptp-1.7.2-ip-path.patch,v 1.2 2009/03/25 15:57:57 pghmcfc Exp $ ++# $Id: pptp-1.7.2-ip-path.patch,v 1.2 2009/03/25 15:57:57 pghmcfc Exp $ + VERSION=1.7.2 + RELEASE= + + ################################################################# +-# CHANGE THIS LINE to point to the location of your pppd binary. ++# CHANGE THIS LINE to point to the location of binaries + PPPD = /usr/sbin/pppd ++# Solaris ++# PPPD = /usr/bin/pppd ++IP = /bin/ip + ################################################################# + + BINDIR=$(DESTDIR)/usr/sbin +@@ -47,6 +52,7 @@ + echo "/* text added by Makefile target config.h */" > config.h + echo "#define PPTP_LINUX_VERSION \"$(VERSION)$(RELEASE)\"" >> config.h + echo "#define PPPD_BINARY \"$(PPPD)\"" >> config.h ++ echo "#define IP_BINARY \"$(IP)\"" >> config.h + + vector_test: vector_test.o vector.o + $(CC) -o vector_test vector_test.o vector.o diff --git a/pptp-1.7.2-makedeps.patch b/pptp-1.7.2-makedeps.patch new file mode 100644 index 0000000..f9bfe71 --- /dev/null +++ b/pptp-1.7.2-makedeps.patch @@ -0,0 +1,80 @@ +Index: Makefile +=================================================================== +RCS file: /cvsroot/pptpclient/pptp-linux/Makefile,v +retrieving revision 1.47 +retrieving revision 1.49 +diff -u -r1.47 -r1.49 +--- Makefile 14 May 2008 06:32:52 -0000 1.47 ++++ Makefile 24 Jul 2008 05:37:47 -0000 1.49 +@@ -96,3 +102,71 @@ + release: + cp pptp_$(VERSION)-0_i386.deb $(WEB) + cd $(WEB);make ++ ++# The following include file dependencies were generated using ++# "makedepend -w0 *.c", then manually removing out of tree entries. ++# DO NOT DELETE ++ ++dirutil.o: dirutil.h ++orckit_quirks.o: pptp_msg.h ++orckit_quirks.o: pptp_compat.h ++orckit_quirks.o: pptp_options.h ++orckit_quirks.o: pptp_ctrl.h ++orckit_quirks.o: util.h ++ppp_fcs.o: ppp_fcs.h ++ppp_fcs.o: pptp_compat.h ++pptp.o: config.h ++pptp.o: pptp_callmgr.h ++pptp.o: pptp_gre.h ++pptp.o: pptp_compat.h ++pptp.o: version.h ++pptp.o: inststr.h ++pptp.o: util.h ++pptp.o: pptp_quirks.h ++pptp.o: pptp_msg.h ++pptp.o: pptp_ctrl.h ++pptp.o: pqueue.h ++pptp.o: pptp_options.h ++pptp_callmgr.o: pptp_callmgr.h ++pptp_callmgr.o: pptp_ctrl.h ++pptp_callmgr.o: pptp_compat.h ++pptp_callmgr.o: pptp_msg.h ++pptp_callmgr.o: dirutil.h ++pptp_callmgr.o: vector.h ++pptp_callmgr.o: util.h ++pptp_callmgr.o: routing.h ++pptp_compat.o: pptp_compat.h ++pptp_compat.o: util.h ++pptp_ctrl.o: pptp_msg.h ++pptp_ctrl.o: pptp_compat.h ++pptp_ctrl.o: pptp_ctrl.h ++pptp_ctrl.o: pptp_options.h ++pptp_ctrl.o: vector.h ++pptp_ctrl.o: util.h ++pptp_ctrl.o: pptp_quirks.h ++pptp_gre.o: ppp_fcs.h ++pptp_gre.o: pptp_compat.h ++pptp_gre.o: pptp_msg.h ++pptp_gre.o: pptp_gre.h ++pptp_gre.o: util.h ++pptp_gre.o: pqueue.h ++pptp_gre.o: test.h ++pptp_quirks.o: orckit_quirks.h ++pptp_quirks.o: pptp_options.h ++pptp_quirks.o: pptp_ctrl.h ++pptp_quirks.o: pptp_compat.h ++pptp_quirks.o: pptp_msg.h ++pptp_quirks.o: pptp_quirks.h ++pqueue.o: util.h ++pqueue.o: pqueue.h ++routing.o: routing.h ++test.o: util.h ++test.o: test.h ++util.o: util.h ++vector.o: pptp_ctrl.h ++vector.o: pptp_compat.h ++vector.o: vector.h ++vector_test.o: vector.h ++vector_test.o: pptp_ctrl.h ++vector_test.o: pptp_compat.h ++version.o: config.h diff --git a/pptp-1.7.2-pptpsetup.patch b/pptp-1.7.2-pptpsetup.patch new file mode 100644 index 0000000..3d10cca --- /dev/null +++ b/pptp-1.7.2-pptpsetup.patch @@ -0,0 +1,23 @@ +Index: pptpsetup +=================================================================== +RCS file: /cvsroot/pptpclient/pptp-linux/pptpsetup,v +retrieving revision 1.4 +diff -u -r1.4 pptpsetup +--- pptpsetup 2 Aug 2006 07:02:47 -0000 1.4 ++++ pptpsetup 25 Mar 2009 13:41:37 -0000 +@@ -154,6 +154,7 @@ + + # delete entry from chap-secrets + my $chap_file = '/etc/ppp/chap-secrets'; ++ my $mode = (stat($chap_file))[2] & 07777; + + open( FILE, $chap_file ) + or die "$0: can't read '$chap_file': $!\n"; +@@ -171,6 +172,7 @@ + # write new chap-secrets + open( FILE, ">$chap_file" ) + or die "$0: can't write '$chap_file': $!\n"; ++ chmod $mode, $chap_file; + print FILE $new_chap; + close FILE; + diff --git a/pptp.spec b/pptp.spec index 4c88339..a28d678 100644 --- a/pptp.spec +++ b/pptp.spec @@ -1,6 +1,6 @@ Name: pptp Version: 1.7.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Point-to-Point Tunneling Protocol (PPTP) Client Group: Applications/Internet License: GPLv2+ @@ -8,6 +8,8 @@ URL: http://pptpclient.sourceforge.net/ Source0: http://downloads.sf.net/pptpclient/pptp-%{version}.tar.gz Patch0: pptp-1.7.2-compat.patch Patch1: pptp-1.7.2-ip-path.patch +Patch2: pptp-1.7.2-pptpsetup.patch +Patch3: pptp-1.7.2-makedeps.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: ppp >= 2.4.2, /sbin/ip @@ -18,13 +20,23 @@ by employers and some cable and ADSL service providers. %prep %setup -q -%patch0 -p1 -b .compat -%patch1 -p1 -b .ip-path -%{__sed} -i -e 's/install -o root -m 555 pptp/install -m 755 pptp/' Makefile + +# Remove reference to stropts.h, not shipped in F9 onwards (applied upstream) +%patch0 -p0 -b .compat + +# Make location of "ip" binary build-time configurable (applied upstream) +%patch1 -p0 -b .ip-path + +# Retain permissions on /etc/ppp/chap-secrets (#492090, applied upstream) +%patch2 -p0 -b .bz492090 + +# Fix Makefile dependencies to support parallel make (applied upstream) +%patch3 -p0 -b .makedeps + +%{__perl} -pi -e 's/install -o root -m 555 pptp/install -m 755 pptp/;' Makefile %build -# Parallel make disabled because .o files don't have dependency on config.h -%{__make} CFLAGS="-Wall %{optflags}" +%{__make} %{?_smp_mflags} CFLAGS="-Wall %{optflags}" IP=/sbin/ip %install %{__rm} -rf %{buildroot} @@ -48,6 +60,13 @@ by employers and some cable and ADSL service providers. %config(noreplace) /etc/ppp/options.pptp %changelog +* Wed Mar 25 2009 Paul Howarth 1.7.2-5 +- Retain permissions on /etc/ppp/chap-secrets when using pptpsetup (#492090) +- Use upstream versions of patches +- Re-enable parallel build; Makefile dependencies now fixed +- Use perl rather than sed to edit Makefile, for spec compatibility with + ancient distro releases + * Thu Feb 26 2009 Fedora Release Engineering - 1.7.2-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild