From ff2a737094f2e77acb72c4140be17c2cf7aae5d0 Mon Sep 17 00:00:00 2001 From: Sylvain Rochet Date: Tue, 19 Jun 2012 17:38:02 +0200 Subject: [PATCH] ppp_settings.remote_name is now a compile time option --- src/netif/ppp/chap-new.c | 2 ++ src/netif/ppp/eap.c | 2 ++ src/netif/ppp/ppp.h | 5 ++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/netif/ppp/chap-new.c b/src/netif/ppp/chap-new.c index 6701b2fe..8e026867 100644 --- a/src/netif/ppp/chap-new.c +++ b/src/netif/ppp/chap-new.c @@ -435,9 +435,11 @@ static void chap_respond(ppp_pcb *pcb, int id, /* Null terminate and clean remote name. */ slprintf(rname, sizeof(rname), "%.*v", nlen, pkt + clen + 1); +#if PPP_REMOTENAME /* Microsoft doesn't send their name back in the PPP packet */ if (pcb->settings.explicit_remote || (pcb->settings.remote_name[0] != 0 && rname[0] == 0)) strlcpy(rname, pcb->settings.remote_name, sizeof(rname)); +#endif /* PPP_REMOTENAME */ /* get secret for authenticating ourselves with the specified host */ if (!get_secret(pcb, pcb->chap_client.name, rname, secret, &secret_len, 0)) { diff --git a/src/netif/ppp/eap.c b/src/netif/ppp/eap.c index 78faf0c7..1b2663ad 100644 --- a/src/netif/ppp/eap.c +++ b/src/netif/ppp/eap.c @@ -1444,10 +1444,12 @@ static void eap_request(ppp_pcb *pcb, u_char *inp, int id, int len) { rhostname[len - vallen] = '\0'; } +#if PPP_REMOTENAME /* In case the remote doesn't give us his name. */ if (pcb->settings.explicit_remote || (pcb->settings.remote_name[0] != '\0' && vallen == len)) strlcpy(rhostname, pcb->settings.remote_name, sizeof (rhostname)); +#endif /* PPP_REMOTENAME */ /* * Get the secret for authenticating ourselves with diff --git a/src/netif/ppp/ppp.h b/src/netif/ppp/ppp.h index 13e79757..3223c942 100644 --- a/src/netif/ppp/ppp.h +++ b/src/netif/ppp/ppp.h @@ -153,7 +153,9 @@ typedef struct ppp_settings_s { u_int disable_defaultip : 1; /* Don't use hostname for default IP addrs */ u_int auth_required : 1; /* Peer is required to authenticate */ +#if PPP_REMOTENAME u_int explicit_remote : 1; /* remote_name specified with remotename opt */ +#endif /* PPP_REMOTENAME */ #if PAP_SUPPORT u_int refuse_pap : 1; /* Don't wanna auth. ourselves with PAP */ #endif /* PAP_SUPPORT */ @@ -189,8 +191,9 @@ typedef struct ppp_settings_s { #if PPP_SERVER char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */ #endif /* PPP_SERVER */ - /* FIXME: make it a compile time option */ +#if PPP_REMOTENAME char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */ +#endif /* PPP_REMOTENAME */ #if CHAP_SUPPORT int chap_timeout_time;