1 diff -up openssh-5.9p0/auth-krb5.c.kuserok openssh-5.9p0/auth-krb5.c
2 --- openssh-5.9p0/auth-krb5.c.kuserok 2011-08-30 16:37:32.651150128 +0200
3 +++ openssh-5.9p0/auth-krb5.c 2011-08-30 16:37:37.549087368 +0200
6 extern ServerOptions options;
9 +ssh_krb5_kuserok(krb5_context krb5_ctx, krb5_principal krb5_user, const char *client)
11 + if (options.use_kuserok)
12 + return krb5_kuserok(krb5_ctx, krb5_user, client);
16 + if (krb5_aname_to_localname(krb5_ctx, krb5_user, sizeof(kuser), kuser))
18 + return strcmp(kuser, client) == 0;
23 krb5_init(void *context)
25 @@ -146,7 +160,7 @@ auth_krb5_password(Authctxt *authctxt, c
29 - if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
30 + if (!ssh_krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
34 diff -up openssh-5.9p0/gss-serv-krb5.c.kuserok openssh-5.9p0/gss-serv-krb5.c
35 --- openssh-5.9p0/gss-serv-krb5.c.kuserok 2011-08-30 16:37:36.988024804 +0200
36 +++ openssh-5.9p0/gss-serv-krb5.c 2011-08-30 16:37:37.659088030 +0200
37 @@ -68,6 +68,7 @@ static int ssh_gssapi_krb5_cmdok(krb5_pr
40 static krb5_context krb_context = NULL;
41 +extern int ssh_krb5_kuserok(krb5_context, krb5_principal, const char *);
43 /* Initialise the krb5 library, for the stuff that GSSAPI won't do */
45 @@ -115,7 +116,7 @@ ssh_gssapi_krb5_userok(ssh_gssapi_client
46 /* NOTE: .k5login and .k5users must opened as root, not the user,
47 * because if they are on a krb5-protected filesystem, user credentials
48 * to access these files aren't available yet. */
49 - if (krb5_kuserok(krb_context, princ, luser) && k5login_exists) {
50 + if (ssh_krb5_kuserok(krb_context, princ, luser) && k5login_exists) {
52 logit("Authorized to %s, krb5 principal %s (krb5_kuserok)",
53 luser, (char *)client->displayname.value);
54 diff -up openssh-5.9p0/servconf.c.kuserok openssh-5.9p0/servconf.c
55 --- openssh-5.9p0/servconf.c.kuserok 2011-08-30 16:37:35.093073603 +0200
56 +++ openssh-5.9p0/servconf.c 2011-08-30 16:41:13.568087145 +0200
57 @@ -144,6 +144,7 @@ initialize_server_options(ServerOptions
58 options->authorized_principals_file = NULL;
59 options->ip_qos_interactive = -1;
60 options->ip_qos_bulk = -1;
61 + options->use_kuserok = -1;
65 @@ -291,6 +292,8 @@ fill_default_server_options(ServerOption
66 options->ip_qos_bulk = IPTOS_THROUGHPUT;
67 if (options->show_patchlevel == -1)
68 options->show_patchlevel = 0;
69 + if (options->use_kuserok == -1)
70 + options->use_kuserok = 1;
72 /* Turn privilege separation on by default */
73 if (use_privsep == -1)
74 @@ -317,7 +320,7 @@ typedef enum {
75 sPermitRootLogin, sLogFacility, sLogLevel,
76 sRhostsRSAAuthentication, sRSAAuthentication,
77 sKerberosAuthentication, sKerberosOrLocalPasswd, sKerberosTicketCleanup,
78 - sKerberosGetAFSToken,
79 + sKerberosGetAFSToken, sKerberosUseKuserok,
80 sKerberosTgtPassing, sChallengeResponseAuthentication,
81 sPasswordAuthentication, sKbdInteractiveAuthentication,
82 sListenAddress, sAddressFamily,
83 @@ -388,11 +391,13 @@ static struct {
85 { "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
87 + { "kerberosusekuserok", sKerberosUseKuserok, SSHCFG_ALL },
89 { "kerberosauthentication", sUnsupported, SSHCFG_ALL },
90 { "kerberosorlocalpasswd", sUnsupported, SSHCFG_GLOBAL },
91 { "kerberosticketcleanup", sUnsupported, SSHCFG_GLOBAL },
92 { "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
93 + { "kerberosusekuserok", sUnsupported, SSHCFG_ALL },
95 { "kerberostgtpassing", sUnsupported, SSHCFG_GLOBAL },
96 { "afstokenpassing", sUnsupported, SSHCFG_GLOBAL },
97 @@ -1371,6 +1376,10 @@ process_server_config_line(ServerOptions
101 + case sKerberosUseKuserok:
102 + intptr = &options->use_kuserok;
107 if (!arg || *arg == '\0')
108 @@ -1580,6 +1589,7 @@ copy_set_server_options(ServerOptions *d
109 M_CP_INTOPT(max_authtries);
110 M_CP_INTOPT(ip_qos_interactive);
111 M_CP_INTOPT(ip_qos_bulk);
112 + M_CP_INTOPT(use_kuserok);
114 /* See comment in servconf.h */
115 COPY_MATCH_STRING_OPTS();
116 @@ -1816,6 +1826,7 @@ dump_config(ServerOptions *o)
117 dump_cfg_fmtint(sUseDNS, o->use_dns);
118 dump_cfg_fmtint(sAllowTcpForwarding, o->allow_tcp_forwarding);
119 dump_cfg_fmtint(sUsePrivilegeSeparation, use_privsep);
120 + dump_cfg_fmtint(sKerberosUseKuserok, o->use_kuserok);
122 /* string arguments */
123 dump_cfg_string(sPidFile, o->pid_file);
124 diff -up openssh-5.9p0/servconf.h.kuserok openssh-5.9p0/servconf.h
125 --- openssh-5.9p0/servconf.h.kuserok 2011-08-30 16:37:35.201051957 +0200
126 +++ openssh-5.9p0/servconf.h 2011-08-30 16:37:37.926087431 +0200
127 @@ -166,6 +166,7 @@ typedef struct {
129 int num_permitted_opens;
132 char *chroot_directory;
133 char *revoked_keys_file;
134 char *trusted_user_ca_keys;
135 diff -up openssh-5.9p0/sshd_config.5.kuserok openssh-5.9p0/sshd_config.5
136 --- openssh-5.9p0/sshd_config.5.kuserok 2011-08-30 16:37:35.979024607 +0200
137 +++ openssh-5.9p0/sshd_config.5 2011-08-30 16:37:38.040087843 +0200
138 @@ -603,6 +603,10 @@ Specifies whether to automatically destr
142 +.It Cm KerberosUseKuserok
143 +Specifies whether to look at .k5login file for user's aliases.
147 Specifies the available KEX (Key Exchange) algorithms.
148 Multiple algorithms must be comma-separated.
149 @@ -746,6 +750,7 @@ Available keywords are
150 .Cm HostbasedUsesNameFromPacketOnly ,
151 .Cm KbdInteractiveAuthentication ,
152 .Cm KerberosAuthentication ,
153 +.Cm KerberosUseKuserok ,
156 .Cm PubkeyAuthentication ,
157 diff -up openssh-5.9p0/sshd_config.kuserok openssh-5.9p0/sshd_config
158 --- openssh-5.9p0/sshd_config.kuserok 2011-08-30 16:37:36.808026328 +0200
159 +++ openssh-5.9p0/sshd_config 2011-08-30 16:37:38.148071520 +0200
160 @@ -77,6 +77,7 @@ ChallengeResponseAuthentication no
161 #KerberosOrLocalPasswd yes
162 #KerberosTicketCleanup yes
163 #KerberosGetAFSToken no
164 +#KerberosUseKuserok yes
167 #GSSAPIAuthentication no