]> git.ozlabs.org Git - ppp.git/commitdiff
Remove dependencies on CHAPMS definition in header files.
authorPaul Mackerras <paulus@samba.org>
Sun, 31 Oct 2004 22:23:18 +0000 (22:23 +0000)
committerPaul Mackerras <paulus@samba.org>
Sun, 31 Oct 2004 22:23:18 +0000 (22:23 +0000)
Fix bug in filling in mdtype field when we NAK and suggest CHAP.
Ask for/suggest MD5 before MSCHAP{v2,} digest.

pppd/auth.c
pppd/chap-new.c
pppd/chap-new.h
pppd/lcp.c
pppd/pppd.h

index 40cb42738f008bca21d3e028efd2740aecd5a181..3904d47508f743e670e3c3de389138199a3ed529 100644 (file)
@@ -73,7 +73,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: auth.c,v 1.97 2004/10/28 00:33:47 paulus Exp $"
+#define RCSID  "$Id: auth.c,v 1.98 2004/10/31 22:23:18 paulus Exp $"
 
 #include <stdio.h>
 #include <stddef.h>
 
 #include <stdio.h>
 #include <stddef.h>
@@ -1109,12 +1109,14 @@ auth_check_options()
     if (auth_required) {
        allow_any_ip = 0;
        if (!wo->neg_chap && !wo->neg_upap && !wo->neg_eap) {
     if (auth_required) {
        allow_any_ip = 0;
        if (!wo->neg_chap && !wo->neg_upap && !wo->neg_eap) {
-           wo->neg_chap = 1; wo->chap_mdtype = MDTYPE_ALL;
+           wo->neg_chap = 1;
+           wo->chap_mdtype = chap_mdtype_all;
            wo->neg_upap = 1;
            wo->neg_eap = 1;
        }
     } else {
            wo->neg_upap = 1;
            wo->neg_eap = 1;
        }
     } else {
-       wo->neg_chap = 0; wo->chap_mdtype = MDTYPE_NONE;
+       wo->neg_chap = 0;
+       wo->chap_mdtype = MDTYPE_NONE;
        wo->neg_upap = 0;
        wo->neg_eap = 0;
     }
        wo->neg_upap = 0;
        wo->neg_eap = 0;
     }
index c8aa530dddb0613d1a9d8ee412ab6366fd277256..367f95702a61bd2f07fd7cae59d54fd004061cb6 100644 (file)
@@ -33,7 +33,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: chap-new.c,v 1.4 2004/01/17 05:47:55 carlsonj Exp $"
+#define RCSID  "$Id: chap-new.c,v 1.5 2004/10/31 22:23:18 paulus Exp $"
 
 #include <stdlib.h>
 #include <string.h>
 
 #include <stdlib.h>
 #include <string.h>
 
 #ifdef CHAPMS
 #include "chap_ms.h"
 
 #ifdef CHAPMS
 #include "chap_ms.h"
+#define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5)
+#else
+#define MDTYPE_ALL (MDTYPE_MD5)
 #endif
 
 #endif
 
