Merge branch 'master' into yaz-744
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 26 Feb 2014 14:30:31 +0000 (15:30 +0100)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 26 Feb 2014 14:30:31 +0000 (15:30 +0100)
IDMETA
NEWS
debian/changelog
doc/comstack.xml
src/zoom-c.c
src/zoom-memcached.c
test/test_comstack.c

diff --git a/IDMETA b/IDMETA
index 2da6142..1e6cabe 100755 (executable)
--- a/IDMETA
+++ b/IDMETA
@@ -1,4 +1,4 @@
 DEBIAN_DIST="jessie wheezy squeeze"
 UBUNTU_DIST="saucy raring quantal precise oneiric lucid"
 CENTOS_DIST="centos5 centos6"
-VERSION=5.0.16
+VERSION=5.0.17
diff --git a/NEWS b/NEWS
index 15ce8ea..03c0eec 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,13 @@
+--- 5.0.17 2014/02/26
+
+Fix ZOOM_connection_connect SEGVs if host==NULL YAZ-746. Problem
+introduced in 5.0.12.
+
+Fix: Setting env YAZ_LOG makes YAZ hang YAZ-745
+yaz_init_gloabsl calls yaz_log_init_globals calls yaz_log_mask_str_x .
+Do not call yaz_init_globals from log_mask_str_x. Problem introduce
+in 5.0.15.
+
 --- 5.0.16 2014/02/25
 
 tcpip/SSL COMSTACK: connect tries all getaddrinfo addresses YAZ-743
index d36d786..a88284a 100644 (file)
@@ -1,3 +1,9 @@
+yaz (5.0.17-1.indexdata) unstable; urgency=medium
+
+  * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk>  Wed, 26 Feb 2014 11:09:21 +0100
+
 yaz (5.0.16-1.indexdata) unstable; urgency=medium
 
   * Upstream.
index 436d84a..846b507 100644 (file)
     }
 
     server_address_ip = cs_straddr(stack, server_address_str);
