more and more ppp options removal

This commit is contained in:
Sylvain Rochet 2012-05-22 21:59:23 +02:00
parent b88dad4034
commit 42827cdea2
12 changed files with 71 additions and 18 deletions

View File

@ -140,9 +140,11 @@ int auth_done[NUM_PPP];
/* List of addresses which the peer may use. */
static struct permitted_ip *addresses[NUM_PPP];
#if 0 /* UNUSED */
/* Wordlist giving addresses which the peer may use
without authenticating itself. */
static struct wordlist *noauth_addrs;
#endif /* UNUSED */
/* Remote telephone number, if available */
char remote_number[MAXNAMELEN];
@ -150,8 +152,10 @@ char remote_number[MAXNAMELEN];
/* Wordlist giving remote telephone numbers which may connect. */
static struct wordlist *permitted_numbers;
#if 0 /* UNUSED */
/* Extra options to apply, from the secrets file entry for the peer. */
static struct wordlist *extra_options;
#endif /* UNUSED */
/* Number of network protocols which we have opened. */
static int num_np_open;
@ -159,8 +163,10 @@ static int num_np_open;
/* Number of network protocols which have come up. */
static int num_np_up;
#if 0 /* UNUSED */
/* Set if we require authentication only because we have a default route. */
static bool default_auth;
#endif /* UNUSED */
/* Hook to enable a plugin to control the idle time limit */
int (*idle_time_hook) __P((struct ppp_idle *)) = NULL;
@ -254,12 +260,12 @@ static void free_wordlist __P((struct wordlist *));
static void set_allowed_addrs __P((int, struct wordlist *, struct wordlist *));
#endif /* UNUSED */
static int some_ip_ok __P((struct wordlist *));
#if 0 /* UNUSE */
static int setupapfile __P((char **));
static int privgroup __P((char **));
static int set_noauth_addr __P((char **));
static int set_permitted_number __P((char **));
static void check_access __P((FILE *, char *));
#if 0 /* UNUSED */
static int wordlist_count __P((struct wordlist *));
#endif /* UNUSED */
@ -406,6 +412,7 @@ option_t auth_options[] = {
};
#endif /* PPP_OPTIONS */
#if 0 /* UNUSED */
/*
* setupapfile - specifies UPAP info for authenticating with peer.
*/
@ -469,7 +476,6 @@ setupapfile(argv)
return (1);
}
/*
* privgroup - allow members of the group to have privileged access.
*/
@ -538,7 +544,7 @@ set_permitted_number(argv)
permitted_numbers = wp;
return 1;
}
#endif
/*
* An Open on LCP has requested a change from Dead to Establish phase.
@ -2105,7 +2111,6 @@ set_allowed_addrs(unit, addrs, opts)
wo->accept_remote = 1;
}
}
#endif /* UNUSED */
/*
* auth_ip_addr - check whether the peer is authorized to use
@ -2225,7 +2230,6 @@ check_access(f, filename)
}
}
#if 0 /* UNUSED */
/*
* scan_authfile - Scan an authorization file for a secret suitable
* for authenticating `client' on `server'. The return value is -1

View File

@ -196,8 +196,8 @@ struct protent ccp_protent = {
"Compressed",
#if PPP_OPTIONS
ccp_option_list,
#endif /* PPP_OPTIONS */
NULL,
#endif /* PPP_OPTIONS */
NULL,
NULL
};

View File

