]> git.ipfire.org Git - people/ms/ipfire-3.x.git/blame - openssh/patches/openssh-5.9p1-kuserok.patch
openssh: Update to 5.9p1.
[people/ms/ipfire-3.x.git] / openssh / patches / openssh-5.9p1-kuserok.patch
CommitLineData
9d8fd3ad
SS
1diff -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
852f4e06
SS
4@@ -54,6 +54,20 @@
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 {
25@@ -146,7 +160,7 @@ auth_krb5_password(Authctxt *authctxt, c
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 }
9d8fd3ad
SS
34diff -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
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
SS
53 luser, (char *)client->displayname.value);
54diff -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
852f4e06
SS
58 options->authorized_principals_file = NULL;
59 options->ip_qos_interactive = -1;
60 options->ip_qos_bulk = -1;
61+ options->use_kuserok = -1;
62 }
63
64 void
65@@ -291,6 +292,8 @@ fill_default_server_options(ServerOption
9d8fd3ad
SS
66 options->ip_qos_bulk = IPTOS_THROUGHPUT;
67 if (options->show_patchlevel == -1)
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)
74@@ -317,7 +320,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,
9d8fd3ad 83@@ -388,11 +391,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 },
9d8fd3ad 97@@ -1371,6 +1376,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')
9d8fd3ad 108@@ -1580,6 +1589,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();
116@@ -1816,6 +1826,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);
9d8fd3ad
SS
124diff -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 {
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;
9d8fd3ad
SS
135diff -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
852f4e06
SS
139 file on logout.
140 The default is
141 .Dq yes .
142+.It Cm KerberosUseKuserok
143+Specifies whether to look at .k5login file for user's aliases.
144+The default is
145+.Dq yes .
146 .It Cm KexAlgorithms
147 Specifies the available KEX (Key Exchange) algorithms.
148 Multiple algorithms must be comma-separated.
9d8fd3ad 149@@ -746,6 +750,7 @@ Available keywords are
852f4e06
SS
150 .Cm HostbasedUsesNameFromPacketOnly ,
151 .Cm KbdInteractiveAuthentication ,
152 .Cm KerberosAuthentication ,
153+.Cm KerberosUseKuserok ,
154 .Cm MaxAuthTries ,
155 .Cm MaxSessions ,
156 .Cm PubkeyAuthentication ,
9d8fd3ad
SS
157diff -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
852f4e06
SS
161 #KerberosOrLocalPasswd yes
162 #KerberosTicketCleanup yes
163 #KerberosGetAFSToken no
164+#KerberosUseKuserok yes
165
166 # GSSAPI options
167 #GSSAPIAuthentication no