|
@@ -622,7 +622,7 @@ static void cmd_back(struct userrec *u, int idx, char *par)
|
|
|
|
|
|
|
|
static void cmd_newpass(struct userrec *u, int idx, char *par)
|
|
static void cmd_newpass(struct userrec *u, int idx, char *par)
|
|
|
{
|
|
{
|
|
|
- char *new = NULL, pass[16] = "";
|
|
|
|
|
|
|
+ char *new = NULL, pass[MAXPASSLEN + 1] = "";
|
|
|
|
|
|
|
|
putlog(LOG_CMDS, "*", "#%s# newpass...", dcc[idx].nick);
|
|
putlog(LOG_CMDS, "*", "#%s# newpass...", dcc[idx].nick);
|
|
|
if (!par[0]) {
|
|
if (!par[0]) {
|
|
@@ -632,7 +632,7 @@ static void cmd_newpass(struct userrec *u, int idx, char *par)
|
|
|
new = newsplit(&par);
|
|
new = newsplit(&par);
|
|
|
|
|
|
|
|
if (!strcmp(new, "rand")) {
|
|
if (!strcmp(new, "rand")) {
|
|
|
- make_rand_str(pass, 15);
|
|
|
|
|
|
|
+ make_rand_str(pass, MAXPASSLEN);
|
|
|
} else {
|
|
} else {
|
|
|
if (strlen(new) < 6) {
|
|
if (strlen(new) < 6) {
|
|
|
dprintf(idx, "Please use at least 6 characters.\n");
|
|
dprintf(idx, "Please use at least 6 characters.\n");
|
|
@@ -641,8 +641,8 @@ static void cmd_newpass(struct userrec *u, int idx, char *par)
|
|
|
egg_snprintf(pass, sizeof pass, "%s", new);
|
|
egg_snprintf(pass, sizeof pass, "%s", new);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (strlen(pass) > 15)
|
|
|
|
|
- pass[15] = 0;
|
|
|
|
|
|
|
+ if (strlen(pass) > MAXPASSLEN)
|
|
|
|
|
+ pass[MAXPASSLEN] = 0;
|
|
|
|
|
|
|
|
if (!goodpass(pass, idx, NULL))
|
|
if (!goodpass(pass, idx, NULL))
|
|
|
return;
|
|
return;
|
|
@@ -656,7 +656,7 @@ static void cmd_newpass(struct userrec *u, int idx, char *par)
|
|
|
|
|
|
|
|
static void cmd_secpass(struct userrec *u, int idx, char *par)
|
|
static void cmd_secpass(struct userrec *u, int idx, char *par)
|
|
|
{
|
|
{
|
|
|
- char *new = NULL, pass[16] = "";
|
|
|
|
|
|
|
+ char *new = NULL, pass[MAXPASSLEN + 1] = "";
|
|
|
|
|
|
|
|
putlog(LOG_CMDS, "*", "#%s# secpass...", dcc[idx].nick);
|
|
putlog(LOG_CMDS, "*", "#%s# secpass...", dcc[idx].nick);
|
|
|
if (!par[0]) {
|
|
if (!par[0]) {
|
|
@@ -666,7 +666,7 @@ static void cmd_secpass(struct userrec *u, int idx, char *par)
|
|
|
new = newsplit(&par);
|
|
new = newsplit(&par);
|
|
|
|
|
|
|
|
if (!strcmp(new, "rand")) {
|
|
if (!strcmp(new, "rand")) {
|
|
|
- make_rand_str(pass, 15);
|
|
|
|
|
|
|
+ make_rand_str(pass, MAXPASSLEN);
|
|
|
} else {
|
|
} else {
|
|
|
if (strlen(new) < 6) {
|
|
if (strlen(new) < 6) {
|
|
|
dprintf(idx, "Please use at least 6 characters.\n");
|
|
dprintf(idx, "Please use at least 6 characters.\n");
|
|
@@ -675,8 +675,8 @@ static void cmd_secpass(struct userrec *u, int idx, char *par)
|
|
|
egg_snprintf(pass, sizeof pass, "%s", new);
|
|
egg_snprintf(pass, sizeof pass, "%s", new);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (strlen(pass) > 15)
|
|
|
|
|
- pass[15] = 0;
|
|
|
|
|
|
|
+ if (strlen(pass) > MAXPASSLEN)
|
|
|
|
|
+ pass[MAXPASSLEN] = 0;
|
|
|
set_user(&USERENTRY_SECPASS, u, pass);
|
|
set_user(&USERENTRY_SECPASS, u, pass);
|
|
|
dprintf(idx, "Changed your secpass to: %s\n", pass);
|
|
dprintf(idx, "Changed your secpass to: %s\n", pass);
|
|
|
#ifdef HUB
|
|
#ifdef HUB
|
|
@@ -1415,7 +1415,7 @@ static void cmd_handle(struct userrec *u, int idx, char *par)
|
|
|
#ifdef HUB
|
|
#ifdef HUB
|
|
|
static void cmd_chpass(struct userrec *u, int idx, char *par)
|
|
static void cmd_chpass(struct userrec *u, int idx, char *par)
|
|
|
{
|
|
{
|
|
|
- char *handle = NULL, *new = NULL, pass[16] = "";
|
|
|
|
|
|
|
+ char *handle = NULL, *new = NULL, pass[MAXPASSLEN] = "";
|
|
|
int atr = u ? u->flags : 0, l;
|
|
int atr = u ? u->flags : 0, l;
|
|
|
|
|
|
|
|
if (!par[0])
|
|
if (!par[0])
|
|
@@ -1442,10 +1442,10 @@ static void cmd_chpass(struct userrec *u, int idx, char *par)
|
|
|
} else {
|
|
} else {
|
|
|
int good = 0;
|
|
int good = 0;
|
|
|
l = strlen(new = newsplit(&par));
|
|
l = strlen(new = newsplit(&par));
|
|
|
- if (l > 15)
|
|
|
|
|
- new[15] = 0;
|
|
|
|
|
|
|
+ if (l > MAXPASSLEN)
|
|
|
|
|
+ new[MAXPASSLEN] = 0;
|
|
|
if (!strcmp(new, "rand")) {
|
|
if (!strcmp(new, "rand")) {
|
|
|
- make_rand_str(pass, 15);
|
|
|
|
|
|
|
+ make_rand_str(pass, MAXPASSLEN);
|
|
|
good = 1;
|
|
good = 1;
|
|
|
} else {
|
|
} else {
|
|
|
if (goodpass(new, idx, NULL)) {
|
|
if (goodpass(new, idx, NULL)) {
|
|
@@ -1453,8 +1453,8 @@ static void cmd_chpass(struct userrec *u, int idx, char *par)
|
|
|
good = 1;
|
|
good = 1;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (strlen(pass) > 15)
|
|
|
|
|
- pass[15] = 0;
|
|
|
|
|
|
|
+ if (strlen(pass) > MAXPASSLEN)
|
|
|
|
|
+ pass[MAXPASSLEN] = 0;
|
|
|
|
|
|
|
|
if (good) {
|
|
if (good) {
|
|
|
set_user(&USERENTRY_PASS, u, pass);
|
|
set_user(&USERENTRY_PASS, u, pass);
|
|
@@ -1470,7 +1470,7 @@ static void cmd_chpass(struct userrec *u, int idx, char *par)
|
|
|
|
|
|
|
|
static void cmd_chsecpass(struct userrec *u, int idx, char *par)
|
|
static void cmd_chsecpass(struct userrec *u, int idx, char *par)
|
|
|
{
|
|
{
|
|
|
- char *handle = NULL, *new = NULL, pass[16] = "";
|
|
|
|
|
|
|
+ char *handle = NULL, *new = NULL, pass[MAXPASSLEN + 1] = "";
|
|
|
int atr = u ? u->flags : 0, l;
|
|
int atr = u ? u->flags : 0, l;
|
|
|
|
|
|
|
|
if (!par[0])
|
|
if (!par[0])
|
|
@@ -1497,10 +1497,10 @@ static void cmd_chsecpass(struct userrec *u, int idx, char *par)
|
|
|
} else {
|
|
} else {
|
|
|
|
|
|
|
|
l = strlen(new = newsplit(&par));
|
|
l = strlen(new = newsplit(&par));
|
|
|
- if (l > 15)
|
|
|
|
|
- new[15] = 0;
|
|
|
|
|
|
|
+ if (l > MAXPASSLEN)
|
|
|
|
|
+ new[MAXPASSLEN] = 0;
|
|
|
if (!strcmp(new, "rand")) {
|
|
if (!strcmp(new, "rand")) {
|
|
|
- make_rand_str(pass, 15);
|
|
|
|
|
|
|
+ make_rand_str(pass, MAXPASSLEN);
|
|
|
} else {
|
|
} else {
|
|
|
if (strlen(new) < 6) {
|
|
if (strlen(new) < 6) {
|
|
|
dprintf(idx, "Please use at least 6 characters.\n");
|
|
dprintf(idx, "Please use at least 6 characters.\n");
|
|
@@ -1509,8 +1509,8 @@ static void cmd_chsecpass(struct userrec *u, int idx, char *par)
|
|
|
egg_snprintf(pass, sizeof pass, "%s", new);
|
|
egg_snprintf(pass, sizeof pass, "%s", new);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- if (strlen(pass) > 15)
|
|
|
|
|
- pass[15] = 0;
|
|
|
|
|
|
|
+ if (strlen(pass) > MAXPASSLEN)
|
|
|
|
|
+ pass[MAXPASSLEN] = 0;
|
|
|
set_user(&USERENTRY_SECPASS, u, pass);
|
|
set_user(&USERENTRY_SECPASS, u, pass);
|
|
|
putlog(LOG_CMDS, "*", "#%s# chsecpass %s [something]", dcc[idx].nick, handle);
|
|
putlog(LOG_CMDS, "*", "#%s# chsecpass %s [something]", dcc[idx].nick, handle);
|
|
|
dprintf(idx, "Secpass for '%s' changed to: %s\n", handle, pass);
|
|
dprintf(idx, "Secpass for '%s' changed to: %s\n", handle, pass);
|
|
@@ -3342,7 +3342,7 @@ static void cmd_pls_user(struct userrec *u, int idx, char *par)
|
|
|
dprintf(idx, "Hey! That's MY name!\n");
|
|
dprintf(idx, "Hey! That's MY name!\n");
|
|
|
else {
|
|
else {
|
|
|
struct userrec *u2 = NULL;
|
|
struct userrec *u2 = NULL;
|
|
|
- char tmp[50] = "", s[16] = "", s2[17] = "";
|
|
|
|
|
|
|
+ char tmp[50] = "", s[MAXPASSLEN + 1] = "", s2[MAXPASSLEN + 1] = "";
|
|
|
|
|
|
|
|
userlist = adduser(userlist, handle, host, "-", USER_DEFAULT, 0);
|
|
userlist = adduser(userlist, handle, host, "-", USER_DEFAULT, 0);
|
|
|
u2 = get_user_by_handle(userlist, handle);
|
|
u2 = get_user_by_handle(userlist, handle);
|
|
@@ -3354,10 +3354,10 @@ static void cmd_pls_user(struct userrec *u, int idx, char *par)
|
|
|
set_user(&USERENTRY_HOSTS, u2, host);
|
|
set_user(&USERENTRY_HOSTS, u2, host);
|
|
|
dprintf(idx, "Added host '%s' to %s.\n", host, handle);
|
|
dprintf(idx, "Added host '%s' to %s.\n", host, handle);
|
|
|
}
|
|
}
|
|
|
- make_rand_str(s, 15);
|
|
|
|
|
|
|
+ make_rand_str(s, MAXPASSLEN);
|
|
|
set_user(&USERENTRY_PASS, u2, s);
|
|
set_user(&USERENTRY_PASS, u2, s);
|
|
|
|
|
|
|
|
- make_rand_str(s2, 16);
|
|
|
|
|
|
|
+ make_rand_str(s2, MAXPASSLEN);
|
|
|
set_user(&USERENTRY_SECPASS, u2, s2);
|
|
set_user(&USERENTRY_SECPASS, u2, s2);
|
|
|
dprintf(idx, "%s's initial password set to %s%s%s\n", handle, BOLD(idx), s, BOLD_END(idx));
|
|
dprintf(idx, "%s's initial password set to %s%s%s\n", handle, BOLD(idx), s, BOLD_END(idx));
|
|
|
dprintf(idx, "%s's initial secpass set to %s%s%s\n", handle, BOLD(idx), s2, BOLD_END(idx));
|
|
dprintf(idx, "%s's initial secpass set to %s%s%s\n", handle, BOLD(idx), s2, BOLD_END(idx));
|