+int chap_mdtype_all = MDTYPE_ALL;
+
 /* Hook for a plugin to validate CHAP challenge */
 int (*chap_verify_hook)(char *name, char *ourname, int id,
                        struct chap_digest_type *digest,
 /* Hook for a plugin to validate CHAP challenge */
 int (*chap_verify_hook)(char *name, char *ourname, int id,
                        struct chap_digest_type *digest,
index 0f38ff434ecf919eb1f714a742199097b4405143..e6a534df80c0d0caf5e2a3f45cfec3dc3acc0b10 100644 (file)
 #define MDTYPE_MICROSOFT_V2    0x1
 #define MDTYPE_MICROSOFT       0x2
 #define MDTYPE_MD5             0x4
 #define MDTYPE_MICROSOFT_V2    0x1
 #define MDTYPE_MICROSOFT       0x2
 #define MDTYPE_MD5             0x4
+#define MDTYPE_NONE            0
 
 
-#ifdef CHAPMS
-#define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5)
-#else
-#define MDTYPE_ALL (MDTYPE_MD5)
-#endif
-#define MDTYPE_NONE 0
+/* hashes supported by this instance of pppd */
+extern int chap_mdtype_all;
 
 /* Return the digest alg. ID for the most preferred digest type. */
 #define CHAP_DIGEST(mdtype) \
 
 /* Return the digest alg. ID for the most preferred digest type. */
 #define CHAP_DIGEST(mdtype) \
+    ((mdtype) & MDTYPE_MD5)? CHAP_MD5: \
     ((mdtype) & MDTYPE_MICROSOFT_V2)? CHAP_MICROSOFT_V2: \
     ((mdtype) & MDTYPE_MICROSOFT)? CHAP_MICROSOFT: \
     ((mdtype) & MDTYPE_MICROSOFT_V2)? CHAP_MICROSOFT_V2: \
     ((mdtype) & MDTYPE_MICROSOFT)? CHAP_MICROSOFT: \
-    ((mdtype) & MDTYPE_MD5)? CHAP_MD5: \
     0
 
 /* Return the bit flag (lsb set) for our most preferred digest type. */
     0
 
 /* Return the bit flag (lsb set) for our most preferred digest type. */
index 8d540715a0470775ea39516e83f199a28120ff94..dde1381abae4c95ca89d662f36da3b002950f913 100644 (file)
@@ -40,7 +40,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID  "$Id: lcp.c,v 1.70 2003/07/28 12:25:41 carlsonj Exp $"
+#define RCSID  "$Id: lcp.c,v 1.71 2004/10/31 22:23:18 paulus Exp $"
 
 /*
  * TODO:
 
 /*
  * TODO:
@@ -359,7 +359,7 @@ lcp_init(unit)
     ao->mru = MAXMRU;
     ao->neg_asyncmap = 1;
     ao->neg_chap = 1;
     ao->mru = MAXMRU;
     ao->neg_asyncmap = 1;
     ao->neg_chap = 1;
-    ao->chap_mdtype = MDTYPE_ALL;
+    ao->chap_mdtype = chap_mdtype_all;
     ao->neg_upap = 1;
     ao->neg_eap = 1;
     ao->neg_magicnumber = 1;
     ao->neg_upap = 1;
     ao->neg_eap = 1;
     ao->neg_magicnumber = 1;
@@ -1670,7 +1670,7 @@ lcp_reqci(f, inp, lenp, reject_if_disagree)
                    if (ao->neg_chap) {
                        PUTCHAR(CILEN_CHAP, nakp);
                        PUTSHORT(PPP_CHAP, nakp);
                    if (ao->neg_chap) {
                        PUTCHAR(CILEN_CHAP, nakp);
                        PUTSHORT(PPP_CHAP, nakp);
-                       PUTCHAR(ao->chap_mdtype, nakp);
+                       PUTCHAR(CHAP_DIGEST(ao->chap_mdtype), nakp);
                    } else {
                        PUTCHAR(CILEN_SHORT, nakp);
                        PUTSHORT(PPP_PAP, nakp);
                    } else {
                        PUTCHAR(CILEN_SHORT, nakp);
                        PUTSHORT(PPP_PAP, nakp);
index dbb3e871634387e46588f41aa7716129526bcf29..02f983e4bdc9f18eab47437a2bc93eaa327b9a79 100644 (file)
@@ -39,7 +39,7 @@
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
- * $Id: pppd.h,v 1.83 2004/10/28 00:32:32 paulus Exp $
+ * $Id: pppd.h,v 1.84 2004/10/31 22:23:18 paulus Exp $
  */
 
 /*
  */
 
 /*
@@ -347,13 +347,11 @@ extern bool       ms_lanman;      /* Use LanMan password instead of NT */
 /* Values for auth_done only */
 #define CHAP_MD5_WITHPEER      0x40
 #define CHAP_MD5_PEER          0x80
 /* Values for auth_done only */
 #define CHAP_MD5_WITHPEER      0x40
 #define CHAP_MD5_PEER          0x80
-#ifdef CHAPMS
 #define CHAP_MS_SHIFT          8       /* LSB position for MS auths */
 #define CHAP_MS_WITHPEER       0x100
 #define CHAP_MS_PEER           0x200
 #define CHAP_MS2_WITHPEER      0x400
 #define CHAP_MS2_PEER          0x800
 #define CHAP_MS_SHIFT          8       /* LSB position for MS auths */
 #define CHAP_MS_WITHPEER       0x100
 #define CHAP_MS_PEER           0x200
 #define CHAP_MS2_WITHPEER      0x400
 #define CHAP_MS2_PEER          0x800
-#endif
 
 extern char *current_option;   /* the name of the option being parsed */
 extern int  privileged_option; /* set iff the current option came from root */
 
 extern char *current_option;   /* the name of the option being parsed */
 extern int  privileged_option; /* set iff the current option came from root */