]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Make support for nscd flushing optional
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 7 Dec 2020 07:45:15 +0000 (08:45 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 7 Dec 2020 18:46:02 +0000 (19:46 +0100)
Fedora will deprecate support for nscd in the upcoming release [1] and plans to
drop it in the next one [2]. At that point we might as well build systemd
without that support too, since there'll be nothing to talk too.

[1] https://fedoraproject.org/wiki/Changes/DeprecateNSCD
[2] https://fedoraproject.org/wiki/Changes/RemoveNSCD

meson.build
meson_options.txt
src/machine/machined-core.c
src/machine/machined.c
src/machine/machined.h
src/shared/meson.build
src/shared/nscd-flush.h
src/test/meson.build

index 75eb6fc1dc55d035583b0363f5314585f8d14b52..5d9413a5bbcdc59d7d2db4e023504aec967c4321 100644 (file)
@@ -1460,6 +1460,7 @@ foreach term : ['analyze',
                 'ima',
                 'initrd',
                 'compat-mutable-uid-boundaries',
+                'nscd',
                 'ldconfig',
                 'localed',
                 'logind',
@@ -3763,6 +3764,7 @@ foreach tuple : [
         ['idn'],
         ['initrd'],
         ['compat-mutable-uid-boundaries'],
+        ['nscd'],
         ['libidn2'],
         ['libidn'],
         ['libiptc'],
index b50b0e9224294ec3517db05f12b35a08cdd20378..cfe11c9ae9e1b3ce8f1de0edbae306db95c3f233 100644 (file)
@@ -44,6 +44,8 @@ option('initrd', type : 'boolean',
        description : 'install services for use when running systemd in initrd')
 option('compat-mutable-uid-boundaries', type : 'boolean', value : 'false',
        description : 'look at uid boundaries in /etc/login.defs for compatibility')
+option('nscd', type : 'boolean',
+       description : 'build support for flushing of the nscd caches')
 
 option('quotaon-path', type : 'string', description : 'path to quotaon')
 option('quotacheck-path', type : 'string', description : 'path to quotacheck')
index 1416fbf82335b62c386fd623b09645d0137c0e81..ffca2094942f28884df570b37837d0d80fff7f17 100644 (file)
@@ -5,6 +5,7 @@
 #include "strv.h"
 #include "user-util.h"
 
+#if ENABLE_NSCD
 static int on_nscd_cache_flush_event(sd_event_source *s, void *userdata) {
         /* Let's ask glibc's nscd daemon to flush its caches. We request this for the three database machines may show
          * up in: the hosts database (for resolvable machine names) and the user and group databases (for the user ns
@@ -35,6 +36,7 @@ int manager_enqueue_nscd_cache_flush(Manager *m) {
 
         return 0;
 }
+#endif
 
 int manager_find_machine_for_uid(Manager *m, uid_t uid, Machine **ret_machine, uid_t *ret_internal_uid) {
         Machine *machine;
index c3c08d181d600bb6e30a58ce4ec7e436ffd66b96..4d8891c4fc4fc479ca3fc9c2ad122c374a678b1f 100644 (file)
@@ -83,7 +83,9 @@ static Manager* manager_unref(Manager *m) {
         hashmap_free(m->image_cache);
 
         sd_event_source_unref(m->image_cache_defer_event);
+#if ENABLE_NSCD
         sd_event_source_unref(m->nscd_cache_flush_event);
+#endif
 
         bus_verify_polkit_async_registry_free(m->polkit_registry);
 
index 6e4182bbd65d667b89e0e66c99078bbae50f9be5..280c32bab6890f7d270e5d735bdac254bc3021a2 100644 (file)
@@ -36,7 +36,9 @@ struct Manager {
         LIST_HEAD(Operation, operations);
         unsigned n_operations;
 
+#if ENABLE_NSCD
         sd_event_source *nscd_cache_flush_event;
+#endif
 
         VarlinkServer *varlink_server;
 };
@@ -57,7 +59,11 @@ int manager_unref_unit(Manager *m, const char *unit, sd_bus_error *error);
 int manager_unit_is_active(Manager *manager, const char *unit);
 int manager_job_is_active(Manager *manager, const char *path);
 
+#if ENABLE_NSCD
 int manager_enqueue_nscd_cache_flush(Manager *m);
+#else
+static inline void manager_enqueue_nscd_cache_flush(Manager *m) {}
+#endif
 
 int manager_find_machine_for_uid(Manager *m, uid_t host_uid, Machine **ret_machine, uid_t *ret_internal_uid);
 int manager_find_machine_for_gid(Manager *m, gid_t host_gid, Machine **ret_machine, gid_t *ret_internal_gid);
index 53165541ac875c3bad00ba50c7821e66826eff76..cc9501f5b20367656eb4bb655a49e26485b4a546 100644 (file)
@@ -173,7 +173,6 @@ shared_sources = files('''
         net-condition.h
         netif-naming-scheme.c
         netif-naming-scheme.h
-        nscd-flush.c
         nscd-flush.h
         nsflags.c
         nsflags.h
@@ -308,6 +307,10 @@ if conf.get('HAVE_PAM') == 1
 '''.split())
 endif
 
+if conf.get('ENABLE_NSCD') == 1
+        shared_sources += files('nscd-flush.c')
+endif
+
 generate_ip_protocol_list = find_program('generate-ip-protocol-list.sh')
 ip_protocol_list_txt = custom_target(
         'ip-protocol-list.txt',
index 5aafa9a24e90fda02e90fde8b8ad78582e1e688b..dac223e658bb4e7ed4eeac070616d17891087471 100644 (file)
@@ -1,4 +1,8 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 #pragma once
 
+#if ENABLE_NSCD
 int nscd_flush_cache(char **databases);
+#else
+static inline void nscd_flush_cache(char **databases) {}
+#endif
index 12bcf35708d53ed8be2f3f13c632fa048f74ae73..9e781f88dcb30b29f8f6897b7c9b73a3a8219777 100644 (file)
@@ -92,17 +92,6 @@ tests += [
           libblkid],
          '', 'manual'],
 
-        [['src/test/test-nscd-flush.c'],
-         [libcore,
-          libshared],
-         [threads,
-          librt,
-          libseccomp,
-          libselinux,
-          libmount,
-          libblkid],
-         '', 'manual'],
-
         [['src/test/test-loopback.c'],
          [libcore,
           libshared],
@@ -827,6 +816,20 @@ tests += [
          [libdl]],
 ]
 
+if conf.get('ENABLE_NSCD') == 1
+        tests += [
+                [['src/test/test-nscd-flush.c'],
+                 [libcore,
+                  libshared],
+                 [threads,
+                  librt,
+                  libseccomp,
+                  libselinux,
+                  libmount,
+                  libblkid],
+                 '', 'manual']]
+endif
+
 ############################################################
 
 # define some tests here, because the link_with deps were not defined earlier