bug-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: DeleteConn can delete the wrong connection in cfservd...


From: Mark . Burgess
Subject: Re: DeleteConn can delete the wrong connection in cfservd...
Date: Tue, 2 Apr 2002 15:13:52 +0200 (MET DST)

It should be sufficient to replace 

DeleteItemStarting(&CONNECTIONLIST,conn->ipaddr); 

with

DeleteItemMatching

This will be in 2.0.1 shortly...

Mark

On 31 Mar, Phil D Amore wrote:
> It appears that it is possible for the DeleteConn function in cfservd to 
> remove the wrong IP address from its connection list if two hosts with 
> similar IPs connect at the same time.  For example, given the two 
> addresses:
> 
> 172.16.52.3
> 172.16.52.36
> 
> I found that this line in the DeleteConn fucntion in cfservd.c:
> 
> DeleteItemStarting(&CONNECTIONLIST,conn->ipaddr); 
> 
> when called with the first IP would incorrectly match and delete the 2nd
> IP if they were both connected at the same time, locking out the first IP
> because of repeated connections.
> 
> I noticed this in 2.0.a14, but the code appears unchanged in 2.0.0.  
> Attached is my current patch for the issue in 2.0.a14.  From what I can
> tell, to work in 2.0.0, the line in the patch:
> 
> -DeleteItemStarting(&CONNECTIONLIST,conn->ipaddr); 
> 
> needs to say:
> 
> -DeleteItemStarting(&CONNECTIONLIST,MapAddress(conn->ipaddr)); 
> 
> But I have not really tested 2.0.0 here yet, so I cannot say for sure if
> things will run properly this way.  Basically what I did was create a new 
> function, DeleteItemExact that used strcmp instead of strncmp to make sure 
> the entire string passed in matches the entire string in the list.  I then 
> replace the DeleteItemStarting call in DeleteConn with this new function.
> 
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272            Email:  address@hidden
Fax : +47 22453205            WWW  :  http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





reply via email to

[Prev in Thread] Current Thread [Next in Thread]