summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/chat.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2000-08-09 19:29:50 +0000
committerbrian <brian@FreeBSD.org>2000-08-09 19:29:50 +0000
commitf56c93c8c26715a676dc67f9de50f2aed9441f3a (patch)
treeaafb91e9fe107daafbcb9d0d07c535eefbf25fae /usr.sbin/ppp/chat.c
parentea1ade141f03ffcf98616cd8d8ac9715815d5141 (diff)
downloadFreeBSD-src-f56c93c8c26715a676dc67f9de50f2aed9441f3a.zip
FreeBSD-src-f56c93c8c26715a676dc67f9de50f2aed9441f3a.tar.gz
Allow leading ``!'' characters in authkeys and chat scripts to
be doubled up to mean a single literaly ``!''.
Diffstat (limited to 'usr.sbin/ppp/chat.c')
-rw-r--r--usr.sbin/ppp/chat.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.sbin/ppp/chat.c b/usr.sbin/ppp/chat.c
index 2f19db2..2264df8 100644
--- a/usr.sbin/ppp/chat.c
+++ b/usr.sbin/ppp/chat.c
@@ -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) {
OpenPOWER on IntegriCloud