Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-5]: src/usr.sbin/pppd Pull up "pppd" 2.3.11 (approved by thorpej):



details:   https://anonhg.NetBSD.org/src/rev/08e27ff08976
branches:  netbsd-1-5
changeset: 488568:08e27ff08976
user:      tron <tron%NetBSD.org@localhost>
date:      Tue Jul 18 16:15:05 2000 +0000

description:
Pull up "pppd" 2.3.11 (approved by thorpej):

        basesrc/usr.sbin/pppd/chat/chat.8 1.12-1.13
        basesrc/usr.sbin/pppd/chat/chat.c 1.18-1.19
        basesrc/usr.sbin/pppd/pppd/auth.c 1.25-1.26
        basesrc/usr.sbin/pppd/pppd/chap.c 1.14-1.15
        basesrc/usr.sbin/pppd/pppd/chap.h 1.8-1.9
        basesrc/usr.sbin/pppd/pppd/eui64.c 1.2-1.3
        basesrc/usr.sbin/pppd/pppd/eui64.h 1.2-1.3
        basesrc/usr.sbin/pppd/pppd/fsm.h 1.8-1.9
        basesrc/usr.sbin/pppd/pppd/ipcp.c 1.18-1.19
        basesrc/usr.sbin/pppd/pppd/ipv6cp.c 1.6-1.8
        basesrc/usr.sbin/pppd/pppd/ipv6cp.h 1.2-1.3
        basesrc/usr.sbin/pppd/pppd/lcp.c 1.20-1.21
        basesrc/usr.sbin/pppd/pppd/main.c 1.35-1.36
        basesrc/usr.sbin/pppd/pppd/options.c 1.31-1.32
        basesrc/usr.sbin/pppd/pppd/patchlevel.h 1.18-1.19
        basesrc/usr.sbin/pppd/pppd/pathnames.h 1.11-1.12
        basesrc/usr.sbin/pppd/pppd/pppd.8 1.27-1.28
        basesrc/usr.sbin/pppd/pppd/pppd.h 1.19-1.20
        basesrc/usr.sbin/pppd/pppd/upap.c 1.11-1.12
        basesrc/usr.sbin/pppd/pppd/upap.h 1.8-1.9
        basesrc/usr.sbin/pppd/pppd/utils.c 1.3-1.4

diffstat:

 usr.sbin/pppd/chat/chat.8       |   24 ++-
 usr.sbin/pppd/chat/chat.c       |   57 +++++-
 usr.sbin/pppd/pppd/auth.c       |  333 +++++++++++++++++++++++++++------------
 usr.sbin/pppd/pppd/chap.c       |   10 +-
 usr.sbin/pppd/pppd/chap.h       |    8 +-
 usr.sbin/pppd/pppd/eui64.c      |   44 ++--
 usr.sbin/pppd/pppd/eui64.h      |   67 +++++--
 usr.sbin/pppd/pppd/fsm.h        |    6 +-
 usr.sbin/pppd/pppd/ipcp.c       |   21 +-
 usr.sbin/pppd/pppd/ipv6cp.c     |  187 ++++++++++++++++++----
 usr.sbin/pppd/pppd/ipv6cp.h     |   89 +++++++++-
 usr.sbin/pppd/pppd/lcp.c        |   45 +++--
 usr.sbin/pppd/pppd/main.c       |  179 ++++++++++++++++++---
 usr.sbin/pppd/pppd/options.c    |  120 ++++++++++++--
 usr.sbin/pppd/pppd/patchlevel.h |    8 +-
 usr.sbin/pppd/pppd/pathnames.h  |   43 +++--
 usr.sbin/pppd/pppd/pppd.8       |   97 ++++++++---
 usr.sbin/pppd/pppd/pppd.h       |   55 ++++-
 usr.sbin/pppd/pppd/upap.c       |   21 +-
 usr.sbin/pppd/pppd/upap.h       |    6 +-
 usr.sbin/pppd/pppd/utils.c      |   24 +-
 21 files changed, 1081 insertions(+), 363 deletions(-)

diffs (truncated from 3118 to 300 lines):

