summaryrefslogtreecommitdiff
path: root/auth-krb5.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth-krb5.c')
-rw-r--r--auth-krb5.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/auth-krb5.c b/auth-krb5.c
index 38164fda8..821913382 100644
--- a/auth-krb5.c
+++ b/auth-krb5.c
@@ -78,6 +78,11 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
78 krb5_error_code problem; 78 krb5_error_code problem;
79 krb5_ccache ccache = NULL; 79 krb5_ccache ccache = NULL;
80 int len; 80 int len;
81 char *client, *platform_client;
82
83 /* get platform-specific kerberos client principal name (if it exists) */
84 platform_client = platform_krb5_get_principal_name(authctxt->pw->pw_name);
85 client = platform_client ? platform_client : authctxt->pw->pw_name;
81 86
82 temporarily_use_uid(authctxt->pw); 87 temporarily_use_uid(authctxt->pw);
83 88
@@ -85,7 +90,7 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
85 if (problem) 90 if (problem)
86 goto out; 91 goto out;
87 92
88 problem = krb5_parse_name(authctxt->krb5_ctx, authctxt->pw->pw_name, 93 problem = krb5_parse_name(authctxt->krb5_ctx, client,
89 &authctxt->krb5_user); 94 &authctxt->krb5_user);
90 if (problem) 95 if (problem)
91 goto out; 96 goto out;
@@ -141,8 +146,7 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
141 if (problem) 146 if (problem)
142 goto out; 147 goto out;
143 148
144 if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, 149 if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, client)) {
145 authctxt->pw->pw_name)) {
146 problem = -1; 150 problem = -1;
147 goto out; 151 goto out;
148 } 152 }
@@ -181,6 +185,9 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
181 185
182 out: 186 out:
183 restore_uid(); 187 restore_uid();
188
189 if (platform_client != NULL)
190 xfree(platform_client);
184 191
185 if (problem) { 192 if (problem) {
186 if (ccache) 193 if (ccache)