Lines Matching +full:per +full:- +full:context

1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
28 * krb5_set_password - Implements set password per RFC 3244
34 #include "k5-int.h"
35 #include "fake-addrinfo.h"
36 #include "os-proto.h"
38 #include "../krb/int-proto.h"
48 krb5_context context; member
61 locate_kpasswd(krb5_context context, const krb5_data *realm, in locate_kpasswd() argument
66 code = k5_locate_server(context, realm, serverlist, locate_service_kpasswd, in locate_kpasswd()
69 code = k5_locate_server(context, realm, serverlist, in locate_kpasswd()
75 for (i = 0; i < serverlist->nservers; i++) { in locate_kpasswd()
76 struct server_entry *s = &serverlist->servers[i]; in locate_kpasswd()
78 if (s->transport == TCP) in locate_kpasswd()
79 s->transport = TCP_OR_UDP; in locate_kpasswd()
80 if (s->hostname != NULL) in locate_kpasswd()
81 s->port = DEFAULT_KPASSWD_PORT; in locate_kpasswd()
82 else if (s->family == AF_INET) in locate_kpasswd()
83 ss2sin(&s->addr)->sin_port = htons(DEFAULT_KPASSWD_PORT); in locate_kpasswd()
84 else if (s->family == AF_INET6) in locate_kpasswd()
85 ss2sin6(&s->addr)->sin6_port = htons(DEFAULT_KPASSWD_PORT); in locate_kpasswd()
105 krb5_free_data_contents(ctx->context, message); in kpasswd_sendto_msg_cleanup()
132 /* some brain-dead OS's don't return useful information from in kpasswd_sendto_msg_callback()
136 ss2sin(&local_addr)->sin_addr.s_addr != 0) { in kpasswd_sendto_msg_callback()
138 local_kaddr.length = sizeof(ss2sin(&local_addr)->sin_addr); in kpasswd_sendto_msg_callback()
139 local_kaddr.contents = (krb5_octet *) &ss2sin(&local_addr)->sin_addr; in kpasswd_sendto_msg_callback()
141 memcmp(ss2sin6(&local_addr)->sin6_addr.s6_addr, in kpasswd_sendto_msg_callback()
144 local_kaddr.length = sizeof(ss2sin6(&local_addr)->sin6_addr); in kpasswd_sendto_msg_callback()
145 local_kaddr.contents = (krb5_octet *) &ss2sin6(&local_addr)->sin6_addr; in kpasswd_sendto_msg_callback()
153 code = krb5_os_localaddr(ctx->context, &addrs); in kpasswd_sendto_msg_callback()
161 * TBD: Does this tamper w/ the auth context in such a way in kpasswd_sendto_msg_callback()
162 * to break us? Yes - provide 1 per conn-state / host... in kpasswd_sendto_msg_callback()
166 if ((code = krb5_auth_con_setaddrs(ctx->context, ctx->auth_context, in kpasswd_sendto_msg_callback()
170 ctx->auth_context->remote_seq_number = ctx->remote_seq_num; in kpasswd_sendto_msg_callback()
171 ctx->auth_context->local_seq_number = ctx->local_seq_num; in kpasswd_sendto_msg_callback()
173 if (ctx->set_password_for) in kpasswd_sendto_msg_callback()
174 code = krb5int_mk_setpw_req(ctx->context, in kpasswd_sendto_msg_callback()
175 ctx->auth_context, in kpasswd_sendto_msg_callback()
176 &ctx->ap_req, in kpasswd_sendto_msg_callback()
177 ctx->set_password_for, in kpasswd_sendto_msg_callback()
178 ctx->newpw, in kpasswd_sendto_msg_callback()
181 code = krb5int_mk_chpw_req(ctx->context, in kpasswd_sendto_msg_callback()
182 ctx->auth_context, in kpasswd_sendto_msg_callback()
183 &ctx->ap_req, in kpasswd_sendto_msg_callback()
184 ctx->newpw, in kpasswd_sendto_msg_callback()
189 message->length = output.length; in kpasswd_sendto_msg_callback()
190 message->data = output.data; in kpasswd_sendto_msg_callback()
193 krb5_free_addresses(ctx->context, addrs); in kpasswd_sendto_msg_callback()
205 change_set_password(krb5_context context, in change_set_password() argument
226 callback_ctx.context = context; in change_set_password()
230 if ((code = krb5_auth_con_init(callback_ctx.context, in change_set_password()
234 if ((code = krb5_mk_req_extended(callback_ctx.context, in change_set_password()
242 callback_ctx.remote_seq_num = callback_ctx.auth_context->remote_seq_number; in change_set_password()
243 callback_ctx.local_seq_num = callback_ctx.auth_context->local_seq_number; in change_set_password()
245 code = locate_kpasswd(callback_ctx.context, &creds->server->realm, &sl); in change_set_password()
254 krb5_free_data_contents(callback_ctx.context, &chpw_rep); in change_set_password()
258 code = k5_sendto(callback_ctx.context, NULL, &creds->server->realm, in change_set_password()
262 code = k5_sendto(callback_ctx.context, NULL, &creds->server->realm, in change_set_password()
269 code = krb5int_rd_chpw_rep(callback_ctx.context, in change_set_password()
281 code = krb5_chpw_result_code_string(callback_ctx.context, in change_set_password()
287 result_code_string->length = strlen(code_string); in change_set_password()
288 result_code_string->data = malloc(result_code_string->length); in change_set_password()
289 if (result_code_string->data == NULL) { in change_set_password()
293 strncpy(result_code_string->data, code_string, result_code_string->length); in change_set_password()
298 krb5_auth_con_free(callback_ctx.context, callback_ctx.auth_context); in change_set_password()
301 krb5_free_data_contents(callback_ctx.context, &callback_ctx.ap_req); in change_set_password()
302 krb5_free_data_contents(callback_ctx.context, &chpw_rep); in change_set_password()
308 krb5_change_password(krb5_context context, in krb5_change_password() argument
315 return change_set_password(context, creds, newpw, NULL, in krb5_change_password()
320 * krb5_set_password - Implements set password per RFC 3244
325 krb5_set_password(krb5_context context, in krb5_set_password() argument
334 return change_set_password(context, creds, newpw, change_password_for, in krb5_set_password()
339 krb5_set_password_using_ccache(krb5_context context, in krb5_set_password_using_ccache() argument
353 ** get the proper creds for use with krb5_set_password - in krb5_set_password_using_ccache()
357 ** first get the principal for the password service - in krb5_set_password_using_ccache()
359 code = krb5_cc_get_principal (context, ccache, &creds.client); in krb5_set_password_using_ccache()
361 code = krb5_build_principal(context, &creds.server, in krb5_set_password_using_ccache()
362 change_password_for->realm.length, in krb5_set_password_using_ccache()
363 change_password_for->realm.data, in krb5_set_password_using_ccache()
366 code = krb5_get_credentials(context, 0, ccache, &creds, &credsp); in krb5_set_password_using_ccache()
368 code = krb5_set_password(context, credsp, newpw, change_password_for, in krb5_set_password_using_ccache()
371 krb5_free_creds(context, credsp); in krb5_set_password_using_ccache()
374 krb5_free_cred_contents(context, &creds); in krb5_set_password_using_ccache()