9fe1afc
diff -up openssh-6.1p1/configure.ac.vendor openssh-6.1p1/configure.ac
9fe1afc
--- openssh-6.1p1/configure.ac.vendor	2012-09-14 20:36:49.153085211 +0200
9fe1afc
+++ openssh-6.1p1/configure.ac	2012-09-14 20:36:49.559088133 +0200
9fe1afc
@@ -4303,6 +4303,12 @@ AC_ARG_WITH([lastlog],
Jan F. Chadima 69dd72f
 		fi
Jan F. Chadima 69dd72f
 	]
Jan F. Chadima 69dd72f
 )
Jan F. Chadima 69dd72f
+AC_ARG_ENABLE(vendor-patchlevel,
Jan F. Chadima 69dd72f
+  [  --enable-vendor-patchlevel=TAG  specify a vendor patch level],
Jan F. Chadima 69dd72f
+  [AC_DEFINE_UNQUOTED(SSH_VENDOR_PATCHLEVEL,[SSH_RELEASE "-" "$enableval"],[Define to your vendor patch level, if it has been modified from the upstream source release.])
Jan F. Chadima 69dd72f
+   SSH_VENDOR_PATCHLEVEL="$enableval"],
Jan F. Chadima 69dd72f
+  [AC_DEFINE(SSH_VENDOR_PATCHLEVEL,SSH_RELEASE,[Define to your vendor patch level, if it has been modified from the upstream source release.])
Jan F. Chadima 69dd72f
+   SSH_VENDOR_PATCHLEVEL=none])
Jan F. Chadima 69dd72f
 
Jan F. Chadima 69dd72f
 dnl lastlog, [uw]tmpx? detection
Jan F. Chadima 69dd72f
 dnl  NOTE: set the paths in the platform section to avoid the
9fe1afc
@@ -4529,6 +4535,7 @@ echo "           Translate v4 in v6 hack
Jan F. Chadima 69dd72f
 echo "                  BSD Auth support: $BSD_AUTH_MSG"
Jan F. Chadima 69dd72f
 echo "              Random number source: $RAND_MSG"
Jan F. Chadima 69dd72f
 echo "             Privsep sandbox style: $SANDBOX_STYLE"
Jan F. Chadima 69dd72f
+echo "                Vendor patch level: $SSH_VENDOR_PATCHLEVEL"
Jan F. Chadima 69dd72f
 
Jan F. Chadima 69dd72f
 echo ""
Jan F. Chadima 69dd72f
 
