mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-04-10 15:45:13 +00:00
Revert "modified auth_reset() so that we can choose which auth we want"
This reverts commit bf10a27db89eb64a50df40a173b2d012b47586e3. Licence issue, we cannot include GPLed source code.
This commit is contained in:
parent
a820f32ec9
commit
624da03bad
@ -1292,42 +1292,21 @@ void
|
|||||||
auth_reset(unit)
|
auth_reset(unit)
|
||||||
int unit;
|
int unit;
|
||||||
{
|
{
|
||||||
lcp_options *go = &lcp_gotoptions[unit];
|
lcp_options *go = &lcp_gotoptions[unit];
|
||||||
lcp_options *ao = &lcp_allowoptions[unit];
|
lcp_options *ao = &lcp_allowoptions[unit];
|
||||||
|
int hadchap;
|
||||||
if( ppp_settings.passwd[0] ) {
|
hadchap = -1;
|
||||||
|
|
||||||
ao->neg_upap = !ppp_settings.refuse_pap;
|
|
||||||
|
|
||||||
ao->neg_eap = !ppp_settings.refuse_eap;
|
|
||||||
|
|
||||||
ao->chap_mdtype = MDTYPE_NONE;
|
|
||||||
if(!ppp_settings.refuse_chap)
|
|
||||||
ao->chap_mdtype |= MDTYPE_MD5;
|
|
||||||
if(!ppp_settings.refuse_mschap)
|
|
||||||
ao->chap_mdtype |= MDTYPE_MICROSOFT;
|
|
||||||
if(!ppp_settings.refuse_mschap_v2)
|
|
||||||
ao->chap_mdtype |= MDTYPE_MICROSOFT_V2;
|
|
||||||
|
|
||||||
ao->neg_chap = (ao->chap_mdtype != MDTYPE_NONE);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
ao->neg_upap = 0;
|
|
||||||
ao->neg_chap = 0;
|
|
||||||
ao->neg_eap = 0;
|
|
||||||
ao->chap_mdtype = MDTYPE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
printf("neg_upap: %d\n", ao->neg_upap);
|
|
||||||
printf("neg_chap: %d\n", ao->neg_chap);
|
|
||||||
printf("neg_chap_md5: %d\n", !!(ao->chap_mdtype&MDTYPE_MD5) );
|
|
||||||
printf("neg_chap_ms: %d\n", !!(ao->chap_mdtype&MDTYPE_MICROSOFT) );
|
|
||||||
printf("neg_chap_ms2: %d\n", !!(ao->chap_mdtype&MDTYPE_MICROSOFT_V2) );
|
|
||||||
printf("neg_eap: %d\n", ao->neg_eap);
|
|
||||||
|
|
||||||
//ao->neg_upap = !ppp_settings.refuse_pap && (ppp_settings.passwd[0] != 0 || get_pap_passwd(NULL));
|
//ao->neg_upap = !ppp_settings.refuse_pap && (ppp_settings.passwd[0] != 0 || get_pap_passwd(NULL));
|
||||||
|
|
||||||
|
ao->neg_upap = !ppp_settings.refuse_pap && ppp_settings.passwd[0] != 0;
|
||||||
|
|
||||||
|
ao->neg_chap = (!ppp_settings.refuse_chap || !ppp_settings.refuse_mschap || !ppp_settings.refuse_mschap_v2) && ppp_settings.passwd[0];
|
||||||
|
|
||||||
|
ao->neg_eap = !ppp_settings.refuse_eap && ppp_settings.passwd[0] != 0;
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
ao->neg_chap = (!ppp_settings.refuse_chap || !refuse_mschap || !refuse_mschap_v2)
|
ao->neg_chap = (!ppp_settings.refuse_chap || !refuse_mschap || !refuse_mschap_v2)
|
||||||
&& (passwd[0] != 0 ||
|
&& (passwd[0] != 0 ||
|
||||||
@ -1340,26 +1319,15 @@ auth_reset(unit)
|
|||||||
(explicit_remote? remote_name: NULL), 0, NULL))) ||
|
(explicit_remote? remote_name: NULL), 0, NULL))) ||
|
||||||
have_srp_secret(ppp_settings.user, (explicit_remote? remote_name: NULL), 0, NULL)); */
|
have_srp_secret(ppp_settings.user, (explicit_remote? remote_name: NULL), 0, NULL)); */
|
||||||
|
|
||||||
go->neg_upap = 0;
|
|
||||||
go->neg_chap = 0;
|
|
||||||
go->neg_eap = 0;
|
|
||||||
go->chap_mdtype = MDTYPE_NONE;
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* FIXME: find what the below stuff do */
|
/* FIXME: find what the below stuff do */
|
||||||
int hadchap;
|
|
||||||
hadchap = -1;
|
|
||||||
|
|
||||||
hadchap = -1;
|
hadchap = -1;
|
||||||
if (go->neg_upap && !uselogin && !have_pap_secret(NULL))
|
if (go->neg_upap && !uselogin && !have_pap_secret(NULL))
|
||||||
go->neg_upap = 0;
|
go->neg_upap = 0;
|
||||||
|
|
||||||
if (go->neg_chap) {
|
if (go->neg_chap) {
|
||||||
if (!(hadchap = have_chap_secret((explicit_remote? remote_name: NULL),
|
if (!(hadchap = have_chap_secret((explicit_remote? remote_name: NULL),
|
||||||
our_name, 1, NULL)))
|
our_name, 1, NULL)))
|
||||||
go->neg_chap = 0;
|
go->neg_chap = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (go->neg_eap &&
|
if (go->neg_eap &&
|
||||||
(hadchap == 0 || (hadchap == -1 &&
|
(hadchap == 0 || (hadchap == -1 &&
|
||||||
!have_chap_secret((explicit_remote? remote_name: NULL), our_name,
|
!have_chap_secret((explicit_remote? remote_name: NULL), our_name,
|
||||||
@ -1763,8 +1731,6 @@ get_secret(unit, client, server, secret, secret_len, am_server)
|
|||||||
*secret_len = len;
|
*secret_len = len;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* FIXME: clean that */
|
|
||||||
#if 0
|
#if 0
|
||||||
// strlcpy(rname, ppp_settings.user, sizeof(rname));
|
// strlcpy(rname, ppp_settings.user, sizeof(rname));
|
||||||
|
|
||||||
|
@ -456,8 +456,14 @@ chap_respond(struct chap_client_state *cs, int id,
|
|||||||
slprintf(rname, sizeof(rname), "%.*v", nlen, pkt + clen + 1);
|
slprintf(rname, sizeof(rname), "%.*v", nlen, pkt + clen + 1);
|
||||||
|
|
||||||
/* Microsoft doesn't send their name back in the PPP packet */
|
/* Microsoft doesn't send their name back in the PPP packet */
|
||||||
if (explicit_remote || (remote_name[0] != 0 && rname[0] == 0))
|
if (ppp_settings.remote_name[0] != 0 && (ppp_settings.explicit_remote || rname[0] == 0)) {
|
||||||
strlcpy(rname, remote_name, sizeof(rname));
|
strncpy(rname, ppp_settings.remote_name, sizeof(rname));
|
||||||
|
rname[sizeof(rname) - 1] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// /* 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));
|
||||||
|
|
||||||
/* get secret for authenticating ourselves with the specified host */
|
/* get secret for authenticating ourselves with the specified host */
|
||||||
if (!get_secret(0, cs->name, rname, secret, &secret_len, 0)) {
|
if (!get_secret(0, cs->name, rname, secret, &secret_len, 0)) {
|
||||||
|
@ -512,11 +512,24 @@ ascii2unicode(char ascii[], int ascii_len, u_char unicode[])
|
|||||||
static void
|
static void
|
||||||
NTPasswordHash(u_char *secret, int secret_len, u_char hash[MD4_SIGNATURE_SIZE])
|
NTPasswordHash(u_char *secret, int secret_len, u_char hash[MD4_SIGNATURE_SIZE])
|
||||||
{
|
{
|
||||||
|
#ifdef __NetBSD__
|
||||||
|
/* NetBSD uses the libc md4 routines which take bytes instead of bits */
|
||||||
|
int mdlen = secret_len;
|
||||||
|
#else
|
||||||
|
int mdlen = secret_len * 8;
|
||||||
|
#endif
|
||||||
md4_context md4Context;
|
md4_context md4Context;
|
||||||
|
|
||||||
md4_starts(&md4Context);
|
md4_starts(&md4Context);
|
||||||
md4_update(&md4Context, secret, secret_len);
|
/* MD4Update can take at most 64 bytes at a time */
|
||||||
|
while (mdlen > 512) {
|
||||||
|
md4_update(&md4Context, secret, 512);
|
||||||
|
secret += 64;
|
||||||
|
mdlen -= 512;
|
||||||
|
}
|
||||||
|
md4_update(&md4Context, secret, mdlen);
|
||||||
md4_finish(&md4Context, hash);
|
md4_finish(&md4Context, hash);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -435,14 +435,6 @@ int ppp_init(void) {
|
|||||||
void
|
void
|
||||||
pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd)
|
pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd)
|
||||||
{
|
{
|
||||||
ppp_settings.refuse_pap = 1;
|
|
||||||
ppp_settings.refuse_chap = 1;
|
|
||||||
ppp_settings.refuse_mschap = 1;
|
|
||||||
ppp_settings.refuse_mschap_v2 = 0;
|
|
||||||
ppp_settings.refuse_eap = 1;
|
|
||||||
|
|
||||||
/* FIXME: re-enable that */
|
|
||||||
#if 0
|
|
||||||
switch(authType) {
|
switch(authType) {
|
||||||
case PPPAUTHTYPE_NONE:
|
case PPPAUTHTYPE_NONE:
|
||||||
default:
|
default:
|
||||||
@ -489,7 +481,6 @@ pppSetAuth(enum pppAuthType authType, const char *user, const char *passwd)
|
|||||||
ppp_settings.refuse_chap = 0;
|
ppp_settings.refuse_chap = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if(user) {
|
if(user) {
|
||||||
strncpy(ppp_settings.user, user, sizeof(ppp_settings.user)-1);
|
strncpy(ppp_settings.user, user, sizeof(ppp_settings.user)-1);
|
||||||
|
@ -58,8 +58,7 @@ struct ppp_settings {
|
|||||||
char user [MAXNAMELEN + 1]; /* Username for PAP */
|
char user [MAXNAMELEN + 1]; /* Username for PAP */
|
||||||
char passwd [MAXSECRETLEN + 1]; /* Password for PAP, secret for CHAP */
|
char passwd [MAXSECRETLEN + 1]; /* Password for PAP, secret for CHAP */
|
||||||
char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */
|
char our_name [MAXNAMELEN + 1]; /* Our name for authentication purposes */
|
||||||
// FIXME: re-enable that
|
char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */
|
||||||
// char remote_name[MAXNAMELEN + 1]; /* Peer's name for authentication */
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ppp_settings ppp_settings;
|
struct ppp_settings ppp_settings;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user