Ticket #814: 0001-Oper-noload-force-identify-fix.patch

File 0001-Oper-noload-force-identify-fix.patch, 2.2 KB (added by Artem Savkov <artem.savkov@…>, at 2012-03-18T09:58:54Z)
  • irc.h

    From 8174b8de20c8a77ee5694f3c2b2c09e8e8101884 Mon Sep 17 00:00:00 2001
    From: Artem Savkov <artem.savkov@gmail.com>
    Date: Sun, 18 Mar 2012 13:33:54 +0400
    Subject: [PATCH] Oper -noload/-force identify fix.
    
    This patch fixes use of "identify -noload"/"identify -force" with /oper.
    http://bugs.bitlbee.org/bitlbee/ticket/815
    ---
     irc.h           |    4 +++-
     irc_commands.c  |   10 +++++++++-
     root_commands.c |    4 ++++
     3 files changed, 16 insertions(+), 2 deletions(-)
    
    diff --git a/irc.h b/irc.h
    index 930b90b..0ee3a03 100644
    a b typedef enum 
    5555           to the IRC server securely (i.e. not echoing to screen or written
    5656           to logfiles) is the /OPER command, try to use that command for
    5757           stuff that matters. */
     58        OPER_HACK_IDENTIFY_NOLOAD = 0x010,
     59        OPER_HACK_IDENTIFY_FORCE  = 0x020,
    5860        OPER_HACK_IDENTIFY = 0x100,
    5961        OPER_HACK_REGISTER = 0x200,
    6062        OPER_HACK_ACCOUNT_ADD = 0x400,
    61         OPER_HACK_ANY = 0x700,  /* To check for them all at once. */
     63        OPER_HACK_ANY = 0x730,  /* To check for them all at once. */
    6264} irc_status_t;
    6365
    6466struct irc_user;
  • irc_commands.c

    diff --git a/irc_commands.c b/irc_commands.c
    index 18a7acd..0240a60 100644
    a b static void irc_cmd_oper_hack( irc_t *irc, char **cmd ) 
    447447        }
    448448        else if( irc->status & OPER_HACK_IDENTIFY )
    449449        {
    450                 char *send_cmd[] = { "identify", password, NULL };
     450                char *send_cmd[] = { "identify", password, NULL, NULL };
     451                if( irc->status & OPER_HACK_IDENTIFY_NOLOAD ) {
     452                        send_cmd[1] = "-noload";
     453                        send_cmd[2] = password;
     454                }
     455                else if( irc->status & OPER_HACK_IDENTIFY_FORCE ) {
     456                        send_cmd[1] = "-force";
     457                        send_cmd[2] = password;
     458                }
    451459                irc_send_num( irc, 491, ":Trying to identify" );
    452460                root_command( irc, send_cmd );
    453461        }
  • root_commands.c

    diff --git a/root_commands.c b/root_commands.c
    index 41b98a1..b46b076 100644
    a b static void cmd_identify( irc_t *irc, char **cmd ) 
    120120        {
    121121                load = FALSE;
    122122                password = cmd[2];
     123                if( password == NULL )
     124                        irc->status |= OPER_HACK_IDENTIFY_NOLOAD;
    123125        }
    124126        else if( strncmp( cmd[1], "-force", 6 ) == 0 )
    125127        {
    126128                password = cmd[2];
     129                if( password == NULL )
     130                        irc->status |= OPER_HACK_IDENTIFY_FORCE;
    127131        }
    128132        else if( irc->b->accounts != NULL )
    129133        {