diff -r 222646aa1f29 -r 08e27ff08976 usr.sbin/pppd/chat/chat.8
--- a/usr.sbin/pppd/chat/chat.8 Tue Jul 18 06:25:25 2000 +0000
+++ b/usr.sbin/pppd/chat/chat.8 Tue Jul 18 16:15:05 2000 +0000
@@ -1,13 +1,13 @@
-.\"    $NetBSD: chat.8,v 1.12 2000/03/29 06:04:49 deberg Exp $
+.\"    $NetBSD: chat.8,v 1.12.4.1 2000/07/18 16:15:05 tron Exp $
 .\" -*- nroff -*-
 .\" manual page [] for chat 1.8
-.\" Id: chat.8,v 1.8 1999/05/12 06:13:22 paulus Exp
+.\" Id: chat.8,v 1.9 1999/09/06 05:10:23 paulus Exp 
 .\" SH section heading
 .\" SS subsection heading
 .\" LP paragraph
 .\" IP indented paragraph
 .\" TP hanging label
-.TH CHAT 8 "27 Sep 1997" "Chat Version 1.17"
+.TH CHAT 8 "22 May 1999" "Chat Version 1.22"
 .SH NAME
 chat \- Automated conversational script with a modem
 .SH SYNOPSIS
@@ -50,6 +50,10 @@
 keyword. When echoing is enabled, all output from the modem is echoed
 to \fIstderr\fR.
 .TP
+.B -E
+Enables environment variable substituion within chat scripts using the
+standard \fI$xxx\fR syntax.
+.TP
 .B -v
 Request that the \fIchat\fR script be executed in a verbose mode. The
 \fIchat\fR program will then log the execution state of the chat
@@ -431,6 +435,14 @@
 .B \\\\t
 Send or expect a tab character.
 .TP
+.B \\\\T
+Send the phone number string as specified with the \fI-T\fR option
+.I (not valid in expect.)
+.TP
+.B \\\\U
+Send the phone number 2 string as specified with the \fI-U\fR option
+.I (not valid in expect.)
+.TP
 .B \\\\\\\\
 Send or expect a backslash character.
 .TP
@@ -443,6 +455,12 @@
 Substitute the sequence with the control character represented by C.
 For example, the character DC1 (17) is shown as \^^Q.
 .I (some characters are not valid in expect.)
+.SH ENVIRONMENT VARIABLES
+Environment variables are available within chat scripts, if  the \fI-E\fR
+option was specified in the command line. The metacharacter \fI$\fR is used
+to introduce the name of the environment variable to substitute. If the
+substition fails, because the requested environment variable is not set,
+\fInothing\fR is replaced for the variable.
 .SH TERMINATION CODES
 The \fIchat\fR program will terminate with the following completion
 codes.
