disabled almost all PPP options strings and support as well as useless file-based auth code

This commit is contained in:
Sylvain Rochet 2012-05-22 01:28:30 +02:00
parent d0645273df
commit b88dad4034
14 changed files with 84 additions and 8 deletions

View File

@ -238,29 +238,36 @@ static void network_phase __P((int));
static void check_idle __P((void *)); static void check_idle __P((void *));
static void connect_time_expired __P((void *)); static void connect_time_expired __P((void *));
static int null_login __P((int)); static int null_login __P((int));
#if 0 /* UNUSED */
/* static int get_pap_passwd __P((char *)); */ /* static int get_pap_passwd __P((char *)); */
static int have_pap_secret __P((int *)); static int have_pap_secret __P((int *));
static int have_chap_secret __P((char *, char *, int, int *)); static int have_chap_secret __P((char *, char *, int, int *));
static int have_srp_secret __P((char *client, char *server, int need_ip, static int have_srp_secret __P((char *client, char *server, int need_ip,
int *lacks_ipp)); int *lacks_ipp));
#endif /* UNUSED */
static int ip_addr_check __P((u_int32_t, struct permitted_ip *)); static int ip_addr_check __P((u_int32_t, struct permitted_ip *));
#if 0 /* UNUSED */
static int scan_authfile __P((FILE *, char *, char *, char *, static int scan_authfile __P((FILE *, char *, char *, char *,
struct wordlist **, struct wordlist **, struct wordlist **, struct wordlist **,
char *, int)); char *, int));
static void free_wordlist __P((struct wordlist *)); static void free_wordlist __P((struct wordlist *));
static void set_allowed_addrs __P((int, struct wordlist *, struct wordlist *)); static void set_allowed_addrs __P((int, struct wordlist *, struct wordlist *));
#endif /* UNUSED */
static int some_ip_ok __P((struct wordlist *)); static int some_ip_ok __P((struct wordlist *));
static int setupapfile __P((char **)); static int setupapfile __P((char **));
static int privgroup __P((char **)); static int privgroup __P((char **));
static int set_noauth_addr __P((char **)); static int set_noauth_addr __P((char **));
static int set_permitted_number __P((char **)); static int set_permitted_number __P((char **));
static void check_access __P((FILE *, char *)); static void check_access __P((FILE *, char *));
#if 0 /* UNUSED */
static int wordlist_count __P((struct wordlist *)); static int wordlist_count __P((struct wordlist *));
#endif /* UNUSED */
#ifdef MAXOCTETS #ifdef MAXOCTETS
static void check_maxoctets __P((void *)); static void check_maxoctets __P((void *));
#endif #endif
#if PPP_OPTIONS
/* /*
* Authentication-related options. * Authentication-related options.
*/ */
@ -397,6 +404,7 @@ option_t auth_options[] = {
{ NULL } { NULL }
}; };
#endif /* PPP_OPTIONS */
/* /*
* setupapfile - specifies UPAP info for authenticating with peer. * setupapfile - specifies UPAP info for authenticating with peer.
@ -737,14 +745,18 @@ link_established(unit)
(*protp->lowerup)(unit); (*protp->lowerup)(unit);
} }
#if PPP_ALLOWED_ADDRS
if (!auth_required && noauth_addrs != NULL) if (!auth_required && noauth_addrs != NULL)
set_allowed_addrs(unit, NULL, NULL); set_allowed_addrs(unit, NULL, NULL);
#endif /* PPP_ALLOWED_ADDRS */
if (auth_required && !(go->neg_upap || go->neg_chap if (auth_required && !(go->neg_upap || go->neg_chap
#if EAP_SUPPORT #if EAP_SUPPORT
|| go->neg_eap || go->neg_eap
#endif /* EAP_SUPPORT */ #endif /* EAP_SUPPORT */
)) { )) {
#if PPP_ALLOWED_ADDRS
/* /*
* We wanted the peer to authenticate itself, and it refused: * We wanted the peer to authenticate itself, and it refused:
* if we have some address(es) it can use without auth, fine, * if we have some address(es) it can use without auth, fine,
@ -754,7 +766,9 @@ link_established(unit)
*/ */
if (noauth_addrs != NULL) { if (noauth_addrs != NULL) {
set_allowed_addrs(unit, NULL, NULL); set_allowed_addrs(unit, NULL, NULL);
} else if (!wo->neg_upap || uselogin || !null_login(unit)) { } else
#endif /* PPP_ALLOWED_ADDRS */
if (!wo->neg_upap || uselogin || !null_login(unit)) {
warn("peer refused to authenticate: terminating link"); warn("peer refused to authenticate: terminating link");
status = EXIT_PEER_AUTH_FAILED; status = EXIT_PEER_AUTH_FAILED;
lcp_close(unit, "peer refused to authenticate"); lcp_close(unit, "peer refused to authenticate");
@ -832,6 +846,7 @@ network_phase(unit)
} }
#endif #endif
#if PPP_OPTIONS
/* /*
* Process extra options from the secrets file * Process extra options from the secrets file
*/ */
@ -840,6 +855,7 @@ network_phase(unit)
free_wordlist(extra_options); free_wordlist(extra_options);
extra_options = 0; extra_options = 0;
} }
#endif /* PPP_OPTIONS */
start_networks(unit); start_networks(unit);
} }
@ -1206,6 +1222,7 @@ connect_time_expired(arg)
lcp_close(0, "Connect time expired"); /* Close connection */ lcp_close(0, "Connect time expired"); /* Close connection */
} }
#if PPP_OPTIONS
/* /*
* auth_check_options - called to check authentication options. * auth_check_options - called to check authentication options.
*/ */
@ -1315,6 +1332,7 @@ auth_check_options()
exit(EXIT_CNID_AUTH_FAILED); exit(EXIT_CNID_AUTH_FAILED);
} }
} }
#endif /* PPP_OPTIONS */
/* /*
* auth_reset - called when LCP is starting negotiations to recheck * auth_reset - called when LCP is starting negotiations to recheck
@ -1554,6 +1572,9 @@ static int
null_login(unit) null_login(unit)
int unit; int unit;
{ {
return 0;
/* FIXME: clean that */
#if 0 /* UNUSED */
char *filename; char *filename;
FILE *f; FILE *f;
int i, ret; int i, ret;
@ -1592,6 +1613,7 @@ null_login(unit)
free_wordlist(addrs); free_wordlist(addrs);
return ret; return ret;
#endif
} }
#if 0 #if 0
@ -1637,6 +1659,7 @@ get_pap_passwd(passwd)
} }
#endif #endif
#if 0 /* UNUSED */
/* /*
* have_pap_secret - check whether we have a PAP file with any * have_pap_secret - check whether we have a PAP file with any
* secrets that we could possibly use for authenticating the peer. * secrets that we could possibly use for authenticating the peer.
@ -1676,7 +1699,6 @@ have_pap_secret(lacks_ipp)
return ret >= 0; return ret >= 0;
} }
/* /*
* have_chap_secret - check whether we have a CHAP file with a * have_chap_secret - check whether we have a CHAP file with a
* secret that we could possibly use for authenticating `client' * secret that we could possibly use for authenticating `client'
@ -1725,7 +1747,6 @@ have_chap_secret(client, server, need_ip, lacks_ipp)
return ret >= 0; return ret >= 0;
} }
/* /*
* have_srp_secret - check whether we have a SRP file with a * have_srp_secret - check whether we have a SRP file with a
* secret that we could possibly use for authenticating `client' * secret that we could possibly use for authenticating `client'
@ -1766,7 +1787,7 @@ have_srp_secret(client, server, need_ip, lacks_ipp)
return ret >= 0; return ret >= 0;
} }
#endif /* UNUSED */
/* /*
* get_secret - open the CHAP secret file and return the secret * get_secret - open the CHAP secret file and return the secret
@ -1927,6 +1948,7 @@ get_srp_secret(unit, client, server, secret, am_server)
#endif #endif
} }
#if 0 /* UNUSED */
/* /*
* set_allowed_addrs() - set the list of allowed addresses. * set_allowed_addrs() - set the list of allowed addresses.
* Also looks for `--' indicating options to apply for this peer * Also looks for `--' indicating options to apply for this peer
@ -2083,6 +2105,7 @@ set_allowed_addrs(unit, addrs, opts)
wo->accept_remote = 1; wo->accept_remote = 1;
} }
} }
#endif /* UNUSED */
/* /*
* auth_ip_addr - check whether the peer is authorized to use * auth_ip_addr - check whether the peer is authorized to use
@ -2202,7 +2225,7 @@ check_access(f, filename)
} }
} }
/* FIXME: useless ! */ #if 0 /* UNUSED */
/* /*
* scan_authfile - Scan an authorization file for a secret suitable * scan_authfile - Scan an authorization file for a secret suitable
* for authenticating `client' on `server'. The return value is -1 * for authenticating `client' on `server'. The return value is -1
@ -2406,3 +2429,4 @@ free_wordlist(wp)
wp = next; wp = next;
} }
} }
#endif /* UNUSED */

