Changeset a199d33


Ignore:
Timestamp:
2008-03-29T22:19:17Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
18ff38f
Parents:
8968133
Message:

Closing bug #209: The PASS command can now be used to identify yourself
to BitlBee. The advantage: No more messing with NickServ hooks. Just set
a server password.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r8968133 ra199d33  
    736736        irc_spawn( irc, u );
    737737       
    738         irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\nIf you've never used BitlBee before, please do read the help information using the \x02help\x02 command. Lots of FAQs are answered there." );
     738        irc_usermsg( irc, "Welcome to the BitlBee gateway!\n\n"
     739                          "If you've never used BitlBee before, please do read the help "
     740                          "information using the \x02help\x02 command. Lots of FAQs are "
     741                          "answered there.\n"
     742                          "If you already have an account on this server, just use the "
     743                          "\x02identify\x02 command to identify yourself." );
    739744       
    740745        if( global.conf->runmode == RUNMODE_FORKDAEMON || global.conf->runmode == RUNMODE_DAEMON )
     
    742747       
    743748        irc->status |= USTATUS_LOGGED_IN;
     749       
     750        /* This is for bug #209 (use PASS to identify to NickServ). */
     751        if( irc->password != NULL )
     752        {
     753                char *send_cmd[] = { "identify", g_strdup( irc->password ), NULL };
     754               
     755                irc_setpass( irc, NULL );
     756                root_command( irc, send_cmd );
     757                g_free( send_cmd[1] );
     758        }
    744759}
    745760
  • irc.h

    r8968133 ra199d33  
    6969        char *host;
    7070        char *realname;
    71         char *password;
     71        char *password; /* HACK: Used to save the user's password, but before
     72                           logging in, this may contain a password we should
     73                           send to identify after USER/NICK are received. */
    7274
    7375        char umode[8];
  • irc_commands.c

    r8968133 ra199d33  
    3030static void irc_cmd_pass( irc_t *irc, char **cmd )
    3131{
    32         if( global.conf->auth_pass &&
     32        if( irc->status & USTATUS_LOGGED_IN )
     33        {
     34                char *send_cmd[] = { "identify", cmd[1], NULL };
     35               
     36                /* We're already logged in, this client seems to send the PASS
     37                   command last. (Possibly it won't send it at all if it turns
     38                   out we don't require it, which will break this feature.)
     39                   Try to identify using the given password. */
     40                return root_command( irc, send_cmd );
     41        }
     42        /* Handling in pre-logged-in state, first see if this server is
     43           password-protected: */
     44        else if( global.conf->auth_pass &&
    3345            ( strncmp( global.conf->auth_pass, "md5:", 4 ) == 0 ?
    3446                md5_verify_password( cmd[1], global.conf->auth_pass + 4 ) == 0 :
     
    3850                irc_check_login( irc );
    3951        }
    40         else
     52        else if( global.conf->auth_pass )
    4153        {
    4254                irc_reply( irc, 464, ":Incorrect password" );
     55        }
     56        else
     57        {
     58                /* Remember the password and try to identify after USER/NICK. */
     59                irc_setpass( irc, cmd[1] );
     60                irc_check_login( irc );
    4361        }
    4462}
     
    581599
    582600static const command_t irc_commands[] = {
    583         { "pass",        1, irc_cmd_pass,        IRC_CMD_PRE_LOGIN },
     601        { "pass",        1, irc_cmd_pass,        0 },
    584602        { "user",        4, irc_cmd_user,        IRC_CMD_PRE_LOGIN },
    585603        { "nick",        1, irc_cmd_nick,        0 },
Note: See TracChangeset for help on using the changeset viewer.