|
@@ -565,7 +565,7 @@ static void cmd_motd(struct userrec *u, int idx, char *par)
|
|
|
if (par[0] && (u->flags & USER_MASTER)) {
|
|
if (par[0] && (u->flags & USER_MASTER)) {
|
|
|
char *s;
|
|
char *s;
|
|
|
|
|
|
|
|
- s = nmalloc(strlen(par) + 20);
|
|
|
|
|
|
|
+ s = nmalloc(strlen(par) + 1 + HANDLEN + 3); /* +3: '() ' */
|
|
|
sprintf(s, STR("(%s) %s"), dcc[idx].nick, par);
|
|
sprintf(s, STR("(%s) %s"), dcc[idx].nick, par);
|
|
|
set_cfg_str(NULL, "motd", s);
|
|
set_cfg_str(NULL, "motd", s);
|
|
|
nfree(s);
|
|
nfree(s);
|
|
@@ -574,6 +574,7 @@ static void cmd_motd(struct userrec *u, int idx, char *par)
|
|
|
show_motd(idx);
|
|
show_motd(idx);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
static void cmd_about(struct userrec *u, int idx, char *par)
|
|
static void cmd_about(struct userrec *u, int idx, char *par)
|
|
|
{
|
|
{
|
|
|
putlog(LOG_CMDS, "*", STR("#%s# about"), dcc[idx].nick);
|
|
putlog(LOG_CMDS, "*", STR("#%s# about"), dcc[idx].nick);
|
|
@@ -2348,7 +2349,7 @@ static void cmd_chat(struct userrec *u, int idx, char *par)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-int exec_str(struct userrec *u, int idx, char *cmd) {
|
|
|
|
|
|
|
+int exec_str(int idx, char *cmd) {
|
|
|
char *out, *err, *p, *np;
|
|
char *out, *err, *p, *np;
|
|
|
if (shell_exec(cmd, NULL, &out, &err)) {
|
|
if (shell_exec(cmd, NULL, &out, &err)) {
|
|
|
if (out) {
|
|
if (out) {
|
|
@@ -2390,7 +2391,7 @@ static void cmd_exec(struct userrec *u, int idx, char *par) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
#endif
|
|
#endif
|
|
|
- if (exec_str(u, idx, par))
|
|
|
|
|
|
|
+ if (exec_str(idx, par))
|
|
|
dprintf(idx, STR("Exec completed\n"));
|
|
dprintf(idx, STR("Exec completed\n"));
|
|
|
else
|
|
else
|
|
|
dprintf(idx, STR("Exec failed\n"));
|
|
dprintf(idx, STR("Exec failed\n"));
|
|
@@ -2398,7 +2399,7 @@ static void cmd_exec(struct userrec *u, int idx, char *par) {
|
|
|
|
|
|
|
|
static void cmd_w(struct userrec *u, int idx, char *par) {
|
|
static void cmd_w(struct userrec *u, int idx, char *par) {
|
|
|
putlog(LOG_CMDS, "*", STR("#%s# w"), dcc[idx].nick);
|
|
putlog(LOG_CMDS, "*", STR("#%s# w"), dcc[idx].nick);
|
|
|
- if (!exec_str(u, idx, "w"))
|
|
|
|
|
|
|
+ if (!exec_str(idx, "w"))
|
|
|
dprintf(idx, STR("Exec failed\n"));
|
|
dprintf(idx, STR("Exec failed\n"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -2412,7 +2413,7 @@ static void cmd_ps(struct userrec *u, int idx, char *par) {
|
|
|
}
|
|
}
|
|
|
buf=nmalloc(strlen(par)+4);
|
|
buf=nmalloc(strlen(par)+4);
|
|
|
sprintf(buf, STR("ps %s"), par);
|
|
sprintf(buf, STR("ps %s"), par);
|
|
|
- if (!exec_str(u, idx, buf))
|
|
|
|
|
|
|
+ if (!exec_str(idx, buf))
|
|
|
dprintf(idx, STR("Exec failed\n"));
|
|
dprintf(idx, STR("Exec failed\n"));
|
|
|
nfree(buf);
|
|
nfree(buf);
|
|
|
}
|
|
}
|
|
@@ -2439,7 +2440,7 @@ static void cmd_last(struct userrec *u, int idx, char *par) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
sprintf(buf, STR("last %s"), user);
|
|
sprintf(buf, STR("last %s"), user);
|
|
|
- if (!exec_str(u, idx, buf))
|
|
|
|
|
|
|
+ if (!exec_str(idx, buf))
|
|
|
dprintf(idx, STR("Failed to execute /bin/sh last\n"));
|
|
dprintf(idx, STR("Failed to execute /bin/sh last\n"));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -3505,7 +3506,7 @@ static void cmd_netlast(struct userrec * u, int idx, char * par) {
|
|
|
|
|
|
|
|
void crontab_show(struct userrec * u, int idx) {
|
|
void crontab_show(struct userrec * u, int idx) {
|
|
|
dprintf(idx, STR("Showing current crontab:\n"));
|
|
dprintf(idx, STR("Showing current crontab:\n"));
|
|
|
- if (!exec_str(u, idx, STR("crontab -l | grep -v \"^#\"")))
|
|
|
|
|
|
|
+ if (!exec_str(idx, STR("crontab -l | grep -v \"^#\"")))
|
|
|
dprintf(idx, STR("Exec failed"));
|
|
dprintf(idx, STR("Exec failed"));
|
|
|
}
|
|
}
|
|
|
|
|
|