Skip to content

Commit

Permalink
Fix: win_cmd_exec: add domain name to realm whe nusername doesn't con…
Browse files Browse the repository at this point in the history
…tain one
  • Loading branch information
nichtsfrei committed Dec 4, 2024
1 parent a5da07e commit 660bde6
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions nasl/nasl_smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,15 @@ nasl_win_cmd_exec (lex_ctxt *lexic)
/* wmiexec.py uses domain/username format. */
if ((c = strchr (username, '\\')))
*c = '/';
// if no / or \ is found, add realm to username?
snprintf (target, sizeof (target), "%s:%s@%s", username, password, host);
if (strchr (username, '/') == NULL)
{
snprintf (target, sizeof (target), "%s/%s:%s@%s", realm, username,
password, host);
}
else
{
snprintf (target, sizeof (target), "%s:%s@%s", username, password, host);
}
if (calculate_host)
g_free (host);

Expand Down

0 comments on commit 660bde6

Please sign in to comment.