6 actx_copy_addr(context, inad, outad)
8 const krb5_address *inad;
13 if (!(tmpad = (krb5_address *)malloc(sizeof(*tmpad))))
15 #ifdef HAVE_C_STRUCTURE_ASSIGNMENT
18 memcpy(tmpad, inad, sizeof(krb5_address));
20 if (!(tmpad->contents = (krb5_octet *)malloc(inad->length))) {
24 memcpy((char *)tmpad->contents, (char *)inad->contents, inad->length);
30 krb5_auth_con_init(context, auth_context)
32 krb5_auth_context * auth_context;
35 (krb5_auth_context)malloc(sizeof(struct _krb5_auth_context));
39 memset(*auth_context, 0, sizeof(struct _krb5_auth_context));
41 /* Default flags, do time not seq */
42 (*auth_context)->auth_context_flags =
43 KRB5_AUTH_CONTEXT_DO_TIME | KRB5_AUTH_CONN_INITIALIZED;
45 (*auth_context)->cksumtype = CKSUMTYPE_RSA_MD4_DES;
46 /* (*auth_context)->cksumtype = CKSUMTYPE_CRC32; */
47 (*auth_context)->magic = KV5M_AUTH_CONTEXT;
52 krb5_auth_con_free(context, auth_context)
54 krb5_auth_context auth_context;
56 if (auth_context->local_addr)
57 krb5_free_address(context, auth_context->local_addr);
58 if (auth_context->remote_addr)
59 krb5_free_address(context, auth_context->remote_addr);
60 if (auth_context->local_port)
61 krb5_free_address(context, auth_context->local_port);
62 if (auth_context->remote_port)
63 krb5_free_address(context, auth_context->remote_port);
64 if (auth_context->authentp)
65 krb5_free_authenticator(context, auth_context->authentp);
66 if (auth_context->keyblock)
67 krb5_free_keyblock(context, auth_context->keyblock);
68 if (auth_context->local_subkey)
69 krb5_free_keyblock(context, auth_context->local_subkey);
70 if (auth_context->remote_subkey)
71 krb5_free_keyblock(context, auth_context->remote_subkey);
72 if (auth_context->rcache)
73 krb5_rc_close(context, auth_context->rcache);
79 krb5_auth_con_setaddrs(context, auth_context, local_addr, remote_addr)
81 krb5_auth_context auth_context;
82 krb5_address * local_addr;
83 krb5_address * remote_addr;
85 krb5_error_code retval;
87 /* Free old addresses */
88 if (auth_context->local_addr)
89 (void) krb5_free_address(context, auth_context->local_addr);
90 if (auth_context->remote_addr)
91 (void) krb5_free_address(context, auth_context->remote_addr);
95 retval = actx_copy_addr(context,
97 &auth_context->local_addr);
99 auth_context->local_addr = NULL;
101 if (!retval && remote_addr)
102 retval = actx_copy_addr(context,
104 &auth_context->remote_addr);
106 auth_context->remote_addr = NULL;
112 krb5_auth_con_getaddrs(context, auth_context, local_addr, remote_addr)
113 krb5_context context;
114 krb5_auth_context auth_context;
115 krb5_address ** local_addr;
116 krb5_address ** remote_addr;
118 krb5_error_code retval;
121 if (local_addr && auth_context->local_addr) {
122 retval = actx_copy_addr(context,
123 auth_context->local_addr,
126 if (!retval && (remote_addr) && auth_context->remote_addr) {
127 retval = actx_copy_addr(context,
128 auth_context->remote_addr,
135 krb5_auth_con_setports(context, auth_context, local_port, remote_port)
136 krb5_context context;
137 krb5_auth_context auth_context;
138 krb5_address * local_port;
139 krb5_address * remote_port;
141 krb5_error_code retval;
143 /* Free old addresses */
144 if (auth_context->local_port)
145 (void) krb5_free_address(context, auth_context->local_port);
146 if (auth_context->remote_port)
147 (void) krb5_free_address(context, auth_context->remote_port);
151 retval = actx_copy_addr(context,
153 &auth_context->local_port);
155 auth_context->local_port = NULL;
157 if (!retval && remote_port)
158 retval = actx_copy_addr(context,
160 &auth_context->remote_port);
162 auth_context->remote_port = NULL;
169 * This function overloads the keyblock field. It is only useful prior to
170 * a krb5_rd_req_decode() call for user to user authentication where the
171 * server has the key and needs to use it to decrypt the incoming request.
172 * Once decrypted this key is no longer necessary and is then overwritten
173 * with the session key sent by the client.
176 krb5_auth_con_setuseruserkey(context, auth_context, keyblock)
177 krb5_context context;
178 krb5_auth_context auth_context;
179 krb5_keyblock * keyblock;
181 if (auth_context->keyblock)
182 krb5_free_keyblock(context, auth_context->keyblock);
183 return(krb5_copy_keyblock(context, keyblock, &(auth_context->keyblock)));
187 krb5_auth_con_getkey(context, auth_context, keyblock)
188 krb5_context context;
189 krb5_auth_context auth_context;
190 krb5_keyblock ** keyblock;
192 if (auth_context->keyblock)
193 return krb5_copy_keyblock(context, auth_context->keyblock, keyblock);
199 krb5_auth_con_getlocalsubkey(context, auth_context, keyblock)
200 krb5_context context;
201 krb5_auth_context auth_context;
202 krb5_keyblock ** keyblock;
204 if (auth_context->local_subkey)
205 return krb5_copy_keyblock(context,auth_context->local_subkey,keyblock);
211 krb5_auth_con_getremotesubkey(context, auth_context, keyblock)
212 krb5_context context;
213 krb5_auth_context auth_context;
214 krb5_keyblock ** keyblock;
216 if (auth_context->remote_subkey)
217 return krb5_copy_keyblock(context,auth_context->remote_subkey,keyblock);
223 krb5_auth_con_setcksumtype(context, auth_context, cksumtype)
224 krb5_context context;
225 krb5_auth_context auth_context;
226 krb5_cksumtype cksumtype;
228 auth_context->cksumtype = cksumtype;
233 krb5_auth_con_getlocalseqnumber(context, auth_context, seqnumber)
234 krb5_context context;
235 krb5_auth_context auth_context;
236 krb5_int32 * seqnumber;
238 *seqnumber = auth_context->local_seq_number;
243 krb5_auth_con_getauthenticator(context, auth_context, authenticator)
244 krb5_context context;
245 krb5_auth_context auth_context;
246 krb5_authenticator ** authenticator;
248 return (krb5_copy_authenticator(context, auth_context->authentp,
253 krb5_auth_con_getremoteseqnumber(context, auth_context, seqnumber)
254 krb5_context context;
255 krb5_auth_context auth_context;
256 krb5_int32 * seqnumber;
258 *seqnumber = auth_context->remote_seq_number;
263 krb5_auth_con_initivector(context, auth_context)
264 krb5_context context;
265 krb5_auth_context auth_context;
267 if (auth_context->keyblock) {
268 int size = krb5_keytype_array[auth_context->keyblock->keytype]->
269 system->block_length;
271 if ((auth_context->i_vector = (krb5_pointer)malloc(size))) {
272 memset(auth_context->i_vector, 0, size);
277 return EINVAL; /* XXX need an error for no keyblock */
281 krb5_auth_con_setivector(context, auth_context, ivector)
282 krb5_context context;
283 krb5_auth_context auth_context;
284 krb5_pointer ivector;
286 auth_context->i_vector = ivector;
291 krb5_auth_con_getivector(context, auth_context, ivector)
292 krb5_context context;
293 krb5_auth_context auth_context;
294 krb5_pointer * ivector;
296 *ivector = auth_context->i_vector;
301 krb5_auth_con_setflags(context, auth_context, flags)
302 krb5_context context;
303 krb5_auth_context auth_context;
306 auth_context->auth_context_flags = flags;
311 krb5_auth_con_getflags(context, auth_context, flags)
312 krb5_context context;
313 krb5_auth_context auth_context;
316 *flags = auth_context->auth_context_flags;
321 krb5_auth_con_setrcache(context, auth_context, rcache)
322 krb5_context context;
323 krb5_auth_context auth_context;
326 auth_context->rcache = rcache;
331 krb5_auth_con_getrcache(context, auth_context, rcache)
332 krb5_context context;
333 krb5_auth_context auth_context;
334 krb5_rcache * rcache;
336 *rcache = auth_context->rcache;