]> jfr.im git - irc.git/blob - software/RELEASES/ircservices/achurch.org/services/lists/ircservices/2004/004539.html
rename -> *.git
[irc.git] / software / RELEASES / ircservices / achurch.org / services / lists / ircservices / 2004 / 004539.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
2 <HTML>
3 <HEAD>
4 <TITLE> [IRCServices] Allocation error: ns unsuspend [retry]
5 </TITLE>
6 <LINK REL="Index" HREF="index.html" >
7 <LINK REL="made" HREF="mailto:ircservices%40ircservices.za.net?Subject=%5BIRCServices%5D%20Allocation%20error%3A%20ns%20unsuspend%20%5Bretry%5D&In-Reply-To=">
8 <META NAME="robots" CONTENT="index,nofollow">
9 <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
10 <LINK REL="Previous" HREF="004537.html">
11 <LINK REL="Next" HREF="004540.html">
12 </HEAD>
13 <BODY BGCOLOR="#ffffff">
14 <H1>[IRCServices] Allocation error: ns unsuspend [retry]</H1>
15 <B>Chawmp</B>
16 <A HREF="mailto:ircservices%40ircservices.za.net?Subject=%5BIRCServices%5D%20Allocation%20error%3A%20ns%20unsuspend%20%5Bretry%5D&In-Reply-To="
17 TITLE="[IRCServices] Allocation error: ns unsuspend [retry]">chawmp at cyberarmy.net
18 </A><BR>
19 <I>Mon Jul 26 05:05:02 PDT 2004</I>
20 <P><UL>
21 <LI>Previous message: <A HREF="004537.html">[IRCServices] old services databases convert
22 </A></li>
23 <LI>Next message: <A HREF="004540.html">[IRCServices] Allocation error: ns unsuspend [retry]
24 </A></li>
25 <LI> <B>Messages sorted by:</B>
26 <a href="date.html#4539">[ date ]</a>
27 <a href="thread.html#4539">[ thread ]</a>
28 <a href="subject.html#4539">[ subject ]</a>
29 <a href="author.html#4539">[ author ]</a>
30 </LI>
31 </UL>
32 <HR>
33 <!--beginarticle-->
34 <PRE>Hi again,
35
36 [ I sent this yesterday, but it seems it got put under another thread in the
37 archive, and didn't actually get sent out to the list, so I'll send it again
38 in case it gets missed :) ]
39
40 I just noticed and patched another bug, quite similar to the last issue I
41 posted about (&quot;Seg Fault/Bus Error on SQUIT&quot;:
42 <A HREF="http://www.ircservices.za.net/pipermail/ircservices/2004/003377.html">http://www.ircservices.za.net/pipermail/ircservices/2004/003377.html</A> ).
43
44 Again, I noticed this one because free() is set up to write a pattern over
45 memory as it is released on our services host. It wouldn't occur in most
46 normal circumstances, but might do unpredictably, depending on a lot of
47 factors, so ought to be fixed.
48
49 The problem occurs when unsuspending a nickname that is part of a group in
50 which no nickname has been used for longer than the NSExpire setting - or
51 something along those lines.
52
53 In modules/nickserv/util.c, unsuspend_nick() does this:
54
55 ARRAY_FOREACH (i, ngi-&gt;nicks) {
56 NickInfo *ni = get_nickinfo(ngi-&gt;nicks[i]);
57 ...
58 }
59
60 get_nickinfo() will free (NickGroupInfo *)ngi under certain conditions
61 (roughly as I described above), making the following attempts to dereference
62 ngi crash the program:
63
64 if (!ni) {
65 module_log(&quot;unsuspend: unable to retrieve NickInfo
66 for %s&quot;
67 &quot; (nick group %u)&quot;, ngi-&gt;nicks[i], ngi-&gt;id);
68 continue;
69 }
70
71 ngi would also be used in subsequent loops, so just changing the log message
72 wouldn't be a solution.
73
74 I didn't have a lot of time to investigate the best way to fix this, but
75 here is the patch I came up with. It seems to do the job, but I would be
76 grateful if anyone can advise something more suitable. (Lines beginning &quot;+&quot;
77 were added; noexpire is just set to 1 before the loop, and restored
78 afterwards, which stops the expiry check. Note that the NSSuspendGrace stuff
79 only happens a few lines after the call to get_nickinfo(), so for that small
80 time, nick groups can disappear.).
81
82 void unsuspend_nick(NickGroupInfo *ngi, int set_time)
83 {
84 time_t now = time(NULL);
85 + int cache_noexpire = 0;
86
87 if (!ngi-&gt;suspendinfo) {
88 module_log(&quot;unsuspend: called on non-suspended nick group %u [%s]&quot;,
89
90 ...
91
92 &quot; %u) to %ld&quot;, ngi-&gt;nicks[ngi-&gt;mainnick], ngi-&gt;id,
93 (long)ngi-&gt;authset);
94 }
95 + cache_noexpire = noexpire;
96 + noexpire = 1;
97 ARRAY_FOREACH (i, ngi-&gt;nicks) {
98 NickInfo *ni = get_nickinfo(ngi-&gt;nicks[i]);
99 if (!ni) {
100
101 ...
102
103 }
104 }
105 }
106 + noexpire = cache_noexpire;
107 }
108
109
110 /*************************************************************************/
111
112 --
113 Tom McIntyre
114 <A HREF="http://www.ircservices.za.net/mailman/listinfo/ircservices">chawmp at cyberarmy.net</A>
115
116
117
118
119 </PRE>
120
121 <!--endarticle-->
122 <HR>
123 <P><UL>
124 <!--threads-->
125 <LI>Previous message: <A HREF="004537.html">[IRCServices] old services databases convert
126 </A></li>
127 <LI>Next message: <A HREF="004540.html">[IRCServices] Allocation error: ns unsuspend [retry]
128 </A></li>
129 <LI> <B>Messages sorted by:</B>
130 <a href="date.html#4539">[ date ]</a>
131 <a href="thread.html#4539">[ thread ]</a>
132 <a href="subject.html#4539">[ subject ]</a>
133 <a href="author.html#4539">[ author ]</a>
134 </LI>
135 </UL>
136
137 </body></html>