diff -r 222646aa1f29 -r 08e27ff08976 usr.sbin/pppd/chat/chat.c
--- a/usr.sbin/pppd/chat/chat.c Tue Jul 18 06:25:25 2000 +0000
+++ b/usr.sbin/pppd/chat/chat.c Tue Jul 18 16:15:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chat.c,v 1.18 1999/08/25 03:15:00 christos Exp $       */
+/*     $NetBSD: chat.c,v 1.18.8.1 2000/07/18 16:15:06 tron Exp $       */
 
 /*
  *     Chat -- a program for automatic session establishment (i.e. dial
@@ -16,6 +16,9 @@
  *     This software is in the public domain.
  *
  * -----------------
+ *     22-May-99 added environment substitutuion, enabled with -E switch.
+ *     Andreas Arens <andras%cityweb.de@localhost>.
+ *
  *     12-May-99 added a feature to read data to be sent from a file,
  *     if the send string starts with @.  Idea from gpk <gpk%onramp.net@localhost>.
  *
@@ -84,9 +87,9 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
-static char rcsid[] = "Id: chat.c,v 1.24 1999/08/13 06:46:09 paulus Exp ";
+static char rcsid[] = "Id: chat.c,v 1.26 1999/12/23 01:39:54 paulus Exp ";
 #else
-__RCSID("$NetBSD: chat.c,v 1.18 1999/08/25 03:15:00 christos Exp $");
+__RCSID("$NetBSD: chat.c,v 1.18.8.1 2000/07/18 16:15:06 tron Exp $");
 #endif
 #endif
 #ifndef __STDC__
@@ -163,6 +166,7 @@
 int Verbose       = 0;
 int quiet         = 0;
 int report        = 0;
+int use_env       = 0;
 int exit_code     = 0;
 FILE* report_fp   = (FILE *) 0;
 char *report_file = (char *) 0;
@@ -251,7 +255,7 @@
 }
 
 /*
- * chat [ -v ] [-T number] [-U number] [ -t timeout ] [ -f chat-file ] \
+ * chat [ -v ] [ -E ] [ -T number ] [ -U number ] [ -t timeout ] [ -f chat-file ] \
  * [ -r report-file ] \
  *             [...[[expect[-say[-expect...]] say expect[-say[-expect]] ...]]]
  *
@@ -274,6 +278,10 @@
            ++echo;
            break;
 
+       case 'E':
+           ++use_env;
+           break;
+
        case 'v':
            ++verbose;
            break;
@@ -454,8 +462,8 @@
 void usage()
 {
     fprintf(stderr, "\
-Usage: %s [-e] [-v] [-t timeout] [-r report-file] [-T phone-number]\n\
-     [-U phone-number2] {-f chat-file | chat-script}\n", program_name);
+Usage: %s [-e] [-E] [-v] [-V] [-t timeout] [-r report-file]\n\
+     [-T phone-number] [-U phone-number2] {-f chat-file | chat-script}\n", program_name);
     exit(1);
 }
 
@@ -654,10 +662,14 @@
 register char *s;
 int sending;  /* set to 1 when sending (putting) this string. */
 {
-    char temp[STR_LEN], cur_chr;
+    char temp[STR_LEN], env_str[STR_LEN], cur_chr;
     register char *s1, *phchar;
     int add_return = sending;
-#define isoctal(chr) (((chr) >= '0') && ((chr) <= '7'))
+#define isoctal(chr)   (((chr) >= '0') && ((chr) <= '7'))
+#define isalnumx(chr)  ((((chr) >= '0') && ((chr) <= '9')) \
+                        || (((chr) >= 'a') && ((chr) <= 'z')) \
+                        || (((chr) >= 'A') && ((chr) <= 'Z')) \
+                        || (chr) == '_')
 
     s1 = temp;
     while (*s) {
@@ -674,6 +686,18 @@
            }
            continue;
        }
