summaryrefslogtreecommitdiff
path: root/openbsd-compat/port-aix.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 /openbsd-compat/port-aix.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 'openbsd-compat/port-aix.c')
-rw-r--r--openbsd-compat/port-aix.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/openbsd-compat/port-aix.c b/openbsd-compat/port-aix.c
index d9c0876f3..0bdefbf6d 100644
--- a/openbsd-compat/port-aix.c
+++ b/openbsd-compat/port-aix.c
@@ -374,6 +374,31 @@ aix_restoreauthdb(void)
374 374
375# endif /* WITH_AIXAUTHENTICATE */ 375# endif /* WITH_AIXAUTHENTICATE */
376 376
377# ifdef USE_AIX_KRB_NAME
378/*
379 * aix_krb5_get_principal_name: returns the user's kerberos client principal name if
380 * configured, otherwise NULL. Caller must free returned string.
381 */
382char *
383aix_krb5_get_principal_name(char *pw_name)
384{
385 char *authname = NULL, *authdomain = NULL, *principal = NULL;
386
387 setuserdb(S_READ);
388 if (getuserattr(pw_name, S_AUTHDOMAIN, &authdomain, SEC_CHAR) != 0)
389 debug("AIX getuserattr S_AUTHDOMAIN: %s", strerror(errno));
390 if (getuserattr(pw_name, S_AUTHNAME, &authname, SEC_CHAR) != 0)
391 debug("AIX getuserattr S_AUTHNAME: %s", strerror(errno));
392
393 if (authdomain != NULL)
394 xasprintf(&principal, "%s@%s", authname ? authname : pw_name, authdomain);
395 else if (authname != NULL)
396 principal = xstrdup(authname);
397 enduserdb();
398 return principal;
399}
400# endif /* USE_AIX_KRB_NAME */
401
377# if defined(AIX_GETNAMEINFO_HACK) && !defined(BROKEN_ADDRINFO) 402# if defined(AIX_GETNAMEINFO_HACK) && !defined(BROKEN_ADDRINFO)
378# undef getnameinfo 403# undef getnameinfo
379/* 404/*