summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1999-11-13 16:18:40 +0000
committerbrian <brian@FreeBSD.org>1999-11-13 16:18:40 +0000
commitaa69617b79d139b2f6dd59ca158cc65893d3bfa7 (patch)
tree83b0a3be0a01abf5b8c4a5ad82bd90cc864cb548 /usr.sbin
parent8e0e122248d8d4b06066df9865158044e526d644 (diff)
downloadFreeBSD-src-aa69617b79d139b2f6dd59ca158cc65893d3bfa7.zip
FreeBSD-src-aa69617b79d139b2f6dd59ca158cc65893d3bfa7.tar.gz
Don't insist on 4 digit umasks in ``set server''.
Pointed out by: joerg
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ppp/command.c22
-rw-r--r--usr.sbin/ppp/ppp.85
-rw-r--r--usr.sbin/ppp/ppp.8.m45
3 files changed, 12 insertions, 20 deletions
diff --git a/usr.sbin/ppp/command.c b/usr.sbin/ppp/command.c
index b742a75..47a83e0 100644
--- a/usr.sbin/ppp/command.c
+++ b/usr.sbin/ppp/command.c
@@ -1179,9 +1179,6 @@ SetStoppedTimeout(struct cmdargs const *arg)
return -1;
}
-#define ismask(x) \
- (*x == '0' && strlen(x) == 4 && strspn(x+1, "0123456789.") == 3)
-
static int
SetServer(struct cmdargs const *arg)
{
@@ -1189,6 +1186,7 @@ SetServer(struct cmdargs const *arg)
if (arg->argc > arg->argn && arg->argc < arg->argn+4) {
const char *port, *passwd, *mask;
+ int mlen;
/* What's what ? */
port = arg->argv[arg->argn];
@@ -1198,8 +1196,13 @@ SetServer(struct cmdargs const *arg)
} else if (arg->argc == arg->argn + 3) {
passwd = arg->argv[arg->argn+1];
mask = arg->argv[arg->argn+2];
- if (!ismask(mask))
+ mlen = strlen(mask);
+ if (mlen == 0 || mlen > 4 || strspn(mask, "01234567") != mlen ||
+ (mlen == 4 && *mask != '0')) {
+ log_Printf(LogWARN, "%s %s: %s: Invalid mask\n",
+ arg->argv[arg->argn - 2], arg->argv[arg->argn - 1], mask);
return -1;
+ }
} else if (strcasecmp(port, "none") == 0) {
if (server_Close(arg->bundle))
log_Printf(LogPHASE, "Disabled server port.\n");
@@ -1214,15 +1217,10 @@ SetServer(struct cmdargs const *arg)
mode_t imask;
char *ptr, name[LINE_LEN + 12];
- if (mask != NULL) {
- unsigned m;
-
- if (sscanf(mask, "%o", &m) == 1)
- imask = m;
- else
- return -1;
- } else
+ if (mask == NULL)
imask = (mode_t)-1;
+ else for (imask = mlen = 0; mask[mlen]; mlen++)
+ imask = (imask * 8) + mask[mlen] - '0';
ptr = strstr(port, "%d");
if (ptr) {
diff --git a/usr.sbin/ppp/ppp.8 b/usr.sbin/ppp/ppp.8
index afd228b..7337192 100644
--- a/usr.sbin/ppp/ppp.8
+++ b/usr.sbin/ppp/ppp.8
@@ -4499,10 +4499,7 @@ If you wish to specify a local domain socket,
.Ar LocalName
must be specified as an absolute file name, otherwise it is assumed
to be the name or number of a TCP port. You must specify the octal umask
-that should be used with local domain sockets as a four character octal
-number beginning with
-.Sq 0 .
-Refer to
+to be used with a local domain socket. Refer to
.Xr umask 2
for umask details. Refer to
.Xr services 5
diff --git a/usr.sbin/ppp/ppp.8.m4 b/usr.sbin/ppp/ppp.8.m4
index afd228b..7337192 100644
--- a/usr.sbin/ppp/ppp.8.m4
+++ b/usr.sbin/ppp/ppp.8.m4
@@ -4499,10 +4499,7 @@ If you wish to specify a local domain socket,
.Ar LocalName
must be specified as an absolute file name, otherwise it is assumed
to be the name or number of a TCP port. You must specify the octal umask
-that should be used with local domain sockets as a four character octal
-number beginning with
-.Sq 0 .
-Refer to
+to be used with a local domain socket. Refer to
.Xr umask 2
for umask details. Refer to
.Xr services 5
OpenPOWER on IntegriCloud