summaryrefslogtreecommitdiff
path: root/servconf.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2011-06-23 08:20:30 +1000
committerDamien Miller <djm@mindrot.org>2011-06-23 08:20:30 +1000
commit82c558761d0fa42dc954d62812b9e4b4a94f64bd (patch)
treef3d5fcedeadd896c0251a6b81a49dc9faf3a68f4 /servconf.c
parent4ac99c366cc1c2afacabc1a8df560aaee5a07b98 (diff)
- 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"
Diffstat (limited to 'servconf.c')
-rw-r--r--servconf.c71
1 files changed, 34 insertions, 37 deletions
diff --git a/servconf.c b/servconf.c
index 909ad7d8f..03b974617 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: servconf.c,v 1.220 2011/06/17 21:47:35 djm Exp $ */ 1/* $OpenBSD: servconf.c,v 1.221 2011/06/22 21:47:28 djm Exp $ */
2/* 2/*
3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 3 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
4 * All rights reserved 4 * All rights reserved
@@ -1549,31 +1549,32 @@ parse_server_config(ServerOptions *options, const char *filename, Buffer *conf,
1549} 1549}
1550 1550
1551static const char * 1551static const char *
1552fmt_intarg(ServerOpCodes code, int val) 1552fmt_multistate_int(int val, const struct multistate *m)
1553{ 1553{
1554 if (code == sAddressFamily) { 1554 u_int i;
1555 switch (val) { 1555
1556 case AF_INET: 1556 for (i = 0; m[i].key != NULL; i++) {
1557 return "inet"; 1557 if (m[i].value == val)
1558 case AF_INET6: 1558 return m[i].key;
1559 return "inet6";
1560 case AF_UNSPEC:
1561 return "any";
1562 default:
1563 return "UNKNOWN";
1564 }
1565 }
1566 if (code == sPermitRootLogin) {
1567 switch (val) {
1568 case PERMIT_NO_PASSWD:
1569 return "without-password";
1570 case PERMIT_FORCED_ONLY:
1571 return "forced-commands-only";
1572 case PERMIT_YES:
1573 return "yes";
1574 }
1575 } 1559 }
1576 if (code == sProtocol) { 1560 return "UNKNOWN";
1561}
1562
1563static const char *
1564fmt_intarg(ServerOpCodes code, int val)
1565{
1566 if (val == -1)
1567 return "unset";
1568 switch (code) {
1569 case sAddressFamily:
1570 return fmt_multistate_int(val, multistate_addressfamily);
1571 case sPermitRootLogin:
1572 return fmt_multistate_int(val, multistate_permitrootlogin);
1573 case sGatewayPorts:
1574 return fmt_multistate_int(val, multistate_gatewayports);
1575 case sCompression:
1576 return fmt_multistate_int(val, multistate_compression);
1577 case sProtocol:
1577 switch (val) { 1578 switch (val) {
1578 case SSH_PROTO_1: 1579 case SSH_PROTO_1:
1579 return "1"; 1580 return "1";
@@ -1584,20 +1585,16 @@ fmt_intarg(ServerOpCodes code, int val)
1584 default: 1585 default:
1585 return "UNKNOWN"; 1586 return "UNKNOWN";
1586 } 1587 }
1588 default:
1589 switch (val) {
1590 case 0:
1591 return "no";
1592 case 1:
1593 return "yes";
1594 default:
1595 return "UNKNOWN";
1596 }
1587 } 1597 }
1588 if (code == sGatewayPorts && val == 2)
1589 return "clientspecified";
1590 if (code == sCompression && val == COMP_DELAYED)
1591 return "delayed";
1592 switch (val) {
1593 case -1:
1594 return "unset";
1595 case 0:
1596 return "no";
1597 case 1:
1598 return "yes";
1599 }
1600 return "UNKNOWN";
1601} 1598}
1602 1599
1603static const char * 1600static const char *