Some support for KRB5_AUTH_CONTEXT_DO_SEQUENCE

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1807 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-06-01 14:37:54 +00:00
parent a44adf98c8
commit 9cb6e5dddc
8 changed files with 81 additions and 9 deletions

View File

@@ -15,6 +15,7 @@ krb5_build_authenticator (krb5_context context,
char buf[1024];
int len;
krb5_error_code ret;
int32_t seq_number;
auth->authenticator_vno = 5;
auth->crealm = malloc(cred->client->realm.length + 1);
@@ -26,7 +27,14 @@ krb5_build_authenticator (krb5_context context,
auth->cusec = tv.tv_usec;
auth->ctime = tv.tv_sec;
auth->subkey = NULL;
auth->seq_number = NULL;
if (auth_context->flags & KRB5_AUTH_CONTEXT_DO_SEQUENCE) {
krb5_generate_seq_number (context,
&cred->session,
&auth_context->local_seqnumber);
auth->seq_number = malloc(sizeof(*auth->seq_number));
*(auth->seq_number) = auth_context->local_seqnumber;
} else
auth->seq_number = NULL;
auth->authorization_data = NULL;
auth->cksum = cksum;
@@ -39,13 +47,15 @@ krb5_build_authenticator (krb5_context context,
memset (buf, 0, sizeof(buf));
len = encode_Authenticator (buf + sizeof(buf) - 1, sizeof(buf), auth);
free (auth->crealm);
ret = krb5_encrypt (context, buf + sizeof(buf) - len, len, &cred->session, result);
if (auth_result)
*auth_result = auth;
else
else {
free (auth->crealm);
free (auth->seq_number);
free (auth);
}
return ret;
}