+       
+       if (use_env && cur_chr == '$') {                /* ARI */
+           phchar = env_str;
+           while (isalnumx(*s))
+               *phchar++ = *s++;
+           *phchar = '\0';
+           phchar = getenv(env_str);
+           if (phchar)
+               while (*phchar)
+                   *s1++ = *phchar++;
+           continue;
+       }
 
        if (cur_chr != '\\') {
            *s1++ = cur_chr;
@@ -707,13 +731,12 @@
        case 'd':
            if (sending)
                *s1++ = '\\';
-
            *s1++ = cur_chr;
            break;
 
        case 'T':
            if (sending && phone_num) {
-               for ( phchar = phone_num; *phchar != '\0'; phchar++) 
+               for (phchar = phone_num; *phchar != '\0'; phchar++) 
                    *s1++ = *phchar;
            }
            else {
@@ -724,7 +747,7 @@
 
        case 'U':
            if (sending && phone_num2) {
-               for ( phchar = phone_num2; *phchar != '\0'; phchar++) 
+               for (phchar = phone_num2; *phchar != '\0'; phchar++) 
                    *s1++ = *phchar;
            }
            else {
@@ -762,6 +785,13 @@
                *s1++ = 'N';
            break;
            
+       case '$':                       /* ARI */
+           if (use_env) {
+               *s1++ = cur_chr;
+               break;
+           }
+           /* FALL THROUGH */
+
        default:
            if (isoctal (cur_chr)) {
                cur_chr &= 0x07;
@@ -974,7 +1004,7 @@
 
     if (say_next) {
        say_next = 0;
-       s = clean(s,0);
+       s = clean(s, 1);
        write(2, s, strlen(s));
         free(s);
        return;
@@ -1430,7 +1460,8 @@
 
        if (s >= end) {
            if (logged < s - minlen) {
-               logf("%0.*v", s - logged, logged);
+               if (verbose)
+                   logf("%0.*v", s - logged, logged);
                logged = s;
            }
            s -= minlen;
diff -r 222646aa1f29 -r 08e27ff08976 usr.sbin/pppd/pppd/auth.c
--- a/usr.sbin/pppd/pppd/auth.c Tue Jul 18 06:25:25 2000 +0000
+++ b/usr.sbin/pppd/pppd/auth.c Tue Jul 18 16:15:05 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: auth.c,v 1.25 1999/08/25 02:07:41 christos Exp $       */
+/*     $NetBSD: auth.c,v 1.25.8.1 2000/07/18 16:15:07 tron Exp $       */
 
 /*
  * auth.c - PPP authentication and phase control.
@@ -37,9 +37,9 @@
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
-#define RCSID  "Id: auth.c,v 1.57 1999/08/13 06:46:10 paulus Exp "
+#define RCSID  "Id: auth.c,v 1.60 1999/12/23 01:25:13 paulus Exp "
 #else
-__RCSID("$NetBSD: auth.c,v 1.25 1999/08/25 02:07:41 christos Exp $");
+__RCSID("$NetBSD: auth.c,v 1.25.8.1 2000/07/18 16:15:07 tron Exp $");
 #endif
 #endif
 
@@ -107,6 +107,10 @@
 /* List of addresses which the peer may use. */
 static struct permitted_ip *addresses[NUM_PPP];
 
+/* Wordlist giving addresses which the peer may use
+   without authenticating itself. */
+static struct wordlist *noauth_addrs;
+
 /* Extra options to apply, from the secrets file entry for the peer. */
 static struct wordlist *extra_options;
 
@@ -119,6 +123,26 @@
 /* Set if we got the contents of passwd[] from the pap-secrets file. */
 static int passwd_from_file;
 
+/* Set if we require authentication only because we have a default route. */
+static bool default_auth;
+
+/* Hook to enable a plugin to control the idle time limit */
+int (*idle_time_hook) __P((struct ppp_idle *)) = NULL;
+
+/* Hook for a plugin to say whether we can possibly authenticate any peer */
+int (*pap_check_hook) __P((void)) = NULL;
+
+/* Hook for a plugin to check the PAP user and password */
+int (*pap_auth_hook) __P((char *user, char *passwd, char **msgp,
+                         struct wordlist **paddrs,
+                         struct wordlist **popts)) = NULL;
+
+/* Hook for a plugin to know about the PAP user logout */
+void (*pap_logout_hook) __P((void)) = NULL;
+
+/* Hook for a plugin to get the PAP password for authenticating us */
+int (*pap_passwd_hook) __P((char *user, char *passwd)) = NULL;
+
 /*
  * This is used to ensure that we don't start an auth-up/down
  * script while one is already running.
@@ -158,7 +182,7 @@
 static void network_phase __P((int));
 static void check_idle __P((void *));
 static void connect_time_expired __P((void *));
-static int  plogin __P((char *, char *, char **, int *));
+static int  plogin __P((char *, char *, char **));
 static void plogout __P((void));
 static int  null_login __P((int));
 static int  get_pap_passwd __P((char *));
@@ -166,14 +190,16 @@
 static int  have_chap_secret __P((char *, char *, int, int *));
 static int  ip_addr_check __P((u_int32_t, struct permitted_ip *));
 static int  scan_authfile __P((FILE *, char *, char *, char *,
-                              struct wordlist **, char *));
+                              struct wordlist **, struct wordlist **,
+                              char *));
 static void free_wordlist __P((struct wordlist *));
 static void auth_script __P((char *));
 static void auth_script_done __P((void *));



Home | Main Index | Thread Index | Old Index