--- /global/users/darren/junk/l2tp/ppp-2.4.2/pppd/Makefile	2003-11-27 21:55:19.000000000 +0000
+++ Makefile	2004-02-02 13:25:24.000000000 +0000
@@ -1,6 +1,6 @@
 #
 # pppd makefile for Linux
-# $Id: Makefile.linux,v 1.60 2003/11/27 21:55:19 paulus Exp $
+# $Id: Makefile.linux,v 1.2 2004/02/02 13:25:24 darren Exp $
 #
 
 # Default installation locations
@@ -8,7 +8,7 @@
 MANDIR = $(DESTDIR)/usr/man
 INCDIR = $(DESTDIR)/usr/include
 
-TARGETS = pppd
+TARGETS = l2tppppd
 
 PPPDSRCS = main.c magic.c fsm.c lcp.c ipcp.c upap.c chap-new.c md5.c ccp.c \
 	   ecp.c ipxcp.c auth.c options.c sys-linux.c md4.c chap_ms.c \
@@ -196,23 +196,23 @@
 
 all: $(TARGETS)
 
-install: pppd
+install: l2tppppd
 	mkdir -p $(BINDIR) $(MANDIR)
 	$(EXTRAINSTALL)
-	$(INSTALL) -s -c -m 555 pppd $(BINDIR)/pppd
-	if chgrp pppusers $(BINDIR)/pppd 2>/dev/null; then \
-	  chmod o-rx,u+s $(BINDIR)/pppd; fi
-	$(INSTALL) -c -m 444 pppd.8 $(MANDIR)/man8
+	$(INSTALL) -s -c -m 555 l2tppppd $(BINDIR)/l2tppppd
+	if chgrp pppusers $(BINDIR)/l2tppppd 2>/dev/null; then \
+	  chmod o-rx,u+s $(BINDIR)/l2tppppd; fi
+	$(INSTALL) -c -m 444 l2tppppd.8 $(MANDIR)/man8
 
-pppd: $(PPPDOBJS)
-	$(CC) $(CFLAGS) $(LDFLAGS) -o pppd $(PPPDOBJS) $(LIBS)
+l2tppppd: $(PPPDOBJS)
+	$(CC) $(CFLAGS) $(LDFLAGS) -o l2tppppd $(PPPDOBJS) $(LIBS)
 
 srp-entry:	srp-entry.c
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ srp-entry.c $(LIBS)
 
 install-devel:
-	mkdir -p $(INCDIR)/pppd
-	$(INSTALL) -c -m 644 $(HEADERS) $(INCDIR)/pppd
+	mkdir -p $(INCDIR)/l2tppppd
+	$(INSTALL) -c -m 644 $(HEADERS) $(INCDIR)/l2tppppd
 
 clean:
 	rm -f $(PPPDOBJS) $(EXTRACLEAN) $(TARGETS) *~ #* core
--- /global/users/darren/junk/l2tp/ppp-2.4.2/pppd/auth.c	2003-06-12 00:56:26.000000000 +0100
+++ auth.c	2004-02-02 13:29:19.000000000 +0000
@@ -73,7 +73,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID	"$Id: auth.c,v 1.95 2003/06/11 23:56:26 paulus Exp $"
+#define RCSID	"$Id: auth.c,v 1.3 2004/02/02 13:29:19 darren Exp $"
 
 #include <stdio.h>
 #include <stddef.h>
@@ -129,6 +129,11 @@
 
 #define ISWILD(word)	(word[0] == '*' && word[1] == 0)
 
+/* remove the #defined CHAP and UPAP secrets files */
+
+extern char * upapfilename;
+extern char * chapfilename;
+
 /* The name by which the peer authenticated itself to us. */
 char peer_authname[MAXNAMELEN];
 
@@ -232,6 +237,7 @@
 #ifdef CHAPMS
 bool refuse_mschap = 0;		/* Don't wanna auth. ourselves with MS-CHAP */
 bool refuse_mschap_v2 = 0;	/* Don't wanna auth. ourselves with MS-CHAPv2 */
+bool ms_ignore_domain = 0;	/* Ignore any MS domain prefix */
 #else
 bool refuse_mschap = 1;		/* Don't wanna auth. ourselves with MS-CHAP */
 bool refuse_mschap_v2 = 1;	/* Don't wanna auth. ourselves with MS-CHAPv2 */