View File

@ -71,6 +71,7 @@ static char deflate_value[8];
bool refuse_mppe_stateful = 1; /* Allow stateful mode? */ bool refuse_mppe_stateful = 1; /* Allow stateful mode? */
#endif #endif
#if PPP_OPTIONS
static option_t ccp_option_list[] = { static option_t ccp_option_list[] = {
{ "noccp", o_bool, &ccp_protent.enabled_flag, { "noccp", o_bool, &ccp_protent.enabled_flag,
"Disable CCP negotiation" }, "Disable CCP negotiation" },
@ -162,6 +163,7 @@ static option_t ccp_option_list[] = {
{ NULL } { NULL }
}; };
#endif /* PPP_OPTIONS */
/* /*
* Protocol entry points from main code. * Protocol entry points from main code.
@ -192,7 +194,9 @@ struct protent ccp_protent = {
1, 1,
"CCP", "CCP",
"Compressed", "Compressed",
#if PPP_OPTIONS
ccp_option_list, ccp_option_list,
#endif /* PPP_OPTIONS */
NULL, NULL,
NULL, NULL,
NULL NULL

View File

@ -62,6 +62,7 @@ int chap_timeout_time = 3;
int chap_max_transmits = 10; int chap_max_transmits = 10;
int chap_rechallenge_time = 0; int chap_rechallenge_time = 0;
#if PPP_OPTIONS
/* /*
* Command-line options. * Command-line options.
*/ */
@ -74,6 +75,7 @@ static option_t chap_option_list[] = {
"Set interval for rechallenge", OPT_PRIO }, "Set interval for rechallenge", OPT_PRIO },
{ NULL } { NULL }
}; };
#endif /* PPP_OPTIONS */
/* /*
* Internal state. * Internal state.
@ -654,6 +656,8 @@ struct protent chap_protent = {
1, /* enabled_flag */ 1, /* enabled_flag */
"CHAP", /* name */ "CHAP", /* name */
NULL, /* data_name */ NULL, /* data_name */
#if PPP_OPTIONS
chap_option_list, chap_option_list,
#endif /* PPP_OPTIONS */
NULL, /* check_options */ NULL, /* check_options */
}; };

