mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-31 01:35:11 +02:00
- OpenBSD CVS Sync
- djm@cvs.openbsd.org 2011/06/22 21:47:28 [servconf.c] reuse the multistate option arrays to pretty-print options for "sshd -T"
This commit is contained in:
parent
4ac99c366c
commit
82c558761d
@ -1,3 +1,9 @@
|
|||||||
|
20110623
|
||||||
|
- OpenBSD CVS Sync
|
||||||
|
- djm@cvs.openbsd.org 2011/06/22 21:47:28
|
||||||
|
[servconf.c]
|
||||||
|
reuse the multistate option arrays to pretty-print options for "sshd -T"
|
||||||
|
|
||||||
20110620
|
20110620
|
||||||
- OpenBSD CVS Sync
|
- OpenBSD CVS Sync
|
||||||
- djm@cvs.openbsd.org 2011/06/04 00:10:26
|
- djm@cvs.openbsd.org 2011/06/04 00:10:26
|
||||||
|
61
servconf.c
61
servconf.c
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: servconf.c,v 1.220 2011/06/17 21:47:35 djm Exp $ */
|
/* $OpenBSD: servconf.c,v 1.221 2011/06/22 21:47:28 djm Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
|
||||||
* All rights reserved
|
* All rights reserved
|
||||||
@ -1548,32 +1548,33 @@ parse_server_config(ServerOptions *options, const char *filename, Buffer *conf,
|
|||||||
filename, bad_options);
|
filename, bad_options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
fmt_multistate_int(int val, const struct multistate *m)
|
||||||
|
{
|
||||||
|
u_int i;
|
||||||
|
|
||||||
|
for (i = 0; m[i].key != NULL; i++) {
|
||||||
|
if (m[i].value == val)
|
||||||
|
return m[i].key;
|
||||||
|
}
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
fmt_intarg(ServerOpCodes code, int val)
|
fmt_intarg(ServerOpCodes code, int val)
|
||||||
{
|
{
|
||||||
if (code == sAddressFamily) {
|
if (val == -1)
|
||||||
switch (val) {
|
return "unset";
|
||||||
case AF_INET:
|
switch (code) {
|
||||||
return "inet";
|
case sAddressFamily:
|
||||||
case AF_INET6:
|
return fmt_multistate_int(val, multistate_addressfamily);
|
||||||
return "inet6";
|
case sPermitRootLogin:
|
||||||
case AF_UNSPEC:
|
return fmt_multistate_int(val, multistate_permitrootlogin);
|
||||||
return "any";
|
case sGatewayPorts:
|
||||||
default:
|
return fmt_multistate_int(val, multistate_gatewayports);
|
||||||
return "UNKNOWN";
|
case sCompression:
|
||||||
}
|
return fmt_multistate_int(val, multistate_compression);
|
||||||
}
|
case sProtocol:
|
||||||
if (code == sPermitRootLogin) {
|
|
||||||
switch (val) {
|
|
||||||
case PERMIT_NO_PASSWD:
|
|
||||||
return "without-password";
|
|
||||||
case PERMIT_FORCED_ONLY:
|
|
||||||
return "forced-commands-only";
|
|
||||||
case PERMIT_YES:
|
|
||||||
return "yes";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (code == sProtocol) {
|
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case SSH_PROTO_1:
|
case SSH_PROTO_1:
|
||||||
return "1";
|
return "1";
|
||||||
@ -1584,20 +1585,16 @@ fmt_intarg(ServerOpCodes code, int val)
|
|||||||
default:
|
default:
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
}
|
}
|
||||||
}
|
default:
|
||||||
if (code == sGatewayPorts && val == 2)
|
|
||||||
return "clientspecified";
|
|
||||||
if (code == sCompression && val == COMP_DELAYED)
|
|
||||||
return "delayed";
|
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case -1:
|
|
||||||
return "unset";
|
|
||||||
case 0:
|
case 0:
|
||||||
return "no";
|
return "no";
|
||||||
case 1:
|
case 1:
|
||||||
return "yes";
|
return "yes";
|
||||||
}
|
default:
|
||||||
return "UNKNOWN";
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user