|
Lines 50-59
Link Here
|
| 50 |
#include <errno.h> |
50 |
#include <errno.h> |
| 51 |
#include <unistd.h> |
51 |
#include <unistd.h> |
| 52 |
#include <string.h> |
52 |
#include <string.h> |
| 53 |
#include <krb5.h> |
53 |
#include <krb5.h> |
| 54 |
|
54 |
|
|
|
55 |
#ifdef _AIX |
| 56 |
#include <usersec.h> |
| 57 |
#endif /* _AIX */ |
| 58 |
|
| 55 |
extern ServerOptions options; |
59 |
extern ServerOptions options; |
| 56 |
|
60 |
|
| 57 |
static int |
61 |
static int |
| 58 |
krb5_init(void *context) |
62 |
krb5_init(void *context) |
| 59 |
{ |
63 |
{ |
|
Lines 82-94
Link Here
|
| 82 |
temporarily_use_uid(authctxt->pw); |
86 |
temporarily_use_uid(authctxt->pw); |
| 83 |
|
87 |
|
| 84 |
problem = krb5_init(authctxt); |
88 |
problem = krb5_init(authctxt); |
| 85 |
if (problem) |
89 |
if (problem) |
| 86 |
goto out; |
90 |
goto out; |
| 87 |
|
91 |
#ifdef _AIX |
| 88 |
problem = krb5_parse_name(authctxt->krb5_ctx, authctxt->pw->pw_name, |
92 |
char *authdomain = NULL; |
| 89 |
&authctxt->krb5_user); |
93 |
char *authname = NULL; |
|
|
94 |
setuserdb(S_READ); |
| 95 |
getuserattr(authctxt->pw->pw_name, S_AUTHDOMAIN, &authdomain, SEC_CHAR); |
| 96 |
getuserattr(authctxt->pw->pw_name, S_AUTHNAME, &authname, SEC_CHAR); |
| 97 |
len = 1; |
| 98 |
if (authname) |
| 99 |
len += strlen(authname); |
| 100 |
else |
| 101 |
len += strlen(authctxt->pw->pw_name); |
| 102 |
|
| 103 |
if (authdomain) |
| 104 |
len += strlen(authdomain + 1); |
| 105 |
|
| 106 |
char *client = xmalloc(len); |
| 107 |
if (authname) |
| 108 |
strcpy(client,authname); |
| 109 |
else |
| 110 |
strcpy(client,authctxt->pw->pw_name); |
| 111 |
|
| 112 |
if (authdomain) { |
| 113 |
strcat(client,"@"); |
| 114 |
strcat(client,authdomain); |
| 115 |
} |
| 116 |
|
| 117 |
problem = krb5_parse_name(authctxt->krb5_ctx, client, |
| 118 |
&authctxt->krb5_user); |
| 119 |
xfree(client); |
| 120 |
enduserdb(); |
| 121 |
#else |
| 122 |
problem = krb5_parse_name(authctxt->krb5_ctx, authctxt->pw->pw_name, |
| 123 |
&authctxt->krb5_user); |
| 124 |
#endif /* _AIX */ |
| 90 |
if (problem) |
125 |
if (problem) |
| 91 |
goto out; |
126 |
goto out; |
| 92 |
|
127 |
|
| 93 |
#ifdef HEIMDAL |
128 |
#ifdef HEIMDAL |
| 94 |
problem = krb5_cc_gen_new(authctxt->krb5_ctx, &krb5_mcc_ops, &ccache); |
129 |
problem = krb5_cc_gen_new(authctxt->krb5_ctx, &krb5_mcc_ops, &ccache); |