Global scan patch

Lubomir Radev <[email protected]>
Newsgroups gmane.network.irc.bopm
Message-ID <Pine.BSF.4.43L0.0503261834090.12693-200000@whitepine.canadian.net>
Hey folks,

Here's a small patch against latest BOPM which adds one more var (server
name) to extract from "Client connecting" notice; on my ircd I got "Remote
client" connecting notice with remote server name embedded in it, so I use
that to send out remote KLINE (I also added a new format spec %s for
accessing that var in kline spec):

        connregex = "\\*\\*\\* Notice -- Remote client: ([^ ]+)
\\(([^@]+)@([^\\)]+)\\) \\[([0-9\\.]+)\\] \\{([^\\}]+)\\}.*";

        kline = "KLINE 600 *@%h ON %s :open proxy, go away";

(my ircd is ircd-hybrid-7-bg)


BOPM dev team: you rule, keep up the great work
bopm-3.1.2+bnet.diff (text/plain, 2.8 KB)
diff -r bopm-3.1.2/src/irc.c bopm-3.1.2+bnet/src/irc.c
998c998
<    regmatch_t pmatch[5];
---
>    regmatch_t pmatch[6];
1003c1003
<    char *user[4];
---
>    char *user[5];
1031c1031
<    if(regexec(preg, parv[3], 5, pmatch, 0) != 0)
---
>    if(regexec(preg, parv[3], 6, pmatch, 0) != 0)
1049a1050
>        SERVER  : pmatch[5].rm_so  TO  pmatch[5].rm_eo
1053c1054
<    for(i = 0; i < 4; i++)
---
>    for(i = 1; i < 6; i++)
1055,1056c1056,1061
<       user[i] = (parv[3] + pmatch[i + 1].rm_so);
<       *(parv[3] + pmatch[i + 1].rm_eo) = '\0';
---
>       if (pmatch[i].rm_so == -1 && pmatch[i].rm_eo == -1) {
>         user[i-1] = "local";
>       } else { 
>         user[i-1] = (parv[3] + pmatch[i].rm_so);
>         *(parv[3] + pmatch[i].rm_eo) = '\0';
>       }
1060,1061c1065,1066
<       log_printf("IRC REGEX -> Parsed %s!%s@%s [%s] from connection notice.",
<           user[0], user[1], user[2], user[3]);
---
>       log_printf("IRC REGEX -> Parsed %s!%s@%s [%s] {%s} from connection notice.",
>           user[0], user[1], user[2], user[3], user[4]);
diff -r bopm-3.1.2/src/scan.c bopm-3.1.2+bnet/src/scan.c
333a334
>  *          user[4] = connecting users server
461a463
>  *          user[4] = connecting users server
476a479
>    ss->irc_server = (char *) DupString(user[4]);
512a516
>    MyFree(ss->irc_server);
634,640c638,644
<       irc_send_channels("OPEN PROXY -> %s!%s@%s %s:%d (%s) [%s]",
<             ss->irc_nick, ss->irc_username, ss->irc_hostname, remote->ip,
<             remote->port, scan_gettype(remote->protocol), scs->name);
< 
<       log_printf("SCAN -> OPEN PROXY %s!%s@%s %s:%d (%s) [%s]",
<             ss->irc_nick, ss->irc_username, ss->irc_hostname, remote->ip,
<             remote->port, scan_gettype(remote->protocol), scs->name);
---
>       irc_send_channels("OPEN PROXY -> %s!%s@%s {%s} %s:%d (%s) [%s]",
>             ss->irc_nick, ss->irc_username, ss->irc_hostname, ss->irc_server,
>             remote->ip, remote->port, scan_gettype(remote->protocol), scs->name);
> 
>       log_printf("SCAN -> OPEN PROXY %s!%s@%s {%s} %s:%d (%s) [%s]",
>             ss->irc_nick, ss->irc_username, ss->irc_hostname, ss->irc_server,
>             remote->ip, remote->port, scan_gettype(remote->protocol), scs->name);
913a918
>          {'s',   (void *) NULL,		FORMATTYPE_STRING },
921,924c926,930
<    table[1].data = ss->irc_hostname;
<    table[2].data = ss->irc_username;
<    table[3].data = ss->irc_nick;
<    table[4].data = type;
---
>    table[1].data = ss->irc_server;
>    table[2].data = ss->irc_hostname;
>    table[3].data = ss->irc_username;
>    table[4].data = ss->irc_nick;
>    table[5].data = type;
diff -r bopm-3.1.2/src/scan.h bopm-3.1.2+bnet/src/scan.h
10a11
>    char *irc_server;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.