diff options
Diffstat (limited to 'root_commands.c')
-rw-r--r-- | root_commands.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/root_commands.c b/root_commands.c index 4ce964ae..dcf7a7ed 100644 --- a/root_commands.c +++ b/root_commands.c @@ -142,10 +142,9 @@ static void cmd_identify(irc_t *irc, char **cmd) return; } - if (load) { + status = auth_check_pass(irc, irc->user->nick, password); + if (load && (status == STORAGE_OK)) { status = storage_load(irc, password); - } else { - status = storage_check_pass(irc->user->nick, password); } switch (status) { @@ -158,7 +157,6 @@ static void cmd_identify(irc_t *irc, char **cmd) case STORAGE_OK: irc_rootmsg(irc, "Password accepted%s", load ? ", settings and accounts loaded" : ""); - irc_setpass(irc, password); irc->status |= USTATUS_IDENTIFIED; irc_umode_set(irc, "+R", 1); @@ -267,7 +265,11 @@ static void cmd_drop(irc_t *irc, char **cmd) { storage_status_t status; - status = storage_remove(irc->user->nick, cmd[1]); + status = auth_check_pass(irc, irc->user->nick, cmd[1]); + if (status == STORAGE_OK) { + status = storage_remove(irc->user->nick); + } + switch (status) { case STORAGE_NO_SUCH_USER: irc_rootmsg(irc, "That account does not exist"); @@ -339,6 +341,10 @@ static int cmd_set_real(irc_t *irc, char **cmd, set_t **head, cmd_set_checkflags set_t *s = set_find(head, set_name); int st; + if (s && s->flags & SET_LOCKED) { + irc_rootmsg(irc, "This setting can not be changed"); + return 0; + } if (s && checkflags && checkflags(irc, s) == 0) { return 0; } @@ -387,6 +393,9 @@ static int cmd_account_set_checkflags(irc_t *irc, set_t *s) } else if (!a->ic && s && s->flags & ACC_SET_ONLINE_ONLY) { irc_rootmsg(irc, "This setting can only be changed when the account is %s-line", "on"); return 0; + } else if (a->flags & ACC_FLAG_LOCKED && s && s->flags & ACC_SET_LOCKABLE) { + irc_rootmsg(irc, "This setting can not be changed for locked accounts"); + return 0; } return 1; @@ -409,6 +418,11 @@ static void cmd_account(irc_t *irc, char **cmd) MIN_ARGS(3); + if (!global.conf->allow_account_add) { + irc_rootmsg(irc, "This server does not allow adding new accounts"); + return; + } + if (cmd[4] == NULL) { for (a = irc->b->accounts; a; a = a->next) { if (strcmp(a->pass, PASSWORD_PENDING) == 0) { @@ -546,7 +560,10 @@ static void cmd_account(irc_t *irc, char **cmd) } if (len >= 1 && g_strncasecmp(cmd[2], "del", len) == 0) { - if (a->ic) { + if (a->flags & ACC_FLAG_LOCKED) { + irc_rootmsg(irc, "Account is locked, can't delete"); + } + else if (a->ic) { irc_rootmsg(irc, "Account is still logged in, can't delete"); } else { account_del(irc->b, a); |