View File

@ -142,6 +142,7 @@ static char *mschap2_peer_challenge = NULL;
#include <net/ppp-comp.h> #include <net/ppp-comp.h>
#endif #endif
#if PPP_OPTIONS
/* /*
* Command-line options. * Command-line options.
*/ */
@ -158,6 +159,7 @@ static option_t chapms_option_list[] = {
#endif #endif
{ NULL } { NULL }
}; };
#endif /* PPP_OPTIONS */
/* /*
* chapms_generate_challenge - generate a challenge for MS-CHAP. * chapms_generate_challenge - generate a challenge for MS-CHAP.
@ -940,7 +942,9 @@ chapms_init(void)
{ {
chap_register_digest(&chapms_digest); chap_register_digest(&chapms_digest);
chap_register_digest(&chapms2_digest); chap_register_digest(&chapms2_digest);
#if PPP_OPTIONS
add_options(chapms_option_list); add_options(chapms_option_list);
#endif /* PPP_OPTIONS */
} }
#endif /* CHAPMS */ #endif /* CHAPMS */

View File

@ -67,6 +67,7 @@ eap_state eap_states[NUM_PPP]; /* EAP state; one for each unit */
static char *pn_secret = NULL; /* Pseudonym generating secret */ static char *pn_secret = NULL; /* Pseudonym generating secret */
#endif #endif
#if PPP_OPTIONS
/* /*
* Command-line options. * Command-line options.
*/ */
@ -91,6 +92,7 @@ static option_t eap_option_list[] = {
#endif #endif
{ NULL } { NULL }
}; };
#endif /* PPP_OPTIONS */
/* /*
* Protocol entry points. * Protocol entry points.
@ -117,7 +119,9 @@ struct protent eap_protent = {
1, /* protocol enabled */ 1, /* protocol enabled */
"EAP", /* text name of protocol */ "EAP", /* text name of protocol */
NULL, /* text name of corresponding data protocol */ NULL, /* text name of corresponding data protocol */
#if PPP_OPTIONS
eap_option_list, /* list of command-line options */ eap_option_list, /* list of command-line options */
#endif /* PPP_OPTIONS */
NULL, /* check requested options; assign defaults */ NULL, /* check requested options; assign defaults */
NULL, /* configure interface for demand-dial */ NULL, /* configure interface for demand-dial */
NULL /* say whether to bring up link for this pkt */ NULL /* say whether to bring up link for this pkt */

