Changeset 9564e55


Ignore:
Timestamp:
2010-11-22T13:17:45Z (13 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
bedad20
Parents:
09d4922
Message:

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.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.h

    r09d4922 r9564e55  
    126126#define CONF_FILE_DEF ETCDIR "bitlbee.conf"
    127127
     128/* Hack to give a little bit more password security on IRC: If an account has
     129   this password set, use /OPER to change it. */
     130#define PASSWORD_PENDING "\r\rchangeme\r\r"
     131
    128132#include "bee.h"
    129133#include "irc.h"
  • irc_commands.c

    r09d4922 r9564e55  
    401401static void irc_cmd_oper( irc_t *irc, char **cmd )
    402402{
     403        account_t *a;
     404       
     405        /* /OPER can now also be used to enter IM passwords without echoing.
     406           It's a hack but the extra password security is worth it. */
     407        for( a = irc->b->accounts; a; a = a->next )
     408                if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
     409                {
     410                        set_setstr( &a->set, "password", cmd[2] );
     411                        return;
     412                }
     413       
    403414        if( global.conf->oper_pass &&
    404415            ( strncmp( global.conf->oper_pass, "md5:", 4 ) == 0 ?
  • root_commands.c

    r09d4922 r9564e55  
    394394                struct prpl *prpl;
    395395               
    396                 MIN_ARGS( 4 );
     396                MIN_ARGS( 3 );
     397               
     398                if( cmd[4] == NULL )
     399                        for( a = irc->b->accounts; a; a = a->next )
     400                                if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
     401                                {
     402                                        irc_usermsg( irc, "Enter password for account %s(%s) "
     403                                                     "first (use /OPER)", a->prpl->name, a->user );
     404                                        return;
     405                                }
    397406               
    398407                prpl = find_protocol( cmd[2] );
     
    410419                                             "trying to add it twice?", prpl->name, cmd[3] );
    411420               
    412                 a = account_add( irc->b, prpl, cmd[3], cmd[4] );
     421                a = account_add( irc->b, prpl, cmd[3], cmd[4] ? cmd[4] : PASSWORD_PENDING );
    413422                if( cmd[5] )
    414423                {
     
    419428               
    420429                irc_usermsg( irc, "Account successfully added" );
     430               
     431                if( cmd[4] == NULL )
     432                        irc_usermsg( irc, "Now, use /OPER to enter your password for this account" );
    421433               
    422434                return;
     
    462474                        for( a = irc->b->accounts; a; a = a->next )
    463475                                if( !a->ic && a->auto_connect )
    464                                         account_on( irc->b, a );
     476                                {
     477                                        if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
     478                                                irc_usermsg( irc, "Enter password for account %s(%s) "
     479                                                             "first (use /OPER)", a->prpl->name, a->user );
     480                                        else
     481                                                account_on( irc->b, a );
     482                                }
    465483                }
    466484                else
     
    520538                if( a->ic )
    521539                        irc_usermsg( irc, "Account already online" );
     540                else if( strcmp( a->pass, PASSWORD_PENDING ) == 0 )
     541                        irc_usermsg( irc, "Enter password for account %s(%s) "
     542                                     "first (use /OPER)", a->prpl->name, a->user );
    522543                else
    523544                        account_on( irc->b, a );
Note: See TracChangeset for help on using the changeset viewer.