Fix bug in filling in mdtype field when we NAK and suggest CHAP.
Ask for/suggest MD5 before MSCHAP{v2,} digest.
* 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>
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_chap = 0; wo->chap_mdtype = MDTYPE_NONE;
+ wo->neg_chap = 0;
+ wo->chap_mdtype = MDTYPE_NONE;
wo->neg_upap = 0;
wo->neg_eap = 0;
}
* 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>
#ifdef CHAPMS
#include "chap_ms.h"
+#define MDTYPE_ALL (MDTYPE_MICROSOFT_V2 | MDTYPE_MICROSOFT | MDTYPE_MD5)
+#else
+#define MDTYPE_ALL (MDTYPE_MD5)
#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,
#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) \
+ ((mdtype) & MDTYPE_MD5)? CHAP_MD5: \
((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. */
* 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:
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;
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);
* 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 $
*/
/*
/* 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
-#endif
extern char *current_option; /* the name of the option being parsed */
extern int privileged_option; /* set iff the current option came from root */