jonathancammack / rpms / openssh

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