|
@@ -256,7 +256,7 @@ static void cmd_config(int idx, char *par)
|
|
|
if (!par[0]) {
|
|
if (!par[0]) {
|
|
|
char *outbuf = NULL;
|
|
char *outbuf = NULL;
|
|
|
|
|
|
|
|
- outbuf = (char *) calloc(1, 1);
|
|
|
|
|
|
|
+ outbuf = (char *) my_calloc(1, 1);
|
|
|
|
|
|
|
|
dprintf(idx, "Usage: config [name [value|-]]\n");
|
|
dprintf(idx, "Usage: config [name [value|-]]\n");
|
|
|
dprintf(idx, "Defined config entry names:\n");
|
|
dprintf(idx, "Defined config entry names:\n");
|
|
@@ -264,10 +264,10 @@ static void cmd_config(int idx, char *par)
|
|
|
for (i = 0; i < cfg_count; i++) {
|
|
for (i = 0; i < cfg_count; i++) {
|
|
|
if ((cfg[i]->flags & CFGF_GLOBAL) && (cfg[i]->describe)) {
|
|
if ((cfg[i]->flags & CFGF_GLOBAL) && (cfg[i]->describe)) {
|
|
|
if (!cnt) {
|
|
if (!cnt) {
|
|
|
- outbuf = (char *) realloc(outbuf, 2 + 1);
|
|
|
|
|
|
|
+ outbuf = (char *) my_realloc(outbuf, 2 + 1);
|
|
|
sprintf(outbuf, " ");
|
|
sprintf(outbuf, " ");
|
|
|
}
|
|
}
|
|
|
- outbuf = (char *) realloc(outbuf, strlen(outbuf) + strlen(cfg[i]->name) + 1 + 1);
|
|
|
|
|
|
|
+ outbuf = (char *) my_realloc(outbuf, strlen(outbuf) + strlen(cfg[i]->name) + 1 + 1);
|
|
|
sprintf(outbuf, "%s%s ", outbuf, cfg[i]->name);
|
|
sprintf(outbuf, "%s%s ", outbuf, cfg[i]->name);
|
|
|
cnt++;
|
|
cnt++;
|
|
|
if (cnt == 10) {
|
|
if (cnt == 10) {
|
|
@@ -524,7 +524,7 @@ static void cmd_motd(int idx, char *par)
|
|
|
size_t size;
|
|
size_t size;
|
|
|
|
|
|
|
|
size = strlen(par) + 1 + strlen(dcc[idx].nick) + 10 + 1 + 1;
|
|
size = strlen(par) + 1 + strlen(dcc[idx].nick) + 10 + 1 + 1;
|
|
|
- s = (char *) calloc(1, size); /* +2: ' 'x2 */
|
|
|
|
|
|
|
+ s = (char *) my_calloc(1, size); /* +2: ' 'x2 */
|
|
|
|
|
|
|
|
egg_snprintf(s, size, "%s %li %s", dcc[idx].nick, now, par);
|
|
egg_snprintf(s, size, "%s %li %s", dcc[idx].nick, now, par);
|
|
|
set_cfg_str(NULL, "motd", s);
|
|
set_cfg_str(NULL, "motd", s);
|
|
@@ -595,13 +595,13 @@ static void cmd_addline(int idx, char *par)
|
|
|
struct list_type *q = (struct list_type *) get_user(&USERENTRY_HOSTS, u);
|
|
struct list_type *q = (struct list_type *) get_user(&USERENTRY_HOSTS, u);
|
|
|
char *hostbuf = NULL, *outbuf = NULL;
|
|
char *hostbuf = NULL, *outbuf = NULL;
|
|
|
|
|
|
|
|
- hostbuf = (char *) calloc(1, 1);
|
|
|
|
|
|
|
+ hostbuf = (char *) my_calloc(1, 1);
|
|
|
for (; q; q = q->next) {
|
|
for (; q; q = q->next) {
|
|
|
- hostbuf = (char *) realloc(hostbuf, strlen(hostbuf) + strlen(q->extra) + 2);
|
|
|
|
|
|
|
+ hostbuf = (char *) my_realloc(hostbuf, strlen(hostbuf) + strlen(q->extra) + 2);
|
|
|
strcat(hostbuf, q->extra);
|
|
strcat(hostbuf, q->extra);
|
|
|
strcat(hostbuf, " ");
|
|
strcat(hostbuf, " ");
|
|
|
}
|
|
}
|
|
|
- outbuf = (char *) calloc(1, strlen(hostbuf) + strlen(u->handle) + 20);
|
|
|
|
|
|
|
+ outbuf = (char *) my_calloc(1, strlen(hostbuf) + strlen(u->handle) + 20);
|
|
|
sprintf(outbuf, "Addline: +user %s %s", u->handle, hostbuf);
|
|
sprintf(outbuf, "Addline: +user %s %s", u->handle, hostbuf);
|
|
|
dumplots(idx, "", outbuf);
|
|
dumplots(idx, "", outbuf);
|
|
|
free(hostbuf);
|
|
free(hostbuf);
|
|
@@ -716,7 +716,7 @@ int my_cmp(const mycmds *c1, const mycmds *c2)
|
|
|
|
|
|
|
|
static void cmd_nohelp(int idx, char *par)
|
|
static void cmd_nohelp(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
- char *buf = (char *) calloc(1, 1);
|
|
|
|
|
|
|
+ char *buf = (char *) my_calloc(1, 1);
|
|
|
|
|
|
|
|
qsort(cmdlist, cmdi, sizeof(mycmds), (int (*)(const void *, const void *)) &my_cmp);
|
|
qsort(cmdlist, cmdi, sizeof(mycmds), (int (*)(const void *, const void *)) &my_cmp);
|
|
|
|
|
|
|
@@ -726,7 +726,7 @@ static void cmd_nohelp(int idx, char *par)
|
|
|
for (int o = 0; (help[o].cmd) && (help[o].desc); o++)
|
|
for (int o = 0; (help[o].cmd) && (help[o].desc); o++)
|
|
|
if (!egg_strcasecmp(help[o].cmd, cmdlist[i].name)) found++;
|
|
if (!egg_strcasecmp(help[o].cmd, cmdlist[i].name)) found++;
|
|
|
if (!found) {
|
|
if (!found) {
|
|
|
- buf = (char *) realloc(buf, strlen(buf) + 2 + strlen(cmdlist[i].name) + 1);
|
|
|
|
|
|
|
+ buf = (char *) my_realloc(buf, strlen(buf) + 2 + strlen(cmdlist[i].name) + 1);
|
|
|
strcat(buf, cmdlist[i].name);
|
|
strcat(buf, cmdlist[i].name);
|
|
|
strcat(buf, ", ");
|
|
strcat(buf, ", ");
|
|
|
}
|
|
}
|
|
@@ -1526,7 +1526,7 @@ static void cmd_hublevel(int idx, char *par)
|
|
|
|
|
|
|
|
dprintf(idx, "Changed bot's hublevel.\n");
|
|
dprintf(idx, "Changed bot's hublevel.\n");
|
|
|
obi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u1);
|
|
obi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u1);
|
|
|
- bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
|
|
|
|
|
|
|
+ bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
|
|
|
|
|
|
|
|
bi->uplink = strdup(obi->uplink);
|
|
bi->uplink = strdup(obi->uplink);
|
|
|
bi->address = strdup(obi->address);
|
|
bi->address = strdup(obi->address);
|
|
@@ -1567,7 +1567,7 @@ static void cmd_uplink(int idx, char *par)
|
|
|
struct bot_addr *bi = NULL, *obi = NULL;
|
|
struct bot_addr *bi = NULL, *obi = NULL;
|
|
|
|
|
|
|
|
obi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u1);
|
|
obi = (struct bot_addr *) get_user(&USERENTRY_BOTADDR, u1);
|
|
|
- bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
|
|
|
|
|
|
|
+ bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
|
|
|
|
|
|
|
|
bi->uplink = strdup(uplink);
|
|
bi->uplink = strdup(uplink);
|
|
|
bi->address = strdup(obi->address);
|
|
bi->address = strdup(obi->address);
|
|
@@ -1623,7 +1623,7 @@ static void cmd_chaddr(int idx, char *par)
|
|
|
relay_port = bi->relay_port;
|
|
relay_port = bi->relay_port;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
|
|
|
|
|
|
|
+ bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
|
|
|
|
|
|
|
|
bi->uplink = strdup(obi->uplink);
|
|
bi->uplink = strdup(obi->uplink);
|
|
|
bi->hublevel = obi->hublevel;
|
|
bi->hublevel = obi->hublevel;
|
|
@@ -1643,13 +1643,13 @@ static void cmd_chaddr(int idx, char *par)
|
|
|
addr++; /* lose the '[' */
|
|
addr++; /* lose the '[' */
|
|
|
r = strchr(addr, ']'); /* pointer to the ending ']' */
|
|
r = strchr(addr, ']'); /* pointer to the ending ']' */
|
|
|
|
|
|
|
|
- bi->address = (char *) calloc(1, r - addr + 1); /* alloc and copy the addr */
|
|
|
|
|
|
|
+ bi->address = (char *) my_calloc(1, r - addr + 1); /* alloc and copy the addr */
|
|
|
strncpyz(bi->address, addr, r - addr + 1);
|
|
strncpyz(bi->address, addr, r - addr + 1);
|
|
|
|
|
|
|
|
q = r + 1; /* set q to ':' at addr */
|
|
q = r + 1; /* set q to ':' at addr */
|
|
|
} else {
|
|
} else {
|
|
|
#endif /* !USE_IPV6 */
|
|
#endif /* !USE_IPV6 */
|
|
|
- bi->address = (char *) calloc(1, q - addr + 1);
|
|
|
|
|
|
|
+ bi->address = (char *) my_calloc(1, q - addr + 1);
|
|
|
strncpyz(bi->address, addr, q - addr + 1);
|
|
strncpyz(bi->address, addr, q - addr + 1);
|
|
|
#ifdef USE_IPV6
|
|
#ifdef USE_IPV6
|
|
|
}
|
|
}
|
|
@@ -1718,7 +1718,7 @@ static void cmd_randstring(int idx, char *par)
|
|
|
if (len < 301) {
|
|
if (len < 301) {
|
|
|
char *randstring = NULL;
|
|
char *randstring = NULL;
|
|
|
|
|
|
|
|
- randstring = (char *) calloc(1, len + 1);
|
|
|
|
|
|
|
+ randstring = (char *) my_calloc(1, len + 1);
|
|
|
make_rand_str(randstring, len);
|
|
make_rand_str(randstring, len);
|
|
|
dprintf(idx, "string: %s\n", randstring);
|
|
dprintf(idx, "string: %s\n", randstring);
|
|
|
free(randstring);
|
|
free(randstring);
|
|
@@ -2421,7 +2421,7 @@ static void cmd_chattr(int idx, char *par)
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
} else if (arg && !strpbrk(chg, "&|")) {
|
|
} else if (arg && !strpbrk(chg, "&|")) {
|
|
|
- tmpchg = (char *) calloc(1, strlen(chg) + 2);
|
|
|
|
|
|
|
+ tmpchg = (char *) my_calloc(1, strlen(chg) + 2);
|
|
|
strcpy(tmpchg, "|");
|
|
strcpy(tmpchg, "|");
|
|
|
strcat(tmpchg, chg);
|
|
strcat(tmpchg, chg);
|
|
|
chg = tmpchg;
|
|
chg = tmpchg;
|
|
@@ -2735,7 +2735,7 @@ static void cmd_ps(int idx, char *par) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
size_t size = strlen(par) + 9 + 1;
|
|
size_t size = strlen(par) + 9 + 1;
|
|
|
- char *buf = (char *) calloc(1, size);
|
|
|
|
|
|
|
+ char *buf = (char *) my_calloc(1, size);
|
|
|
|
|
|
|
|
egg_snprintf(buf, size, "ps %s", par);
|
|
egg_snprintf(buf, size, "ps %s", par);
|
|
|
if (!exec_str(idx, buf))
|
|
if (!exec_str(idx, buf))
|
|
@@ -3073,9 +3073,9 @@ static void cmd_su(int idx, char *par)
|
|
|
*/
|
|
*/
|
|
|
if (dcc[idx].u.chat->away != NULL)
|
|
if (dcc[idx].u.chat->away != NULL)
|
|
|
free(dcc[idx].u.chat->away);
|
|
free(dcc[idx].u.chat->away);
|
|
|
- dcc[idx].u.chat->away = (char *) calloc(1, strlen(dcc[idx].nick) + 1);
|
|
|
|
|
|
|
+ dcc[idx].u.chat->away = (char *) my_calloc(1, strlen(dcc[idx].nick) + 1);
|
|
|
strcpy(dcc[idx].u.chat->away, dcc[idx].nick);
|
|
strcpy(dcc[idx].u.chat->away, dcc[idx].nick);
|
|
|
- dcc[idx].u.chat->su_nick = (char *) calloc(1, strlen(dcc[idx].nick) + 1);
|
|
|
|
|
|
|
+ dcc[idx].u.chat->su_nick = (char *) my_calloc(1, strlen(dcc[idx].nick) + 1);
|
|
|
strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
|
|
strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
|
|
|
dcc[idx].user = u;
|
|
dcc[idx].user = u;
|
|
|
strcpy(dcc[idx].nick, par);
|
|
strcpy(dcc[idx].nick, par);
|
|
@@ -3092,7 +3092,7 @@ static void cmd_su(int idx, char *par)
|
|
|
dprintf(idx, "Setting your username to %s.\n", par);
|
|
dprintf(idx, "Setting your username to %s.\n", par);
|
|
|
if (atr & USER_MASTER)
|
|
if (atr & USER_MASTER)
|
|
|
dcc[idx].u.chat->con_flags = conmask;
|
|
dcc[idx].u.chat->con_flags = conmask;
|
|
|
- dcc[idx].u.chat->su_nick = (char *) calloc(1, strlen(dcc[idx].nick) + 1);
|
|
|
|
|
|
|
+ dcc[idx].u.chat->su_nick = (char *) my_calloc(1, strlen(dcc[idx].nick) + 1);
|
|
|
strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
|
|
strcpy(dcc[idx].u.chat->su_nick, dcc[idx].nick);
|
|
|
dcc[idx].user = u;
|
|
dcc[idx].user = u;
|
|
|
strcpy(dcc[idx].nick, par);
|
|
strcpy(dcc[idx].nick, par);
|
|
@@ -3178,13 +3178,13 @@ static void cmd_newleaf(int idx, char *par)
|
|
|
|
|
|
|
|
userlist = adduser(userlist, handle, "none", "-", USER_OP, 1);
|
|
userlist = adduser(userlist, handle, "none", "-", USER_OP, 1);
|
|
|
u1 = get_user_by_handle(userlist, handle);
|
|
u1 = get_user_by_handle(userlist, handle);
|
|
|
- bi = (struct bot_addr *) calloc(1, sizeof(struct bot_addr));
|
|
|
|
|
|
|
+ bi = (struct bot_addr *) my_calloc(1, sizeof(struct bot_addr));
|
|
|
|
|
|
|
|
- bi->uplink = (char *) calloc(1, strlen(conf.bot->nick) + 1);
|
|
|
|
|
|
|
+ bi->uplink = (char *) my_calloc(1, strlen(conf.bot->nick) + 1);
|
|
|
/* strcpy(bi->uplink, conf.bot->nick); */
|
|
/* strcpy(bi->uplink, conf.bot->nick); */
|
|
|
strcpy(bi->uplink, "");
|
|
strcpy(bi->uplink, "");
|
|
|
|
|
|
|
|
- bi->address = (char *) calloc(1, 1);
|
|
|
|
|
|
|
+ bi->address = (char *) my_calloc(1, 1);
|
|
|
bi->telnet_port = 3333;
|
|
bi->telnet_port = 3333;
|
|
|
bi->relay_port = 3333;
|
|
bi->relay_port = 3333;
|
|
|
bi->hublevel = 0;
|
|
bi->hublevel = 0;
|
|
@@ -3208,7 +3208,7 @@ static void cmd_nopass(int idx, char *par)
|
|
|
{
|
|
{
|
|
|
int cnt = 0;
|
|
int cnt = 0;
|
|
|
struct userrec *cu = NULL;
|
|
struct userrec *cu = NULL;
|
|
|
- char *users = (char *) calloc(1, 1);
|
|
|
|
|
|
|
+ char *users = (char *) my_calloc(1, 1);
|
|
|
|
|
|
|
|
putlog(LOG_CMDS, "*", "#%s# nopass %s", dcc[idx].nick, (par && par[0]) ? par : "");
|
|
putlog(LOG_CMDS, "*", "#%s# nopass %s", dcc[idx].nick, (par && par[0]) ? par : "");
|
|
|
|
|
|
|
@@ -3216,7 +3216,7 @@ static void cmd_nopass(int idx, char *par)
|
|
|
if (!cu->bot) {
|
|
if (!cu->bot) {
|
|
|
if (u_pass_match(cu, "-")) {
|
|
if (u_pass_match(cu, "-")) {
|
|
|
cnt++;
|
|
cnt++;
|
|
|
- users = (char *) realloc(users, strlen(users) + strlen(cu->handle) + 1 + 1);
|
|
|
|
|
|
|
+ users = (char *) my_realloc(users, strlen(users) + strlen(cu->handle) + 1 + 1);
|
|
|
strcat(users, cu->handle);
|
|
strcat(users, cu->handle);
|
|
|
strcat(users, " ");
|
|
strcat(users, " ");
|
|
|
}
|
|
}
|
|
@@ -4127,7 +4127,7 @@ void gotremotereply (char *frombot, char *tohand, char *toidx, char *ln) {
|
|
|
if ((idx >= 0) && (idx < dcc_total) && (dcc[idx].type == &DCC_CHAT) && (!strcmp(dcc[idx].nick, tohand))) {
|
|
if ((idx >= 0) && (idx < dcc_total) && (dcc[idx].type == &DCC_CHAT) && (!strcmp(dcc[idx].nick, tohand))) {
|
|
|
char *buf = NULL;
|
|
char *buf = NULL;
|
|
|
|
|
|
|
|
- buf = (char *) calloc(1, strlen(frombot) + 2 + 1);
|
|
|
|
|
|
|
+ buf = (char *) my_calloc(1, strlen(frombot) + 2 + 1);
|
|
|
|
|
|
|
|
sprintf(buf, "(%s)", frombot);
|
|
sprintf(buf, "(%s)", frombot);
|
|
|
dprintf(idx, "%-13s %s\n", buf, ln);
|
|
dprintf(idx, "%-13s %s\n", buf, ln);
|