aboutsummaryrefslogtreecommitdiffstats
path: root/root_commands.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@google.com>2010-11-22 13:17:45 +0000
committerWilmer van der Gaast <wilmer@google.com>2010-11-22 13:17:45 +0000
commit9564e55a35ebffaad644c13827ec2b795fb21154 (patch)
tree5ede79f1cdfd51d28ada354a7c17fed7b7306880 /root_commands.c
parent09d4922d3740eb0ad2e42e02ca5d57f03b263eab (diff)
Allow omitting the password argument to "account add", to then separately
enter the password using the /OPER command (which will not echo to the screen and/or logs). It's a fairly ugly hack but the improved password security is worth it IMHO.
Diffstat (limited to 'root_commands.c')
-rw-r--r--root_commands.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/root_commands.c b/root_commands.c
index db29d088..01313b1c 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -393,7 +393,16 @@ static void cmd_account( irc_t *irc, char **cmd )
{
struct prpl *prpl;
- MIN_ARGS( 4 );
+ MIN_ARGS( 3 );
+
+ if( cmd[4] == NULL )
+ for( a = irc->b->accounts; a; a = a->next )
+ if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
+ {
+ irc_usermsg( irc, "Enter password for account %s(%s) "
+ "first (use /OPER)", a->prpl->name, a->user );
+ return;
+ }
prpl = find_protocol( cmd[2] );
@@ -409,7 +418,7 @@ static void cmd_account( irc_t *irc, char **cmd )
"protocol `%s' and username `%s'. Are you accidentally "
"trying to add it twice?", prpl->name, cmd[3] );
- a = account_add( irc->b, prpl, cmd[3], cmd[4] );
+ a = account_add( irc->b, prpl, cmd[3], cmd[4] ? cmd[4] : PASSWORD_PENDING );
if( cmd[5] )
{
irc_usermsg( irc, "Warning: Passing a servername/other flags to `account add' "
@@ -419,6 +428,9 @@ static void cmd_account( irc_t *irc, char **cmd )
irc_usermsg( irc, "Account successfully added" );
+ if( cmd[4] == NULL )
+ irc_usermsg( irc, "Now, use /OPER to enter your password for this account" );
+
return;
}
else if( len >= 1 && g_strncasecmp( cmd[1], "list", len ) == 0 )
@@ -461,7 +473,13 @@ static void cmd_account( irc_t *irc, char **cmd )
for( a = irc->b->accounts; a; a = a->next )
if( !a->ic && a->auto_connect )
- account_on( irc->b, a );
+ {
+ if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
+ irc_usermsg( irc, "Enter password for account %s(%s) "
+ "first (use /OPER)", a->prpl->name, a->user );
+ else
+ account_on( irc->b, a );
+ }
}
else
{
@@ -519,6 +537,9 @@ static void cmd_account( irc_t *irc, char **cmd )
{
if( a->ic )
irc_usermsg( irc, "Account already online" );
+ else if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
+ irc_usermsg( irc, "Enter password for account %s(%s) "
+ "first (use /OPER)", a->prpl->name, a->user );
else
account_on( irc->b, a );
}