]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/network.c
Update svn:keyword properties.
[thirdparty/cups.git] / scheduler / network.c
index 7f30b1e256195718be446082b512487881c86c1c..054faa50fe36257f53ead0d276ead3958726f8c2 100644 (file)
@@ -1,9 +1,9 @@
 /*
- * "$Id: network.c 7861 2008-08-26 03:15:14Z mike $"
+ * "$Id$"
  *
  *   Network interface functions for the CUPS scheduler.
  *
- *   Copyright 2007-2010 by Apple Inc.
+ *   Copyright 2007-2012 by Apple Inc.
  *   Copyright 1997-2006 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -166,7 +166,7 @@ cupsdNetIFUpdate(void)
       */
 
       if (httpAddrLocalhost((http_addr_t *)(addr->ifa_addr)))
-        strcpy(hostname, "localhost");
+        strlcpy(hostname, "localhost", sizeof(hostname));
       else
        httpAddrString((http_addr_t *)(addr->ifa_addr), hostname,
                       sizeof(hostname));
@@ -186,7 +186,7 @@ cupsdNetIFUpdate(void)
 
     strlcpy(temp->name, addr->ifa_name, sizeof(temp->name));
     temp->hostlen = hostlen;
-    strcpy(temp->hostname, hostname);  /* Safe because hostname is allocated */
+    memcpy(temp->hostname, hostname, hostlen + 1);
 
     if (addr->ifa_addr->sa_family == AF_INET)
     {
@@ -264,12 +264,7 @@ cupsdNetIFUpdate(void)
 
       if (match)
       {
-        if (lis->address.addr.sa_family == AF_INET)
-          temp->port = ntohs(lis->address.ipv4.sin_port);
-#ifdef AF_INET6
-        else if (lis->address.addr.sa_family == AF_INET6)
-          temp->port = ntohs(lis->address.ipv6.sin6_port);
-#endif /* AF_INET6 */
+        temp->port = httpAddrPort(&(lis->address));
        break;
       }
     }
@@ -301,5 +296,5 @@ compare_netif(cupsd_netif_t *a,             /* I - First network interface */
 
 
 /*
- * End of "$Id: network.c 7861 2008-08-26 03:15:14Z mike $".
+ * End of "$Id$".
  */