-    if (!server_address_ip)
-    {
+    if (!server_address_ip) {
         fprintf(stderr, "cs_straddr: address could not be resolved\n");
         return -1;
     }
 
     status = cs_connect(stack, server_address_ip);
-    if (status != 0) {
+    if (status) {
         fprintf(stderr, "cs_connect: %s\n", cs_strerror(stack));
         return -1;
     }
 
+    status = cs_rcvconnect(stack);
+    if (status) {
+        fprintf(stderr, "cs_rcvconnect: %s\n", cs_strerror(stack));
+        return -1;
+    }
+
     status = cs_put(stack, protocol_package, protocol_package_length);
     if (status) {
         fprintf(stderr, "cs_put: %s\n", cs_strerror(stack));
         return -1;
     }
-    /* Now get a response */
 
+    /* Now get a response */
     length_incoming = cs_get(stack, &buf, &size);
     if (!length_incoming) {
         fprintf(stderr, "Connection closed\n");
@@ -54,7 +59,7 @@
     /* clean up */
     cs_close(stack);
     if (buf)
-        free(buf);
+        xfree(buf);
     return 0;
 ]]>
    </programlisting>
index b1f5aca..1bbac7e 100644 (file)
@@ -361,7 +361,6 @@ ZOOM_API(void)
                             const char *host, int portnum)
 {
     const char *val;
-    const char *http_lead;
 
     initlog();
 
@@ -428,16 +427,18 @@ ZOOM_API(void)
     else
         c->lang = 0;
 
-    val = ZOOM_options_get(c->options, "sru");
-    if (val && *val && !strstr(host, "://"))
-        http_lead = "http://";
-    else
-        http_lead = "";
-    c->sru_mode = get_sru_mode_from_string(val);
-
     if (host)
     {
         char hostn[128];
+        const char *http_lead;
+
+        val = ZOOM_options_get(c->options, "sru");
+        if (val && *val && !strstr(host, "://"))
+            http_lead = "http://";
+        else
+            http_lead = "";
+        c->sru_mode = get_sru_mode_from_string(val);
+
         xfree(c->host_port);
         if (portnum)
         {
index cbf4a9a..70d7f3a 100644 (file)
@@ -122,19 +122,37 @@ int ZOOM_memcached_configure(ZOOM_connection c)
     return 0;
 }
 
+#if HAVE_LIBMEMCACHED_MEMCACHED_H
+static void wrbuf_vary_puts(WRBUF w, const char *v)
+{
+    if (v)
+    {
+        if (strlen(v) > 40)
+        {
+            wrbuf_sha1_puts(w, v, 1);
+        }
+        else
+        {
+            wrbuf_puts(w, v);
+        }
+    }
+}
+#endif
+
 void ZOOM_memcached_resultset(ZOOM_resultset r, ZOOM_query q)
 {
 #if HAVE_LIBMEMCACHED_MEMCACHED_H
     ZOOM_connection c = r->connection;
+
     r->mc_key = wrbuf_alloc();
-    wrbuf_puts(r->mc_key, "0;");
-    wrbuf_puts(r->mc_key, c->host_port);
+    wrbuf_puts(r->mc_key, "1;");
+    wrbuf_vary_puts(r->mc_key, c->host_port);
+    wrbuf_puts(r->mc_key, ";");
+    wrbuf_vary_puts(r->mc_key, ZOOM_resultset_option_get(r, "extraArgs"));
     wrbuf_puts(r->mc_key, ";");
-    if (c->user)
-        wrbuf_puts(r->mc_key, c->user);
+    wrbuf_vary_puts(r->mc_key, c->user);
     wrbuf_puts(r->mc_key, ";");
-    if (c->group)
-        wrbuf_puts(r->mc_key, c->group);
+    wrbuf_vary_puts(r->mc_key, c->group);
     wrbuf_puts(r->mc_key, ";");
     if (c->password)
         wrbuf_sha1_puts(r->mc_key, c->password, 1);
@@ -146,8 +164,7 @@ void ZOOM_memcached_resultset(ZOOM_resultset r, ZOOM_query q)
         wrbuf_destroy(w);
     }
     wrbuf_puts(r->mc_key, ";");
-    if (r->req_facets)
-        wrbuf_puts(r->mc_key, r->req_facets);
+    wrbuf_vary_puts(r->mc_key, r->req_facets);
 #endif
 }
 
index ecbceb3..fedf567 100644 (file)
@@ -223,18 +223,23 @@ static int comstack_example(const char *server_address_str)
     }
 
     server_address_ip = cs_straddr(stack, server_address_str);
-    if (!server_address_ip)
-    {
+    if (!server_address_ip) {
         fprintf(stderr, "cs_straddr: address could not be resolved\n");
         return -1;
     }
 
     status = cs_connect(stack, server_address_ip);
-    if (status != 0) {
+    if (status) {
         fprintf(stderr, "cs_connect: %s\n", cs_strerror(stack));
         return -1;
     }
 
+    status = cs_rcvconnect(stack);
+    if (status) {
+        fprintf(stderr, "cs_rcvconnect: %s\n", cs_strerror(stack));
+        return -1;
+    }
+
     status = cs_put(stack, protocol_package, protocol_package_length);
     if (status) {
         fprintf(stderr, "cs_put: %s\n", cs_strerror(stack));
@@ -242,7 +247,6 @@ static int comstack_example(const char *server_address_str)
     }
 
     /* Now get a response */
-
     length_incoming = cs_get(stack, &buf, &size);
     if (!length_incoming) {
         fprintf(stderr, "Connection closed\n");
@@ -258,7 +262,7 @@ static int comstack_example(const char *server_address_str)
     /* clean up */
     cs_close(stack);
     if (buf)
-        free(buf);
+        xfree(buf);
     return 0;
 }