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 |
55 | 55 | to the IRC server securely (i.e. not echoing to screen or written |
56 | 56 | to logfiles) is the /OPER command, try to use that command for |
57 | 57 | stuff that matters. */ |
| 58 | OPER_HACK_IDENTIFY_NOLOAD = 0x010, |
| 59 | OPER_HACK_IDENTIFY_FORCE = 0x020, |
58 | 60 | OPER_HACK_IDENTIFY = 0x100, |
59 | 61 | OPER_HACK_REGISTER = 0x200, |
60 | 62 | 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. */ |
62 | 64 | } irc_status_t; |
63 | 65 | |
64 | 66 | struct irc_user; |
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 ) |
447 | 447 | } |
448 | 448 | else if( irc->status & OPER_HACK_IDENTIFY ) |
449 | 449 | { |
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 | } |
451 | 459 | irc_send_num( irc, 491, ":Trying to identify" ); |
452 | 460 | root_command( irc, send_cmd ); |
453 | 461 | } |
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 ) |
120 | 120 | { |
121 | 121 | load = FALSE; |
122 | 122 | password = cmd[2]; |
| 123 | if( password == NULL ) |
| 124 | irc->status |= OPER_HACK_IDENTIFY_NOLOAD; |
123 | 125 | } |
124 | 126 | else if( strncmp( cmd[1], "-force", 6 ) == 0 ) |
125 | 127 | { |
126 | 128 | password = cmd[2]; |
| 129 | if( password == NULL ) |
| 130 | irc->status |= OPER_HACK_IDENTIFY_FORCE; |
127 | 131 | } |
128 | 132 | else if( irc->b->accounts != NULL ) |
129 | 133 | { |