]> git.ozlabs.org Git - ppp.git/blobdiff - pppd/chap_ms.c
The use of <net/ppp_defs.h> isn't guranteed to exist on Linux (e.g. uclibc, buildroot...
[ppp.git] / pppd / chap_ms.c
index c6e4b34bd60001ab30b05189726f3550c95a5fcb..8e59280cbee6aab7b284b13a5222fa2b322a2f8e 100644 (file)
@@ -80,8 +80,6 @@
 #include "config.h"
 #endif
 
-#ifdef CHAPMS
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #include <unistd.h>
+#if defined(SOL2)
+#include <net/ppp-comp.h>
+#else
+#include <linux/ppp-comp.h>
+#endif
 
 #include "pppd.h"
 #include "chap-new.h"
 #include "mppe.h"
 
 #ifdef UNIT_TEST
-#undef MPPE
+#undef PPP_WITH_MPPE
 #endif
 
 static void    ascii2unicode (char[], int, u_char[]);
@@ -112,16 +115,16 @@ static void       ChapMS2_NT (u_char *, u_char[16], char *, char *, int,
 static void    GenerateAuthenticatorResponsePlain
                        (char*, int, u_char[24], u_char[16], u_char *,
                         char *, u_char[41]);
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
 static void    ChapMS_LANMan (u_char *, char *, int, u_char *);
 #endif
 
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
 bool   ms_lanman = 0;          /* Use LanMan password instead of NT */
                                /* Has meaning only with MS-CHAP challenges */
 #endif
 
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
 #ifdef DEBUGMPPEKEY
 /* For MPPE debug */
 /* Use "[]|}{?/><,`!2&&(" (sans quotes) for RFC 3079 MS-CHAPv2 test value */
@@ -132,14 +135,13 @@ static char *mschap2_peer_challenge = NULL;
 
 #include "fsm.h"               /* Need to poke MPPE options */
 #include "ccp.h"
-#include <net/ppp-comp.h>
 #endif
 
 /*
  * Command-line options.
  */
 static option_t chapms_option_list[] = {
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
        { "ms-lanman", o_bool, &ms_lanman,
          "Use LanMan passwd when using MS-CHAP", 1 },
 #endif
@@ -197,7 +199,7 @@ chapms_verify_response(int id, char *name,
        if (response_len != MS_CHAP_RESPONSE_LEN)
                goto bad;
 
-#ifndef MSLANMAN
+#ifndef PPP_WITH_MSLANMAN
        if (!response[MS_CHAP_USENT]) {
                /* Should really propagate this into the error packet. */
                notice("Peer request for LANMAN auth not supported");
@@ -208,7 +210,7 @@ chapms_verify_response(int id, char *name,
        /* Generate the expected response. */
        ChapMS(challenge, (char *)secret, secret_len, md);
 
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
        /* Determine which part of response to verify against */
        if (!response[MS_CHAP_USENT])
                diff = memcmp(&response[MS_CHAP_LANMANRESP],
@@ -626,7 +628,7 @@ ChapMS2_NT(u_char *rchallenge, u_char PeerChallenge[16], char *username,
     ChallengeResponse(Challenge, PasswordHash, NTResponse);
 }
 
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
 static u_char *StdText = (u_char *)"KGS!@#$%"; /* key from rasapi32.dll */
 
 static void
@@ -718,7 +720,7 @@ GenerateAuthenticatorResponsePlain
 }
 
 
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
 
 /*
  * Set mppe_xxxx_key from MS-CHAP credentials. (see RFC 3079)
@@ -754,7 +756,7 @@ SetMasterKeys(char *secret, int secret_len, u_char NTResponse[24], int IsServer)
     mppe_set_chapv2(PasswordHashHash, NTResponse, IsServer);
 }
 
-#endif /* MPPE */
+#endif /* PPP_WITH_MPPE */
 
 
 void
@@ -765,7 +767,7 @@ ChapMS(u_char *rchallenge, char *secret, int secret_len,
 
     ChapMS_NT(rchallenge, secret, secret_len, &response[MS_CHAP_NTRESP]);
 
-#ifdef MSLANMAN
+#ifdef PPP_WITH_MSLANMAN
     ChapMS_LANMan(rchallenge, secret, secret_len,
                  &response[MS_CHAP_LANMANRESP]);
 
@@ -775,7 +777,7 @@ ChapMS(u_char *rchallenge, char *secret, int secret_len,
     response[MS_CHAP_USENT] = 1;
 #endif
 
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
     Set_Start_Key(rchallenge, secret, secret_len);
 #endif
 }
@@ -820,7 +822,7 @@ ChapMS2(u_char *rchallenge, u_char *PeerChallenge,
                                       &response[MS_CHAP2_PEER_CHALLENGE],
                                       rchallenge, user, authResponse);
 
-#ifdef MPPE
+#ifdef PPP_WITH_MPPE
     SetMasterKeys(secret, secret_len,
                  &response[MS_CHAP2_NTRESP], authenticator);
 #endif
@@ -944,5 +946,3 @@ int main(int argc, char *argv[]) {
 
 #endif  /* UNIT_TEST */
 
-
-#endif /* CHAPMS */