@ -350,7 +350,10 @@ chap_handle_response(struct chap_server_state *ss, int id,
ok = (*verifier)(name, ss->name, id, ss->digest,
ss->challenge + PPP_HDRLEN + CHAP_HDRLEN,
response, ss->message, sizeof(ss->message));
#if 0 /* UNUSED */
if (!ok || !auth_number()) {
#endif /* UNUSED */
if (!ok) {
ss->flags |= AUTH_FAILED;
warn("Peer %q failed CHAP authentication", name);
}
@ -658,6 +661,8 @@ struct protent chap_protent = {
NULL, /* data_name */
#if PPP_OPTIONS
chap_option_list,
#endif /* PPP_OPTIONS */
NULL, /* check_options */
#endif /* PPP_OPTIONS */
NULL,
NULL
};

View File

@ -121,8 +121,8 @@ struct protent eap_protent = {
NULL, /* text name of corresponding data protocol */
#if PPP_OPTIONS
eap_option_list, /* list of command-line options */
#endif /* PPP_OPTIONS */
NULL, /* check requested options; assign defaults */
#endif /* PPP_OPTIONS */
NULL, /* configure interface for demand-dial */
NULL /* say whether to bring up link for this pkt */
};

View File

@ -115,8 +115,8 @@ struct protent ecp_protent = {
"Encrypted",
#if PPP_OPTIONS
ecp_option_list,
#endif /* PPP_OPTIONS */
NULL,
#endif /* PPP_OPTIONS */
NULL,
NULL
};

View File

@ -141,9 +141,10 @@ static int setdnsaddr __P((char **));
static int setwinsaddr __P((char **));
static int setnetmask __P((char **));
int setipaddr __P((char *, char **, int));
static void printipaddr __P((option_t *, void (*)(void *, char *,...),void *));
#if PPP_OPTIONS
static void printipaddr __P((option_t *, void (*)(void *, char *,...),void *));
static option_t ipcp_option_list[] = {
{ "noip", o_bool, &ipcp_protent.enabled_flag,
"Disable IP and IPCP" },
@ -279,8 +280,8 @@ struct protent ipcp_protent = {
"IP",
#if PPP_OPTIONS
ipcp_option_list,
#endif /* PPP_OPTIONS */
ip_check_options,
#endif /* PPP_OPTIONS */
ip_demand_conf,
ip_active_pkt
};
@ -412,6 +413,7 @@ setwinsaddr(argv)
return (1);
}
#if 0 /* UNUSED */
/*
* setipaddr - Set the IP address
* If doit is 0, the call is to check whether this option is
@ -484,7 +486,9 @@ setipaddr(arg, argv, doit)
return 1;
}
#endif /* UNUSED */
#if PPP_OPTIONS
static void
printipaddr(opt, printer, arg)
option_t *opt;
@ -499,6 +503,7 @@ printipaddr(opt, printer, arg)
if (wo->hisaddr != 0)
printer(arg, "%I", wo->hisaddr);
}
#endif /* PPP_OPTIONS */
/*
* setnetmask - set the netmask to be used on the interface.
@ -1687,6 +1692,7 @@ endswitch:
}
#if 0 /* UNUSED */
/*
* ip_check_options - check that any IP-related options are OK,
* and assign appropriate defaults.
@ -1717,7 +1723,7 @@ ip_check_options()
}
ask_for_local = wo->ouraddr != 0 || !disable_defaultip;
}
#endif /* UNUSED */
/*
* ip_demand_conf - configure the interface as though

View File

@ -285,8 +285,8 @@ struct protent lcp_protent = {
NULL,
#if PPP_OPTIONS
lcp_option_list,
#endif /* PPP_OPTIONS */
NULL,
#endif /* PPP_OPTIONS */
NULL,
NULL
};

View File

