102
krb5_error_code KRB5_LIB_FUNCTION
103
krb5_build_authenticator (krb5_context context,
104
krb5_auth_context auth_context,
105
krb5_enctype enctype,
108
Authenticator **auth_result,
110
krb5_key_usage usage)
102
KRB5_LIB_FUNCTION krb5_error_code KRB5_LIB_CALL
103
_krb5_build_authenticator (krb5_context context,
104
krb5_auth_context auth_context,
105
krb5_enctype enctype,
109
krb5_key_usage usage)
113
112
u_char *buf = NULL;
116
115
krb5_error_code ret;
117
116
krb5_crypto crypto;
119
auth = calloc(1, sizeof(*auth));
121
krb5_set_error_message(context, ENOMEM, N_("malloc: out of memory", ""));
125
auth->authenticator_vno = 5;
126
copy_Realm(&cred->client->realm, &auth->crealm);
127
copy_PrincipalName(&cred->client->name, &auth->cname);
129
krb5_us_timeofday (context, &auth->ctime, &auth->cusec);
131
ret = krb5_auth_con_getlocalsubkey(context, auth_context, &auth->subkey);
118
memset(&auth, 0, sizeof(auth));
120
auth.authenticator_vno = 5;
121
copy_Realm(&cred->client->realm, &auth.crealm);
122
copy_PrincipalName(&cred->client->name, &auth.cname);
124
krb5_us_timeofday (context, &auth.ctime, &auth.cusec);
126
ret = krb5_auth_con_getlocalsubkey(context, auth_context, &auth.subkey);
137
132
krb5_generate_seq_number (context,
139
134
&auth_context->local_seqnumber);
140
ALLOC(auth->seq_number, 1);
141
if(auth->seq_number == NULL) {
135
ALLOC(auth.seq_number, 1);
136
if(auth.seq_number == NULL) {
145
*auth->seq_number = auth_context->local_seqnumber;
140
*auth.seq_number = auth_context->local_seqnumber;
147
auth->seq_number = NULL;
148
auth->authorization_data = NULL;
142
auth.seq_number = NULL;
143
auth.authorization_data = NULL;
151
if (cksum != NULL && cksum->cksumtype == CKSUMTYPE_GSSAPI) {
153
* This is not GSS-API specific, we only enable it for
156
ret = make_etypelist(context, &auth->authorization_data);
146
ALLOC(auth.cksum, 1);
147
if (auth.cksum == NULL) {
151
ret = copy_Checksum(cksum, auth.cksum);
155
if (auth.cksum->cksumtype == CKSUMTYPE_GSSAPI) {
157
* This is not GSS-API specific, we only enable it for
160
ret = make_etypelist(context, &auth.authorization_data);
161
166
/* XXX - Copy more to auth_context? */
163
auth_context->authenticator->ctime = auth->ctime;
164
auth_context->authenticator->cusec = auth->cusec;
168
auth_context->authenticator->ctime = auth.ctime;
169
auth_context->authenticator->cusec = auth.cusec;
166
ASN1_MALLOC_ENCODE(Authenticator, buf, buf_size, auth, &len, ret);
171
ASN1_MALLOC_ENCODE(Authenticator, buf, buf_size, &auth, &len, ret);
169
174
if(buf_size != len)
192
free_Authenticator (&auth);
191
/* Don't free the `cksum', it's allocated by the caller */
193
free_Authenticator (auth);
198
free_Authenticator (auth);