From 35987a1c74b708cd9ba2dc351400edd4d4046a6f Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Fri, 28 Feb 2014 23:17:28 +0000 Subject: Allow use of "ac x set -del password" to use /oper to change the password "securely". Patch from Flexo, bug #1117. --- protocols/account.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'protocols') 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 ); -- cgit v1.2.3