Re: bopm is broken
Elan Ruusamäe <[email protected]>
| Newsgroups | gmane.network.irc.bopm |
|---|---|
| Message-ID | <[email protected]> |
hi didn't find any other place to send this.. attached diff, that will allow you use bopm on ircd, that is unable to give you ip addresses. beware that if you're not running local dns cache, then this could slow down bopm. plus it fixes segfault, when connregex is invalid On Friday 09 July 2004 17:29, Elan Ruusamäe wrote: > On Friday 09 July 2004 16:42, Philipp Kern wrote: > > On Fr, 2004-07-09 at 15:38, Joe Dow wrote: > > > [Jul 09 21:29:40 2004] IRC READ -> :FrostNet.Ice.Snoice.Net NOTICE > > > Console :*** Notice -- Client connecting at buzz.snoice.net: Brianc > > > ([email protected]) [0] {0} > > > > There's no IP address in your connection notice. > > Fix this or BOPM won't work anyway. > > i've done few fixes that it will work for name-based lookups. it's safe for > me because i run dnscache, so the lookup won't block for BOPM (cached entry > already generated for IRCD) > > probably should send the diffs to bopm developers... > > > Bye, > > phil -- glen
name-resolv.patch
(text/x-diff, 2.1 KB)
Index: src/irc.c
===================================================================
RCS file: /data/cvs/bopm/src/irc.c,v
retrieving revision 1.27
diff -u -r1.27 irc.c
--- src/irc.c 29 Nov 2003 19:56:19 -0000 1.27
+++ src/irc.c 9 Jul 2004 14:31:25 -0000
@@ -1056,6 +1056,22 @@
*(parv[3] + pmatch[i + 1].rm_eo) = '\0';
}
+ // make user[3] as ip, for ConverenceRoom
+ // this should be config option instead?
+ // glen 2004-04-17
+ {
+ struct in_addr *addr;
+
+ /* If IP is a hostname, resolve it using gethostbyname (which will block!) */
+ if (!(addr = firedns_resolveip4(user[3]))) {
+ log_printf("IRC REGEX -> Error resolving host '%s': %s",
+ user[3], firedns_strerror(fdns_errno));
+ } else {
+ /* IP = the resolved IP now (it was the ip OR hostname before) */
+ user[3] = inet_ntoa(*addr);
+ }
+ }
+
if(OPT_DEBUG > 0)
log_printf("IRC REGEX -> Parsed %s!%s@%s [%s] from connection notice.",
user[0], user[1], user[2], user[3]);
Index: src/scan.c
===================================================================
RCS file: /data/cvs/bopm/src/scan.c,v
retrieving revision 1.33
diff -u -r1.33 scan.c
--- src/scan.c 22 Jun 2003 17:05:30 -0000 1.33
+++ src/scan.c 9 Jul 2004 14:31:26 -0000
@@ -423,12 +430,14 @@
continue;
break;
case OPM_ERR_BADADDR:
+ // ss->manual_target could be NULL, happens when making invalid regex, and segfaults suck
+ // -glen 2004-04-17
log_printf("OPM -> Bad address %s [%s].",
- ss->manual_target->name, ss->ip);
+ ss->manual_target ? ss->manual_target->name : "SERVER", ss->ip);
break;
default:
log_printf("OPM -> Unknown error %s [%s].",
- ss->manual_target->name, ss->ip);
+ ss->manual_target ? ss->manual_target->name : "SERVER", ss->ip);
break;
}
}