X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/42af6a672d16302ee1b8971a7cc164120f7572ab..53e66fad5465e72c7231ff4af272ab584dd33f1a:/windows/wingss.c diff --git a/windows/wingss.c b/windows/wingss.c index 5125a3a7..742106e8 100644 --- a/windows/wingss.c +++ b/windows/wingss.c @@ -1,8 +1,10 @@ #ifndef NO_GSSAPI -#include +#include "putty.h" + #define SECURITY_WIN32 #include + #include "sshgss.h" #include "misc.h" @@ -96,6 +98,7 @@ Ssh_gss_stat ssh_gss_import_name(char *host, Ssh_gss_name *srv_name) Ssh_gss_stat ssh_gss_acquire_cred(Ssh_gss_ctx *ctx) { winSsh_gss_ctx *winctx = snew(winSsh_gss_ctx); + memset(winctx, 0, sizeof(winSsh_gss_ctx)); /* prepare our "wrapper" structure */ winctx->maj_stat = winctx->min_stat = SEC_E_OK; @@ -128,8 +131,8 @@ Ssh_gss_stat ssh_gss_init_sec_context(Ssh_gss_ctx *ctx, Ssh_gss_buf *send_tok) { winSsh_gss_ctx *winctx = (winSsh_gss_ctx *) *ctx; - SecBuffer wsend_tok = {send_tok->len,SECBUFFER_TOKEN,send_tok->data}; - SecBuffer wrecv_tok = {recv_tok->len,SECBUFFER_TOKEN,recv_tok->data}; + SecBuffer wsend_tok = {send_tok->length,SECBUFFER_TOKEN,send_tok->value}; + SecBuffer wrecv_tok = {recv_tok->length,SECBUFFER_TOKEN,recv_tok->value}; SecBufferDesc output_desc={SECBUFFER_VERSION,1,&wsend_tok}; SecBufferDesc input_desc ={SECBUFFER_VERSION,1,&wrecv_tok}; unsigned long flags=ISC_REQ_MUTUAL_AUTH|ISC_REQ_REPLAY_DETECT| @@ -153,8 +156,8 @@ Ssh_gss_stat ssh_gss_init_sec_context(Ssh_gss_ctx *ctx, /* prepare for the next round */ winctx->context_handle = &winctx->context; - send_tok->data = (char*) wsend_tok.pvBuffer; - send_tok->len = wsend_tok.cbBuffer; + send_tok->value = wsend_tok.pvBuffer; + send_tok->length = wsend_tok.cbBuffer; /* check & return our status */ if (winctx->maj_stat==SEC_E_OK) return SSH_GSS_S_COMPLETE; @@ -169,8 +172,8 @@ Ssh_gss_stat ssh_gss_free_tok(Ssh_gss_buf *send_tok) if (send_tok == NULL) return SSH_GSS_FAILURE; /* free Windows buffer */ - p_FreeContextBuffer(send_tok->data); - send_tok->len = 0; send_tok->data = NULL; + p_FreeContextBuffer(send_tok->value); + SSH_GSS_CLEAR_BUF(send_tok); return SSH_GSS_OK; } @@ -249,8 +252,8 @@ Ssh_gss_stat ssh_gss_display_status(Ssh_gss_ctx ctx, Ssh_gss_buf *buf) break; } - buf->data = dupstr(msg); - buf->len = strlen(buf->data); + buf->value = dupstr(msg); + buf->length = strlen(buf->value); return SSH_GSS_OK; } @@ -281,8 +284,8 @@ Ssh_gss_stat ssh_gss_get_mic(Ssh_gss_ctx ctx, Ssh_gss_buf *buf, InputBufferDescriptor.pBuffers = InputSecurityToken; InputBufferDescriptor.ulVersion = SECBUFFER_VERSION; InputSecurityToken[0].BufferType = SECBUFFER_DATA; - InputSecurityToken[0].cbBuffer = buf->len; - InputSecurityToken[0].pvBuffer = buf->data; + InputSecurityToken[0].cbBuffer = buf->length; + InputSecurityToken[0].pvBuffer = buf->value; InputSecurityToken[1].BufferType = SECBUFFER_TOKEN; InputSecurityToken[1].cbBuffer = ContextSizes.cbMaxSignature; InputSecurityToken[1].pvBuffer = snewn(ContextSizes.cbMaxSignature, char); @@ -293,8 +296,8 @@ Ssh_gss_stat ssh_gss_get_mic(Ssh_gss_ctx ctx, Ssh_gss_buf *buf, 0); if (winctx->maj_stat == SEC_E_OK) { - hash->len = InputSecurityToken[1].cbBuffer; - hash->data = InputSecurityToken[1].pvBuffer; + hash->length = InputSecurityToken[1].cbBuffer; + hash->value = InputSecurityToken[1].pvBuffer; } return winctx->maj_stat; @@ -302,7 +305,7 @@ Ssh_gss_stat ssh_gss_get_mic(Ssh_gss_ctx ctx, Ssh_gss_buf *buf, Ssh_gss_stat ssh_gss_free_mic(Ssh_gss_buf *hash) { - sfree(hash->data); + sfree(hash->value); return SSH_GSS_OK; }