Browse code

freshclam autotools: Fix libshared.a linking issue

As libfreshclam links in libshared.a, we don't need to link it again
into freshclam. Presently we do and as a consequence the global
variables in libshared.a cannot be reliably set in freshclam/libfreshlam
and be expected to have the correct values within libshared.so calls.

Specifically, users observed freshclam failing to use syslog even though
syslog was enabled. The reason was that the libshared.a logg() function
will only write to syslog() if the logg_syslog global is non-zero.
When libshared.a is linked twice (first into libfreshclam and again into
freshclam) then setting the logg_syslog global might not set the same
variable that the logg() function depends on.

To address this issue this patch stops linking libshared.a into
freshclam and instead exports the required libshared.a symbols from
libfreshclam.so (using libfreshclam.map) so that freshclam can still use
those functions.

Micah Snyder authored on 2020/09/07 07:50:58
Showing 2 changed files
... ...
@@ -35,7 +35,7 @@ endif
35 35
 AM_CFLAGS=@WERR_CFLAGS@
36 36
 DEFS = @DEFS@
37 37
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav -I$(top_builddir)/libclamav -I$(top_srcdir)/libclamunrar_iface -I$(top_srcdir)/libfreshclam @CURL_CPPFLAGS@ @SSL_CPPFLAGS@ @FRESHCLAM_CPPFLAGS@ @ZLIB_CFLAGS@ @JSON_CPPFLAGS@ @PCRE_CPPFLAGS@
38
-LIBS = @SSL_LDFLAGS@ @SSL_LIBS@ @CURL_LDFLAGS@ @CURL_LIBS@ $(top_builddir)/libclamav/libclamav.la $(top_builddir)/shared/libshared.la $(top_builddir)/libfreshclam/libfreshclam.la @FRESHCLAM_LIBS@ @ZLIB_LIBS@ @THREAD_LIBS@
38
+LIBS = @SSL_LDFLAGS@ @SSL_LIBS@ @CURL_LDFLAGS@ @CURL_LIBS@ $(top_builddir)/libclamav/libclamav.la $(top_builddir)/libfreshclam/libfreshclam.la @FRESHCLAM_LIBS@ @ZLIB_LIBS@ @THREAD_LIBS@
39 39
 
40 40
 AM_INSTALLCHECK_STD_OPTIONS_EXEMPT=freshclam$(EXEEXT)
41 41
 CLEANFILES=*.gcda *.gcno
... ...
@@ -28,6 +28,17 @@ FRESHCLAM_PUBLIC {
28 28
     mprintf_disabled;
29 29
 };
30 30
 FRESHCLAM_PRIVATE {
31
+  global:
32
+    optparse;
33
+    optget;
34
+    optfree;
35
+    get_version;
36
+    print_version;
37
+    check_flevel;
38
+    drop_privileges;
39
+    daemonize_parent_wait;
40
+    daemonize_signal_parent;
41
+    sendln;
31 42
   local:
32 43
     *;
33 44
 };