fixes from Farrell

This commit is contained in:
Paul Mackerras 1997-05-22 06:46:19 +00:00
parent 1764436dfa
commit 3fc12c3580

View File

@ -32,7 +32,7 @@
*/
#ifndef lint
static char rcsid[] = "$Id: chap_ms.c,v 1.3 1997/04/30 05:51:40 paulus Exp $";
static char rcsid[] = "$Id: chap_ms.c,v 1.4 1997/05/22 06:46:19 paulus Exp $";
#endif
#ifdef CHAPMS
@ -47,7 +47,9 @@ static char rcsid[] = "$Id: chap_ms.c,v 1.3 1997/04/30 05:51:40 paulus Exp $";
#include "chap_ms.h"
#include "md4.h"
#ifndef USE_CRYPT
#include <des.h>
#endif
typedef struct {
u_char LANManResp[24];
@ -264,7 +266,8 @@ ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, response)
ChallengeResponse(rchallenge, (char *)md4Context.buffer, response->NTResp);
}
static u_char *StdText = "KGS!@#$%"; /* key from rasapi32.dll */
#ifdef MSLANMAN
static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */
static ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, response)
char *rchallenge;
@ -285,6 +288,7 @@ static ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, response)
DesEncrypt( StdText, UcasePassword + 7, PasswordHash + 8 );
ChallengeResponse(rchallenge, PasswordHash, response->LANManResp);
}
#endif
void
ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len)
@ -295,6 +299,9 @@ ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len)
int secret_len;
{
MS_ChapResponse response;
#ifdef MSLANMAN
extern int ms_lanman;
#endif
#if 0
CHAPDEBUG((LOG_INFO, "ChapMS: secret is '%.*s'", secret_len, secret));
@ -303,10 +310,15 @@ ChapMS(cstate, rchallenge, rchallenge_len, secret, secret_len)
/* Calculate both always */
ChapMS_NT(rchallenge, rchallenge_len, secret, secret_len, &response);
#ifdef MSLANMAN
ChapMS_LANMan(rchallenge, rchallenge_len, secret, secret_len, &response);
/* prefered method is set by option */
response.UseNT = !ms_lanman;
#else
response.UseNT = 1;
#endif
BCOPY(&response, cstate->response, MS_CHAP_RESPONSE_LEN);
cstate->resp_length = MS_CHAP_RESPONSE_LEN;