summaryrefslogtreecommitdiff
path: root/usr.sbin/ppp
diff options
context:
space:
mode:
authorbrian <brian@cvs.openbsd.org>2000-08-09 19:31:26 +0000
committerbrian <brian@cvs.openbsd.org>2000-08-09 19:31:26 +0000
commitc2055611e1b893d127e227d04e4d33081ec2b0ee (patch)
tree9ca7f423730ae3c0ba218ae4cb854137de6ac803 /usr.sbin/ppp
parente4a26046c959aadce578f477fde142670cc0e65b (diff)
Allow leading ``!'' characters in authkeys and chat scripts to
be doubled up to mean a single literaly ``!''.
Diffstat (limited to 'usr.sbin/ppp')
-rw-r--r--usr.sbin/ppp/ppp/README.changes4
-rw-r--r--usr.sbin/ppp/ppp/chap.c9
-rw-r--r--usr.sbin/ppp/ppp/chat.c11
-rw-r--r--usr.sbin/ppp/ppp/ppp.814
4 files changed, 26 insertions, 12 deletions
diff --git a/usr.sbin/ppp/ppp/README.changes b/usr.sbin/ppp/ppp/README.changes
index 450c9573bd8..d30aa3a061b 100644
--- a/usr.sbin/ppp/ppp/README.changes
+++ b/usr.sbin/ppp/ppp/README.changes
@@ -1,4 +1,4 @@
-$OpenBSD: README.changes,v 1.16 2000/06/23 09:47:04 brian Exp $
+$OpenBSD: README.changes,v 1.17 2000/08/09 19:31:25 brian Exp $
This file summarises changes made to ppp that effect
its configuration.
@@ -102,3 +102,5 @@ o It is now only necessary to escape the `-' character in chat scripts twice.
See the example files for details.
o Environment variables and ~ are expanded on in commands
o ``nat pptp'' is no longer necessary as this is now done transparently
+o The ``!'' at the start of chat scripts and authkey can be made literal
+ (rather than meaning execute) by doubling it to ``!!''.
diff --git a/usr.sbin/ppp/ppp/chap.c b/usr.sbin/ppp/ppp/chap.c
index 29a6b3b16b1..54ce582f2e2 100644
--- a/usr.sbin/ppp/ppp/chap.c
+++ b/usr.sbin/ppp/ppp/chap.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $OpenBSD: chap.c,v 1.21 2000/07/19 11:06:31 brian Exp $
+ * $OpenBSD: chap.c,v 1.22 2000/08/09 19:31:25 brian Exp $
*
* TODO:
*/
@@ -682,12 +682,13 @@ chap_Input(struct bundle *bundle, struct link *l, struct mbuf *bp)
switch (chap->auth.in.hdr.code) {
case CHAP_CHALLENGE:
- if (*bundle->cfg.auth.key == '!')
+ if (*bundle->cfg.auth.key == '!' && bundle->cfg.auth.key[1] != '!')
chap_StartChild(chap, bundle->cfg.auth.key + 1,
bundle->cfg.auth.name);
else
- chap_Respond(chap, bundle->cfg.auth.name,
- bundle->cfg.auth.key, p->link.lcp.his_authtype
+ chap_Respond(chap, bundle->cfg.auth.name, bundle->cfg.auth.key +
+ (*bundle->cfg.auth.key == '!' ? 1 : 0),
+ p->link.lcp.his_authtype
#ifdef HAVE_DES
, lanman
#endif
diff --git a/usr.sbin/ppp/ppp/chat.c b/usr.sbin/ppp/ppp/chat.c
index be243407bca..20f6246505f 100644
--- a/usr.sbin/ppp/ppp/chat.c
+++ b/usr.sbin/ppp/ppp/chat.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $OpenBSD: chat.c,v 1.13 2000/02/27 01:38:25 brian Exp $
+ * $OpenBSD: chat.c,v 1.14 2000/08/09 19:31:25 brian Exp $
*/
#include <sys/param.h>
@@ -213,7 +213,8 @@ chat_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
* portion of that sequence.
*/
- needcr = c->state == CHAT_SEND && *c->argptr != '!';
+ needcr = c->state == CHAT_SEND &&
+ (*c->argptr != '!' || c->argptr[1] == '!');
/* We leave room for a potential HDLC header in the target string */
ExpandString(c, c->argptr, c->exp + 2, sizeof c->exp - 2, needcr);
@@ -254,8 +255,8 @@ chat_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
else if (c->nargptr == NULL && !strcmp(c->exp+2, "TIMEOUT"))
gottimeout = 1;
else {
- if (c->exp[2] == '!')
- ExecStr(c->physical, c->exp + 3, c->exp + 2, sizeof c->exp - 2);
+ if (c->exp[2] == '!' && c->exp[3] != '!')
+ ExecStr(c->physical, c->exp + 3, c->exp + 3, sizeof c->exp - 3);
if (c->exp[2] == '\0') {
/* Empty string, reparse (this may be better as a `goto start') */
@@ -279,7 +280,7 @@ chat_UpdateSet(struct fdescriptor *d, fd_set *r, fd_set *w, fd_set *e, int *n)
}
/* set c->argptr to point in the right place */
- c->argptr = c->exp + 2;
+ c->argptr = c->exp + (c->exp[2] == '!' ? 3 : 2);
c->arglen = strlen(c->argptr);
if (c->state == CHAT_EXPECT) {
diff --git a/usr.sbin/ppp/ppp/ppp.8 b/usr.sbin/ppp/ppp/ppp.8
index e0d2c73043a..2b4fc3e0feb 100644
--- a/usr.sbin/ppp/ppp/ppp.8
+++ b/usr.sbin/ppp/ppp/ppp.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ppp.8,v 1.90 2000/07/19 11:06:36 brian Exp $
+.\" $OpenBSD: ppp.8,v 1.91 2000/08/09 19:31:25 brian Exp $
.Dd 20 September 1995
.nr XX \w'\fC00'
.Dt PPP 8
@@ -3782,7 +3782,13 @@ and
.Dq authkey
values.
.Pp
-Ignoring the
+If the
+.Dq \&!
+is doubled up
+.Pq to Dq \&!! ,
+it is treated as a single literal
+.Dq \&! ,
+otherwise, ignoring the
.Dq \&! ,
.Ar value
is parsed as a program to execute in the same was as the
@@ -4289,6 +4295,10 @@ It is also possible to execute external commands from the chat script.
To do this, the first character of the expect or send string is an
exclamation mark
.Pq Dq \&! .
+If a literal exclaimation mark is required, double it up to
+.Dq \&!!
+and it will be treated as a single literal
+.Dq \&! .
When the command is executed, standard input and standard output are
directed to the open device (see the
.Dq set device