summaryrefslogtreecommitdiff
path: root/auth-krb5.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2009-12-21 10:49:21 +1100
committerDarren Tucker <dtucker@zip.com.au>2009-12-21 10:49:21 +1100
commit1bf3503c9d5f0c79a108ea0060bcec3e0efe2b37 (patch)
tree8821d5df4418bb67f6cf1c4ab5f01a94cf27fcf0 /auth-krb5.c
parentc8802aac28470714ec204d00342f6ecbca45908f (diff)
- (dtucker) [auth-krb5.c platform.{c,h} openbsd-compat/port-aix.{c,h}]
Bug #1583: Use system's kerberos principal name on AIX if it's available. Based on a patch from and tested by Miguel Sanders.
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 868288126..d019fe202 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 }
@@ -176,6 +180,9 @@ auth_krb5_password(Authctxt *authctxt, const char *password)
176 180
177 out: 181 out:
178 restore_uid(); 182 restore_uid();
183
184 if (platform_client != NULL)
185 xfree(platform_client);
179 186
180 if (problem) { 187 if (problem) {
181 if (ccache) 188 if (ccache)