aboutsummaryrefslogtreecommitdiff
path: root/vendor/gopkg.in/mgo.v2/internal/sasl/sasl_windows.c
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/gopkg.in/mgo.v2/internal/sasl/sasl_windows.c')
-rw-r--r--vendor/gopkg.in/mgo.v2/internal/sasl/sasl_windows.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/vendor/gopkg.in/mgo.v2/internal/sasl/sasl_windows.c b/vendor/gopkg.in/mgo.v2/internal/sasl/sasl_windows.c
index dd6a88a..c359fd6 100644
--- a/vendor/gopkg.in/mgo.v2/internal/sasl/sasl_windows.c
+++ b/vendor/gopkg.in/mgo.v2/internal/sasl/sasl_windows.c
@@ -10,14 +10,18 @@ SECURITY_STATUS SEC_ENTRY sspi_acquire_credentials_handle(CredHandle *cred_handl
auth_identity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI;
auth_identity.User = (LPSTR) username;
auth_identity.UserLength = strlen(username);
- auth_identity.Password = (LPSTR) password;
- auth_identity.PasswordLength = strlen(password);
+ auth_identity.Password = NULL;
+ auth_identity.PasswordLength = 0;
+ if(password){
+ auth_identity.Password = (LPSTR) password;
+ auth_identity.PasswordLength = strlen(password);
+ }
auth_identity.Domain = (LPSTR) domain;
auth_identity.DomainLength = strlen(domain);
return call_sspi_acquire_credentials_handle(NULL, SSPI_PACKAGE_NAME, SECPKG_CRED_OUTBOUND, NULL, &auth_identity, NULL, NULL, cred_handle, &ignored);
}
-int sspi_step(CredHandle *cred_handle, int has_context, CtxtHandle *context, PVOID *buffer, ULONG *buffer_length, char *target)
+int sspi_step(CredHandle *cred_handle, int has_context, CtxtHandle *context, PVOID buffer, ULONG buffer_length, PVOID *out_buffer, ULONG *out_buffer_length, char *target)
{
SecBufferDesc inbuf;
SecBuffer in_bufs[1];
@@ -30,8 +34,8 @@ int sspi_step(CredHandle *cred_handle, int has_context, CtxtHandle *context, PVO
inbuf.ulVersion = SECBUFFER_VERSION;
inbuf.cBuffers = 1;
inbuf.pBuffers = in_bufs;
- in_bufs[0].pvBuffer = *buffer;
- in_bufs[0].cbBuffer = *buffer_length;
+ in_bufs[0].pvBuffer = buffer;
+ in_bufs[0].cbBuffer = buffer_length;
in_bufs[0].BufferType = SECBUFFER_TOKEN;
}
@@ -57,9 +61,9 @@ int sspi_step(CredHandle *cred_handle, int has_context, CtxtHandle *context, PVO
&context_attr,
NULL);
- *buffer = malloc(out_bufs[0].cbBuffer);
- *buffer_length = out_bufs[0].cbBuffer;
- memcpy(*buffer, out_bufs[0].pvBuffer, *buffer_length);
+ *out_buffer = malloc(out_bufs[0].cbBuffer);
+ *out_buffer_length = out_bufs[0].cbBuffer;
+ memcpy(*out_buffer, out_bufs[0].pvBuffer, *out_buffer_length);
return ret;
}