Package: hpsockd
Version: 0.17
Severity: normal

Hi,

hpsockd currently fails to build on Debian GNU/Hurd as it doesn't recognize the OS and then has an unconditional use of MAXPATHLEN.

The attached patch resolves these issues.

Thank you,

Barry deFreese


diff -Nru hpsockd-0.17/src/Makefile.os hpsockd-0.17+nmu1/src/Makefile.os
--- hpsockd-0.17/src/Makefile.os        2008-06-14 11:06:52.520000000 -0400
+++ hpsockd-0.17+nmu1/src/Makefile.os   2009-06-17 16:02:03.500000000 -0400
@@ -44,3 +44,6 @@
 
 GNU/kFreeBSD.debug: Linux.debug
 
+GNU: Linux
+
+GNU.debug: Linux.debug
diff -Nru hpsockd-0.17/src/sockd/gram.y hpsockd-0.17+nmu1/src/sockd/gram.y
--- hpsockd-0.17/src/sockd/gram.y       2008-06-14 11:06:52.780000000 -0400
+++ hpsockd-0.17+nmu1/src/sockd/gram.y  2009-06-19 12:19:09.790000000 -0400
@@ -420,9 +420,19 @@
                ; 
 
 hostToken:     T_HOST                                  { struct hostent *hp;
-                                                         char tmp[MAXPATHLEN];
+                                                         char *tmp = NULL;
+                                                         int tmplen = 16;
                                                          register int i;
-                                                         
gethostname(tmp,sizeof(tmp));
+                                                         tmp = malloc(tmplen);
+                                                         
gethostname(tmp,tmplen);
+                                                         tmp[tmplen-1] = '\0';
+                                                         while (strlen(tmp) >= 
tmplen-1)
+                                                         {
+                                                               tmplen *= 2;
+                                                               tmp = 
realloc(tmp, tmplen);
+                                                               
gethostname(tmp, tmplen);
+                                                               tmp[tmplen-1] = 
'\0';
+                                                         }
                                                          if 
((hp=gethostbyname(tmp))==NULL) {
                                                                
syslog(LOG_ERR,"No such host");
                                                                YYABORT;
@@ -430,6 +440,7 @@
                                                          
NEWLIST($$,*(int*)hp->h_addr_list[0]);
                                                          for (i=1; 
hp->h_addr_list[i]; i++)
                                                                
ADDTOLIST($$,*(int*)hp->h_addr_list[i]);
+                                                         free(tmp);
                                                        }
                ;
 

Reply via email to