@@ -319,6 +325,8 @@
       "Require MS-CHAPv2 authentication from peer",
       OPT_ALIAS | OPT_PRIOSUB | OPT_A2OR | MDTYPE_MICROSOFT_V2,
       &lcp_wantoptions[0].chap_mdtype },
+    { "ms-ignore-domain", o_bool, &ms_ignore_domain,
+      "Ignore any MS domain prefix in the username", 1 },
 #endif
 
     { "refuse-pap", o_bool, &refuse_pap,
@@ -1267,7 +1275,7 @@
      * Open the file of pap secrets and scan for a suitable secret
      * for authenticating this user.
      */
-    filename = _PATH_UPAPFILE;
+    filename = upapfilename;
     addrs = opts = NULL;
     ret = UPAP_AUTHNAK;
     f = fopen(filename, "r");
@@ -1586,7 +1594,7 @@
      * Open the file of pap secrets and scan for a suitable secret.
      */
     if (ret <= 0) {
-	filename = _PATH_UPAPFILE;
+	filename = upapfilename;
 	addrs = NULL;
 	f = fopen(filename, "r");
 	if (f == NULL)
@@ -1634,7 +1642,7 @@
 	    return ret;
     }
 
-    filename = _PATH_UPAPFILE;
+    filename = upapfilename;
     f = fopen(filename, "r");
     if (f == NULL)
 	return 0;
@@ -1672,7 +1680,7 @@
 	    return ret;
     }
 
-    filename = _PATH_UPAPFILE;
+    filename = upapfilename;
     f = fopen(filename, "r");
     if (f == NULL)
 	return 0;
@@ -1717,7 +1725,7 @@
 	}
     }
 
-    filename = _PATH_CHAPFILE;
+    filename = chapfilename;
     f = fopen(filename, "r");
     if (f == NULL)
 	return 0;
@@ -1780,23 +1788,23 @@
 	free_wordlist(addrs);
 
     return ret >= 0;
-}
+	}
 
 
-/*
+	/*
  * get_secret - open the CHAP secret file and return the secret
  * for authenticating the given client on the given server.
  * (We could be either client or server).
  */
-int
-get_secret(unit, client, server, secret, secret_len, am_server)
+	int
+	get_secret(unit, client, server, secret, secret_len, am_server)
     int unit;
     char *client;
     char *server;
     char *secret;
     int *secret_len;
     int am_server;
-{
+	{
     FILE *f;
     int ret, len;
     char *filename;
@@ -1812,7 +1820,7 @@
 	    return 0;
 	}
     } else {
-	filename = _PATH_CHAPFILE;
+		filename = chapfilename;
 	addrs = NULL;
 	secbuf[0] = 0;
 
@@ -1846,22 +1854,22 @@
     *secret_len = len;
 
     return 1;
-}
+	}
 
 
-/*
+	/*
  * get_srp_secret - open the SRP secret file and return the secret
  * for authenticating the given client on the given server.
  * (We could be either client or server).
  */
-int
-get_srp_secret(unit, client, server, secret, am_server)
+	int
+	get_srp_secret(unit, client, server, secret, am_server)
     int unit;
     char *client;
     char *server;
     char *secret;
     int am_server;
