diff options
author | Dennis Kaarsemaker <dennis@kaarsemaker.net> | 2016-02-22 21:04:10 +0100 |
---|---|---|
committer | Dennis Kaarsemaker <dennis@kaarsemaker.net> | 2016-03-23 07:44:13 +0100 |
commit | 3ac6d9fe93279d74d36a6bf2b6e2ba182ed3bf34 (patch) | |
tree | 681d3c36caa3f2680ca5b810c09f3d1f54a868cd /root_commands.c | |
parent | d701547347b15bd76f19fcf667cbf8e5c1219cbb (diff) |
Support for locked-down accounts
In certain situations, e.g. when working with pregenerated
configurations, it is useful to be able lock down accounts so they
cannot be deleted and authentication information (user, password,
server) cannot be changed.
We mark such sensitive settings with ACC_SET_LOCKABLE and will refuse to
change them if the account is locked by setting the ACC_FLAG_LOCKED
flag.
This flag is stored in the xml files as account attribute locked="true".
Diffstat (limited to 'root_commands.c')
-rw-r--r-- | root_commands.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/root_commands.c b/root_commands.c index 4ce964ae..f9c6e8e9 100644 --- a/root_commands.c +++ b/root_commands.c @@ -387,6 +387,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; @@ -546,7 +549,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); |