diff options
author | brian <brian@cvs.openbsd.org> | 2001-01-29 01:34:39 +0000 |
---|---|---|
committer | brian <brian@cvs.openbsd.org> | 2001-01-29 01:34:39 +0000 |
commit | 6902ad624715f1f472e517db8dcf5412185daa1c (patch) | |
tree | 4376febc5309c123cb760154ed117588b93dd495 /usr.sbin | |
parent | 79b7d58c9bed52df12100a5411d0cda568d06ac8 (diff) |
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.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/ppp/bundle.c | 13 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/command.c | 10 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/ppp.8 | 15 | ||||
-rw-r--r-- | usr.sbin/ppp/ppp/server.c | 9 |
4 files changed, 27 insertions, 20 deletions
diff --git a/usr.sbin/ppp/ppp/bundle.c b/usr.sbin/ppp/ppp/bundle.c index f38b695c4ae..0609bec9cff 100644 --- a/usr.sbin/ppp/ppp/bundle.c +++ b/usr.sbin/ppp/ppp/bundle.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: bundle.c,v 1.49 2001/01/26 01:41:03 brian Exp $ + * $OpenBSD: bundle.c,v 1.50 2001/01/29 01:34:38 brian Exp $ */ #include <sys/param.h> @@ -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 diff --git a/usr.sbin/ppp/ppp/command.c b/usr.sbin/ppp/ppp/command.c index 13353328967..41df51c19c8 100644 --- a/usr.sbin/ppp/ppp/command.c +++ b/usr.sbin/ppp/ppp/command.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $OpenBSD: command.c,v 1.55 2001/01/26 01:41:03 brian Exp $ + * $OpenBSD: command.c,v 1.56 2001/01/29 01:34:38 brian Exp $ * */ #include <sys/param.h> @@ -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; diff --git a/usr.sbin/ppp/ppp/ppp.8 b/usr.sbin/ppp/ppp/ppp.8 index bb0b14a797c..929784c8627 100644 --- a/usr.sbin/ppp/ppp/ppp.8 +++ b/usr.sbin/ppp/ppp/ppp.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ppp.8,v 1.106 2001/01/26 01:46:13 brian Exp $ +.\" $OpenBSD: ppp.8,v 1.107 2001/01/29 01:34:38 brian Exp $ .Dd 20 September 1995 .Dt PPP 8 .Os @@ -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. diff --git a/usr.sbin/ppp/ppp/server.c b/usr.sbin/ppp/ppp/server.c index 3e437e1ad80..d0e6801a483 100644 --- a/usr.sbin/ppp/ppp/server.c +++ b/usr.sbin/ppp/ppp/server.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $OpenBSD: server.c,v 1.9 2001/01/26 01:41:04 brian Exp $ + * $OpenBSD: server.c,v 1.10 2001/01/29 01:34:38 brian Exp $ */ #include <sys/param.h> @@ -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; |