-{
+	{
     FILE *fp;
     int ret;
     char *filename;
--- /global/users/darren/junk/l2tp/ppp-2.4.2/pppd/chap-new.c	2003-11-27 22:22:36.000000000 +0000
+++ chap-new.c	2004-02-02 13:29:19.000000000 +0000
@@ -33,7 +33,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID	"$Id: chap-new.c,v 1.3 2003/11/27 22:22:36 paulus Exp $"
+#define RCSID	"$Id: chap-new.c,v 1.2 2004/02/02 13:29:19 darren Exp $"
 
 #include <stdlib.h>
 #include <string.h>
@@ -396,6 +396,14 @@
 	int ok;
 	char secret[MAXSECRETLEN];
 	int secret_len;
+#ifdef CHAPMS
+	char nametmp[MAXNAMELEN];
+
+	if (ms_ignore_domain && strrchr(name, '\\')) {
+		strcpy(nametmp, strrchr(name, '\\') + 1);
+		strcpy(name, nametmp);
+	}
+#endif
 
 	/* Get the secret that the peer is supposed to know */
 	if (!get_secret(0, name, ourname, secret, &secret_len, 1)) {
--- /global/users/darren/junk/l2tp/ppp-2.4.2/pppd/main.c	2004-01-13 04:00:34.000000000 +0000
+++ main.c	2004-02-13 10:28:50.000000000 +0000
@@ -40,7 +40,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID	"$Id: main.c,v 1.131 2004/01/13 04:00:34 paulus Exp $"
+#define RCSID	"$Id: main.c,v 1.3 2004/02/13 10:28:50 darren Exp $"
 
 #include <stdio.h>
 #include <ctype.h>
@@ -95,6 +95,15 @@
 #include "atcp.h"
 #endif
 
+/* remove the statically compiled CHAP and UPAP secrets names */
+char * upapfilename;
+char * chapfilename;
+
+static char * default_upap = _PATH_UPAPFILE;
+static char * default_chap = _PATH_CHAPFILE;
+
+
+
 static const char rcsid[] = RCSID;
 
 /* interface vars */
@@ -279,6 +288,9 @@
     struct protent *protp;
     char numbuf[16];
 
+    upapfilename = default_upap;
+    chapfilename = default_chap;
+    
     link_stats_valid = 0;
     new_phase(PHASE_INITIALIZE);
 
@@ -426,7 +438,7 @@
 	else
 	    p = "(unknown)";
     }
-    syslog(LOG_NOTICE, "pppd %s started by %s, uid %d", VERSION, p, uid);
+    syslog(LOG_NOTICE, "l2tppppd %s started by %s, uid %d", VERSION, p, uid);
     script_setenv("PPPLOGNAME", p, 0);
 
     if (devnam[0])
@@ -838,9 +850,9 @@
 reopen_log()
 {
 #ifdef ULTRIX
-    openlog("pppd", LOG_PID);
+    openlog("l2tppppd", LOG_PID);
 #else
-    openlog("pppd", LOG_PID | LOG_NDELAY, LOG_PPP);
+    openlog("l2tppppd", LOG_PID | LOG_NDELAY, LOG_PPP);
     setlogmask(LOG_UPTO(LOG_INFO));
 #endif
 }
--- /global/users/darren/junk/l2tp/ppp-2.4.2/pppd/options.c	2004-01-13 04:02:07.000000000 +0000
+++ options.c	2004-02-02 13:25:24.000000000 +0000
@@ -40,7 +40,7 @@
  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#define RCSID	"$Id: options.c,v 1.92 2004/01/13 04:02:07 paulus Exp $"
+#define RCSID	"$Id: options.c,v 1.2 2004/02/02 13:25:24 darren Exp $"
 
 #include <ctype.h>
 #include <stdio.h>
@@ -62,6 +62,10 @@
 #include "pppd.h"
 #include "pathnames.h"
 
+/* remove the dependanies for a statically compiled PAP and CHAP secrets file */
+extern char * upapfilename;
+extern char * chapfilename;
+
 #if defined(ultrix) || defined(NeXT)
 char *strdup __P((char *));
 #endif
@@ -308,6 +312,12 @@
     { "mo-timeout", o_int, &maxoctets_timeout,
       "Check for traffic limit every N seconds", OPT_PRIO | OPT_LLIMIT | 1 },
 #endif
+    { "papfilename", o_string, &upapfilename,
+      "set the upap filename", OPT_PRIO },
+  
+    { "chapfilename", o_string, &chapfilename,
+      "set the chap filename", OPT_PRIO },
+
 
     { NULL }
 };
--- /global/users/darren/junk/l2tp/ppp-2.4.2/pppd/pppd.h	2003-04-07 01:01:46.000000000 +0100
+++ pppd.h	2004-02-02 13:29:19.000000000 +0000
@@ -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.
  *
- * $Id: pppd.h,v 1.82 2003/04/07 00:01:46 paulus Exp $
+ * $Id: pppd.h,v 1.2 2004/02/02 13:29:19 darren Exp $
  */
 
 /*
@@ -310,6 +310,10 @@
 extern bool	dump_options;	/* print out option values */
 extern bool	dryrun;		/* check everything, print options, exit */
 
+#ifdef CHAPMS
+extern bool	ms_ignore_domain; /* Ignore any MS domain prefix */
+#endif
+
 #ifdef MAXOCTETS
 extern unsigned int maxoctets;	     /* Maximum octetes per session (in bytes) */
 extern int       maxoctets_dir;      /* Direction :
