Lines Matching refs:authctxt
55 Authctxt *authctxt = (Authctxt *)context; in krb5_init() local
59 if (authctxt->krb5_ctx == NULL) { in krb5_init()
60 problem = krb5_init_context(&authctxt->krb5_ctx); in krb5_init()
63 krb5_init_ets(authctxt->krb5_ctx); in krb5_init()
66 fatal_add_cleanup(krb5_cleanup_proc, authctxt); in krb5_init()
78 auth_krb5(Authctxt *authctxt, krb5_data *auth, char **client, krb5_data *reply) in auth_krb5() argument
90 problem = krb5_init(authctxt); in auth_krb5()
94 problem = krb5_auth_con_init(authctxt->krb5_ctx, in auth_krb5()
95 &authctxt->krb5_auth_ctx); in auth_krb5()
101 problem = krb5_auth_con_setaddrs_from_fd(authctxt->krb5_ctx, in auth_krb5()
102 authctxt->krb5_auth_ctx, &fd); in auth_krb5()
104 problem = krb5_auth_con_genaddrs(authctxt->krb5_ctx, in auth_krb5()
105 authctxt->krb5_auth_ctx,fd, in auth_krb5()
112 problem = krb5_sname_to_principal(authctxt->krb5_ctx, NULL, NULL , in auth_krb5()
117 problem = krb5_rd_req(authctxt->krb5_ctx, &authctxt->krb5_auth_ctx, in auth_krb5()
123 problem = krb5_copy_principal(authctxt->krb5_ctx, ticket->client, in auth_krb5()
124 &authctxt->krb5_user); in auth_krb5()
126 problem = krb5_copy_principal(authctxt->krb5_ctx, in auth_krb5()
128 &authctxt->krb5_user); in auth_krb5()
134 problem = krb5_mk_rep(authctxt->krb5_ctx, authctxt->krb5_auth_ctx, in auth_krb5()
140 if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, in auth_krb5()
141 authctxt->pw->pw_name)) in auth_krb5()
145 krb5_unparse_name(authctxt->krb5_ctx, authctxt->krb5_user, in auth_krb5()
151 krb5_free_principal(authctxt->krb5_ctx, server); in auth_krb5()
153 krb5_free_ticket(authctxt->krb5_ctx, ticket); in auth_krb5()
160 if (authctxt->krb5_ctx != NULL) in auth_krb5()
162 krb5_get_err_text(authctxt->krb5_ctx, problem)); in auth_krb5()
172 auth_krb5_tgt(Authctxt *authctxt, krb5_data *tgt) in auth_krb5_tgt() argument
179 if (authctxt->pw == NULL || authctxt->krb5_user == NULL) in auth_krb5_tgt()
182 temporarily_use_uid(authctxt->pw); in auth_krb5_tgt()
185 problem = krb5_cc_gen_new(authctxt->krb5_ctx, &krb5_fcc_ops, &ccache); in auth_krb5_tgt()
205 problem = krb5_cc_resolve(authctxt->krb5_ctx, ccname, &ccache); in auth_krb5_tgt()
211 problem = krb5_cc_initialize(authctxt->krb5_ctx, ccache, in auth_krb5_tgt()
212 authctxt->krb5_user); in auth_krb5_tgt()
217 problem = krb5_rd_cred2(authctxt->krb5_ctx, authctxt->krb5_auth_ctx, in auth_krb5_tgt()
222 problem = krb5_rd_cred(authctxt->krb5_ctx, authctxt->krb5_auth_ctx, in auth_krb5_tgt()
226 problem = krb5_cc_store_cred(authctxt->krb5_ctx, ccache, *creds); in auth_krb5_tgt()
231 authctxt->krb5_fwd_ccache = ccache; in auth_krb5_tgt()
234 …authctxt->krb5_ticket_file = (char *)krb5_cc_get_name(authctxt->krb5_ctx, authctxt->krb5_fwd_ccach… in auth_krb5_tgt()
236 problem = krb5_unparse_name(authctxt->krb5_ctx, authctxt->krb5_user, in auth_krb5_tgt()
250 krb5_get_err_text(authctxt->krb5_ctx, problem)); in auth_krb5_tgt()
252 krb5_cc_destroy(authctxt->krb5_ctx, ccache); in auth_krb5_tgt()
260 auth_krb5_password(Authctxt *authctxt, const char *password) in auth_krb5_password() argument
270 if (authctxt->pw == NULL) in auth_krb5_password()
273 temporarily_use_uid(authctxt->pw); in auth_krb5_password()
275 problem = krb5_init(authctxt); in auth_krb5_password()
279 problem = krb5_parse_name(authctxt->krb5_ctx, authctxt->pw->pw_name, in auth_krb5_password()
280 &authctxt->krb5_user); in auth_krb5_password()
285 problem = krb5_cc_gen_new(authctxt->krb5_ctx, &krb5_mcc_ops, in auth_krb5_password()
286 &authctxt->krb5_fwd_ccache); in auth_krb5_password()
290 problem = krb5_cc_initialize(authctxt->krb5_ctx, in auth_krb5_password()
291 authctxt->krb5_fwd_ccache, authctxt->krb5_user); in auth_krb5_password()
296 problem = krb5_verify_user(authctxt->krb5_ctx, authctxt->krb5_user, in auth_krb5_password()
297 authctxt->krb5_fwd_ccache, password, 1, NULL); in auth_krb5_password()
298 temporarily_use_uid(authctxt->pw); in auth_krb5_password()
304 problem = krb5_get_init_creds_password(authctxt->krb5_ctx, &creds, in auth_krb5_password()
305 authctxt->krb5_user, (char *)password, NULL, NULL, 0, NULL, NULL); in auth_krb5_password()
309 problem = krb5_sname_to_principal(authctxt->krb5_ctx, NULL, NULL, in auth_krb5_password()
315 problem = krb5_verify_init_creds(authctxt->krb5_ctx, &creds, server, in auth_krb5_password()
317 krb5_free_principal(authctxt->krb5_ctx, server); in auth_krb5_password()
318 temporarily_use_uid(authctxt->pw); in auth_krb5_password()
322 if (!krb5_kuserok(authctxt->krb5_ctx, authctxt->krb5_user, in auth_krb5_password()
323 authctxt->pw->pw_name)) { in auth_krb5_password()
344 problem = krb5_cc_resolve(authctxt->krb5_ctx, ccname, &authctxt->krb5_fwd_ccache); in auth_krb5_password()
348 problem = krb5_cc_initialize(authctxt->krb5_ctx, authctxt->krb5_fwd_ccache, in auth_krb5_password()
349 authctxt->krb5_user); in auth_krb5_password()
353 problem= krb5_cc_store_cred(authctxt->krb5_ctx, authctxt->krb5_fwd_ccache, in auth_krb5_password()
359 …authctxt->krb5_ticket_file = (char *)krb5_cc_get_name(authctxt->krb5_ctx, authctxt->krb5_fwd_ccach… in auth_krb5_password()
365 if (authctxt->krb5_ctx != NULL && problem!=-1) in auth_krb5_password()
367 krb5_get_err_text(authctxt->krb5_ctx, problem)); in auth_krb5_password()
372 krb5_cleanup_proc(authctxt); in auth_krb5_password()
385 Authctxt *authctxt = (Authctxt *)context; in krb5_cleanup_proc() local
388 if (authctxt->krb5_fwd_ccache) { in krb5_cleanup_proc()
389 krb5_cc_destroy(authctxt->krb5_ctx, authctxt->krb5_fwd_ccache); in krb5_cleanup_proc()
390 authctxt->krb5_fwd_ccache = NULL; in krb5_cleanup_proc()
392 if (authctxt->krb5_user) { in krb5_cleanup_proc()
393 krb5_free_principal(authctxt->krb5_ctx, authctxt->krb5_user); in krb5_cleanup_proc()
394 authctxt->krb5_user = NULL; in krb5_cleanup_proc()
396 if (authctxt->krb5_auth_ctx) { in krb5_cleanup_proc()
397 krb5_auth_con_free(authctxt->krb5_ctx, in krb5_cleanup_proc()
398 authctxt->krb5_auth_ctx); in krb5_cleanup_proc()
399 authctxt->krb5_auth_ctx = NULL; in krb5_cleanup_proc()
401 if (authctxt->krb5_ctx) { in krb5_cleanup_proc()
402 krb5_free_context(authctxt->krb5_ctx); in krb5_cleanup_proc()
403 authctxt->krb5_ctx = NULL; in krb5_cleanup_proc()