9fe1afc
diff -up openssh-6.1p1/servconf.c.vendor openssh-6.1p1/servconf.c
9fe1afc
--- openssh-6.1p1/servconf.c.vendor	2012-09-14 20:36:49.124085002 +0200
9fe1afc
+++ openssh-6.1p1/servconf.c	2012-09-14 20:50:34.995972516 +0200
9fe1afc
@@ -128,6 +128,7 @@ initialize_server_options(ServerOptions
Jan F. Chadima 69dd72f
 	options->max_authtries = -1;
Jan F. Chadima 69dd72f
 	options->max_sessions = -1;
Jan F. Chadima 69dd72f
 	options->banner = NULL;
Jan F. Chadima 69dd72f
+	options->show_patchlevel = -1;
Jan F. Chadima 69dd72f
 	options->use_dns = -1;
Jan F. Chadima 69dd72f
 	options->client_alive_interval = -1;
Jan F. Chadima 69dd72f
 	options->client_alive_count_max = -1;
9fe1afc
@@ -289,6 +290,9 @@ fill_default_server_options(ServerOption
Jan F. Chadima 69dd72f
 		options->ip_qos_bulk = IPTOS_THROUGHPUT;
9fe1afc
 	if (options->version_addendum == NULL)
9fe1afc
 		options->version_addendum = xstrdup("");
Jan F. Chadima 69dd72f
+	if (options->show_patchlevel == -1)
9fe1afc
+		options->show_patchlevel = 0;
9fe1afc
+
Jan F. Chadima 69dd72f
 	/* Turn privilege separation on by default */
Jan F. Chadima 69dd72f
 	if (use_privsep == -1)
9fe1afc
 		use_privsep = PRIVSEP_NOSANDBOX;
9fe1afc
@@ -326,7 +330,7 @@ typedef enum {
Jan F. Chadima 69dd72f
 	sIgnoreUserKnownHosts, sCiphers, sMacs, sProtocol, sPidFile,
Jan F. Chadima 69dd72f
 	sGatewayPorts, sPubkeyAuthentication, sXAuthLocation, sSubsystem,
Jan F. Chadima 69dd72f
 	sMaxStartups, sMaxAuthTries, sMaxSessions,
Jan F. Chadima 69dd72f
-	sBanner, sUseDNS, sHostbasedAuthentication,
Jan F. Chadima 69dd72f
+	sBanner, sShowPatchLevel, sUseDNS, sHostbasedAuthentication,
d9e6186
 	sHostbasedUsesNameFromPacketOnly, sClientAliveInterval,
d9e6186
 	sClientAliveCountMax, sAuthorizedKeysFile,
d9e6186
 	sGssAuthentication, sGssCleanupCreds, sAcceptEnv, sPermitTunnel,
9fe1afc
@@ -441,6 +445,7 @@ static struct {
Jan F. Chadima 69dd72f
 	{ "maxauthtries", sMaxAuthTries, SSHCFG_ALL },
Jan F. Chadima 69dd72f
 	{ "maxsessions", sMaxSessions, SSHCFG_ALL },
Jan F. Chadima 69dd72f
 	{ "banner", sBanner, SSHCFG_ALL },
Jan F. Chadima 69dd72f
+	{ "showpatchlevel", sShowPatchLevel, SSHCFG_GLOBAL },
Jan F. Chadima 69dd72f
 	{ "usedns", sUseDNS, SSHCFG_GLOBAL },
Jan F. Chadima 69dd72f
 	{ "verifyreversemapping", sDeprecated, SSHCFG_GLOBAL },
Jan F. Chadima 69dd72f
 	{ "reversemappingcheck", sDeprecated, SSHCFG_GLOBAL },
9fe1afc
@@ -1162,6 +1167,10 @@ process_server_config_line(ServerOptions
Jan F. Chadima 69dd72f
 		multistate_ptr = multistate_privsep;
Jan F. Chadima 69dd72f
 		goto parse_multistate;
Jan F. Chadima 69dd72f
 
Jan F. Chadima 69dd72f
+	case sShowPatchLevel:
Jan F. Chadima 69dd72f
+		intptr = &options->show_patchlevel;
Jan F. Chadima 69dd72f
+		goto parse_flag;
Jan F. Chadima 69dd72f
+
Jan F. Chadima 69dd72f
 	case sAllowUsers:
Jan F. Chadima 69dd72f
 		while ((arg = strdelim(&cp)) && *arg != '\0') {
Jan F. Chadima 69dd72f
 			if (options->num_allow_users >= MAX_ALLOW_USERS)
9fe1afc
@@ -1956,6 +1965,7 @@ dump_config(ServerOptions *o)
Jan F. Chadima 69dd72f
 	dump_cfg_fmtint(sUseLogin, o->use_login);
Jan F. Chadima 69dd72f
 	dump_cfg_fmtint(sCompression, o->compression);
Jan F. Chadima 69dd72f
 	dump_cfg_fmtint(sGatewayPorts, o->gateway_ports);
Jan F. Chadima 69dd72f
+	dump_cfg_fmtint(sShowPatchLevel, o->show_patchlevel);
Jan F. Chadima 69dd72f
 	dump_cfg_fmtint(sUseDNS, o->use_dns);
Jan F. Chadima 69dd72f
 	dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding);
Jan F. Chadima 69dd72f
 	dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
9fe1afc
diff -up openssh-6.1p1/servconf.h.vendor openssh-6.1p1/servconf.h
9fe1afc
--- openssh-6.1p1/servconf.h.vendor	2012-09-14 20:36:49.125085009 +0200
9fe1afc
+++ openssh-6.1p1/servconf.h	2012-09-14 20:36:49.564088168 +0200
d9e6186
@@ -140,6 +140,7 @@ typedef struct {
Jan F. Chadima 69dd72f
 	int	max_authtries;
Jan F. Chadima 69dd72f
 	int	max_sessions;
Jan F. Chadima 69dd72f
 	char   *banner;			/* SSH-2 banner message */
Jan F. Chadima 69dd72f
+	int	show_patchlevel;	/* Show vendor patch level to clients */
Jan F. Chadima 69dd72f
 	int	use_dns;
Jan F. Chadima 69dd72f
 	int	client_alive_interval;	/*
Jan F. Chadima 69dd72f
 					 * poke the client this often to
9fe1afc
diff -up openssh-6.1p1/sshd_config.vendor openssh-6.1p1/sshd_config
9fe1afc
--- openssh-6.1p1/sshd_config.vendor	2012-09-14 20:36:49.507087759 +0200
9fe1afc
+++ openssh-6.1p1/sshd_config	2012-09-14 20:36:49.565088175 +0200
9fe1afc
@@ -114,6 +114,7 @@ UsePrivilegeSeparation sandbox		# Defaul
d9e6186
 #Compression delayed
d9e6186
 #ClientAliveInterval 0
d9e6186
 #ClientAliveCountMax 3
d9e6186
+#ShowPatchLevel no
d9e6186
 #UseDNS yes
d9e6186
 #PidFile /var/run/sshd.pid
d9e6186
 #MaxStartups 10
9fe1afc
diff -up openssh-6.1p1/sshd_config.0.vendor openssh-6.1p1/sshd_config.0
9fe1afc
--- openssh-6.1p1/sshd_config.0.vendor	2012-09-14 20:36:49.510087780 +0200
9fe1afc
+++ openssh-6.1p1/sshd_config.0	2012-09-14 20:36:49.567088190 +0200
9fe1afc
@@ -558,6 +558,11 @@ DESCRIPTION
Jan F. Chadima 69dd72f
              Defines the number of bits in the ephemeral protocol version 1
Jan F. Chadima 69dd72f
              server key.  The minimum value is 512, and the default is 1024.
Jan F. Chadima 69dd72f
 
Jan F. Chadima 69dd72f
+     ShowPatchLevel
Jan F. Chadima 69dd72f
+	     Specifies whether sshd will display the specific patch level of
Jan F. Chadima 69dd72f
+	     the binary in the server identification string.  The patch level
Jan F. Chadima 69dd72f
+	     is set at compile-time.  The default is M-bM-^@M-^\noM-bM-^@M-^].
Jan F. Chadima 69dd72f
+
Jan F. Chadima 69dd72f
      StrictModes
Jan F. Chadima 69dd72f
              Specifies whether sshd(8) should check file modes and ownership
Jan F. Chadima 69dd72f
              of the user's files and home directory before accepting login.
9fe1afc
diff -up openssh-6.1p1/sshd_config.5.vendor openssh-6.1p1/sshd_config.5
9fe1afc
--- openssh-6.1p1/sshd_config.5.vendor	2012-09-14 20:36:49.512087794 +0200
9fe1afc
+++ openssh-6.1p1/sshd_config.5	2012-09-14 20:36:49.568088198 +0200
9fe1afc
@@ -978,6 +978,14 @@ This option applies to protocol version
Jan F. Chadima 69dd72f
 .It Cm ServerKeyBits
Jan F. Chadima 69dd72f
 Defines the number of bits in the ephemeral protocol version 1 server key.
Jan F. Chadima 69dd72f
 The minimum value is 512, and the default is 1024.
Jan F. Chadima 69dd72f
+.It Cm ShowPatchLevel 
Jan F. Chadima 69dd72f
+Specifies whether 
Jan F. Chadima 69dd72f
+.Nm sshd 
Jan F. Chadima 69dd72f
+will display the patch level of the binary in the identification string. 
Jan F. Chadima 69dd72f
+The patch level is set at compile-time. 
Jan F. Chadima 69dd72f
+The default is 
Jan F. Chadima 69dd72f
+.Dq no . 
Jan F. Chadima 69dd72f
+This option applies to protocol version 1 only. 
Jan F. Chadima 69dd72f
 .It Cm StrictModes
Jan F. Chadima 69dd72f
 Specifies whether
Jan F. Chadima 69dd72f
 .Xr sshd 8
9fe1afc
diff -up openssh-6.1p1/sshd.c.vendor openssh-6.1p1/sshd.c
9fe1afc
--- openssh-6.1p1/sshd.c.vendor	2012-09-14 20:36:49.399086981 +0200
9fe1afc
+++ openssh-6.1p1/sshd.c	2012-09-14 20:47:30.696088744 +0200
9fe1afc
@@ -433,7 +433,7 @@ sshd_exchange_identification(int sock_in
d9e6186
 	}
d9e6186
 
9fe1afc
 	xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s",
9fe1afc
-	    major, minor, SSH_VERSION,
9fe1afc
+	    major, minor, (options.show_patchlevel == 1) ? SSH_VENDOR_PATCHLEVEL : SSH_VERSION,
9fe1afc
 	    *options.version_addendum == '\0' ? "" : " ",
9fe1afc
 	    options.version_addendum, newline);
9fe1afc
 
9fe1afc
@@ -1635,7 +1635,8 @@ main(int ac, char **av)
d9e6186
 		exit(1);
d9e6186
 	}
d9e6186
 
d9e6186
-	debug("sshd version %.100s", SSH_RELEASE);
d9e6186
+	debug("sshd version %.100s",
d9e6186
+	      (options.show_patchlevel == 1) ? SSH_VENDOR_PATCHLEVEL : SSH_RELEASE);
d9e6186
 
d9e6186
 	/* Store privilege separation user for later use if required. */
d9e6186
 	if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) {