diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2014-02-28 23:17:28 +0000 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2014-02-28 23:17:28 +0000 |
commit | 35987a1c74b708cd9ba2dc351400edd4d4046a6f (patch) | |
tree | 34b8a4257258f13a4aa902169a6e7f81e75d1a43 /protocols/account.c | |
parent | 2e815e5627b54696d4a81cddd8162fa0414b118f (diff) |
Allow use of "ac x set -del password" to use /oper to change the password
"securely". Patch from Flexo, bug #1117.
Diffstat (limited to 'protocols/account.c')
-rw-r--r-- | protocols/account.c | 16 |
1 files changed, 12 insertions, 4 deletions
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 ); |