6cf9b8
diff -up openssh-7.4p1/configure.ac.vendor openssh-7.4p1/configure.ac
6cf9b8
--- openssh-7.4p1/configure.ac.vendor	2016-12-23 13:34:51.681253844 +0100
6cf9b8
+++ openssh-7.4p1/configure.ac	2016-12-23 13:34:51.694253847 +0100
6cf9b8
@@ -4930,6 +4930,12 @@ AC_ARG_WITH([lastlog],
47b1c9
 		fi
47b1c9
 	]
Jan F. Chadima 69dd72
 )
Jan F. Chadima 69dd72
+AC_ARG_ENABLE(vendor-patchlevel,
Jan F. Chadima 69dd72
+  [  --enable-vendor-patchlevel=TAG  specify a vendor patch level],
Jan F. Chadima 69dd72
+  [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 69dd72
+   SSH_VENDOR_PATCHLEVEL="$enableval"],
Jan F. Chadima 69dd72
+  [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 69dd72
+   SSH_VENDOR_PATCHLEVEL=none])
47b1c9
 
Jan F. Chadima 69dd72
 dnl lastlog, [uw]tmpx? detection
Jan F. Chadima 69dd72
 dnl  NOTE: set the paths in the platform section to avoid the
6cf9b8
@@ -5194,6 +5200,7 @@ echo "           Translate v4 in v6 hack
Jan F. Chadima 69dd72
 echo "                  BSD Auth support: $BSD_AUTH_MSG"
Jan F. Chadima 69dd72
 echo "              Random number source: $RAND_MSG"
Jan F. Chadima 69dd72
 echo "             Privsep sandbox style: $SANDBOX_STYLE"
Jan F. Chadima 69dd72
+echo "                Vendor patch level: $SSH_VENDOR_PATCHLEVEL"
Jan F. Chadima 69dd72
 
Jan F. Chadima 69dd72
 echo ""
Jan F. Chadima 69dd72
 
