]> git.ipfire.org Git - people/arne_f/ipfire-3.x.git/blame - openssh/patches/openssh-6.1p1-kuserok.patch
openssh: Update to 6.1p1.
[people/arne_f/ipfire-3.x.git] / openssh / patches / openssh-6.1p1-kuserok.patch
CommitLineData
43c69e28
SS
1diff -up openssh-6.1p1/auth-krb5.c.kuserok openssh-6.1p1/auth-krb5.c
2--- openssh-6.1p1/auth-krb5.c.kuserok 2012-09-14 21:08:16.941496194 +0200
3+++ openssh-6.1p1/auth-krb5.c 2012-09-14 21:08:17.063496896 +0200
4@@ -55,6 +55,20 @@
852f4e06
SS
5
6 extern ServerOptions options;
7
8+int
9+ssh_krb5_kuserok(krb5_context krb5_ctx, krb5_principal krb5_user, const char *client)
10+{
11+ if (options.use_kuserok)
12+ return krb5_kuserok(krb5_ctx, krb5_user, client);
13+ else {
14+ char kuser[65];
15+
16+ if (krb5_aname_to_localname(krb5_ctx, krb5_user, sizeof(kuser), kuser))
17+ return 0;
18+ return strcmp(kuser, client) == 0;
19+ }
20+}
21+
22 static int
23 krb5_init(void *context)
24 {
43c69e28 25@@ -147,7 +161,7 @@ auth_krb5_password(Authctxt *authctxt, c
852f4e06
SS
26 if (problem)
27 goto out;
28
29- if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
30+ if (!ssh_krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
31 problem = -1;
32 goto out;
33 }
43c69e28
SS
34diff -up openssh-6.1p1/gss-serv-krb5.c.kuserok openssh-6.1p1/gss-serv-krb5.c
35--- openssh-6.1p1/gss-serv-krb5.c.kuserok 2012-09-14 21:08:17.019496642 +0200
36+++ openssh-6.1p1/gss-serv-krb5.c 2012-09-14 21:08:17.065496906 +0200
9d8fd3ad
SS
37@@ -68,6 +68,7 @@ static int ssh_gssapi_krb5_cmdok(krb5_pr
38 int);
852f4e06
SS
39
40 static krb5_context krb_context = NULL;
41+extern int ssh_krb5_kuserok(krb5_context, krb5_principal, const char *);
42
43 /* Initialise the krb5 library, for the stuff that GSSAPI won't do */
44
9d8fd3ad
SS
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) {
852f4e06
SS
51 retval = 1;
52 logit("Authorized to %s, krb5 principal %s (krb5_kuserok)",
9d8fd3ad 53 luser, (char *)client->displayname.value);
43c69e28
SS
54diff -up openssh-6.1p1/servconf.c.kuserok openssh-6.1p1/servconf.c
55--- openssh-6.1p1/servconf.c.kuserok 2012-09-14 21:08:16.989496471 +0200
56+++ openssh-6.1p1/servconf.c 2012-09-14 21:09:30.864868698 +0200
57@@ -152,6 +152,7 @@ initialize_server_options(ServerOptions
852f4e06
SS
58 options->ip_qos_interactive = -1;
59 options->ip_qos_bulk = -1;
43c69e28 60 options->version_addendum = NULL;
852f4e06
SS
61+ options->use_kuserok = -1;
62 }
63
64 void
43c69e28
SS
65@@ -301,6 +302,8 @@ fill_default_server_options(ServerOption
66 options->version_addendum = xstrdup("");
9d8fd3ad 67 if (options->show_patchlevel == -1)
43c69e28 68 options->show_patchlevel = 0;
852f4e06
SS
69+ if (options->use_kuserok == -1)
70+ options->use_kuserok = 1;
9d8fd3ad
SS
71
72 /* Turn privilege separation on by default */
73 if (use_privsep == -1)
43c69e28 74@@ -327,7 +330,7 @@ typedef enum {
852f4e06
SS
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,
43c69e28 83@@ -399,11 +402,13 @@ static struct {
852f4e06
SS
84 #else
85 { "kerberosgetafstoken", sUnsupported, SSHCFG_GLOBAL },
86 #endif
87+ { "kerberosusekuserok", sKerberosUseKuserok, SSHCFG_ALL },
88 #else
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 },
94 #endif
95 { "kerberostgtpassing", sUnsupported, SSHCFG_GLOBAL },
96 { "afstokenpassing", sUnsupported, SSHCFG_GLOBAL },
43c69e28 97@@ -1486,6 +1491,10 @@ process_server_config_line(ServerOptions
852f4e06
SS
98 *activep = value;
99 break;
100
101+ case sKerberosUseKuserok:
102+ intptr = &options->use_kuserok;
103+ goto parse_flag;
104+
105 case sPermitOpen:
106 arg = strdelim(&cp);
107 if (!arg || *arg == '\0')
43c69e28 108@@ -1769,6 +1778,7 @@ copy_set_server_options(ServerOptions *d
852f4e06
SS
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);
113
9d8fd3ad
SS
114 /* See comment in servconf.h */
115 COPY_MATCH_STRING_OPTS();
43c69e28 116@@ -2005,6 +2015,7 @@ dump_config(ServerOptions *o)
852f4e06
SS
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);
121
122 /* string arguments */
123 dump_cfg_string(sPidFile, o->pid_file);
43c69e28
SS
124diff -up openssh-6.1p1/servconf.h.kuserok openssh-6.1p1/servconf.h
125--- openssh-6.1p1/servconf.h.kuserok 2012-09-14 21:08:16.990496476 +0200
126+++ openssh-6.1p1/servconf.h 2012-09-14 21:08:17.071496942 +0200
127@@ -169,6 +169,7 @@ typedef struct {
852f4e06
SS
128
129 int num_permitted_opens;
130
131+ int use_kuserok;
132 char *chroot_directory;
133 char *revoked_keys_file;
134 char *trusted_user_ca_keys;
43c69e28
SS
135diff -up openssh-6.1p1/sshd_config.kuserok openssh-6.1p1/sshd_config
136--- openssh-6.1p1/sshd_config.kuserok 2012-09-14 21:08:17.002496545 +0200
137+++ openssh-6.1p1/sshd_config 2012-09-14 21:08:17.074496957 +0200
138@@ -79,6 +79,7 @@ ChallengeResponseAuthentication no
139 #KerberosOrLocalPasswd yes
140 #KerberosTicketCleanup yes
141 #KerberosGetAFSToken no
142+#KerberosUseKuserok yes
143
144 # GSSAPI options
145 #GSSAPIAuthentication no
146diff -up openssh-6.1p1/sshd_config.5.kuserok openssh-6.1p1/sshd_config.5
147--- openssh-6.1p1/sshd_config.5.kuserok 2012-09-14 21:08:17.004496556 +0200
148+++ openssh-6.1p1/sshd_config.5 2012-09-14 21:08:17.073496952 +0200
149@@ -618,6 +618,10 @@ Specifies whether to automatically destr
852f4e06
SS
150 file on logout.
151 The default is
152 .Dq yes .
153+.It Cm KerberosUseKuserok
154+Specifies whether to look at .k5login file for user's aliases.
155+The default is
156+.Dq yes .
157 .It Cm KexAlgorithms
158 Specifies the available KEX (Key Exchange) algorithms.
159 Multiple algorithms must be comma-separated.
43c69e28 160@@ -767,6 +771,7 @@ Available keywords are
852f4e06
SS
161 .Cm HostbasedUsesNameFromPacketOnly ,
162 .Cm KbdInteractiveAuthentication ,
163 .Cm KerberosAuthentication ,
164+.Cm KerberosUseKuserok ,
165 .Cm MaxAuthTries ,
166 .Cm MaxSessions ,
167 .Cm PubkeyAuthentication ,