DragonFlyBSD / DPorts

The dedicated application build system for DragonFly BSD
Other
89 stars 46 forks source link

samba412 unable to contact elasticsearch for spotlight search #233

Closed autumnjolitz closed 1 year ago

autumnjolitz commented 1 year ago

Hi,

This is what was necessary to make samba412 connect to my elasticsearch service for spotlight search (i.e. mdfind ...)

(cpython37) nyx:/usr/dports/net/samba412 [master]$ cat dragonfly/patch-libcli_http_http.c
--- libcli/http/http.c  2022-03-21 17:28:10.348261000 -0700
+++ libcli/http/http.c.orig     2022-03-21 17:27:15.628107000 -0700
@@ -141,7 +141,7 @@
                return HTTP_ALL_DATA_READ;
        }

+#if defined(FREEBSD) || defined(__DragonFly__)
-#ifdef FREEBSD
        int s0, s1, s2, s3; s0 = s1 = s2 = s3 = 0;
        n = sscanf(line, "%n%*[^:]%n: %n%*[^\r\n]%n\r\n", &s0, &s1, &s2, &s3);

@@ -199,7 +199,7 @@
                return false;
        }

+#if defined(FREEBSD) || defined(__DragonFly__)
-#ifdef FREEBSD
        int s0, s1, s2, s3; s0 = s1 = s2 = s3 = 0;
        n = sscanf(line, "%n%*[^/]%n/%c.%c %d %n%*[^\r\n]%n\r\n",
                   &s0, &s1, &major, &minor, &code, &s2, &s3);

I think it should be added to the dragonfly/ patch directory for this port.

autumnjolitz commented 1 year ago

To be more specific, DragonFly inherited FreeBSD's sscanf which is markedly different from glibc's sscanf. In this case, the C HTTP parser was not appropriately interpreting the HTTP response from ElasticSearch. This patch simply marks the FreeBSD sections as also DragonFly friendly.

daftaupe commented 1 year ago

Thanks for the report, I will add the patch.