View | Details | Raw Unified | Return to bug 1583 | Differences between
and this patch

Collapse All | Expand All

(-)auth-krb5.c (+38 lines)
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 77-94 Link Here
77
#endif
81
#endif
78
	krb5_error_code problem;
82
	krb5_error_code problem;
79
	krb5_ccache ccache = NULL;
83
	krb5_ccache ccache = NULL;
80
	int len;
84
	int len;
81
85
86
#ifdef _AIX
87
	len = 1;
88
	char *authdomain = NULL;
89
	char *authname = NULL;
90
	setuserdb(S_READ);
91
	getuserattr(authctxt->pw->pw_name, S_AUTHDOMAIN, &authdomain, SEC_CHAR);
92
	getuserattr(authctxt->pw->pw_name, S_AUTHNAME, &authname, SEC_CHAR);
93
	enduserdb();
94
95
	if (authname)
96
		len += strlen(authname);
97
	else
98
		len += strlen(authctxt->pw->pw_name);
99
100
	if (authdomain)
101
		len += (strlen(authdomain) + 1);
102
103
	char *client = xmalloc(len);
104
	if (authname)
105
		strcpy(client,authname);
106
	else
107
		strcpy(client,authctxt->pw->pw_name);
108
109
	if (authdomain) {
110
		strcat(client,"@");
111
		strcat(client,authdomain);
112
	}
113
#endif /* _AIX */
82
	temporarily_use_uid(authctxt->pw);
114
	temporarily_use_uid(authctxt->pw);
83
115
84
	problem = krb5_init(authctxt);
116
	problem = krb5_init(authctxt);
85
	if (problem)
117
	if (problem)
86
		goto out;
118
		goto out;
87
119
120
#ifdef _AIX
121
	problem = krb5_parse_name(authctxt->krb5_ctx, client,
122
		    &authctxt->krb5_user);
123
	xfree(client);
124
#else
88
	problem = krb5_parse_name(authctxt->krb5_ctx, authctxt->pw->pw_name,
125
	problem = krb5_parse_name(authctxt->krb5_ctx, authctxt->pw->pw_name,
89
		    &authctxt->krb5_user);
126
		    &authctxt->krb5_user);
127
#endif /* _AIX */
90
	if (problem)
128
	if (problem)
91
		goto out;
129
		goto out;
92
130
93
#ifdef HEIMDAL
131
#ifdef HEIMDAL
94
	problem = krb5_cc_gen_new(authctxt->krb5_ctx, &krb5_mcc_ops, &ccache);
132
	problem = krb5_cc_gen_new(authctxt->krb5_ctx, &krb5_mcc_ops, &ccache);

Return to bug 1583