diff options
author | Mike Gilbert <floppym@gentoo.org> | 2023-04-26 11:43:59 -0400 |
---|---|---|
committer | Mike Gilbert <floppym@gentoo.org> | 2023-04-26 11:44:25 -0400 |
commit | 15e49b95c5b14796f6819b13fcbf8714ea0e9235 (patch) | |
tree | 71163271382a9ce70e83e607fe107de92206423b /net-dialup/ppp | |
parent | net-libs/ngtcp2: destabilize 0.15.0 for ~amd64 (diff) | |
download | gentoo-15e49b95c5b14796f6819b13fcbf8714ea0e9235.tar.gz gentoo-15e49b95c5b14796f6819b13fcbf8714ea0e9235.tar.bz2 gentoo-15e49b95c5b14796f6819b13fcbf8714ea0e9235.zip |
net-dialup/ppp: apply passwordfd-read-early.patch
Bug: https://bugs.gentoo.org/905112
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'net-dialup/ppp')
-rw-r--r-- | net-dialup/ppp/files/ppp-2.5.0-passwordfd-read-early.patch | 97 | ||||
-rw-r--r-- | net-dialup/ppp/ppp-2.5.0-r1.ebuild | 117 |
2 files changed, 214 insertions, 0 deletions
diff --git a/net-dialup/ppp/files/ppp-2.5.0-passwordfd-read-early.patch b/net-dialup/ppp/files/ppp-2.5.0-passwordfd-read-early.patch new file mode 100644 index 000000000000..f61e8227efe2 --- /dev/null +++ b/net-dialup/ppp/files/ppp-2.5.0-passwordfd-read-early.patch @@ -0,0 +1,97 @@ +From a198cd83dfba6a738a4df80abd2675b4e8ee193c Mon Sep 17 00:00:00 2001 +From: Mike Frysinger <vapier@gentoo.org> +Date: Fri, 3 Jan 2020 17:19:09 +0100 +Subject: [PATCH] passwordfd: read early + +--- + pppd/plugins/passwordfd.c | 54 ++++++++++++++++++--------------------- + 1 file changed, 25 insertions(+), 29 deletions(-) + +diff --git a/pppd/plugins/passwordfd.c b/pppd/plugins/passwordfd.c +index c1f782e..13aec56 100644 +--- a/pppd/plugins/passwordfd.c ++++ b/pppd/plugins/passwordfd.c +@@ -24,11 +24,11 @@ + + char pppd_version[] = PPPD_VERSION; + +-static int passwdfd = -1; + static char save_passwd[MAXSECRETLEN]; + ++static int readpassword (char **); + static struct option options[] = { +- { "passwordfd", o_int, &passwdfd, ++ { "passwordfd", o_special, (void *)readpassword, + "Receive password on this file descriptor" }, + { NULL } + }; +@@ -38,43 +38,39 @@ static int pwfd_check (void) + return 1; + } + +-static int pwfd_passwd (char *user, char *passwd) ++static int readpassword(char **argv) + { +- int readgood, red; +- +- if (passwdfd == -1) +- return -1; ++ char *arg = *argv; ++ int passwdfd = -1; ++ int chunk, len; + +- if (passwd == NULL) +- return 1; +- +- if (passwdfd == -2) { +- strcpy (passwd, save_passwd); +- return 1; ++ if (sscanf(arg, "%d", &passwdfd) != 1 || passwdfd < 0) ++ { ++ error ("\"%s\" is not a valid file descriptor number", arg); ++ return 0; + } + +- readgood = 0; ++ len = 0; + do { +- red = read (passwdfd, passwd + readgood, MAXSECRETLEN - 1 - readgood); +- if (red == 0) +- break; +- if (red < 0) { +- error ("Can't read secret from fd\n"); +- readgood = -1; ++ chunk = read (passwdfd, save_passwd + len, MAXSECRETLEN - 1 - len); ++ if (chunk == 0) + break; ++ if (chunk < 0) { ++ error ("Can't read secret from fd %d", passwdfd); ++ return 0; + } +- readgood += red; +- } while (readgood < MAXSECRETLEN - 1); +- ++ len += chunk; ++ } while (len < MAXSECRETLEN - 1); ++ save_passwd[len] = 0; + close (passwdfd); + +- if (readgood < 0) +- return 0; +- +- passwd[readgood] = 0; +- strcpy (save_passwd, passwd); +- passwdfd = -2; ++ return 1; ++} + ++static int pwfd_passwd (char *user, char *passwd) ++{ ++ if (passwd != NULL) ++ strcpy (passwd, save_passwd); + return 1; + } + +-- +2.40.0 + diff --git a/net-dialup/ppp/ppp-2.5.0-r1.ebuild b/net-dialup/ppp/ppp-2.5.0-r1.ebuild new file mode 100644 index 000000000000..9e490709f159 --- /dev/null +++ b/net-dialup/ppp/ppp-2.5.0-r1.ebuild @@ -0,0 +1,117 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit linux-info pam + +PATCH_TARBALL_NAME="${PN}-2.4.9-patches-03" +DESCRIPTION="Point-to-Point Protocol (PPP)" +HOMEPAGE="https://ppp.samba.org/" +SRC_URI="https://download.samba.org/pub/ppp/${P}.tar.gz + https://raw.githubusercontent.com/ppp-project/ppp/${P}/contrib/pppgetpass/pppgetpass.8" + +LICENSE="BSD GPL-2" +SLOT="0/${PV}" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +IUSE="activefilter atm gtk pam systemd" + +DEPEND=" + dev-libs/openssl:0= + virtual/libcrypt:= + activefilter? ( net-libs/libpcap ) + atm? ( net-dialup/linux-atm ) + gtk? ( x11-libs/gtk+:2 ) + pam? ( sys-libs/pam ) + systemd? ( sys-apps/systemd ) +" +RDEPEND="${DEPEND} + !<net-misc/netifrc-0.7.1-r2" +BDEPEND="virtual/pkgconfig" +PDEPEND="net-dialup/ppp-scripts" + +PATCHES=( + "${FILESDIR}"/ppp-2.5.0-passwordfd-read-early.patch +) + +pkg_setup() { + # Avoid linux-info_pkg_setup + : +} + +src_configure() { + local args=( + --localstatedir="${EPREFIX}"/var + --runstatedir="${EPREFIX}"/run + $(use_enable systemd) + $(use_with atm) + $(use_with pam) + $(use_with activefilter pcap) + $(use_with gtk) + --enable-cbcp + ) + econf "${args[@]}" +} + +src_install() { + default + + find "${ED}" -name '*.la' -type f -delete || die + + if use pam; then + pamd_mimic_system ppp auth account session + fi + + insinto /etc/modprobe.d + newins "${FILESDIR}/modules.ppp" ppp.conf + + dosbin scripts/p{on,off,log} + doman scripts/pon.1 + dosym pon.1 /usr/share/man/man1/poff.1 + dosym pon.1 /usr/share/man/man1/plog.1 + + # Adding misc. specialized scripts to doc dir + dodoc -r scripts + + if use gtk ; then + dosbin contrib/pppgetpass/pppgetpass.{gtk,vt} + newsbin contrib/pppgetpass/pppgetpass.sh pppgetpass + else + newsbin contrib/pppgetpass/pppgetpass.vt pppgetpass + fi + # Missing from upstream tarball + # https://github.com/ppp-project/ppp/pull/412 + #doman contrib/pppgetpass/pppgetpass.8 + doman "${DISTDIR}/pppgetpass.8" +} + +pkg_postinst() { + local CONFIG_CHECK="~PPP ~PPP_ASYNC ~PPP_SYNC_TTY" + local ERROR_PPP="CONFIG_PPP:\t missing PPP support (REQUIRED)" + local ERROR_PPP_ASYNC="CONFIG_PPP_ASYNC:\t missing asynchronous serial line discipline" + ERROR_PPP_ASYNC+=" (optional, but highly recommended)" + local WARNING_PPP_SYNC_TTY="CONFIG_PPP_SYNC_TTY:\t missing synchronous serial line discipline" + WARNING_PPP_SYNC_TTY+=" (optional; used by 'sync' pppd option)" + if use activefilter ; then + CONFIG_CHECK+=" ~PPP_FILTER" + local ERROR_PPP_FILTER="CONFIG_PPP_FILTER:\t missing PPP filtering support (REQUIRED)" + fi + CONFIG_CHECK+=" ~PPP_DEFLATE ~PPP_BSDCOMP ~PPP_MPPE" + local ERROR_PPP_DEFLATE="CONFIG_PPP_DEFLATE:\t missing Deflate compression (optional, but highly recommended)" + local ERROR_PPP_BSDCOMP="CONFIG_PPP_BSDCOMP:\t missing BSD-Compress compression (optional, but highly recommended)" + local WARNING_PPP_MPPE="CONFIG_PPP_MPPE:\t missing MPPE encryption (optional, mostly used by PPTP links)" + CONFIG_CHECK+=" ~PPPOE ~PACKET" + local WARNING_PPPOE="CONFIG_PPPOE:\t missing PPPoE support (optional, needed by pppoe plugin)" + local WARNING_PACKET="CONFIG_PACKET:\t missing AF_PACKET support (optional, used by pppoe plugin)" + if use atm ; then + CONFIG_CHECK+=" ~PPPOATM" + local WARNING_PPPOATM="CONFIG_PPPOATM:\t missing PPPoA support (optional, needed by pppoatm plugin)" + fi + + linux-info_pkg_setup + + echo + elog "pon, poff and plog scripts have been supplied for experienced users." + elog "Users needing particular scripts (ssh,rsh,etc.) should check out the" + elog "/usr/share/doc/${PF}/scripts directory." +} |