pppd/options.c: fix memory leak on error path (#441) found by Coverity 602err: 603 fclose(f); 604 privileged_option = oldpriv; CID 436193 (#1 of 1): Resource leak (RESOURCE_LEAK)10. overwrite_var: Overwriting option_source in option_source = oldsource leaks the storage that option_source points to. 605 option_source = oldsource; Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
pppd/options.c: handle malloc failure (#425) Signed-off-by: Ilya Shipitsin <chipitsine@gmail.com>
Additional fixes for broken build This change fixes the build when - ./configure is run with --disable-plugins - ./configure is run with --disable-peap --disable-eaptls --disable-microsoft-extensions The latter disables the MPPE encryption too, but <pppd/crypto.h> is still needed. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Fix several issues uncovered by Coverity (#397) * Fix for coverity issue 436265, we should cap copy to size of destination buffer Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fix for coverity issue 436262, llv6_ntoa() returns a pointer to a buffer that can be up to 64 bytes long; likely not a problem, but this will quiet coverity Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fix for coverity issue 436251, not freeing path in the normal flow of the code Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436258, Digest maybe uninitialized in some paths of this code Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fix for coverity issue 436254, forgot to free 's' before returning from the function? Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436251, memory leak in put_string() function Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue 436215, should copy at most sizeof(devname) bytes Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436203, if no authentication (or no accounting) server was found, we still need to free the allocated local instance Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436171, use of uninitialized variable Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Use of signed vs unsigned variable in printf for MD4Update Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436182, fixing possible buffer overrun in handling of PW_CLASS attribute Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Fixing coverity issue #436156 Signed-off-by: Eivind Næss <eivnaes@yahoo.com> * Compile errors Signed-off-by: Eivind Næss <eivnaes@yahoo.com> [paulus@ozlabs.org - Squashed to avoid breaking bisection] Signed-off-by: Eivind Næss <eivnaes@yahoo.com> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Header file reorganization and cleaning up the public API for pppd version 2.5.0 (#379) This commit does several things, being a squash-and-merge of a series of changes; squashed in order not to break bisection. * Clean up pppd.h, moving declarations that should only be accessed by pppd code (not by users of pppd) to a new pppd-private.h. Also, other parts of pppd.h were moved to multilink.h, chap.h, eap.h, eui64.h, and a new options.h. * Provide an API for access to data that is needed by plugins (in no particular order): - ifname - ifunit - remote_name - remote_number - peer_authname - status (now called "code" internally) - phase - doing_multilink - multilink_master - idle_time_limit - link_connect_time - max_connect_time - link_stats - ipparam - hostname - got_sigterm - got_sigusr2 - got_sighup - session_number - maxoctets - maxoctets_dir - debug - persist - devnam - modem - peer_authname - sync_serial * Update the version number to 2.5.0. * Detect availability of stddef.h and stdarg.h. * Rename some headers: - pppcrypt.c/h to crypto_ms.c/h - ppp-crypto.c/h to crypto.c/h - ppp-crypto-priv.h to crypto-priv.h - chap-new.c/h to chap.c/h * Remove chap-md5.h, crypto-priv.h, eap-tls.h, etc. from the list of header files to be installed. * Provide typedefs for the hook functions. * Provide a typedef for the "phase" variable. * Provide a typedef for the link statistics array. * Remove the option_t typedef. * Rename the following functions by adding a "ppp_" prefix (with the intention that these are a "public" API for use by plugins): - option_error - add_options - int_option, - options_from_file - script_setenv - bad_ip_adrs, - netif_get/set_mtu (renamed to ppp_get/set_mtu) - get_time - timeout - untimeout - safe_fork - sys_close - set_session_number - update_link_stats (renamed to ppp_get_link_stats) - add_notifier (renamed to ppp_add_notify) - remove_notifier (renamed to ppp_del_notify) - generic_[dis]establish_ppp (to ppp_generic_[dis]establish) * Rename ppp_devnam to ppp_devname. * Rename ppp_available() to ppp_check_kernel_support(). * Use unsigned char instead of u_char, unsigned short instead of u_short, uint32_t instead of u_int32_t. * Add const to some declarations * Update comments * Change the interface for notifiers to use an enum to identify which notifier is to be modified. * Provide an API for getting the path to a file, with an enum to identify different types of file. * Link plugins with the -DPLUGIN flag [paulus@ozlabs.org - wrote commit message] Signed-off-by: Eivind Næss <eivnaes@yahoo.com> Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Add option to show all options (show-options), and fixing up the version text to include copyright and package name from autotools. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Let ./configure control the paths for pppd This was previously done by specifying an overriding value for _ROOT_PATH. With this change, this variable is now gone. Instead, pathnames.h will use the SYSCONFDIR and LOCALSTATEDIR to resolve these paths. These directories is already controlled by configure. Package maintainers should be aware though that this may change their current configuration. The convential ./configure way is to specify: ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var/run --with-plugin-dir=/usr/lib/pppd/2.4.10 If one omit the --sysconfdir option, then the default location is by ${prefix}/etc which may not be what you want. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Removing option to configure PPP_WITH_MAXOCTETS, helps clean up the code and it can be controlled via config options. It does nothing by default Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Cleanup in pppd/pppd.h, eliminate unecessary headers This removes the need to include the following heades in pppd.h <limits.h>, this is included where needed (main.c). The number of groups already retrieved is stored in the "int ngroups" variable. <sys/params.h>, use MAXPATHLEN where needed <net/if.h>, such that the value of IFNAMSIZ doesn't have to be declared to include <pppd/pppd.h> Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Changing MAXOCTETS to PPP_WITH_MAXOCTETS Though, this could be renamed to PPP_WITH_SESSION_LIMITS; I don't know Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Changing PPP_FILTER to PPP_WITH_FILTER for consistency. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Changing PLUGIN to PPP_WITH_PLUGINS for consistency Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Changing HAVE_MULTILINK to PPP_WITH_MULTILINK To be consistent with other options / defines. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
Changing INET6 to PPP_WITH_IPV6CP and adding configure option Based on feedback on PR #296, the option ipv6-support seems inconsistent with the existing ipxcp option. Futhermore, the #define has been renamed to avoid bleeding into third party projects. pppdconf.h is already distributed and will define or undefine the PPP_WITH_IPV6CP define. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
pppd: Add dummy noipx option Add "noipx" as an option that does nothing to avoid breaking installations that have "noipx" in /etc/ppp/defaults or wherever. (The IPX-related options were removed by commit c2881a6b71a3 ("pppd: Drop linux IPX support (#326)", 2022-01-13)). Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
pppd: Add ipv6-{up,down}-script options (#321) These allow a user to specify the paths to the scripts usually located at /etc/ppp/ipv6-up and /etc/ppp/ipv6-down, similarly to the existing ip-up-script and ip-down-script options Signed-off-by: Daniel Barlow <dan@telent.net>
pppd: Remove usage of incorrect constant MAXIFNAMELEN MAXIFNAMELEN is currently hardcoded to 32, but maximal size of interface name on Linux is just 15 + nul-term byte. This limit is already provided by IFNAMSIZ macro defined in net/if.h header file. So replace MAXIFNAMELEN usage by IFNAMSIZ to not silently truncate interface name. Signed-off-by: Pali Rohár <pali@kernel.org>
Use autoconf/automake to configure and make ppp This change brings in autoconf/automake scripts to configure the ppp project. Current change doesn't eliminate the previous build system, but the new script autogen.sh will overwrite configure, and generate the basic Makefile.in and Makefile files. Features can now be enabled by command line: * Microsoft Extensions, - MSCHAP - MPPE - MS LAN Manager support * IPXCP protocol * CBCP protocol * PAM support * EAP-TLS support * EAP-SRP support * Max session lifetime by byte count * Plugins * Packet activity filter support * Multilink * IPv6 support Control linkage with * OpenSSL (-lssl -lcrypto) * systemd (-lsystemd) * libatm (-latm) * libsrp (-lsrp) * pam (-lpam) Also, the configure script is made sensitive to features of OpenSSL. Like the presence or absence of DES, SHA, MD4 and MD5 crypto support. In the cases where either of these are missing, the support will be directly compiled into pppd and plugins. In addition, package maintainers can now control the installation paths with standard --prefix=, or --localstatedir=, or --sysconfdir= to configure. On top of that, they can now control the following directories: * runtime directory w/--with-runtime-dir * logfile directory w/--with-logfile-dir * plugin directory w/--with-plugin-dir In the case where automake isn't the right solution, namely: SunOS kernel module build, the original Makefile infrastructure is preserved and reused. Care was taken to only cosmetically touchup the source files in this change. This means: * Insert HAVE_CONFIG_H and include config.h in all .c files. * Change HAS_SHADOW to HAVE_SHADOW_H * Change HAVE_LOGWTMP to HAVE_UTMP_H * Introduce HAVE_CRYPT_H into the source code where appropriate * Added ifdef MPPE where appropriate * USE_SRP required a few changes as it didn't compile * Touchup some compile warning in pppstats directory on SunOS Introduced a new pppdconf.h file that exports the appropriate defines to a module that wants to provide a module that pppd can dynamically load. This will define/undef features like MPPE, CHAPMS such that the project doesn't have to guess what features pppd is compiled with. Signed-off-by: Eivind Næss <eivnaes@yahoo.com>
pppd: Export $CALL_FILE to the link scripts (#196) From https://bugs.debian.org/51880 “ This would make it much easier for me, and cleaner too, to handle multiple, mutually exclusive, dialout internet service providers. ” Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Co-authored-by: Marco d'Itri <md@linux.it>
Add option to specify ip-up script From https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=101587 Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>