Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Aug 2014 18:34:42 +0000 (UTC)
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r364213 - in head/graphics/sane-backends: . files
Message-ID:  <53e27542.50fe.1aacf6d2@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tijl
Date: Wed Aug  6 18:34:42 2014
New Revision: 364213
URL: http://svnweb.freebsd.org/changeset/ports/364213
QAT: https://qat.redports.org/buildarchive/r364213/

Log:
  Import upstream git commit 37523b867d411c2f82d08128246be7e38bc9812c:
  Bugfix in kodakaio.c to fix segfault when non kodak scanners return
  unexpected data via avahi auto discovery

Modified:
  head/graphics/sane-backends/Makefile
  head/graphics/sane-backends/files/patch-backend__kodakaio.c

Modified: head/graphics/sane-backends/Makefile
==============================================================================
--- head/graphics/sane-backends/Makefile	Wed Aug  6 16:41:32 2014	(r364212)
+++ head/graphics/sane-backends/Makefile	Wed Aug  6 18:34:42 2014	(r364213)
@@ -3,7 +3,7 @@
 
 PORTNAME=	sane-backends
 PORTVERSION=	1.0.24
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	graphics
 MASTER_SITES=	http://alioth.debian.org/frs/download.php/3958/ \
 		http://fossies.org/linux/misc/

Modified: head/graphics/sane-backends/files/patch-backend__kodakaio.c
==============================================================================
--- head/graphics/sane-backends/files/patch-backend__kodakaio.c	Wed Aug  6 16:41:32 2014	(r364212)
+++ head/graphics/sane-backends/files/patch-backend__kodakaio.c	Wed Aug  6 18:34:42 2014	(r364213)
@@ -1,6 +1,6 @@
 --- backend/kodakaio.c.orig	2012-08-10 09:33:29.000000000 +0900
 +++ backend/kodakaio.c	2012-08-29 16:35:36.000000000 +0900
-@@ -165,6 +165,10 @@
+@@ -181,6 +181,10 @@
  #include <math.h>
  #include <poll.h>
  #include <time.h>
@@ -9,5 +9,64 @@
 +#include <sys/socket.h>
 +#endif
  
- #if HAVE_CUPS
+ #if WITH_AVAHI
  /* used for auto detecting network printers  */
+@@ -2184,6 +2188,7 @@
+     AvahiLookupResultFlags flags,
+     AVAHI_GCC_UNUSED void* userdata) {
+ 
++	AvahiStringList *vid_pair_list = NULL, *pid_pair_list = NULL;
+ 	char *pidkey, *pidvalue;
+ 	char *vidkey, *vidvalue;
+ 	size_t valuesize;
+@@ -2204,20 +2209,40 @@
+             avahi_address_snprint(a, sizeof(a), address);
+ 
+ /* Output short for Kodak ESP */
+-	DBG(min(10,DBG_AUTO), "%s:%u  %s  ", a,port,host_name);
+-	avahi_string_list_get_pair(avahi_string_list_find(txt, "vid"), 
+-		&vidkey, &vidvalue, &valuesize);
+-	DBG(min(10,DBG_AUTO), "%s=%s  ", vidkey, vidvalue);
+-	avahi_string_list_get_pair(avahi_string_list_find(txt, "pid"), 
+-		&pidkey, &pidvalue, &valuesize);
+-	DBG(min(10,DBG_AUTO), "%s=%s\n", pidkey, pidvalue);
++	DBG(min(10,DBG_AUTO), "%s:%u  %s\n", a,port,host_name);
++
++	vid_pair_list = avahi_string_list_find(txt, "vid");
++	if(vid_pair_list != NULL) {
++		avahi_string_list_get_pair(vid_pair_list, &vidkey, &vidvalue, &valuesize);
++		DBG(min(10,DBG_AUTO), "%s=%s  ", vidkey, vidvalue);
++	}
++	else	DBG(min(10,DBG_AUTO), "failed to find key vid\n");
+ 
++	pid_pair_list = avahi_string_list_find(txt, "pid");
++	if(pid_pair_list != NULL) {
++		avahi_string_list_get_pair(pid_pair_list, &pidkey, &pidvalue, &valuesize);
++		DBG(min(10,DBG_AUTO), "%s=%s\n", pidkey, pidvalue);
++	}
++	else	DBG(min(10,DBG_AUTO), "failed to find key pid\n");
++
++	if(pid_pair_list != NULL && vid_pair_list != NULL) {
+ 		ProcessAvahiDevice(name, vidvalue, pidvalue, a);
+-	avahi_free(vidkey); avahi_free(vidvalue);
+-	avahi_free(pidkey); avahi_free(pidvalue);
++	}
++	else DBG(min(10,DBG_AUTO), "didn't call ProcessAvahiDevice\n");
++
++	if(vid_pair_list != NULL) {
++		avahi_free(vidkey); 
++		avahi_free(vidvalue);
++		DBG(min(15,DBG_AUTO), "vidkey and vidvalue freed\n");
++	}
++	if(pid_pair_list != NULL) {
++		avahi_free(pidkey); 
++		avahi_free(pidvalue);
++		DBG(min(15,DBG_AUTO), "pidkey and pidvalue freed\n");
++	}
+         }
+     }
+-
++    DBG(min(10,DBG_AUTO), "ending resolve_callback\n");
+     avahi_service_resolver_free(r);
+ }
+ 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53e27542.50fe.1aacf6d2>