Changes in irc_commands.c [f9756bd:eeb85a8]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_commands.c
rf9756bd reeb85a8 30 30 static void irc_cmd_pass( irc_t *irc, char **cmd ) 31 31 { 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 && 45 ( strncmp( global.conf->auth_pass, "md5:", 4 ) == 0 ? 46 md5_verify_password( cmd[1], global.conf->auth_pass + 4 ) == 0 : 47 strcmp( cmd[1], global.conf->auth_pass ) == 0 ) ) 32 if( global.conf->auth_pass && strcmp( cmd[1], global.conf->auth_pass ) == 0 ) 48 33 { 49 34 irc->status |= USTATUS_AUTHORIZED; 50 35 irc_check_login( irc ); 51 36 } 52 else if( global.conf->auth_pass )37 else 53 38 { 54 39 irc_reply( irc, 464, ":Incorrect password" ); 55 }56 else57 {58 /* Remember the password and try to identify after USER/NICK. */59 irc_setpass( irc, cmd[1] );60 irc_check_login( irc );61 40 } 62 41 } … … 109 88 static void irc_cmd_oper( irc_t *irc, char **cmd ) 110 89 { 111 if( global.conf->oper_pass && 112 ( strncmp( global.conf->oper_pass, "md5:", 4 ) == 0 ? 113 md5_verify_password( cmd[2], global.conf->oper_pass + 4 ) == 0 : 114 strcmp( cmd[2], global.conf->oper_pass ) == 0 ) ) 90 if( global.conf->oper_pass && strcmp( cmd[2], global.conf->oper_pass ) == 0 ) 115 91 { 116 92 irc_umode_set( irc, "+o", 1 ); … … 278 254 if( cmd[1] != irc->last_target ) 279 255 { 280 g_free( irc->last_target ); 256 if( irc->last_target ) 257 g_free( irc->last_target ); 281 258 irc->last_target = g_strdup( cmd[1] ); 282 259 } … … 598 575 599 576 static const command_t irc_commands[] = { 600 { "pass", 1, irc_cmd_pass, 0},577 { "pass", 1, irc_cmd_pass, IRC_CMD_PRE_LOGIN }, 601 578 { "user", 4, irc_cmd_user, IRC_CMD_PRE_LOGIN }, 602 579 { "nick", 1, irc_cmd_nick, 0 },
Note: See TracChangeset
for help on using the changeset viewer.