From 660d3afd4adffa001f7185816b96c5cac05f4652 Mon Sep 17 00:00:00 2001 From: bdodge Date: Mon, 30 Sep 2024 09:21:35 -0400 Subject: [PATCH] fix anon auth --- lib/libsmb2.c | 1 + lib/ntlmssp.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/libsmb2.c b/lib/libsmb2.c index fb82ec95..d58df3f4 100644 --- a/lib/libsmb2.c +++ b/lib/libsmb2.c @@ -3386,6 +3386,7 @@ smb2_negotiate_request_cb(struct smb2_context *smb2, int status, void *command_d memset(&rep, 0, sizeof(rep)); memset(&err, 0, sizeof(err)); + smb2_set_error(smb2, ""); /* negotiate highest version in request dialects */ switch (smb2->version) { diff --git a/lib/ntlmssp.c b/lib/ntlmssp.c index 2119da60..92e0c294 100644 --- a/lib/ntlmssp.c +++ b/lib/ntlmssp.c @@ -169,13 +169,13 @@ ntlmssp_init_context(const char *user, } if (user) { - auth_data->user = strdup(user); + auth_data->user = strdup(user); } if (password) { - auth_data->password = strdup(password); + auth_data->password = strdup(password); } if (domain) { - auth_data->domain = strdup(domain); + auth_data->domain = strdup(domain); } if (workstation) { auth_data->workstation = strdup(workstation); @@ -980,7 +980,7 @@ ntlmssp_authenticate_blob(struct smb2_server *server, struct smb2_context *smb2, } /* if no user/pw, and anonymous allowed, do anonymous */ if (!auth_data->user || (auth_data->user[0] == '\0') || - !auth_data->password || (auth_data->password[0] == '\0')) { + !smb2->password || (smb2->password[0] == '\0')) { if (server->allow_anonymous) { return 0; }