3f55133
diff -up openssh-7.0p1/gss-serv-krb5.c.GSSAPIEnablek5users openssh-7.0p1/gss-serv-krb5.c
3f55133
--- openssh-7.0p1/gss-serv-krb5.c.GSSAPIEnablek5users	2015-08-12 11:27:44.022407951 +0200
3f55133
+++ openssh-7.0p1/gss-serv-krb5.c	2015-08-12 11:27:44.047407912 +0200
132f8f8
@@ -260,7 +260,6 @@ ssh_gssapi_krb5_cmdok(krb5_principal pri
140e5ca
 	FILE *fp;
140e5ca
 	char file[MAXPATHLEN];
580f986
 	char line[BUFSIZ] = "";
140e5ca
-	char kuser[65]; /* match krb5_kuserok() */
140e5ca
 	struct stat st;
140e5ca
 	struct passwd *pw = the_authctxt->pw;
140e5ca
 	int found_principal = 0;
132f8f8
@@ -269,7 +268,7 @@ ssh_gssapi_krb5_cmdok(krb5_principal pri
140e5ca
 
140e5ca
 	snprintf(file, sizeof(file), "%s/.k5users", pw->pw_dir);
140e5ca
 	/* If both .k5login and .k5users DNE, self-login is ok. */
140e5ca
-	if (!k5login_exists && (access(file, F_OK) == -1)) {
140e5ca
+	if ( !options.enable_k5users || (!k5login_exists && (access(file, F_OK) == -1))) {
140e5ca
                 return ssh_krb5_kuserok(krb_context, principal, luser,
140e5ca
                                         k5login_exists);
140e5ca
 	}
3f55133
diff -up openssh-7.0p1/servconf.c.GSSAPIEnablek5users openssh-7.0p1/servconf.c
3f55133
--- openssh-7.0p1/servconf.c.GSSAPIEnablek5users	2015-08-12 11:27:44.036407930 +0200
3f55133
+++ openssh-7.0p1/servconf.c	2015-08-12 11:28:49.087306430 +0200
3f55133
@@ -173,6 +173,7 @@ initialize_server_options(ServerOptions
140e5ca
 	options->version_addendum = NULL;
1900351
 	options->fingerprint_hash = -1;
140e5ca
 	options->use_kuserok = -1;
140e5ca
+	options->enable_k5users = -1;
140e5ca
 }
140e5ca
 
132f8f8
 /* Returns 1 if a string option is unset or set to "none" or 0 otherwise. */
3f55133
@@ -351,6 +352,8 @@ fill_default_server_options(ServerOption
3f55133
 		options->fwd_opts.streamlocal_bind_unlink = 0;
3f55133
 	if (options->fingerprint_hash == -1)
1900351
 		options->fingerprint_hash = SSH_FP_HASH_DEFAULT;
140e5ca
+	if (options->enable_k5users == -1)
140e5ca
+		options->enable_k5users = 0;
3f55133
 	if (options->use_kuserok == -1)
3f55133
 		options->use_kuserok = 1;
3f55133
 
3f55133
@@ -423,7 +426,7 @@ typedef enum {
132f8f8
 	sHostbasedUsesNameFromPacketOnly, sHostbasedAcceptedKeyTypes,
3f55133
 	sHostKeyAlgorithms,
132f8f8
 	sClientAliveInterval, sClientAliveCountMax, sAuthorizedKeysFile,
140e5ca
-	sGssAuthentication, sGssCleanupCreds, sGssStrictAcceptor,
140e5ca
+	sGssAuthentication, sGssCleanupCreds, sGssEnablek5users, sGssStrictAcceptor,
140e5ca
 	sGssKeyEx, sGssStoreRekey, sAcceptEnv, sPermitTunnel,
140e5ca
 	sMatch, sPermitOpen, sForceCommand, sChrootDirectory,
140e5ca
 	sUsePrivilegeSeparation, sAllowAgentForwarding,
3f55133
@@ -502,12 +505,14 @@ static struct {
140e5ca
 	{ "gssapistrictacceptorcheck", sGssStrictAcceptor, SSHCFG_GLOBAL },
140e5ca
 	{ "gssapikeyexchange", sGssKeyEx, SSHCFG_GLOBAL },
140e5ca
 	{ "gssapistorecredentialsonrekey", sGssStoreRekey, SSHCFG_GLOBAL },
140e5ca
+	{ "gssapienablek5users", sGssEnablek5users, SSHCFG_ALL },
140e5ca
 #else
140e5ca
 	{ "gssapiauthentication", sUnsupported, SSHCFG_ALL },
140e5ca
 	{ "gssapicleanupcredentials", sUnsupported, SSHCFG_GLOBAL },
140e5ca
 	{ "gssapistrictacceptorcheck", sUnsupported, SSHCFG_GLOBAL },
140e5ca
 	{ "gssapikeyexchange", sUnsupported, SSHCFG_GLOBAL },
140e5ca
 	{ "gssapistorecredentialsonrekey", sUnsupported, SSHCFG_GLOBAL },
140e5ca
+	{ "gssapienablek5users", sUnsupported, SSHCFG_ALL },
140e5ca
 #endif
140e5ca
 	{ "gssusesessionccache", sUnsupported, SSHCFG_GLOBAL },
140e5ca
 	{ "gssapiusesessioncredcache", sUnsupported, SSHCFG_GLOBAL },
3f55133
@@ -1680,6 +1685,10 @@ process_server_config_line(ServerOptions
140e5ca
 		intptr = &options->use_kuserok;
140e5ca
 		goto parse_flag;
140e5ca
 
140e5ca
+	case sGssEnablek5users:
140e5ca
+		intptr = &options->enable_k5users;
140e5ca
+		goto parse_flag;
140e5ca
+
140e5ca
 	case sPermitOpen:
140e5ca
 		arg = strdelim(&cp;;
140e5ca
 		if (!arg || *arg == '\0')
3f55133
@@ -2035,6 +2044,7 @@ copy_set_server_options(ServerOptions *d
140e5ca
 	M_CP_INTOPT(ip_qos_interactive);
140e5ca
 	M_CP_INTOPT(ip_qos_bulk);
140e5ca
 	M_CP_INTOPT(use_kuserok);
140e5ca
+	M_CP_INTOPT(enable_k5users);
140e5ca
 	M_CP_INTOPT(rekey_limit);
140e5ca
 	M_CP_INTOPT(rekey_interval);
140e5ca
 
3f55133
@@ -2317,6 +2327,7 @@ dump_config(ServerOptions *o)
140e5ca
 	dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
1900351
 	dump_cfg_fmtint(sFingerprintHash, o->fingerprint_hash);
140e5ca
 	dump_cfg_fmtint(sKerberosUseKuserok, o->use_kuserok);
140e5ca
+	dump_cfg_fmtint(sGssEnablek5users, o->enable_k5users);
140e5ca
 
140e5ca
 	/* string arguments */
140e5ca
 	dump_cfg_string(sPidFile, o->pid_file);
3f55133
diff -up openssh-7.0p1/servconf.h.GSSAPIEnablek5users openssh-7.0p1/servconf.h
3f55133
--- openssh-7.0p1/servconf.h.GSSAPIEnablek5users	2015-08-12 11:27:44.022407951 +0200
3f55133
+++ openssh-7.0p1/servconf.h	2015-08-12 11:27:44.048407911 +0200
3f55133
@@ -180,7 +180,8 @@ typedef struct {
140e5ca
 
140e5ca
 	int	num_permitted_opens;
140e5ca
 
140e5ca
-	int	use_kuserok;
140e5ca
+	int		use_kuserok;
140e5ca
+	int		enable_k5users;
140e5ca
 	char   *chroot_directory;
140e5ca
 	char   *revoked_keys_file;
140e5ca
 	char   *trusted_user_ca_keys;
3f55133
diff -up openssh-7.0p1/sshd_config.5.GSSAPIEnablek5users openssh-7.0p1/sshd_config.5
3f55133
--- openssh-7.0p1/sshd_config.5.GSSAPIEnablek5users	2015-08-12 11:27:44.023407950 +0200
3f55133
+++ openssh-7.0p1/sshd_config.5	2015-08-12 11:27:44.048407911 +0200
3f55133
@@ -633,6 +633,12 @@ on logout.
13073f8
 on logout.
140e5ca
 The default is
140e5ca
 .Dq yes .
140e5ca
+.It Cm GSSAPIEnablek5users
140e5ca
+Specifies whether to look at .k5users file for GSSAPI authentication
140e5ca
+access control. Further details are described in
140e5ca
+.Xr ksu 1 .
140e5ca
+The default is
140e5ca
+.Dq no .
140e5ca
 .It Cm GSSAPIStrictAcceptorCheck
535d341
 Determines whether to be strict about the identity of the GSSAPI acceptor
535d341
 a client authenticates against.
3f55133
diff -up openssh-7.0p1/sshd_config.GSSAPIEnablek5users openssh-7.0p1/sshd_config
3f55133
--- openssh-7.0p1/sshd_config.GSSAPIEnablek5users	2015-08-12 11:27:44.023407950 +0200
3f55133
+++ openssh-7.0p1/sshd_config	2015-08-12 11:27:44.048407911 +0200
535d341
@@ -94,6 +94,7 @@ GSSAPIAuthentication yes
535d341
 GSSAPICleanupCredentials no
535d341
 #GSSAPIStrictAcceptorCheck yes
535d341
 #GSSAPIKeyExchange no
535d341
+#GSSAPIEnablek5users no
535d341
 
535d341
 # Set this to 'yes' to enable PAM authentication, account processing,
535d341
 # and session processing. If this is enabled, PAM authentication will