summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ssh/libssh
diff options
context:
space:
mode:
authorjp161948 <none@none>2007-08-29 07:20:42 -0700
committerjp161948 <none@none>2007-08-29 07:20:42 -0700
commite5e9deda1d23b18f1cb530f8945e11e334149fae (patch)
tree7001bca69353a0e148be8fec7a0982588a95324a /usr/src/cmd/ssh/libssh
parentf90d838348625e70e0b7dc47eefc467f8383d39b (diff)
downloadillumos-gate-e5e9deda1d23b18f1cb530f8945e11e334149fae.tar.gz
PSARC/2007/032 ssh disable banner
4972643 wants banner page to display but not when issuing commands
Diffstat (limited to 'usr/src/cmd/ssh/libssh')
-rw-r--r--usr/src/cmd/ssh/libssh/common/misc.c25
-rw-r--r--usr/src/cmd/ssh/libssh/common/readconf.c19
2 files changed, 43 insertions, 1 deletions
diff --git a/usr/src/cmd/ssh/libssh/common/misc.c b/usr/src/cmd/ssh/libssh/common/misc.c
index 1b7646f4dc..9fe8d8c1b8 100644
--- a/usr/src/cmd/ssh/libssh/common/misc.c
+++ b/usr/src/cmd/ssh/libssh/common/misc.c
@@ -420,3 +420,28 @@ mysignal(int sig, mysig_t act)
return (signal(sig, act));
#endif
}
+
+/*
+ * Return true if argument is one of "yes", "true", "no" or "false". If
+ * 'active' is 0 than we are in a non-matching Host section of the
+ * configuration file so we check the syntax but will not set the value of
+ * '*option'. Otherwise we set its value if not already set.
+ */
+int
+get_yes_no_flag(int *option, const char *arg, const char *filename, int linenum,
+ int active)
+{
+ int value = -1;
+
+ if (arg == NULL || *arg == '\0')
+ fatal("%.200s line %d: Missing argument.", filename, linenum);
+ if (strcmp(arg, "yes") == 0 || strcmp(arg, "true") == 0)
+ value = 1;
+ else if (strcmp(arg, "no") == 0 || strcmp(arg, "false") == 0)
+ value = 0;
+
+ if (active && *option == -1 && value != -1)
+ *option = value;
+
+ return (value != -1);
+}
diff --git a/usr/src/cmd/ssh/libssh/common/readconf.c b/usr/src/cmd/ssh/libssh/common/readconf.c
index b3459f2e1f..09afd7cca9 100644
--- a/usr/src/cmd/ssh/libssh/common/readconf.c
+++ b/usr/src/cmd/ssh/libssh/common/readconf.c
@@ -128,7 +128,7 @@ typedef enum {
oHostKeyAlgorithms, oBindAddress, oSmartcardDevice,
oClearAllForwardings, oNoHostAuthenticationForLocalhost,
oFallBackToRsh, oUseRsh, oConnectTimeout,
- oServerAliveInterval, oServerAliveCountMax,
+ oServerAliveInterval, oServerAliveCountMax, oDisableBanner,
oDeprecated
} OpCodes;
@@ -218,6 +218,7 @@ static struct {
{ "connecttimeout", oConnectTimeout },
{ "serveraliveinterval", oServerAliveInterval },
{ "serveralivecountmax", oServerAliveCountMax },
+ { "disablebanner", oDisableBanner },
{ NULL, oBadOption }
};
@@ -756,6 +757,19 @@ parse_int:
intptr = &options->server_alive_count_max;
goto parse_int;
+ case oDisableBanner:
+ arg = strdelim(&s);
+ if (get_yes_no_flag(&options->disable_banner, arg, filename,
+ linenum, *activep) == 1)
+ break;
+
+ if (strcmp(arg, "in-exec-mode") == 0)
+ options->disable_banner = SSH_NO_BANNER_IN_EXEC_MODE;
+ else
+ fatal("%.200s line %d: Bad yes/no/in-exec-mode "
+ "argument.", filename, linenum);
+ break;
+
case oDeprecated:
debug("%s line %d: Deprecated option \"%s\"",
filename, linenum, keyword);
@@ -895,6 +909,7 @@ initialize_options(Options * options)
options->use_rsh = -1;
options->server_alive_interval = -1;
options->server_alive_count_max = -1;
+ options->disable_banner = -1;
}
/*
@@ -1035,6 +1050,8 @@ fill_default_options(Options * options)
options->server_alive_interval = 0;
if (options->server_alive_count_max == -1)
options->server_alive_count_max = 3;
+ if (options->disable_banner == -1)
+ options->disable_banner = 0;
/* options->proxy_command should not be set by default */
/* options->user will be set in the main program if appropriate */
/* options->hostname will be set in the main program if appropriate */