aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2014-02-28 23:17:28 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2014-02-28 23:17:28 +0000
commit35987a1c74b708cd9ba2dc351400edd4d4046a6f (patch)
tree34b8a4257258f13a4aa902169a6e7f81e75d1a43
parent2e815e5627b54696d4a81cddd8162fa0414b118f (diff)
Allow use of "ac x set -del password" to use /oper to change the password
"securely". Patch from Flexo, bug #1117.
-rw-r--r--irc.h2
-rw-r--r--irc_commands.c2
-rw-r--r--protocols/account.c16
-rw-r--r--root_commands.c2
4 files changed, 15 insertions, 7 deletions
diff --git a/irc.h b/irc.h
index 866e85c3..39cf178c 100644
--- a/irc.h
+++ b/irc.h
@@ -59,7 +59,7 @@ typedef enum
OPER_HACK_IDENTIFY_NOLOAD = 0x01100,
OPER_HACK_IDENTIFY_FORCE = 0x02100,
OPER_HACK_REGISTER = 0x200,
- OPER_HACK_ACCOUNT_ADD = 0x400,
+ OPER_HACK_ACCOUNT_PASSWORD = 0x400,
OPER_HACK_ANY = 0x3700, /* To check for them all at once. */
IRC_UTF8_NICKS = 0x10000, /* Disable ASCII restrictions on buddy nicks. */
diff --git a/irc_commands.c b/irc_commands.c
index 3db243bf..19930121 100644
--- a/irc_commands.c
+++ b/irc_commands.c
@@ -432,7 +432,7 @@ static void irc_cmd_oper_hack( irc_t *irc, char **cmd )
/* /OPER can now also be used to enter IM/identify passwords without
echoing. It's a hack but the extra password security is worth it. */
- if( irc->status & OPER_HACK_ACCOUNT_ADD )
+ if( irc->status & OPER_HACK_ACCOUNT_PASSWORD )
{
account_t *a;
diff --git a/protocols/account.c b/protocols/account.c
index dec9c3ea..b90a60ee 100644
--- a/protocols/account.c
+++ b/protocols/account.c
@@ -153,10 +153,18 @@ char *set_eval_account( set_t *set, char *value )
}
else if( strcmp( set->key, "password" ) == 0 )
{
- /* set -del should be allowed now, but I don't want to have any
- NULL pointers to have to deal with. */
- if( !value )
- value = "";
+ /* set -del allows /oper to be used to change the password or,
+ iff oauth is enabled, reset the oauth credential magic.
+ */
+ if( !value ) {
+ if ( set_getbool( &(acc->set), "oauth" ) ) {
+ value = "";
+ } else {
+ value = PASSWORD_PENDING;
+ ((irc_t *)acc->bee->ui_data)->status |= OPER_HACK_ACCOUNT_PASSWORD;
+ irc_rootmsg((irc_t *)acc->bee->ui_data, "You may now use /OPER to set the password");
+ }
+ }
g_free( acc->pass );
acc->pass = g_strdup( value );
diff --git a/root_commands.c b/root_commands.c
index 0bd16163..2c153f0e 100644
--- a/root_commands.c
+++ b/root_commands.c
@@ -421,7 +421,7 @@ static void cmd_account( irc_t *irc, char **cmd )
return;
}
- irc->status |= OPER_HACK_ACCOUNT_ADD;
+ irc->status |= OPER_HACK_ACCOUNT_PASSWORD;
}
prpl = find_protocol( cmd[2] );