Blame SOURCES/openssh-6.6p1-GSSAPIEnablek5users.patch

9070b3
diff -up openssh-7.4p1/gss-serv-krb5.c.GSSAPIEnablek5users openssh-7.4p1/gss-serv-krb5.c
9070b3
--- openssh-7.4p1/gss-serv-krb5.c.GSSAPIEnablek5users	2016-12-23 15:18:40.615216100 +0100
9070b3
+++ openssh-7.4p1/gss-serv-krb5.c	2016-12-23 15:18:40.628216102 +0100
9070b3
@@ -279,7 +279,6 @@ ssh_gssapi_krb5_cmdok(krb5_principal pri
9070b3
 	FILE *fp;
9070b3
 	char file[MAXPATHLEN];
9070b3
 	char *line = NULL;
9070b3
-	char kuser[65]; /* match krb5_kuserok() */
9070b3
 	struct stat st;
9070b3
 	struct passwd *pw = the_authctxt->pw;
9070b3
 	int found_principal = 0;
9070b3
@@ -288,7 +287,7 @@ ssh_gssapi_krb5_cmdok(krb5_principal pri
9070b3
 
9070b3
 	snprintf(file, sizeof(file), "%s/.k5users", pw->pw_dir);
9070b3
 	/* If both .k5login and .k5users DNE, self-login is ok. */
9070b3
-	if (!k5login_exists && (access(file, F_OK) == -1)) {
9070b3
+	if ( !options.enable_k5users || (!k5login_exists && (access(file, F_OK) == -1))) {
9070b3
                 return ssh_krb5_kuserok(krb_context, principal, luser,
9070b3
                                         k5login_exists);
9070b3
 	}
9070b3
diff -up openssh-7.4p1/servconf.c.GSSAPIEnablek5users openssh-7.4p1/servconf.c
9070b3
--- openssh-7.4p1/servconf.c.GSSAPIEnablek5users	2016-12-23 15:18:40.615216100 +0100
9070b3
+++ openssh-7.4p1/servconf.c	2016-12-23 15:35:36.354401156 +0100
9070b3
@@ -168,6 +168,7 @@ initialize_server_options(ServerOptions
9070b3
 	options->gss_store_rekey = -1;
9070b3
 	options->gss_kex_algorithms = NULL;
9070b3
 	options->use_kuserok = -1;
9070b3
+	options->enable_k5users = -1;
9070b3
 	options->password_authentication = -1;
9070b3
 	options->kbd_interactive_authentication = -1;
9070b3
	options->permit_empty_passwd = -1;
9070b3
@@ -345,6 +346,8 @@ fill_default_server_options(ServerOption
9070b3
 #endif
9070b3
 	if (options->use_kuserok == -1)
9070b3
 		options->use_kuserok = 1;
9070b3
+	if (options->enable_k5users == -1)
9070b3
+		options->enable_k5users = 0;
9070b3
 	if (options->password_authentication == -1)
9070b3
 		options->password_authentication = 1;
9070b3
 	if (options->kbd_interactive_authentication == -1)
9070b3
@@ -418,7 +421,7 @@ typedef enum {
9070b3
 	sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedAlgorithms,
9070b3
 	sHostKeyAlgorithms, sPerSourceMaxStartups, sPerSourceNetBlockSize,
9070b3
 	sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
9070b3
-	sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor,
9070b3
+	sGssAuthentication, sGssCleanupCreds, sGssEnablek5users, sGssStrictAcceptor,
9070b3
 	sGssKeyEx, sGssKexAlgorithms, sGssStoreRekey,
9070b3
 	sAcceptEnv, sSetEnv, sPermitTunnel,
9070b3
 	sMatch, sPermitOpen, sPermitListen, sForceCommand, sChrootDirectory,
9070b3
@@ -497,14 +500,16 @@ static struct {
9070b3
 	{ "gssapikeyexchange", sGssKeyEx, SSHCFG_GLOBAL },
9070b3
 	{ "gssapistorecredentialsonrekey", sGssStoreRekey, SSHCFG_GLOBAL },
9070b3
 	{ "gssapikexalgorithms", sGssKexAlgorithms, SSHCFG_GLOBAL },
9070b3
+	{ "gssapienablek5users", sGssEnablek5users, SSHCFG_ALL },
9070b3
 #else
9070b3
 	{ "gssapiauthentication", sUnsupported, SSHCFG_ALL },
9070b3
 	{ "gssapicleanupcredentials", sUnsupported, SSHCFG_GLOBAL },
9070b3
 	{ "gssapicleanupcreds", sUnsupported, SSHCFG_GLOBAL },
9070b3
 	{ "gssapistrictacceptorcheck", sUnsupported, SSHCFG_GLOBAL },
9070b3
 	{ "gssapikeyexchange", sUnsupported, SSHCFG_GLOBAL },
9070b3
 	{ "gssapistorecredentialsonrekey", sUnsupported, SSHCFG_GLOBAL },
9070b3
 	{ "gssapikexalgorithms", sUnsupported, SSHCFG_GLOBAL },
9070b3
+	{ "gssapienablek5users", sUnsupported, SSHCFG_ALL },
9070b3
 #endif
9070b3
 	{ "gssusesessionccache", sUnsupported, SSHCFG_GLOBAL },
9070b3
 	{ "gssapiusesessioncredcache", sUnsupported, SSHCFG_GLOBAL },
9070b3
@@ -1653,6 +1658,10 @@ process_server_config_line(ServerOptions
9070b3
 		intptr = &options->use_kuserok;
9070b3
 		goto parse_flag;
9070b3
 
9070b3
+	case sGssEnablek5users:
9070b3
+		intptr = &options->enable_k5users;
9070b3
+		goto parse_flag;
9070b3
+
9070b3
	case sMatch:
9070b3
		if (cmdline)
9070b3
			fatal("Match directive not supported as a command-line "
9070b3
@@ -2026,6 +2035,7 @@ copy_set_server_options(ServerOptions *d
9070b3
 	M_CP_INTOPT(ip_qos_interactive);
9070b3
 	M_CP_INTOPT(ip_qos_bulk);
9070b3
 	M_CP_INTOPT(use_kuserok);
9070b3
+	M_CP_INTOPT(enable_k5users);
9070b3
 	M_CP_INTOPT(rekey_limit);
9070b3
 	M_CP_INTOPT(rekey_interval);
9070b3
 	M_CP_INTOPT(log_level);
9070b3
@@ -2320,6 +2330,7 @@ dump_config(ServerOptions *o)
9070b3
 # endif
9070b3
 	dump_cfg_fmtint(sKerberosUniqueCCache, o->kerberos_unique_ccache);
9070b3
 	dump_cfg_fmtint(sKerberosUseKuserok, o->use_kuserok);
9070b3
+	dump_cfg_fmtint(sGssEnablek5users, o->enable_k5users);
9070b3
 #endif
9070b3
 #ifdef GSSAPI
9070b3
 	dump_cfg_fmtint(sGssAuthentication, o->gss_authentication);
9070b3
diff -up openssh-7.4p1/servconf.h.GSSAPIEnablek5users openssh-7.4p1/servconf.h
9070b3
--- openssh-7.4p1/servconf.h.GSSAPIEnablek5users	2016-12-23 15:18:40.616216100 +0100
9070b3
+++ openssh-7.4p1/servconf.h	2016-12-23 15:18:40.629216102 +0100
9070b3
@@ -174,6 +174,7 @@ typedef struct {
9070b3
	int     kerberos_unique_ccache;		/* If true, the acquired ticket will
9070b3
						 * be stored in per-session ccache */
9070b3
 	int	use_kuserok;
9070b3
+	int		enable_k5users;
9070b3
 	int     gss_authentication;	/* If true, permit GSSAPI authentication */
9070b3
 	int     gss_keyex;		/* If true, permit GSSAPI key exchange */
9070b3
 	int     gss_cleanup_creds;	/* If true, destroy cred cache on logout */
9070b3
diff -up openssh-7.4p1/sshd_config.5.GSSAPIEnablek5users openssh-7.4p1/sshd_config.5
9070b3
--- openssh-7.4p1/sshd_config.5.GSSAPIEnablek5users	2016-12-23 15:18:40.630216103 +0100
9070b3
+++ openssh-7.4p1/sshd_config.5	2016-12-23 15:36:21.607408435 +0100
9070b3
@@ -628,6 +628,12 @@ Specifies whether to automatically destr
9070b3
 on logout.
9070b3
 The default is
9070b3
 .Cm yes .
9070b3
+.It Cm GSSAPIEnablek5users
9070b3
+Specifies whether to look at .k5users file for GSSAPI authentication
9070b3
+access control. Further details are described in
9070b3
+.Xr ksu 1 .
9070b3
+The default is
9070b3
+.Cm no .
9070b3
 .It Cm GSSAPIKeyExchange
9070b3
 Specifies whether key exchange based on GSSAPI is allowed. GSSAPI key exchange
9070b3
 doesn't rely on ssh keys to verify host identity.
9070b3
diff -up openssh-7.4p1/sshd_config.GSSAPIEnablek5users openssh-7.4p1/sshd_config
9070b3
--- openssh-7.4p1/sshd_config.GSSAPIEnablek5users	2016-12-23 15:18:40.616216100 +0100
9070b3
+++ openssh-7.4p1/sshd_config	2016-12-23 15:18:40.631216103 +0100
9070b3
@@ -80,6 +80,7 @@ GSSAPIAuthentication yes
9070b3
 #GSSAPICleanupCredentials yes
9070b3
 #GSSAPIStrictAcceptorCheck yes
9070b3
 #GSSAPIKeyExchange no
9070b3
+#GSSAPIEnablek5users no
9070b3
 
9070b3
 # Set this to 'yes' to enable PAM authentication, account processing,
9070b3
 # and session processing. If this is enabled, PAM authentication will