Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pbkdf2 bot linking #1577

Merged
merged 3 commits into from
May 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions src/dcc.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,25 @@ static void dcc_bot_digest(int idx, char *challenge, char *password)
dcc[idx].nick);
}

static char *get_bot_pass(struct userrec *u) {
char *pass2 = get_user(&USERENTRY_PASS2, u);
char *pass = get_user(&USERENTRY_PASS, u);
if (pass2) {
if (!pass) {
pass = pass2;
if (encrypt_pass)
set_user(&USERENTRY_PASS, u, pass);
} else if (strcmp(pass2, pass) && encrypt_pass2)
pass = pass2;
} else if (pass && encrypt_pass2)
set_user(&USERENTRY_PASS2, u, pass);
return pass;
}

static void dcc_bot_new(int idx, char *buf, int x)
{
struct userrec *u = get_user_by_handle(userlist, dcc[idx].nick);
char *code, *pass2 = NULL, *pass = NULL;
char *code, *pass;

if (raw_log) {
if (!strncmp(buf, "s ", 2))
Expand All @@ -376,17 +391,7 @@ static void dcc_bot_new(int idx, char *buf, int x)
/* We entered the wrong password */
putlog(LOG_BOTS, "*", DCC_BADPASS, dcc[idx].nick);
else if (!strcasecmp(code, "passreq")) {
pass2 = get_user(&USERENTRY_PASS2, u);
pass = get_user(&USERENTRY_PASS, u);
if (pass2) {
if (!pass) {
pass = pass2;
if (encrypt_pass)
set_user(&USERENTRY_PASS, u, pass);
} else if (strcmp(pass2, pass) && encrypt_pass2)
pass = pass2;
} else if (pass && encrypt_pass2)
set_user(&USERENTRY_PASS2, u, pass);
pass = get_bot_pass(u);
if (!pass || !strcmp(pass, "-")) {
putlog(LOG_BOTS, "*", DCC_PASSREQ, dcc[idx].nick);
dprintf(idx, "-\n");
Expand Down Expand Up @@ -596,7 +601,7 @@ static int dcc_bot_check_digest(int idx, char *remote_digest)
char digest_string[33]; /* 32 for digest in hex + null */
unsigned char digest[16];
int i, ret;
char *password = get_user(&USERENTRY_PASS, dcc[idx].user);
char *password = get_bot_pass(dcc[idx].user);

if (!password)
return 1;
Expand Down