Changeset 9564e55 for root_commands.c


Ignore:
Timestamp:
2010-11-22T13:17:45Z (14 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.