6cf9b8
diff -up openssh-7.4p1/servconf.c.vendor openssh-7.4p1/servconf.c
6cf9b8
--- openssh-7.4p1/servconf.c.vendor	2016-12-19 05:59:41.000000000 +0100
6cf9b8
+++ openssh-7.4p1/servconf.c	2016-12-23 13:36:07.555268628 +0100
6cf9b8
@@ -143,6 +143,7 @@ initialize_server_options(ServerOptions
Jan F. Chadima 69dd72
 	options->max_authtries = -1;
Jan F. Chadima 69dd72
 	options->max_sessions = -1;
Jan F. Chadima 69dd72
 	options->banner = NULL;
Jan F. Chadima 69dd72
+	options->show_patchlevel = -1;
Jan F. Chadima 69dd72
 	options->use_dns = -1;
Jan F. Chadima 69dd72
 	options->client_alive_interval = -1;
Jan F. Chadima 69dd72
 	options->client_alive_count_max = -1;
6cf9b8
@@ -325,6 +326,8 @@ fill_default_server_options(ServerOption
bbf61d
 		options->ip_qos_bulk = IPTOS_DSCP_CS1;
9fe1af
 	if (options->version_addendum == NULL)
9fe1af
 		options->version_addendum = xstrdup("");
Jan F. Chadima 69dd72
+	if (options->show_patchlevel == -1)
9fe1af
+		options->show_patchlevel = 0;
190035
 	if (options->fwd_opts.streamlocal_bind_mask == (mode_t)-1)
190035
 		options->fwd_opts.streamlocal_bind_mask = 0177;
190035
 	if (options->fwd_opts.streamlocal_bind_unlink == -1)
6cf9b8
@@ -402,7 +405,7 @@ typedef enum {
6cf9b8
 	sIgnoreUserKnownHosts, sCiphers, sMacs, sPidFile,
132f8f
 	sGatewayPorts, sPubkeyAuthentication, sPubkeyAcceptedKeyTypes,
132f8f
 	sXAuthLocation, sSubsystem, sMaxStartups, sMaxAuthTries, sMaxSessions,
Jan F. Chadima 69dd72
-	sBanner, sUseDNS, sHostbasedAuthentication,
Jan F. Chadima 69dd72
+	sBanner, sShowPatchLevel, sUseDNS, sHostbasedAuthentication,
132f8f
 	sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedKeyTypes,
3f5513
 	sHostKeyAlgorithms,
132f8f
 	sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
6cf9b8
@@ -528,6 +531,7 @@ static struct {
Jan F. Chadima 69dd72
 	{ "maxauthtries", sMaxAuthTries, SSHCFG_ALL },
Jan F. Chadima 69dd72
 	{ "maxsessions", sMaxSessions, SSHCFG_ALL },
Jan F. Chadima 69dd72
 	{ "banner", sBanner, SSHCFG_ALL },
Jan F. Chadima 69dd72
+	{ "showpatchlevel", sShowPatchLevel, SSHCFG_GLOBAL },
Jan F. Chadima 69dd72
 	{ "usedns", sUseDNS, SSHCFG_GLOBAL },
Jan F. Chadima 69dd72
 	{ "verifyreversemapping", sDeprecated, SSHCFG_GLOBAL },
Jan F. Chadima 69dd72
 	{ "reversemappingcheck", sDeprecated, SSHCFG_GLOBAL },
6cf9b8
@@ -1369,6 +1373,10 @@ process_server_config_line(ServerOptions
17b491
 		intptr = &options->disable_forwarding;
17b491
 		goto parse_flag;
Jan F. Chadima 69dd72
 
Jan F. Chadima 69dd72
+	case sShowPatchLevel:
Jan F. Chadima 69dd72
+		intptr = &options->show_patchlevel;
Jan F. Chadima 69dd72
+		goto parse_flag;
Jan F. Chadima 69dd72
+
Jan F. Chadima 69dd72
 	case sAllowUsers:
Jan F. Chadima 69dd72
 		while ((arg = strdelim(&cp)) && *arg != '\0') {
3cd489
 			if (match_user(NULL, NULL, NULL, arg) == -1)
6cf9b8
@@ -2269,6 +2277,7 @@ dump_config(ServerOptions *o)
bbf61d
 	dump_cfg_fmtint(sEmptyPasswd, o->permit_empty_passwd);
Jan F. Chadima 69dd72
 	dump_cfg_fmtint(sCompression, o->compression);
190035
 	dump_cfg_fmtint(sGatewayPorts, o->fwd_opts.gateway_ports);
Jan F. Chadima 69dd72
+	dump_cfg_fmtint(sShowPatchLevel, o->show_patchlevel);
Jan F. Chadima 69dd72
 	dump_cfg_fmtint(sUseDNS, o->use_dns);
Jan F. Chadima 69dd72
 	dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding);
535d34
 	dump_cfg_fmtint(sAllowAgentForwarding, o->allow_agent_forwarding);
6cf9b8
diff -up openssh-7.4p1/servconf.h.vendor openssh-7.4p1/servconf.h
6cf9b8
--- openssh-7.4p1/servconf.h.vendor	2016-12-19 05:59:41.000000000 +0100
6cf9b8
+++ openssh-7.4p1/servconf.h	2016-12-23 13:34:51.694253847 +0100
6cf9b8
@@ -149,6 +149,7 @@ typedef struct {
Jan F. Chadima 69dd72
 	int	max_authtries;
Jan F. Chadima 69dd72
 	int	max_sessions;
Jan F. Chadima 69dd72
 	char   *banner;			/* SSH-2 banner message */
Jan F. Chadima 69dd72
+	int	show_patchlevel;	/* Show vendor patch level to clients */
Jan F. Chadima 69dd72
 	int	use_dns;
Jan F. Chadima 69dd72
 	int	client_alive_interval;	/*
Jan F. Chadima 69dd72
 					 * poke the client this often to
6cf9b8
diff -up openssh-7.4p1/sshd_config.5.vendor openssh-7.4p1/sshd_config.5
6cf9b8
--- openssh-7.4p1/sshd_config.5.vendor	2016-12-23 13:34:51.695253847 +0100
6cf9b8
+++ openssh-7.4p1/sshd_config.5	2016-12-23 13:37:17.482282253 +0100
6cf9b8
@@ -1334,6 +1334,13 @@ an OpenSSH Key Revocation List (KRL) as
bbf61d
 .Cm AcceptEnv
bbf61d
 or
bbf61d
 .Cm PermitUserEnvironment .
Jan F. Chadima 69dd72
+.It Cm ShowPatchLevel 
Jan F. Chadima 69dd72
+Specifies whether 
Jan F. Chadima 69dd72
+.Nm sshd 
Jan F. Chadima 69dd72
+will display the patch level of the binary in the identification string. 
Jan F. Chadima 69dd72
+The patch level is set at compile-time. 
Jan F. Chadima 69dd72
+The default is 
Jan F. Chadima 69dd72
+.Dq no . 
190035
 .It Cm StreamLocalBindMask
190035
 Sets the octal file creation mode mask
190035
 .Pq umask
6cf9b8
diff -up openssh-7.4p1/sshd_config.vendor openssh-7.4p1/sshd_config
6cf9b8
--- openssh-7.4p1/sshd_config.vendor	2016-12-23 13:34:51.690253846 +0100
6cf9b8
+++ openssh-7.4p1/sshd_config	2016-12-23 13:34:51.695253847 +0100
6cf9b8
@@ -105,6 +105,7 @@ X11Forwarding yes
3f5513
 #Compression delayed
3f5513
 #ClientAliveInterval 0
3f5513
 #ClientAliveCountMax 3
3f5513
+#ShowPatchLevel no
3f5513
 #UseDNS no
3f5513
 #PidFile /var/run/sshd.pid
3f5513
 #MaxStartups 10:30:100
6cf9b8
diff -up openssh-7.4p1/sshd.c.vendor openssh-7.4p1/sshd.c
6cf9b8
--- openssh-7.4p1/sshd.c.vendor	2016-12-23 13:34:51.682253844 +0100
6cf9b8
+++ openssh-7.4p1/sshd.c	2016-12-23 13:38:32.434296856 +0100
6cf9b8
@@ -367,7 +367,8 @@ sshd_exchange_identification(struct ssh
6cf9b8
 	char remote_version[256];	/* Must be at least as big as buf. */
3f5513
 
17b491
 	xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s\r\n",
6cf9b8
-	    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION,
6cf9b8
+	    PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2,
6cf9b8
+	    (options.show_patchlevel == 1) ? SSH_VENDOR_PATCHLEVEL : SSH_VERSION,
3f5513
 	    *options.version_addendum == '\0' ? "" : " ",
17b491
 	    options.version_addendum);
3f5513
 
6cf9b8
@@ -1650,7 +1651,8 @@ main(int ac, char **av)
3f5513
 		exit(1);
3f5513
 	}
3f5513
 
3f5513
-	debug("sshd version %s, %s", SSH_VERSION,
3f5513
+	debug("sshd version %s, %s", 
3f5513
+		(options.show_patchlevel == 1) ? SSH_VENDOR_PATCHLEVEL : SSH_VERSION,
3f5513
 #ifdef WITH_OPENSSL
3f5513
 	    SSLeay_version(SSLEAY_VERSION)
3f5513
 #else