Skip to content

Commit

Permalink
fix anon auth
Browse files Browse the repository at this point in the history
  • Loading branch information
bdodge committed Sep 30, 2024
1 parent 4f66b7a commit 660d3af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions lib/libsmb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions lib/ntlmssp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 660d3af

Please sign in to comment.