gss: fix import/export of accumulating contexts

gss_{import,export}_sec_context did not work with partially accumulating
contexts, where the initial context token had not been completely accumulated,

Further, in gss_import_sec_context(), ctx->gc_input.value was not allocated to
a buffer sufficiently large to accumulate the target length.
This commit is contained in:
Luke Howard
2021-08-08 14:45:13 +10:00
parent 3b1f9f0a3f
commit 06232dfcce
4 changed files with 64 additions and 74 deletions

View File

@@ -279,10 +279,13 @@ loop(gss_OID mechoid,
gsskrb5_get_time_offset(&client_time_offset);
gsskrb5_set_time_offset(server_time_offset);
tmp.length = output_token.length - offset;
if (token_split && tmp.length > token_split)
tmp.length = token_split;
tmp.value = (char *)output_token.value + offset;
if (output_token.length && ((uint8_t *)output_token.value)[0] == 0x60) {
tmp.length = output_token.length - offset;
if (token_split && tmp.length > token_split)
tmp.length = token_split;
tmp.value = (char *)output_token.value + offset;
} else
tmp = output_token;
if (verbose_flag)
printf("loop #%d: accept offset=%zu len=%zu\n", num_loops,