From 6b8c78bacce7894943353808038c52042d4b4715 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Sat, 9 Jun 2012 15:55:01 +0200 Subject: [PATCH] moved remote_name and explicit_remote global variable to ppp_settings --- src/netif/ppp/auth.c | 6 ------ src/netif/ppp/chap-new.c | 4 ++-- src/netif/ppp/eap.c | 6 +++--- src/netif/ppp/ppp_impl.h | 7 ++----- 4 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/netif/ppp/auth.c b/src/netif/ppp/auth.c index 9209f0ca..7273859a 100644 --- a/src/netif/ppp/auth.c +++ b/src/netif/ppp/auth.c @@ -238,19 +238,13 @@ bool refuse_mschap_v2 = 0; /* Don't wanna auth. ourselves with MS-CHAPv2 */ bool refuse_mschap = 1; /* Don't wanna auth. ourselves with MS-CHAP */ bool refuse_mschap_v2 = 1; /* Don't wanna auth. ourselves with MS-CHAPv2 */ #endif /* MSCHAP_SUPPORT */ -#endif /* MOVED TO ppp_settings */ -#if 0 /* UNUSED */ bool usehostname = 0; /* Use hostname for our_name */ bool auth_required = 0; /* Always require authentication from peer */ bool allow_any_ip = 0; /* Allow peer to use any IP address */ -#endif /* UNUSED */ bool explicit_remote = 0; /* User specified explicit remote name */ -#if 0 /* UNUSED */ bool explicit_user = 0; /* Set if "user" option supplied */ bool explicit_passwd = 0; /* Set if "password" option supplied */ -#endif /* UNUSED */ char remote_name[MAXNAMELEN]; /* Peer's name for authentication */ -#if 0 /* UNUSED */ static char *uafname; /* name of most recent +ua file */ extern char *crypt (const char *, const char *); diff --git a/src/netif/ppp/chap-new.c b/src/netif/ppp/chap-new.c index 05cf6943..d9ecd1e0 100644 --- a/src/netif/ppp/chap-new.c +++ b/src/netif/ppp/chap-new.c @@ -492,8 +492,8 @@ chap_respond(struct chap_client_state *cs, int id, slprintf(rname, sizeof(rname), "%.*v", nlen, pkt + clen + 1); /* Microsoft doesn't send their name back in the PPP packet */ - if (explicit_remote || (remote_name[0] != 0 && rname[0] == 0)) - strlcpy(rname, remote_name, sizeof(rname)); + if (ppp_settings.explicit_remote || (ppp_settings.remote_name[0] != 0 && rname[0] == 0)) + strlcpy(rname, ppp_settings.remote_name, sizeof(rname)); /* get secret for authenticating ourselves with the specified host */ if (!get_secret(0, cs->name, rname, secret, &secret_len, 0)) { diff --git a/src/netif/ppp/eap.c b/src/netif/ppp/eap.c index 9c2337ea..af50d789 100644 --- a/src/netif/ppp/eap.c +++ b/src/netif/ppp/eap.c @@ -1451,9 +1451,9 @@ int len; } /* In case the remote doesn't give us his name. */ - if (explicit_remote || - (remote_name[0] != '\0' && vallen == len)) - strlcpy(rhostname, remote_name, sizeof (rhostname)); + if (ppp_settings.explicit_remote || + (ppp_settings.remote_name[0] != '\0' && vallen == len)) + strlcpy(rhostname, ppp_settings.remote_name, sizeof (rhostname)); /* * Get the secret for authenticating ourselves with diff --git a/src/netif/ppp/ppp_impl.h b/src/netif/ppp/ppp_impl.h index 59971801..f2711e3e 100644 --- a/src/netif/ppp/ppp_impl.h +++ b/src/netif/ppp/ppp_impl.h @@ -255,9 +255,6 @@ struct epdisc { /* * Global variables. */ -extern char remote_name[MAXNAMELEN]; /* Peer's name for authentication */ -extern bool explicit_remote;/* remote_name specified with remotename opt */ - extern int unsuccess; /* # unsuccessful connection attempts */ extern int listen_time; /* time to listen first (ms) */ extern int status; /* exit status for pppd */ @@ -431,8 +428,8 @@ struct ppp_settings { #if PPP_SERVER char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */ #endif /* PPP_SERVER */ - /* FIXME: re-enable that */ - /* char remote_name[MAXNAMELEN + 1]; */ /* Peer's name for authentication */ + /* FIXME: make it a compile time option */ + char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */ }; struct ppp_settings ppp_settings;