@ -128,9 +128,10 @@ int maxoctets_dir = 0; /* default - sum of traffic */
int maxoctets_timeout = 1; /* default 1 second */
#endif
#if 0 /* UNUSED */
extern option_t auth_options[];
extern struct stat devstat;
#endif /* UNUSED */
#ifdef PPP_FILTER
struct bpf_program pass_filter;/* Filter program for packets to pass */
@ -140,15 +141,20 @@ struct bpf_program active_filter; /* Filter program for link-active pkts */
char *current_option; /* the name of the option being parsed */
int privileged_option; /* set iff the current option came from root */
char *option_source; /* string saying where the option came from */
#if 0 /* UNUSED */
int option_priority = OPRIO_CFGFILE; /* priority of the current options */
#endif /* UNUSED */
bool devnam_fixed; /* can no longer change device name */
#if 0 /* UNUSED */
static int logfile_fd = -1; /* fd opened for log file */
static char logfile_name[MAXPATHLEN]; /* name of log file */
#endif /* UNUSED */
/*
* Prototypes
*/
#if 0 /* UNUSED */
static int setdomain __P((char **));
static int readfile __P((char **));
static int callfile __P((char **));
@ -156,6 +162,7 @@ static int showversion __P((char **));
static int showhelp __P((char **));
static void usage __P((void));
static int setlogfile __P((char **));
#endif /* UNUSED */
#ifdef PLUGIN
static int loadplugin __P((char **));
#endif
@ -169,6 +176,7 @@ static int setactivefilter __P((char **));
static int setmodir __P((char **));
#endif
#if 0 /* UNUSED */
static option_t *find_option __P((const char *name));
static int process_option __P((option_t *, char *, char **));
static int n_arguments __P((option_t *));
@ -184,7 +192,6 @@ struct option_list {
static struct option_list *extra_options = NULL;
#if PPP_OPTIONS
/*
* Valid arguments.
*/

View File

@ -190,8 +190,10 @@ int privopen; /* don't lock, open device as root */
char *no_ppp_msg = "Sorry - this system lacks PPP kernel support\n";
#if 0 /* UNUSED */
GIDSET_TYPE groups[NGROUPS_MAX];/* groups the user is in */
int ngroups; /* How many groups valid in groups */
#endif /* UNUSED */
static struct timeval start_time; /* Time when link was started. */
@ -322,7 +324,9 @@ int ppp_oldmain() {
slprintf(numbuf, sizeof(numbuf), "%d", uid);
script_setenv("ORIG_UID", numbuf, 0);
#if 0 /* UNUSED */
ngroups = getgroups(NGROUPS_MAX, groups);
#endif /* UNUSED */
/*
* Initialize magic number generator now so that protocols may
@ -356,12 +360,14 @@ int ppp_oldmain() {
devnam_fixed = 1; /* can no longer change device name */
#if 0 /* UNUSED */
/*
* Work out the device name, if it hasn't already been specified,
* and parse the tty's options file.
*/
if (the_channel->process_extra_options)
(*the_channel->process_extra_options)();
#endif /* UNUSED */
if (debug)
setlogmask(LOG_UPTO(LOG_DEBUG));

View File

@ -87,6 +87,7 @@
typedef unsigned char bool;
#if 0
enum opt_type {
o_special_noarg = 0,
o_special = 1,
@ -162,6 +163,7 @@ struct permitted_ip {
u_int32_t base; /* match if (addr & mask) == base */
u_int32_t mask; /* base and mask are in network byte order */
};
#endif
/*
* Unfortunately, the linux kernel driver uses a different structure
@ -227,7 +229,9 @@ extern int privileged; /* We were run by real-uid root */
extern int need_holdoff; /* Need holdoff period after link terminates */
extern char **script_env; /* Environment variables for scripts */
extern int detached; /* Have detached from controlling tty */
#if 0
extern GIDSET_TYPE groups[NGROUPS_MAX]; /* groups the user is in */
#endif
extern int ngroups; /* How many groups valid in groups */
extern struct pppd_stats link_stats; /* byte/packet counts etc. for link */
extern int link_stats_valid; /* set if link_stats is valid */
@ -414,8 +418,8 @@ struct protent {
bool enabled_flag; /* 0 iff protocol is disabled */
char *name; /* Text name of protocol */
char *data_name; /* Text name of corresponding data protocol */
option_t *options; /* List of command-line options */
#if PPP_OPTIONS
option_t *options; /* List of command-line options */
/* Check requested options, assign defaults */
void (*check_options) __P((void));
#endif /* PPP_OPTIONS */
@ -436,6 +440,7 @@ extern struct protent *protocols[];
* with PPP STREAMS modules pushed onto it).
*/
struct channel {
#if PPP_OPTIONS
/* set of options for this channel */
option_t *options;
/* find and process a per-channel options file */
@ -444,6 +449,7 @@ struct channel {
void (*check_options) __P((void));
/* get the channel ready to do PPP, return a file descriptor */
int (*connect) __P((void));
#endif /* PPP_OPTIONS */
/* we're finished with the channel */
void (*disconnect) __P((void));
/* put the channel into PPP `mode' */
@ -670,7 +676,9 @@ int get_if_hwaddr __P((u_char *addr, char *name));
char *get_first_ethernet __P((void));
/* Procedures exported from options.c */
#if 0 /* UNUSED */
int setipaddr __P((char *, char **, int)); /* Set local/remote ip addresses */
#endif /* UNUSED */
int parse_args __P((int argc, char **argv));
/* Parse options from arguments given */
int options_from_file __P((char *filename, int must_exist, int check_prot,
@ -688,6 +696,7 @@ void option_error __P((char *fmt, ...));
#else
#define option_error(x, ...)
#endif /* PPP_OPTIONS */
#if PPP_OPTIONS
int int_option __P((char *, int *));
/* Simplified number_option for decimal ints */
void add_options __P((option_t *)); /* Add extra options */
@ -696,6 +705,7 @@ int override_value __P((const char *, int, const char *));
/* override value if permitted by priority */
void print_options __P((void (*) __P((void *, char *, ...)), void *));
/* print out values of all options */
#endif /* PPP_OPTIONS */
int parse_dotted_ip __P((char *, u_int32_t *));

View File

@ -112,7 +112,9 @@ static int setdevname __P((char *, char **, int));
static int setspeed __P((char *, char **, int));
static int setxonxoff __P((char **));
static int setescape __P((char **));
#if 0 /* UNUSED */
static void printescape __P((option_t *, void (*)(void *, char *,...),void *));
#endif /* UNUSED */
static void finish_tty __P((void));
static int start_charshunt __P((int, int));
static void stop_charshunt __P((void *, int));
@ -154,7 +156,9 @@ char *pty_socket = NULL; /* Socket to connect to pty */
int using_pty = 0; /* we're allocating a pty as the device */
extern uid_t uid;
#if 0 /* UNUSED */
extern int kill_link;
#endif /* UNUSED */
extern int asked_to_quit;
extern int got_sigterm;
@ -163,6 +167,7 @@ extern int privopen; /* don't lock, open device as root */
u_int32_t xmit_accm[8]; /* extended transmit ACCM */
#if 0 /* UNUSED */
/* option descriptors */
option_t tty_options[] = {
/* device name must be first, or change connect_tty() below! */
@ -243,12 +248,15 @@ option_t tty_options[] = {
{ NULL }
};
#endif /* UNUSED */
struct channel tty_channel = {
#if PPP_OPTIONS
tty_options,
&tty_process_extra_options,
&tty_check_options,
&connect_tty,
#endif /* UNUSED */
&disconnect_tty,
&tty_establish_ppp,
&tty_disestablish_ppp,
@ -373,6 +381,7 @@ setescape(argv)
return ret;
}
#if 0 /* UNUSED */
static void
printescape(opt, printer, arg)
option_t *opt;
@ -396,6 +405,7 @@ printescape(opt, printer, arg)
if (first)
printer(arg, "oops # nothing escaped");
}
#endif /* UNUSED */
/*
* tty_init - do various tty-related initializations.
@ -440,6 +450,7 @@ void tty_process_extra_options()
#endif /* PPP_OPTIONS */
}
#if 0 /* UNUSED */
/*
* tty_check_options - do consistency checks on the options we were given.
*/
@ -508,7 +519,9 @@ tty_check_options()
&& S_ISCHR(statbuf.st_mode) && statbuf.st_rdev == devstat.st_rdev)
log_to_fd = -1;
}
#endif /* UNUSED */
#if 0 /* UNUSED */
/*
* connect_tty - get the serial port ready to start doing PPP.
* That is, open the serial port, set its speed and mode, and run
@ -770,7 +783,7 @@ int connect_tty()
asked_to_quit = 1;
return -1;
}
#endif /* UNUSED */
void disconnect_tty()
{

View File

@ -106,8 +106,8 @@ struct protent pap_protent = {
NULL,
#if PPP_OPTIONS
pap_option_list,
#endif /* PPP_OPTIONS */
NULL,
#endif /* PPP_OPTIONS */
NULL,
NULL
};
@ -432,6 +432,7 @@ upap_rauthreq(u, inp, id, len)
rpasswdlen, &msg);
BZERO(rpasswd, rpasswdlen);
#if 0 /* UNUSED */
/*
* Check remote number authorization. A plugin may have filled in
* the remote number or added an allowed number, and rather than
@ -444,6 +445,7 @@ upap_rauthreq(u, inp, id, len)
warn("calling number %q is not authorized", remote_number);
}
}
#endif /* UNUSED */
msglen = strlen(msg);
if (msglen > 255)