View File

@ -69,6 +69,7 @@ static const char rcsid[] = RCSID;
#include "fsm.h" #include "fsm.h"
#include "ecp.h" #include "ecp.h"
#if PPP_OPTIONS
static option_t ecp_option_list[] = { static option_t ecp_option_list[] = {
{ "noecp", o_bool, &ecp_protent.enabled_flag, { "noecp", o_bool, &ecp_protent.enabled_flag,
"Disable ECP negotiation" }, "Disable ECP negotiation" },
@ -77,6 +78,7 @@ static option_t ecp_option_list[] = {
{ NULL } { NULL }
}; };
#endif /* PPP_OPTIONS */
/* /*
* Protocol entry points from main code. * Protocol entry points from main code.
@ -111,7 +113,9 @@ struct protent ecp_protent = {
0, 0,
"ECP", "ECP",
"Encrypted", "Encrypted",
#if PPP_OPTIONS
ecp_option_list, ecp_option_list,
#endif /* PPP_OPTIONS */
NULL, NULL,
NULL, NULL,
NULL NULL

View File

@ -143,6 +143,7 @@ static int setnetmask __P((char **));
int setipaddr __P((char *, char **, int)); int setipaddr __P((char *, char **, int));
static void printipaddr __P((option_t *, void (*)(void *, char *,...),void *)); static void printipaddr __P((option_t *, void (*)(void *, char *,...),void *));
#if PPP_OPTIONS
static option_t ipcp_option_list[] = { static option_t ipcp_option_list[] = {
{ "noip", o_bool, &ipcp_protent.enabled_flag, { "noip", o_bool, &ipcp_protent.enabled_flag,
"Disable IP and IPCP" }, "Disable IP and IPCP" },
@ -243,6 +244,7 @@ static option_t ipcp_option_list[] = {
{ NULL } { NULL }
}; };
#endif /* PPP_OPTIONS */
/* /*
* Protocol entry points from main code. * Protocol entry points from main code.
@ -275,7 +277,9 @@ struct protent ipcp_protent = {
1, 1,
"IPCP", "IPCP",
"IP", "IP",
#if PPP_OPTIONS
ipcp_option_list, ipcp_option_list,
#endif /* PPP_OPTIONS */
ip_check_options, ip_check_options,
ip_demand_conf, ip_demand_conf,
ip_active_pkt ip_active_pkt
@ -322,8 +326,12 @@ setvjslots(argv)
{ {
int value; int value;
/* FIXME: found what int_option() did */
#if PPP_OPTIONS
if (!int_option(*argv, &value)) if (!int_option(*argv, &value))
return 0; return 0;
#endif /* PPP_OPTIONS */
if (value < 2 || value > 16) { if (value < 2 || value > 16) {
option_error("vj-max-slots value must be between 2 and 16"); option_error("vj-max-slots value must be between 2 and 16");
return 0; return 0;

View File

@ -90,6 +90,7 @@ static void printendpoint __P((option_t *, void (*)(void *, char *, ...),
void *)); void *));
#endif /* HAVE_MULTILINK */ #endif /* HAVE_MULTILINK */
#if PPP_OPTIONS
static option_t lcp_option_list[] = { static option_t lcp_option_list[] = {
/* LCP options */ /* LCP options */
{ "-all", o_special_noarg, (void *)noopt, { "-all", o_special_noarg, (void *)noopt,
@ -195,6 +196,7 @@ static option_t lcp_option_list[] = {
{NULL} {NULL}
}; };
#endif /* PPP_OPTIONS */
/* global vars */ /* global vars */
fsm lcp_fsm[NUM_PPP]; /* LCP fsm structure (global)*/ fsm lcp_fsm[NUM_PPP]; /* LCP fsm structure (global)*/
@ -281,7 +283,9 @@ struct protent lcp_protent = {
1, 1,
"LCP", "LCP",
NULL, NULL,
#if PPP_OPTIONS
lcp_option_list, lcp_option_list,
#endif /* PPP_OPTIONS */
NULL, NULL,
NULL, NULL,
NULL NULL

View File

@ -184,6 +184,7 @@ struct option_list {
static struct option_list *extra_options = NULL; static struct option_list *extra_options = NULL;
#if PPP_OPTIONS
/* /*
* Valid arguments. * Valid arguments.
*/ */
@ -1625,3 +1626,4 @@ loadplugin(argv)
return 0; return 0;
} }
#endif /* PLUGIN */ #endif /* PLUGIN */
#endif /* PPP_OPTIONS */

View File

@ -13,7 +13,7 @@ The PolarSSL API was not changed at all, so if you are already using
PolarSSL you can choose to skip the compilation of the included PolarSSL PolarSSL you can choose to skip the compilation of the included PolarSSL
library into lwIP: library into lwIP:
The following define are available for flexibility: The following defines are available for flexibility:
LWIP_INCLUDED_POLARSSL_MD4_C ; Use lwIP internal PolarSSL for MD4 LWIP_INCLUDED_POLARSSL_MD4_C ; Use lwIP internal PolarSSL for MD4
LWIP_INCLUDED_POLARSSL_MD5_C ; Use lwIP internal PolarSSL for MD5 LWIP_INCLUDED_POLARSSL_MD5_C ; Use lwIP internal PolarSSL for MD5
@ -21,7 +21,7 @@ LWIP_INCLUDED_POLARSSL_SHA1_C ; Use lwIP internal PolarSSL for SHA1
LWIP_INCLUDED_POLARSSL_DES_C ; Use lwIP internal PolarSSL for DES LWIP_INCLUDED_POLARSSL_DES_C ; Use lwIP internal PolarSSL for DES
If set (=1), the default if required by another enabled PPP feature unless If set (=1), the default if required by another enabled PPP feature unless
explicitely set to 0, using included lwIP PolarSSL. explicitly set to 0, using included lwIP PolarSSL.
If clear (=0), using external PolarSSL. If clear (=0), using external PolarSSL.

View File

@ -343,6 +343,7 @@ int ppp_oldmain() {
progname = *argv; progname = *argv;
#if PPP_OPTIONS
/* /*
* Parse, in order, the system options file, the user's options file, * Parse, in order, the system options file, the user's options file,
* and the command line arguments. * and the command line arguments.
@ -351,6 +352,8 @@ int ppp_oldmain() {
|| !options_from_user() || !options_from_user()
|| !parse_args(argc-1, argv+1)) || !parse_args(argc-1, argv+1))
exit(EXIT_OPTION_ERROR); exit(EXIT_OPTION_ERROR);
#endif /* PPP_OPTIONS */
devnam_fixed = 1; /* can no longer change device name */ devnam_fixed = 1; /* can no longer change device name */
/* /*
@ -363,6 +366,7 @@ int ppp_oldmain() {
if (debug) if (debug)
setlogmask(LOG_UPTO(LOG_DEBUG)); setlogmask(LOG_UPTO(LOG_DEBUG));
#if 0
/* /*
* Check that we are running as root. * Check that we are running as root.
*/ */
@ -376,7 +380,9 @@ int ppp_oldmain() {
option_error("%s", no_ppp_msg); option_error("%s", no_ppp_msg);
exit(EXIT_NO_KERNEL_SUPPORT); exit(EXIT_NO_KERNEL_SUPPORT);
} }
#endif
#if PPP_OPTIONS
/* /*
* Check that the options given are valid and consistent. * Check that the options given are valid and consistent.
*/ */
@ -399,6 +405,7 @@ int ppp_oldmain() {
print_options(pr_log, NULL); print_options(pr_log, NULL);
end_pr_log(); end_pr_log();
} }
#endif /* PPP_OPTIONS */
if (dryrun) if (dryrun)
die(0); die(0);

View File

@ -415,8 +415,10 @@ struct protent {
char *name; /* Text name of protocol */ char *name; /* Text name of protocol */
char *data_name; /* Text name of corresponding data protocol */ char *data_name; /* Text name of corresponding data protocol */
option_t *options; /* List of command-line options */ option_t *options; /* List of command-line options */
#if PPP_OPTIONS
/* Check requested options, assign defaults */ /* Check requested options, assign defaults */
void (*check_options) __P((void)); void (*check_options) __P((void));
#endif /* PPP_OPTIONS */
/* Configure interface for demand-dial */ /* Configure interface for demand-dial */
int (*demand_conf) __P((int unit)); int (*demand_conf) __P((int unit));
/* Say whether to bring up link for this pkt */ /* Say whether to bring up link for this pkt */
@ -680,8 +682,12 @@ int options_from_list __P((struct wordlist *, int privileged));
/* Parse options from a wordlist */ /* Parse options from a wordlist */
int getword __P((FILE *f, char *word, int *newlinep, char *filename)); int getword __P((FILE *f, char *word, int *newlinep, char *filename));
/* Read a word from a file */ /* Read a word from a file */
#if PPP_OPTIONS
void option_error __P((char *fmt, ...)); void option_error __P((char *fmt, ...));
/* Print an error message about an option */ /* Print an error message about an option */
#else
#define option_error(x, ...)
#endif /* PPP_OPTIONS */
int int_option __P((char *, int *)); int int_option __P((char *, int *));
/* Simplified number_option for decimal ints */ /* Simplified number_option for decimal ints */
void add_options __P((option_t *)); /* Add extra options */ void add_options __P((option_t *)); /* Add extra options */

View File

@ -427,7 +427,7 @@ void tty_process_extra_options()
fatal("Couldn't stat default device %s: %m", devnam); fatal("Couldn't stat default device %s: %m", devnam);
} }
#if PPP_OPTIONS
/* /*
* Parse the tty options file. * Parse the tty options file.
* The per-tty options file should not change * The per-tty options file should not change
@ -437,6 +437,7 @@ void tty_process_extra_options()
*/ */
if (!options_for_tty()) if (!options_for_tty())
exit(EXIT_OPTION_ERROR); exit(EXIT_OPTION_ERROR);
#endif /* PPP_OPTIONS */
} }
/* /*

View File

@ -58,6 +58,7 @@ static const char rcsid[] = RCSID;
static bool hide_password = 1; static bool hide_password = 1;
#if PPP_OPTIONS
/* /*
* Command-line options. * Command-line options.
*/ */
@ -76,6 +77,7 @@ static option_t pap_option_list[] = {
{ NULL } { NULL }
}; };
#endif /* PPP_OPTIONS */
/* /*
* Protocol entry points. * Protocol entry points.
@ -102,7 +104,9 @@ struct protent pap_protent = {
1, 1,
"PAP", "PAP",
NULL, NULL,
#if PPP_OPTIONS
pap_option_list, pap_option_list,
#endif /* PPP_OPTIONS */
NULL, NULL,
NULL, NULL,
NULL NULL