diff -r -u -N ppp-2.3.11.patchedorig/pppd/Makefile.linux ppp-2.3.11/pppd/Makefile.linux --- ppp-2.3.11.patchedorig/pppd/Makefile.linux Thu Aug 3 10:17:30 2000 +++ ppp-2.3.11/pppd/Makefile.linux Thu Aug 3 10:17:33 2000 @@ -9,13 +9,13 @@ PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap.c md5.c ccp.c \ ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c cbcp.c \ - demand.c utils.c sha1dgst.c mppe.c extra_crypto.c + demand.c utils.c sha1dgst.c mppe.c extra_crypto.c pathnames.c HEADERS = callout.h pathnames.h patchlevel.h chap.h md5.h chap_ms.h md4.h \ ipxcp.h cbcp.h sha.h sha_locl.h mppe.h extra_crypto.h MANPAGES = pppd.8 PPPDOBJS = main.o magic.o fsm.o lcp.o ipcp.o upap.o chap.o md5.o ccp.o \ auth.o options.o demand.o utils.o sys-linux.o ipxcp.o cbcp.o \ - mppe.o sha1dgst.o extra_crypto.o + mppe.o sha1dgst.o extra_crypto.o pathnames.o all: pppd diff -r -u -N ppp-2.3.11.patchedorig/pppd/main.c ppp-2.3.11/pppd/main.c --- ppp-2.3.11.patchedorig/pppd/main.c Wed Dec 22 18:12:31 1999 +++ ppp-2.3.11/pppd/main.c Thu Aug 3 10:32:44 2000 @@ -231,6 +231,8 @@ struct stat statbuf; char numbuf[16]; + init_paths("/etc/ppp/"); + new_phase(PHASE_INITIALIZE); /* @@ -282,7 +284,19 @@ progname = *argv; + /* MSI: Added this prepass of the command line arguments + so that the syspath option can have a chance to + take effect. This MAY have other consequences as + I am honoring the argument-scan-after-options-file-parse + order of the origianl. Also means I'm doing this twice, + but I don't see a clean way to insert a new high + priority argument like syspath otherwise... + */ + + prepass = 1; + parse_args(argc-1, argv+1); prepass = 0; + if (!options_from_file(_PATH_SYSOPTIONS, !privileged, 0, 1) || !options_from_user()) exit(EXIT_OPTION_ERROR); diff -r -u -N ppp-2.3.11.patchedorig/pppd/options.c ppp-2.3.11/pppd/options.c --- ppp-2.3.11.patchedorig/pppd/options.c Wed Dec 22 17:28:52 1999 +++ ppp-2.3.11/pppd/options.c Thu Aug 3 10:17:33 2000 @@ -136,6 +136,7 @@ static int setxonxoff __P((char **)); static int readfile __P((char **)); static int callfile __P((char **)); +static void syspath __P((char **)); static int showversion __P((char **)); static int showhelp __P((char **)); static void usage __P((void)); @@ -235,6 +236,8 @@ "Take options from a file", OPT_PREPASS }, { "call", o_special, callfile, "Take options from a privileged file", OPT_PREPASS }, + { "syspath",o_special,syspath, + "make all file access reletive to path",OPT_PREPASS }, { "persist", o_bool, &persist, "Keep on reopening connection after close", 1 }, { "nopersist", o_bool, &persist, @@ -1189,6 +1192,12 @@ char **argv; { return options_from_file(*argv, 1, 1, privileged_option); +} + +static void syspath(char **argv) +{ + + init_paths(*argv); } /* diff -r -u -N ppp-2.3.11.patchedorig/pppd/pathnames.c ppp-2.3.11/pppd/pathnames.c --- ppp-2.3.11.patchedorig/pppd/pathnames.c Wed Dec 31 16:00:00 1969 +++ ppp-2.3.11/pppd/pathnames.c Thu Aug 3 10:17:33 2000 @@ -0,0 +1,60 @@ +#include +#include +#include +#include "pathnames.h" + +char *_PATH_UPAPFILE=NULL, + *_PATH_CHAPFILE=NULL, + *_PATH_SYSOPTIONS=NULL, + *_PATH_IPUP=NULL, + *_PATH_IPDOWN=NULL, + *_PATH_AUTHUP=NULL, + *_PATH_AUTHDOWN=NULL, + *_PATH_TTYOPT=NULL, + *_PATH_CONNERRS=NULL, + *_PATH_PEERFILES=NULL, + *_PATH_RESOLV=NULL, + *_PATH_USEROPT=NULL, + *_PATH_IPV6UP=NULL, + *_PATH_IPV6DOWN=NULL, + *_PATH_IPXUP=NULL, + *_PATH_IPXDOWN=NULL; + + + +char *makename(char *base, char *path, char **strptr) +{ + char workbuf[512]; + if(strlen(base) + strlen(path)>510) + { return NULL; } + + sprintf(workbuf,"%s%s",base,path); + if(*strptr!=NULL) free(*strptr); + *strptr=strdup(workbuf); + return *strptr; +} + +/* initialize all pathnames in the form of $BASE/filename */ +void init_paths(char *base) +{ + makename(base,_PATH_UPAPFILE_D,&_PATH_UPAPFILE); + makename(base,_PATH_CHAPFILE_D,&_PATH_CHAPFILE); + makename(base,_PATH_SYSOPTIONS_D,&_PATH_SYSOPTIONS); + makename(base,_PATH_IPUP_D,&_PATH_IPUP); + makename(base,_PATH_IPDOWN_D,&_PATH_IPDOWN); + makename(base,_PATH_AUTHUP_D,&_PATH_AUTHUP); + makename(base,_PATH_AUTHDOWN_D,&_PATH_AUTHDOWN); + makename(base,_PATH_TTYOPT_D,&_PATH_TTYOPT); + makename(base,_PATH_CONNERRS_D,&_PATH_CONNERRS); + makename(base,_PATH_PEERFILES_D,&_PATH_PEERFILES); + makename(base,_PATH_RESOLV_D,&_PATH_RESOLV); + makename(base,_PATH_USEROPT_D,&_PATH_USEROPT); +#ifdef INET6 + makename(base,_PATH_IPV6UP_D,&_PATH_IPV6UP); + makename(base,_PATH_IPV6DOWN_D,&_PATH_IPV6DOWN); +#endif +#ifdef IPXCHANGE + makename(base,_PATH_IPXUP_D,&_PATH_IPXUP); + makename(base,_PATH_IPXDOWN_D,&_PATH_IPXDOWN); +#endif +}; diff -r -u -N ppp-2.3.11.patchedorig/pppd/pathnames.h ppp-2.3.11/pppd/pathnames.h --- ppp-2.3.11.patchedorig/pppd/pathnames.h Fri Nov 19 21:09:26 1999 +++ ppp-2.3.11/pppd/pathnames.h Thu Aug 3 10:17:33 2000 @@ -2,15 +2,17 @@ * define path names * * $Id: pathnames.h,v 1.12 1999/11/19 09:46:08 masputra Exp $ + * + * Pathnames may now be modified at run time by command line options. All + * constant define'd pathnames are now char pointers. */ #ifdef HAVE_PATHS_H #include - #else -#ifndef _PATH_VARRUN -#define _PATH_VARRUN "/etc/ppp/" -#endif + #ifndef _PATH_VARRUN + #define _PATH_VARRUN "/etc/ppp/" + #endif #define _PATH_DEVNULL "/dev/null" #endif @@ -18,26 +20,33 @@ #define _ROOT_PATH #endif -#define _PATH_UPAPFILE _ROOT_PATH "/etc/ppp/pap-secrets" -#define _PATH_CHAPFILE _ROOT_PATH "/etc/ppp/chap-secrets" -#define _PATH_SYSOPTIONS _ROOT_PATH "/etc/ppp/options" -#define _PATH_IPUP _ROOT_PATH "/etc/ppp/ip-up" -#define _PATH_IPDOWN _ROOT_PATH "/etc/ppp/ip-down" -#define _PATH_AUTHUP _ROOT_PATH "/etc/ppp/auth-up" -#define _PATH_AUTHDOWN _ROOT_PATH "/etc/ppp/auth-down" -#define _PATH_TTYOPT _ROOT_PATH "/etc/ppp/options." -#define _PATH_CONNERRS _ROOT_PATH "/etc/ppp/connect-errors" -#define _PATH_PEERFILES _ROOT_PATH "/etc/ppp/peers/" -#define _PATH_RESOLV _ROOT_PATH "/etc/ppp/resolv.conf" +#define _PATH_UPAPFILE_D _ROOT_PATH "pap-secrets" +#define _PATH_CHAPFILE_D _ROOT_PATH "chap-secrets" +#define _PATH_SYSOPTIONS_D _ROOT_PATH "options" +#define _PATH_IPUP_D _ROOT_PATH "ip-up" +#define _PATH_IPDOWN_D _ROOT_PATH "ip-down" +#define _PATH_AUTHUP_D _ROOT_PATH "auth-up" +#define _PATH_AUTHDOWN_D _ROOT_PATH "auth-down" +#define _PATH_TTYOPT_D _ROOT_PATH "options." +#define _PATH_CONNERRS_D _ROOT_PATH "connect-errors" +#define _PATH_PEERFILES_D _ROOT_PATH "peers/" +#define _PATH_RESOLV_D _ROOT_PATH "resolv.conf" -#define _PATH_USEROPT ".ppprc" +#define _PATH_USEROPT_D ".ppprc" #ifdef INET6 -#define _PATH_IPV6UP _ROOT_PATH "/etc/ppp/ipv6-up" -#define _PATH_IPV6DOWN _ROOT_PATH "/etc/ppp/ipv6-down" +#define _PATH_IPV6UP_D _ROOT_PATH "ipv6-up" +#define _PATH_IPV6DOWN_D _ROOT_PATH "ipv6-down" #endif #ifdef IPX_CHANGE -#define _PATH_IPXUP _ROOT_PATH "/etc/ppp/ipx-up" -#define _PATH_IPXDOWN _ROOT_PATH "/etc/ppp/ipx-down" +#define _PATH_IPXUP_D _ROOT_PATH "ipx-up" +#define _PATH_IPXDOWN_D _ROOT_PATH "ipx-down" #endif /* IPX_CHANGE */ + +extern char *_PATH_UPAPFILE, *_PATH_CHAPFILE, *_PATH_SYSOPTIONS, *_PATH_IPUP, + *_PATH_IPDOWN, *_PATH_AUTHUP, *_PATH_AUTHDOWN, *_PATH_TTYOPT, + *_PATH_CONNERRS, *_PATH_PEERFILES, *_PATH_RESOLV, *_PATH_USEROPT, + *_PATH_IPV6UP, *_PATH_IPV6DOWN, *_PATH_IPXUP, *_PATH_IPXDOWN; + +extern void init_paths (char *base);