author | Huie-Ying Lee <huieying.lee@oracle.com> |
Fri, 30 May 2014 10:34:34 -0700 | |
changeset 1924 | 72ec8810274b |
child 4503 | bf30d46ab06e |
permissions | -rw-r--r-- |
1924
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
1 |
# |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
2 |
# This patch is to add a new DisableBanner option to the ssh client command, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
3 |
# which allows the ssh command to disable the display of the banner message. |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
4 |
# We have contributed back this feature to the OpenSSH upstream community. For |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
5 |
# more information, see https://bugzilla.mindrot.org/show_bug.cgi?id=2242. |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
6 |
# In the future, if this feature is accepted by the upsteam in a later release, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
7 |
# we will remove this patch when we upgrade to that release. |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
8 |
# |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
9 |
--- orig/readconf.c Wed May 21 15:04:21 2014 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
10 |
+++ new/readconf.c Wed May 28 11:56:04 2014 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
11 |
@@ -148,7 +148,11 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
12 |
oKexAlgorithms, oIPQoS, oRequestTTY, oIgnoreUnknown, oProxyUseFdpass, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
13 |
oCanonicalDomains, oCanonicalizeHostname, oCanonicalizeMaxDots, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
14 |
oCanonicalizeFallbackLocal, oCanonicalizePermittedCNAMEs, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
15 |
+#ifdef DISABLE_BANNER |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
16 |
+ oDisableBanner, oIgnoredUnknownOption, oDeprecated, oUnsupported |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
17 |
+#else |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
18 |
oIgnoredUnknownOption, oDeprecated, oUnsupported |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
19 |
+#endif |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
20 |
} OpCodes; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
21 |
|
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
22 |
/* Textual representations of the tokens. */ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
23 |
@@ -266,6 +270,9 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
24 |
{ "canonicalizehostname", oCanonicalizeHostname }, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
25 |
{ "canonicalizemaxdots", oCanonicalizeMaxDots }, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
26 |
{ "canonicalizepermittedcnames", oCanonicalizePermittedCNAMEs }, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
27 |
+#ifdef DISABLE_BANNER |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
28 |
+ { "disablebanner", oDisableBanner }, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
29 |
+#endif |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
30 |
{ "ignoreunknown", oIgnoreUnknown }, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
31 |
|
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
32 |
{ NULL, oBadOption } |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
33 |
@@ -682,6 +689,17 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
34 |
{ NULL, -1 } |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
35 |
}; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
36 |
|
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
37 |
+#ifdef DISABLE_BANNER |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
38 |
+static const struct multistate multistate_disablebanner[] = { |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
39 |
+ { "true", SSH_DISABLEBANNER_YES }, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
40 |
+ { "false", SSH_DISABLEBANNER_NO }, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
41 |
+ { "yes", SSH_DISABLEBANNER_YES }, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
42 |
+ { "no", SSH_DISABLEBANNER_NO }, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
43 |
+ { "in-exec-mode", SSH_DISABLEBANNER_INEXECMODE }, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
44 |
+ { NULL, -1 } |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
45 |
+}; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
46 |
+#endif |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
47 |
+ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
48 |
/* |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
49 |
* Processes a single option line as used in the configuration files. This |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
50 |
* only sets those values that have not already been set. |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
51 |
@@ -1392,6 +1410,13 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
52 |
intptr = &options->canonicalize_fallback_local; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
53 |
goto parse_flag; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
54 |
|
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
55 |
+#ifdef DISABLE_BANNER |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
56 |
+ case oDisableBanner: |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
57 |
+ intptr = &options->disable_banner; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
58 |
+ multistate_ptr = multistate_disablebanner; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
59 |
+ goto parse_multistate; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
60 |
+#endif |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
61 |
+ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
62 |
case oDeprecated: |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
63 |
debug("%s line %d: Deprecated option \"%s\"", |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
64 |
filename, linenum, keyword); |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
65 |
@@ -1554,6 +1579,9 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
66 |
options->ip_qos_bulk = -1; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
67 |
options->request_tty = -1; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
68 |
options->proxy_use_fdpass = -1; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
69 |
+#ifdef DISABLE_BANNER |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
70 |
+ options->disable_banner = -1; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
71 |
+#endif |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
72 |
options->ignored_unknown = NULL; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
73 |
options->num_canonical_domains = 0; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
74 |
options->num_permitted_cnames = 0; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
75 |
@@ -1721,6 +1749,12 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
76 |
options->canonicalize_fallback_local = 1; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
77 |
if (options->canonicalize_hostname == -1) |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
78 |
options->canonicalize_hostname = SSH_CANONICALISE_NO; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
79 |
+ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
80 |
+#ifdef DISABLE_BANNER |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
81 |
+ if (options->disable_banner == -1) |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
82 |
+ options->disable_banner = 0; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
83 |
+#endif |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
84 |
+ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
85 |
#define CLEAR_ON_NONE(v) \ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
86 |
do { \ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
87 |
if (v != NULL && strcasecmp(v, "none") == 0) { \ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
88 |
--- orig/readconf.h Wed May 21 15:04:35 2014 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
89 |
+++ new/readconf.h Wed May 28 11:08:53 2014 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
90 |
@@ -155,6 +155,9 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
91 |
struct allowed_cname permitted_cnames[MAX_CANON_DOMAINS]; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
92 |
|
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
93 |
char *ignored_unknown; /* Pattern list of unknown tokens to ignore */ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
94 |
+#ifdef DISABLE_BANNER |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
95 |
+ int disable_banner; /* Disable display of banner */ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
96 |
+#endif |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
97 |
} Options; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
98 |
|
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
99 |
#define SSH_CANONICALISE_NO 0 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
100 |
@@ -175,6 +178,12 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
101 |
#define SSHCONF_CHECKPERM 1 /* check permissions on config file */ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
102 |
#define SSHCONF_USERCONF 2 /* user provided config file not system */ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
103 |
|
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
104 |
+#ifdef DISABLE_BANNER |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
105 |
+#define SSH_DISABLEBANNER_NO 0 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
106 |
+#define SSH_DISABLEBANNER_YES 1 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
107 |
+#define SSH_DISABLEBANNER_INEXECMODE 2 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
108 |
+#endif |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
109 |
+ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
110 |
void initialize_options(Options *); |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
111 |
void fill_default_options(Options *); |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
112 |
int process_config_line(Options *, struct passwd *, const char *, char *, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
113 |
--- orig/ssh_config.5 Thu May 22 15:05:04 2014 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
114 |
+++ new/ssh_config.5 Fri May 23 09:36:52 2014 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
115 |
@@ -507,6 +507,14 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
116 |
then the backgrounded master connection will automatically terminate |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
117 |
after it has remained idle (with no client connections) for the |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
118 |
specified time. |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
119 |
+.It Cm DisableBanner |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
120 |
+If set to yes, disables the display of the banner message. |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
121 |
+If set to in-exec-mode, disables the display of banner message when in remote |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
122 |
+command mode only. |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
123 |
+.Pp |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
124 |
+The default value is no, which means that the banner is displayed unless the |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
125 |
+log level is QUIET, FATAL, or ERROR. See also the Banner option in |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
126 |
+.Xr sshd_config 4 . This option applies to protocol version 2 only. |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
127 |
.It Cm DynamicForward |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
128 |
Specifies that a TCP port on the local machine be forwarded |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
129 |
over the secure channel, and the application |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
130 |
--- orig/sshconnect2.c Wed May 21 15:05:27 2014 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
131 |
+++ new/sshconnect2.c Thu May 29 17:33:56 2014 |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
132 |
@@ -82,6 +82,10 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
133 |
extern char *server_version_string; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
134 |
extern Options options; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
135 |
|
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
136 |
+#ifdef DISABLE_BANNER |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
137 |
+extern Buffer command; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
138 |
+#endif |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
139 |
+ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
140 |
/* |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
141 |
* SSH2 key exchange |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
142 |
*/ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
143 |
@@ -480,7 +484,20 @@ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
144 |
debug3("input_userauth_banner"); |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
145 |
raw = packet_get_string(&len); |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
146 |
lang = packet_get_string(NULL); |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
147 |
+ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
148 |
+#ifdef DISABLE_BANNER |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
149 |
+ /* |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
150 |
+ * Banner is a warning message according to RFC 4252. So, never print |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
151 |
+ * a banner in error log level or lower. If the log level is higher, |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
152 |
+ * use DisableBanner option to decide whether to display it or not. |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
153 |
+ */ |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
154 |
+ if (len > 0 && options.log_level >= SYSLOG_LEVEL_INFO && |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
155 |
+ (options.disable_banner == SSH_DISABLEBANNER_NO || |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
156 |
+ (options.disable_banner == SSH_DISABLEBANNER_INEXECMODE && |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
157 |
+ buffer_len(&command) == 0))) { |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
158 |
+#else |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
159 |
if (len > 0 && options.log_level >= SYSLOG_LEVEL_INFO) { |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
160 |
+#endif |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
161 |
if (len > 65536) |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
162 |
len = 65536; |
72ec8810274b
18828925 migrate the disablebanner feature from SunSSH to OpenSSH
Huie-Ying Lee <huieying.lee@oracle.com>
parents:
diff
changeset
|
163 |
msg = xmalloc(len * 4 + 1); /* max expansion from strnvis() */ |