6 krb5_auth_con_init(context, auth_context)
8 krb5_auth_context ** auth_context;
10 if (*auth_context = (krb5_auth_context *)malloc(sizeof(krb5_auth_context))){
11 memset(*auth_context, 0, sizeof(krb5_auth_context));
13 /* Default flags, do time not seq */
14 (*auth_context)->auth_context_flags =
15 KRB5_AUTH_CONTEXT_DO_TIME | KRB5_AUTH_CONN_INITIALIZED;
17 (*auth_context)->cksumtype = CKSUMTYPE_RSA_MD4_DES;
18 /* (*auth_context)->cksumtype = CKSUMTYPE_CRC32; */
25 krb5_auth_con_free(context, auth_context)
27 krb5_auth_context * auth_context;
29 if (auth_context->authentp)
30 krb5_free_authenticator(context, auth_context->authentp);
31 if (auth_context->keyblock)
32 krb5_free_keyblock(context, auth_context->keyblock);
33 if (auth_context->local_subkey)
34 krb5_free_keyblock(context, auth_context->local_subkey);
35 if (auth_context->remote_subkey)
36 krb5_free_keyblock(context, auth_context->remote_subkey);
42 krb5_auth_con_setaddrs(context, auth_context, local_addr, remote_addr)
44 krb5_auth_context * auth_context;
45 krb5_address * local_addr;
46 krb5_address * remote_addr;
48 auth_context->remote_addr = remote_addr;
49 auth_context->local_addr = local_addr;
53 /* XXX this call is a hack. Fixed when I do the servers. */
55 krb5_auth_con_setkey(context, auth_context, keyblock)
57 krb5_auth_context * auth_context;
58 krb5_keyblock * keyblock;
60 if (auth_context->keyblock)
61 krb5_free_keyblock(context, auth_context->keyblock);
62 return(krb5_copy_keyblock(context, keyblock, &(auth_context->keyblock)));
66 * This function overloads the keyblock field. It is only useful prior to
67 * a krb5_rd_req_decode() call for user to user authentication where the
68 * server has the key and needs to use it to decrypt the incoming request.
69 * Once decrypted this key is no longer necessary and is then overwritten
70 * with the session key sent by the client.
73 krb5_auth_con_setuseruserkey(context, auth_context, keyblock)
75 krb5_auth_context * auth_context;
76 krb5_keyblock * keyblock;
78 if (auth_context->keyblock)
79 krb5_free_keyblock(context, auth_context->keyblock);
80 return(krb5_copy_keyblock(context, keyblock, &(auth_context->keyblock)));
84 krb5_auth_con_getkey(context, auth_context, keyblock)
86 krb5_auth_context * auth_context;
87 krb5_keyblock ** keyblock;
89 if (auth_context->keyblock)
90 return krb5_copy_keyblock(context, auth_context->keyblock, keyblock);
96 krb5_auth_con_getlocalsubkey(context, auth_context, keyblock)
98 krb5_auth_context * auth_context;
99 krb5_keyblock ** keyblock;
101 if (auth_context->local_subkey)
102 return krb5_copy_keyblock(context,auth_context->local_subkey,keyblock);
108 krb5_auth_con_getremotesubkey(context, auth_context, keyblock)
109 krb5_context context;
110 krb5_auth_context * auth_context;
111 krb5_keyblock ** keyblock;
113 if (auth_context->remote_subkey)
114 return krb5_copy_keyblock(context,auth_context->remote_subkey,keyblock);
120 krb5_auth_con_setcksumtype(context, auth_context, cksumtype)
121 krb5_context context;
122 krb5_auth_context * auth_context;
123 krb5_cksumtype cksumtype;
125 auth_context->cksumtype = cksumtype;
130 krb5_auth_con_getlocalseqnumber(context, auth_context, seqnumber)
131 krb5_context context;
132 krb5_auth_context * auth_context;
133 krb5_int32 * seqnumber;
135 *seqnumber = auth_context->local_seq_number;
140 krb5_auth_con_getauthenticator(context, auth_context, authenticator)
141 krb5_context context;
142 krb5_auth_context * auth_context;
143 krb5_authenticator ** authenticator;
145 return (krb5_copy_authenticator(context, auth_context->authentp,
150 krb5_auth_con_getremoteseqnumber(context, auth_context, seqnumber)
151 krb5_context context;
152 krb5_auth_context * auth_context;
153 krb5_int32 * seqnumber;
155 *seqnumber = auth_context->remote_seq_number;
160 krb5_auth_con_initivector(context, auth_context)
161 krb5_context context;
162 krb5_auth_context * auth_context;
164 if (auth_context->keyblock) {
165 int size = krb5_keytype_array[auth_context->keyblock->keytype]->
166 system->block_length;
168 if (auth_context->i_vector = (krb5_pointer)malloc(size)) {
169 memset(auth_context->i_vector, 0, size);
174 return EINVAL; /* XXX need an error for no keyblock */
178 krb5_auth_con_setivector(context, auth_context, ivector)
179 krb5_context context;
180 krb5_auth_context * auth_context;
181 krb5_pointer ivector;
183 auth_context->i_vector = ivector;
188 krb5_auth_con_getivector(context, auth_context, ivector)
189 krb5_context context;
190 krb5_auth_context * auth_context;
191 krb5_pointer * ivector;
193 *ivector = auth_context->i_vector;
198 krb5_auth_con_setflags(context, auth_context, flags)
199 krb5_context context;
200 krb5_auth_context * auth_context;
203 auth_context->auth_context_flags = flags;
208 krb5_auth_con_setrcache(context, auth_context, rcache)
209 krb5_context context;
210 krb5_auth_context * auth_context;
213 auth_context->rcache = rcache;