1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Don't insist on 4 digit umasks in ``set server''.

Pointed out by: joerg
This commit is contained in:
Brian Somers 1999-11-13 16:18:40 +00:00
parent 9b1b0fc0e0
commit e6ee5b3933
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53125
3 changed files with 12 additions and 20 deletions

View File

@ -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) {

View File

@ -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

View File

@ -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