r22539 - in /desktop/unstable/vino/debian: changelog patches/11_hurd_maxhostnamelen.patch

pochu at users.alioth.debian.org pochu at users.alioth.debian.org
Tue Dec 8 00:13:57 UTC 2009


Author: pochu
Date: Tue Dec  8 00:13:56 2009
New Revision: 22539

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=22539
Log:
* debian/patches/11_hurd_maxhostnamelen.patch:
  - Fix build on GNU/Hurd by malloc'ing enough memory for the hostname
    rather than using MAXHOSTNAMELEN, which is undefined on some OS'es.

Added:
    desktop/unstable/vino/debian/patches/11_hurd_maxhostnamelen.patch
Modified:
    desktop/unstable/vino/debian/changelog

Modified: desktop/unstable/vino/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/vino/debian/changelog?rev=22539&op=diff
==============================================================================
--- desktop/unstable/vino/debian/changelog [utf-8] (original)
+++ desktop/unstable/vino/debian/changelog [utf-8] Tue Dec  8 00:13:56 2009
@@ -1,3 +1,11 @@
+vino (2.28.1-3) UNRELEASED; urgency=low
+
+  * debian/patches/11_hurd_maxhostnamelen.patch:
+    - Fix build on GNU/Hurd by malloc'ing enough memory for the hostname
+      rather than using MAXHOSTNAMELEN, which is undefined on some OS'es.
+
+ -- Emilio Pozuelo Monfort <pochu at debian.org>  Fri, 04 Dec 2009 13:41:46 +0100
+
 vino (2.28.1-2) unstable; urgency=low
 
   * Only require NM on Linux architectures.

Added: desktop/unstable/vino/debian/patches/11_hurd_maxhostnamelen.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/vino/debian/patches/11_hurd_maxhostnamelen.patch?rev=22539&op=file
==============================================================================
--- desktop/unstable/vino/debian/patches/11_hurd_maxhostnamelen.patch (added)
+++ desktop/unstable/vino/debian/patches/11_hurd_maxhostnamelen.patch [utf-8] Tue Dec  8 00:13:56 2009
@@ -1,0 +1,121 @@
+diff -ruNp vino-2.28.1/server/miniupnp/miniupnpc.c vino-2.28.1.new/server/miniupnp/miniupnpc.c
+--- vino-2.28.1/server/miniupnp/miniupnpc.c	2009-04-18 15:22:24.000000000 +0200
++++ vino-2.28.1.new/server/miniupnp/miniupnpc.c	2009-12-04 01:01:02.000000000 +0100
+@@ -13,7 +13,6 @@
+ #include <io.h>
+ #define snprintf _snprintf
+ #define strncasecmp memicmp
+-#define MAXHOSTNAMELEN 64
+ #else
+ #include <unistd.h>
+ #include <sys/socket.h>
+@@ -132,7 +131,7 @@ int simpleUPnPcommand(int s, const char 
+                       char * buffer, int * bufsize)
+ {
+ 	struct sockaddr_in dest;
+-	char hostname[MAXHOSTNAMELEN+1];
++	char *hostname;
+ 	unsigned short port = 0;
+ 	char * path;
+ 	char soapact[128];
+@@ -214,6 +213,7 @@ int simpleUPnPcommand(int s, const char 
+ 		{
+ 			PRINT_SOCKET_ERROR("socket");
+ 			*bufsize = 0;
++			free (hostname);
+ 			return -1;
+ 		}
+ 		dest.sin_family = AF_INET;
+@@ -224,6 +224,7 @@ int simpleUPnPcommand(int s, const char 
+ 			PRINT_SOCKET_ERROR("connect");
+ 			closesocket(s);
+ 			*bufsize = 0;
++			free (hostname);
+ 			return -1;
+ 		}
+ 	}
+@@ -234,6 +235,7 @@ int simpleUPnPcommand(int s, const char 
+ 		printf("Error sending SOAP request\n");
+ #endif
+ 		closesocket(s);
++		free (hostname);
+ 		return -1;
+ 	}
+ 
+diff -ruNp vino-2.28.1/server/miniupnp/miniwget.c vino-2.28.1.new/server/miniupnp/miniwget.c
+--- vino-2.28.1/server/miniupnp/miniwget.c	2009-04-18 15:22:24.000000000 +0200
++++ vino-2.28.1.new/server/miniupnp/miniwget.c	2009-12-04 01:18:42.000000000 +0100
+@@ -12,7 +12,6 @@
+ #ifdef WIN32
+ #include <winsock2.h>
+ #include <io.h>
+-#define MAXHOSTNAMELEN 64
+ #define MIN(x,y) (((x)<(y))?(x):(y))
+ #define snprintf _snprintf
+ #define herror
+@@ -148,7 +147,7 @@ miniwget2(const char * url, const char *
+ /* parseURL()
+  * arguments :
+  *   url :		source string not modified
+- *   hostname :	hostname destination string (size of MAXHOSTNAMELEN+1)
++ *   hostname :	hostname destination string (must be freed by the caller if there was no error)
+  *   port :		port (destination)
+  *   path :		pointer to the path part of the URL 
+  *
+@@ -169,15 +168,18 @@ int parseURL(const char * url, char * ho
+ 	p3 = strchr(p1, '/');
+ 	if(!p3)
+ 		return 0;
+-	memset(hostname, 0, MAXHOSTNAMELEN + 1);
+ 	if(!p2 || (p2>p3))
+ 	{
+-		strncpy(hostname, p1, MIN(MAXHOSTNAMELEN, (int)(p3-p1)));
++		hostname = malloc ((int)(p3-p1) + 1);
++		strncpy(hostname, p1, (int)(p3-p1));
++		hostname[(int)(p3-p1)] = '\0';
+ 		*port = 80;
+ 	}
+ 	else
+ 	{
+-		strncpy(hostname, p1, MIN(MAXHOSTNAMELEN, (int)(p2-p1)));
++		hostname = malloc ((int)(p2-p1) + 1);
++		strncpy(hostname, p1, (int)(p2-p1));
++		hostname[(int)(p2-p1)] = '\0';
+ 		*port = 0;
+ 		p2++;
+ 		while( (*p2 >= '0') && (*p2 <= '9'))
+@@ -196,11 +198,14 @@ void * miniwget(const char * url, int * 
+ 	unsigned short port;
+ 	char * path;
+ 	/* protocol://host:port/chemin */
+-	char hostname[MAXHOSTNAMELEN+1];
++	char *hostname;
++	void *ret;
+ 	*size = 0;
+ 	if(!parseURL(url, hostname, &port, &path))
+ 		return NULL;
+-	return miniwget2(url, hostname, port, path, size, 0, 0);
++	ret = miniwget2(url, hostname, port, path, size, 0, 0);
++	free (hostname);
++	return ret;
+ }
+ 
+ void * miniwget_getaddr(const char * url, int * size, char * addr, int addrlen)
+@@ -208,12 +213,15 @@ void * miniwget_getaddr(const char * url
+ 	unsigned short port;
+ 	char * path;
+ 	/* protocol://host:port/chemin */
+-	char hostname[MAXHOSTNAMELEN+1];
++	char *hostname;
++	void *ret;
+ 	*size = 0;
+ 	if(addr)
+ 		addr[0] = '\0';
+ 	if(!parseURL(url, hostname, &port, &path))
+ 		return NULL;
+-	return miniwget2(url, hostname, port, path, size, addr, addrlen);
++	ret = miniwget2(url, hostname, port, path, size, addr, addrlen);
++	free (hostname);
++	return ret;
+ }
+ 




More information about the pkg-gnome-commits mailing list