summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ssh/libssh/common/misc.c
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/common/misc.c
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/common/misc.c')
-rw-r--r--usr/src/cmd/ssh/libssh/common/misc.c25
1 files changed, 25 insertions, 0 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);
+}