Only remove socket files with ``set server open''.
Only show the mask in ``show bundle'' when it's been specified. Complain about unexpected arguments after ``set server {none,open,closed}'' Log re-open failures as warnings rather than phase messages. Fix some markup for the ``set server'' man page description.
This commit is contained in:
parent
4834b77d04
commit
37b8a5c7bd
@ -1183,11 +1183,12 @@ bundle_ShowStatus(struct cmdargs const *arg)
|
||||
prompt_Printf(arg->prompt, " Auth name: %s\n",
|
||||
arg->bundle->cfg.auth.name);
|
||||
prompt_Printf(arg->prompt, " Diagnostic socket: ");
|
||||
if (*server.cfg.sockname != '\0')
|
||||
prompt_Printf(arg->prompt, "%s, mask 0%03o%s\n",
|
||||
server.cfg.sockname, (int)server.cfg.mask,
|
||||
server.fd == -1 ? " (not open)" : "");
|
||||
else if (server.cfg.port != 0)
|
||||
if (*server.cfg.sockname != '\0') {
|
||||
prompt_Printf(arg->prompt, "%s", server.cfg.sockname);
|
||||
if (server.cfg.mask != (mode_t)-1)
|
||||
prompt_Printf(arg->prompt, ", mask 0%03o", (int)server.cfg.mask);
|
||||
prompt_Printf(arg->prompt, "%s\n", server.fd == -1 ? " (not open)" : "");
|
||||
} else if (server.cfg.port != 0)
|
||||
prompt_Printf(arg->prompt, "TCP port %d%s\n", server.cfg.port,
|
||||
server.fd == -1 ? " (not open)" : "");
|
||||
else
|
||||
|
@ -1286,7 +1286,9 @@ SetServer(struct cmdargs const *arg)
|
||||
arg->argv[arg->argn - 2], arg->argv[arg->argn - 1], mask);
|
||||
return -1;
|
||||
}
|
||||
} else if (strcasecmp(port, "none") == 0) {
|
||||
} else if (arg->argc != arg->argn + 1)
|
||||
return -1;
|
||||
else if (strcasecmp(port, "none") == 0) {
|
||||
if (server_Clear(arg->bundle))
|
||||
log_Printf(LogPHASE, "Disabled server socket\n");
|
||||
return 0;
|
||||
@ -1295,10 +1297,10 @@ SetServer(struct cmdargs const *arg)
|
||||
case SERVER_OK:
|
||||
return 0;
|
||||
case SERVER_FAILED:
|
||||
log_Printf(LogPHASE, "Failed to reopen server port\n");
|
||||
log_Printf(LogWARN, "Failed to reopen server port\n");
|
||||
return 1;
|
||||
case SERVER_UNSET:
|
||||
log_Printf(LogPHASE, "Cannot reopen unset server socket\n");
|
||||
log_Printf(LogWARN, "Cannot reopen unset server socket\n");
|
||||
return 1;
|
||||
default:
|
||||
break;
|
||||
|
@ -5148,7 +5148,10 @@ The optimum value is just over twice the MTU value.
|
||||
If
|
||||
.Ar value
|
||||
is unspecified or zero, the default kernel controlled value is used.
|
||||
.It "set server|socket" Ar TcpPort|LocalName|none|open|closed Op password Op Ar mask
|
||||
.It "set server|socket" Ar TcpPort Ns No \&| Ns Xo
|
||||
.Ar LocalName Ns No |none|open|closed
|
||||
.Op password Op Ar mask
|
||||
.Xc
|
||||
This command tells
|
||||
.Nm
|
||||
to listen on the given socket or
|
||||
@ -5156,17 +5159,17 @@ to listen on the given socket or
|
||||
for incoming command connections.
|
||||
.Pp
|
||||
The word
|
||||
.Ar none
|
||||
.Dq none
|
||||
instructs
|
||||
.Nm
|
||||
to close any existing socket and clear the socket configuration.
|
||||
The word
|
||||
.Ar open
|
||||
.Dq open
|
||||
instructs
|
||||
.Nm
|
||||
to attempt to re-open the port.
|
||||
The word
|
||||
.Ar closed
|
||||
.Dq closed
|
||||
instructs
|
||||
.Nm
|
||||
to close the open port.
|
||||
@ -5175,7 +5178,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 to be used with a local domain socket.
|
||||
You may specify the octal umask to be used with a local domain socket.
|
||||
Refer to
|
||||
.Xr umask 2
|
||||
for umask details.
|
||||
|
@ -5148,7 +5148,10 @@ The optimum value is just over twice the MTU value.
|
||||
If
|
||||
.Ar value
|
||||
is unspecified or zero, the default kernel controlled value is used.
|
||||
.It "set server|socket" Ar TcpPort|LocalName|none|open|closed Op password Op Ar mask
|
||||
.It "set server|socket" Ar TcpPort Ns No \&| Ns Xo
|
||||
.Ar LocalName Ns No |none|open|closed
|
||||
.Op password Op Ar mask
|
||||
.Xc
|
||||
This command tells
|
||||
.Nm
|
||||
to listen on the given socket or
|
||||
@ -5156,17 +5159,17 @@ to listen on the given socket or
|
||||
for incoming command connections.
|
||||
.Pp
|
||||
The word
|
||||
.Ar none
|
||||
.Dq none
|
||||
instructs
|
||||
.Nm
|
||||
to close any existing socket and clear the socket configuration.
|
||||
The word
|
||||
.Ar open
|
||||
.Dq open
|
||||
instructs
|
||||
.Nm
|
||||
to attempt to re-open the port.
|
||||
The word
|
||||
.Ar closed
|
||||
.Dq closed
|
||||
instructs
|
||||
.Nm
|
||||
to close the open port.
|
||||
@ -5175,7 +5178,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 to be used with a local domain socket.
|
||||
You may specify the octal umask to be used with a local domain socket.
|
||||
Refer to
|
||||
.Xr umask 2
|
||||
for umask details.
|
||||
|
@ -185,6 +185,7 @@ enum server_stat
|
||||
server_Reopen(struct bundle *bundle)
|
||||
{
|
||||
char name[sizeof server.cfg.sockname];
|
||||
struct stat st;
|
||||
u_short port;
|
||||
mode_t mask;
|
||||
enum server_stat ret;
|
||||
@ -193,9 +194,9 @@ server_Reopen(struct bundle *bundle)
|
||||
strcpy(name, server.cfg.sockname);
|
||||
mask = server.cfg.mask;
|
||||
server_Close(bundle);
|
||||
if (server.cfg.sockname[0] != '\0')
|
||||
/* blow it away - and hope nobody else is using it */
|
||||
unlink(server.cfg.sockname);
|
||||
if (server.cfg.sockname[0] != '\0' && stat(server.cfg.sockname, &st) == 0)
|
||||
if (!(st.st_mode & S_IFSOCK) || unlink(server.cfg.sockname) != 0)
|
||||
return SERVER_FAILED;
|
||||
ret = server_LocalOpen(bundle, name, mask);
|
||||
} else if (server.cfg.port != 0) {
|
||||
port = server.cfg.port;
|
||||
|
Loading…
Reference in New Issue
Block a user