Bug 116260 - Compile failure of kdelibs with cups-1.2svn
Summary: Compile failure of kdelibs with cups-1.2svn
Status: CLOSED FIXED
Alias: None
Product: kdeprint
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: KDEPrint Devel Mailinglist
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-13 20:30 UTC by Christopher Neufeld
Modified: 2008-12-31 19:21 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Neufeld 2005-11-13 20:30:43 UTC
Version:           3.5.0-rc1 (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
Compiler:          gcc-3.4.3 Compiler compiled from sources
OS:                Linux

I have the same symptoms as bug 7286.  I haven't figured out how to reopen that bug, so I'm creating a new one.

My fix was:

--- kdelibs-3.5.0/kdeprint/cups/cupsdconf2/cups-util.c~ Sat Sep 10 04:27:41 2005
+++ kdelibs-3.5.0/kdeprint/cups/cupsdconf2/cups-util.c  Sun Nov 13 13:51:08 2005
@@ -442,7 +442,7 @@
   * See if we are accessing localhost...
   */

-  if (ntohl(http->hostaddr.sin_addr.s_addr) != 0x7f000001 &&
+  if (ntohl(http->hostaddr.ipv4.sin_addr.s_addr) != 0x7f000001 &&
       strcasecmp(http->hostname, "localhost") != 0)
     return (0);

following which, it compiles cleanly.
Comment 1 Christopher Neufeld 2005-11-13 20:31:58 UTC
That should have been bug 72867.
Comment 2 Thiago Macieira 2005-11-13 21:08:46 UTC
It looks like it, but it isn't the same bug.
Comment 3 Thiago Macieira 2005-11-13 21:09:12 UTC
SVN commit 480212 by thiago:

Do not assume about the internals of struct sockaddr_in.

CCBUG:116260


 M  +1 -1      cups-util.c  


--- branches/KDE/3.5/kdelibs/kdeprint/cups/cupsdconf2/cups-util.c #480211:480212
@@ -442,7 +442,7 @@
   * See if we are accessing localhost...
   */
 
-  if (ntohl(http->hostaddr.sin_addr.s_addr) != 0x7f000001 &&
+  if (ntohl(*(int*)&http->hostaddr.sin_addr) != 0x7f000001 &&
       strcasecmp(http->hostname, "localhost") != 0)
     return (0);
 
Comment 4 Thiago Macieira 2005-11-13 21:11:47 UTC
SVN commit 480213 by thiago:

Forward-porting the bugfix for bug 116260.

BUG:116260
BACKPORT:480212


 M  +1 -1      cups-util.c  


--- trunk/KDE/kdelibs/kdeprint/cups/cupsdconf2/cups-util.c #480212:480213
@@ -442,7 +442,7 @@
   * See if we are accessing localhost...
   */
 
-  if (ntohl(http->hostaddr.sin_addr.s_addr) != 0x7f000001 &&
+  if (ntohl(*(int*)&http->hostaddr.sin_addr) != 0x7f000001 &&
       strcasecmp(http->hostname, "localhost") != 0)
     return (0);
 
Comment 5 Dirk Mueller 2005-11-14 16:21:23 UTC
On Sunday 13 November 2005 21:09, Thiago Macieira wrote:

> Do not assume about the internals of struct sockaddr_in.


that doesn't quite work for anything besides IPv4 and only accidentally works 
on x86. 

it would be better to use the wrapper that is provided by cups itself 
(httpAddrLocalhost())
Comment 6 Thiago Macieira 2005-11-15 00:11:02 UTC
Dirk Mueller wrote:
>that doesn't quite work for anything besides IPv4 and only accidentally
> works on x86.
>
>it would be better to use the wrapper that is provided by cups itself
>(httpAddrLocalhost())


Maybe, but I don't know the first thing about CUPS, so I wouldn't know 
that function was there.

Unfortunately, IPv4 doesn't provide a function like IPv6's 
IN6_IS_ADDR_LOOPBACK.
Comment 7 John Layt 2008-12-31 19:21:06 UTC
Closing old Resolved status bug.