summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--source4/Makefile10
-rw-r--r--source4/build/smb_build/input.pm21
-rw-r--r--source4/build/smb_build/main.pl3
-rw-r--r--source4/build/smb_build/makefile.pm54
-rw-r--r--source4/build/smb_build/output.pm12
-rw-r--r--source4/lib/basic.mk6
-rw-r--r--source4/lib/gencache/gencache.h94
-rw-r--r--source4/rules.mk3
-rw-r--r--source4/scripting/python/samba/provision.py5
10 files changed, 163 insertions, 46 deletions
diff --git a/.gitignore b/.gitignore
index a8c1f9a4cc..b0786b66d6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
source/pidl/Makefile
source/mkconfig.mk
source/test-results
-source/lib/gencache/gencache.h
source/lib/ldb/bin
*.pc
autom4te.cache
diff --git a/source4/Makefile b/source4/Makefile
index a99dc825f1..a2f0afc5f1 100644
--- a/source4/Makefile
+++ b/source4/Makefile
@@ -27,7 +27,7 @@ include data.mk
DEFAULT_HEADERS = $(srcdir)/lib/util/dlinklist.h \
$(srcdir)/version.h
-binaries:: $(BINARIES)
+binaries::
libraries:: $(STATIC_LIBS) $(SHARED_LIBS)
modules:: $(SHARED_MODULES)
headers:: $(PUBLIC_HEADERS) $(DEFAULT_HEADERS)
@@ -122,8 +122,10 @@ installbin:: $(SBIN_PROGS) $(BIN_PROGS) $(TORTURE_PROGS) installdirs
$(DESTDIR)$(TORTUREDIR) \
$(TORTURE_PROGS)
-installlib:: $(INSTALLABLE_SHARED_LIBS) $(STATIC_LIBS) installdirs
- @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(INSTALLABLE_SHARED_LIBS)
+installplugins::
+
+installlib:: $(SHARED_LIBS) $(STATIC_LIBS) installdirs
+ @$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(SHLIBEXT)" $(SHARED_LIBS)
#@$(SHELL) $(srcdir)/script/installlib.sh $(DESTDIR)$(libdir) "$(STLIBEXT)" $(STATIC_LIBS)
installheader:: headers installdirs
@@ -165,6 +167,8 @@ uninstallheader::
uninstallman::
@$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(mandir) $(MANPAGES)
+uninstallplugins::
+
config.status:
@echo "config.status does not exist. Please run ./configure."
@/bin/false
diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm
index 51c89a834f..ed584e185c 100644
--- a/source4/build/smb_build/input.pm
+++ b/source4/build/smb_build/input.pm
@@ -66,8 +66,6 @@ sub check_subsystem($$$)
unless (defined($subsys->{INIT_FUNCTION_TYPE})) { $subsys->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
unless (defined($subsys->{INIT_FUNCTION_SENTINEL})) { $subsys->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
- add_libreplace($subsys);
}
sub check_module($$$)
@@ -76,8 +74,6 @@ sub check_module($$$)
die("Module $mod->{NAME} does not have a SUBSYSTEM set") if not defined($mod->{SUBSYSTEM});
- my $use_default = 0;
-
if (not exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS})) {
$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS} = [];
}
@@ -113,11 +109,11 @@ sub check_module($$$)
$sane_subsystem =~ s/^lib//;
$mod->{INSTALLDIR} = "MODULESDIR/$sane_subsystem";
push (@{$mod->{PUBLIC_DEPENDENCIES}}, $mod->{SUBSYSTEM});
+ add_libreplace($mod);
}
if (grep(/INTEGRATED/, @{$mod->{OUTPUT_TYPE}})) {
push (@{$INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTIONS}}, $mod->{INIT_FUNCTION}) if defined($mod->{INIT_FUNCTION});
}
- add_libreplace($mod);
}
sub check_library($$$)
@@ -126,9 +122,7 @@ sub check_library($$$)
return if ($lib->{ENABLE} ne "YES");
- unless (defined($lib->{OUTPUT_TYPE})) {
- $lib->{OUTPUT_TYPE} = $default_ot;
- }
+ unless (defined($lib->{OUTPUT_TYPE})) { $lib->{OUTPUT_TYPE} = $default_ot; }
if (defined($lib->{VERSION}) and not defined($lib->{SO_VERSION})) {
print "$lib->{NAME}: Please specify SO_VERSION when specifying VERSION\n";
@@ -141,12 +135,8 @@ sub check_library($$$)
}
unless (defined($lib->{INIT_FUNCTION_TYPE})) { $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
-
unless (defined($lib->{INIT_FUNCTION_SENTINEL})) { $lib->{INIT_FUNCTION_SENTINEL} = "NULL"; }
-
- unless(defined($lib->{INSTALLDIR})) {
- $lib->{INSTALLDIR} = "LIBDIR";
- }
+ unless (defined($lib->{INSTALLDIR})) { $lib->{INSTALLDIR} = "LIBDIR"; }
add_libreplace($lib);
}
@@ -234,6 +224,7 @@ sub calc_unique_deps($$$$$$$$)
if (defined ($dep->{OUTPUT_TYPE}) &&
($withlibs or
(@{$dep->{OUTPUT_TYPE}}[0] eq "INTEGRATED") or
+ (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ") or
(@{$dep->{OUTPUT_TYPE}}[0] eq "STATIC_LIBRARY"))) {
push (@$busy, $dep->{NAME});
calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PUBLIC_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy);
@@ -280,9 +271,7 @@ sub check($$$$$)
}
}
- foreach my $k (keys %$INPUT) {
- my $part = $INPUT->{$k};
-
+ foreach my $part (values %$INPUT) {
$part->{LINK_FLAGS} = [];
$part->{FULL_OBJ_LIST} = ["\$($part->{NAME}_OBJ_LIST)"];
diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl
index a85eab32de..4c09e32422 100644
--- a/source4/build/smb_build/main.pl
+++ b/source4/build/smb_build/main.pl
@@ -20,7 +20,7 @@ my $INPUT = {};
my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk");
my $subsys_output_type;
-$subsys_output_type = ["STATIC_LIBRARY"];
+$subsys_output_type = ["MERGED_OBJ"];
my $library_output_type;
if ($config::config{USESHARED} eq "true") {
@@ -59,6 +59,7 @@ my $shared_libs_used = 0;
foreach my $key (values %$OUTPUT) {
next unless defined $key->{OUTPUT_TYPE};
+ $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}});
$mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
if (defined($key->{PC_FILE})) {
push(@{$mkenv->{pc_files}}, "$key->{BASEDIR}/$key->{PC_FILE}");
diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm
index 7fd31a5114..16b46ed343 100644
--- a/source4/build/smb_build/makefile.pm
+++ b/source4/build/smb_build/makefile.pm
@@ -28,12 +28,9 @@ sub new($$$)
$self->{python_dsos} = [];
$self->{python_pys} = [];
$self->{shared_libs} = [];
- $self->{installable_shared_libs} = [];
$self->{headers} = [];
$self->{shared_modules} = [];
$self->{plugins} = [];
- $self->{install_plugins} = "";
- $self->{uninstall_plugins} = "";
$self->{pc_files} = [];
$self->{proto_headers} = [];
$self->{output} = "";
@@ -154,16 +151,24 @@ sub SharedModule($$)
} else {
push (@{$self->{shared_modules}}, "$ctx->{TARGET_SHARED_LIBRARY}");
push (@{$self->{plugins}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
- $self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
- $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n";
- $self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
- $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
- $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
+ $self->output("installplugins:: $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n");
+ $self->output("\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+ $self->output("\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n");
+ $self->output("\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
if (defined($ctx->{ALIASES})) {
foreach (@{$ctx->{ALIASES}}) {
- $self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
- $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
- $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
+ $self->output("\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
+ $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
+ }
+ }
+
+ $self->output("uninstallplugins::\n");
+ $self->output("\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+ $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n");
+
+ if (defined($ctx->{ALIASES})) {
+ foreach (@{$ctx->{ALIASES}}) {
+ $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n");
}
}
}
@@ -237,7 +242,6 @@ sub SharedLibrary($$)
my ($self,$ctx) = @_;
push (@{$self->{shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
- push (@{$self->{installable_shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
$self->_prepare_list($ctx, "DEPEND_LIST");
$self->_prepare_list($ctx, "LINK_FLAGS");
@@ -273,6 +277,25 @@ __EOD__
$self->output("\n");
}
+sub MergedObj($$)
+{
+ my ($self, $ctx) = @_;
+
+ $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
+ $self->_prepare_list($ctx, "OBJ_LIST");
+ $self->_prepare_list($ctx, "FULL_OBJ_LIST");
+ push(@{$self->{all_objs}}, "\$($ctx->{NAME}_FULL_OBJ_LIST)");
+ $self->output(<< "__EOD__"
+#
+$ctx->{TARGET_MERGED_OBJ}: \$($ctx->{NAME}_FULL_OBJ_LIST)
+ \@echo Partially linking \$@
+ \@mkdir -p bin/mergedobj
+ \$(PARTLINK) -o \$@ \$($ctx->{NAME}_FULL_OBJ_LIST)
+
+__EOD__
+);
+}
+
sub StaticLibrary($$)
{
my ($self,$ctx) = @_;
@@ -328,7 +351,7 @@ sub Binary($$)
push (@{$self->{bin_progs}}, "$installdir/$ctx->{BINARY}");
}
- push (@{$self->{binaries}}, "$localdir/$ctx->{BINARY}");
+ $self->output("binaries:: $localdir/$ctx->{BINARY}\n");
$self->_prepare_list($ctx, "OBJ_LIST");
$self->_prepare_list($ctx, "FULL_OBJ_LIST");
@@ -425,12 +448,10 @@ sub write($$)
$self->output("MANPAGES = " . array2oneperline($self->{manpages})."\n");
$self->output("BIN_PROGS = " . array2oneperline($self->{bin_progs}) . "\n");
$self->output("SBIN_PROGS = " . array2oneperline($self->{sbin_progs}) . "\n");
- $self->output("BINARIES = " . array2oneperline($self->{binaries}) . "\n");
$self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
$self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
$self->output("PYTHON_DSOS = " . array2oneperline($self->{python_dsos}) . "\n");
$self->output("PYTHON_PYS = " . array2oneperline($self->{python_pys}) . "\n");
- $self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n");
$self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
$self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
$self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n");
@@ -438,9 +459,6 @@ sub write($$)
$self->output("SHARED_MODULES = " . array2oneperline($self->{shared_modules}) . "\n");
$self->output("PLUGINS = " . array2oneperline($self->{plugins}) . "\n");
- $self->output("\ninstallplugins: \$(PLUGINS)\n".$self->{install_plugins}."\n");
- $self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
-
$self->_prepare_mk_files();
$self->output($self->{mkfile});
diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm
index 4350370fbf..0ddb9e4efb 100644
--- a/source4/build/smb_build/output.pm
+++ b/source4/build/smb_build/output.pm
@@ -89,6 +89,17 @@ sub generate_shared_library($)
$lib->{OUTPUT_SHARED_LIBRARY} = $lib->{TARGET_SHARED_LIBRARY};
}
+sub generate_merged_obj($)
+{
+ my $lib = shift;
+
+ my $link_name = $lib->{NAME};
+ $link_name =~ s/^LIB//;
+
+ $lib->{MERGED_OBJNAME} = lc($link_name).".o";
+ $lib->{TARGET_MERGED_OBJ} = $lib->{OUTPUT_MERGED_OBJ} = "bin/mergedobj/$lib->{MERGED_OBJNAME}";
+}
+
sub generate_static_library($)
{
my $lib = shift;
@@ -153,6 +164,7 @@ sub create_output($$)
generate_binary($part) if grep(/BINARY/, @{$part->{OUTPUT_TYPE}});
generate_shared_library($part) if grep(/SHARED_LIBRARY/, @{$part->{OUTPUT_TYPE}});
generate_static_library($part) if grep(/STATIC_LIBRARY/, @{$part->{OUTPUT_TYPE}});
+ generate_merged_obj($part) if grep(/MERGED_OBJ/, @{$part->{OUTPUT_TYPE}});
$part->{OUTPUT} = $part->{"OUTPUT_" . @{$part->{OUTPUT_TYPE}}[0]};
$part->{TARGET} = $part->{"TARGET_" . @{$part->{OUTPUT_TYPE}}[0]};
}
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index 8653779044..53eb0d038f 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -18,15 +18,11 @@ include tdr/config.mk
include dbwrap/config.mk
include crypto/config.mk
-################################################
-# Start SUBSYSTEM LIBCOMPRESSION
[SUBSYSTEM::LIBCOMPRESSION]
OBJ_FILES = compression/mszip.o
-# End SUBSYSTEM LIBCOMPRESION
-################################################
[SUBSYSTEM::GENCACHE]
-PRIVATE_PROTO_HEADER = gencache/gencache.h
+PUBLIC_HEADERS = gencache/gencache.h
OBJ_FILES = gencache/gencache.o
PRIVATE_DEPENDENCIES = TDB_WRAP
diff --git a/source4/lib/gencache/gencache.h b/source4/lib/gencache/gencache.h
new file mode 100644
index 0000000000..1481676fd9
--- /dev/null
+++ b/source4/lib/gencache/gencache.h
@@ -0,0 +1,94 @@
+#ifndef __LIB_GENCACHE_GENCACHE_H__
+#define __LIB_GENCACHE_GENCACHE_H__
+
+/**
+ * Cache initialisation function. Opens cache tdb file or creates
+ * it if does not exist.
+ *
+ * @return true on successful initialisation of the cache or
+ * false on failure
+ **/
+bool gencache_init(struct loadparm_context *lp_ctx);
+
+/**
+ * Cache shutdown function. Closes opened cache tdb file.
+ *
+ * @return true on successful closing the cache or
+ * false on failure during cache shutdown
+ **/
+bool gencache_shutdown(void);
+
+/**
+ * Set an entry in the cache file. If there's no such
+ * one, then add it.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param value text representation value being cached
+ * @param timeout time when the value is expired
+ *
+ * @retval true when entry is successfuly stored
+ * @retval false on failure
+ **/
+bool gencache_set(const char *keystr, const char *value, time_t timeout);
+
+/**
+ * Set existing entry to the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param valstr text representation value being cached
+ * @param timeout time when the value is expired
+ *
+ * @retval true when entry is successfuly set
+ * @retval false on failure
+ **/
+bool gencache_set_only(const char *keystr, const char *valstr, time_t timeout);
+
+/**
+ * Delete one entry from the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ *
+ * @retval true upon successful deletion
+ * @retval false in case of failure
+ **/
+bool gencache_del(const char *keystr);
+
+/**
+ * Get existing entry from the cache file.
+ *
+ * @param keystr string that represents a key of this entry
+ * @param valstr buffer that is allocated and filled with the entry value
+ * buffer's disposing must be done outside
+ * @param timeout pointer to a time_t that is filled with entry's
+ * timeout
+ *
+ * @retval true when entry is successfuly fetched
+ * @retval false for failure
+ **/
+bool gencache_get(const char *keystr, char **valstr, time_t *timeout);
+
+/**
+ * Iterate through all entries which key matches to specified pattern
+ *
+ * @param fn pointer to the function that will be supplied with each single
+ * matching cache entry (key, value and timeout) as an arguments
+ * @param data void pointer to an arbitrary data that is passed directly to the fn
+ * function on each call
+ * @param keystr_pattern pattern the existing entries' keys are matched to
+ *
+ **/
+void gencache_iterate(void (*fn)(const char* key, const char *value, time_t timeout, void* dptr),
+ void* data, const char* keystr_pattern);
+
+/********************************************************************
+ lock a key
+********************************************************************/
+int gencache_lock_entry( const char *key );
+
+/********************************************************************
+ unlock a key
+********************************************************************/
+void gencache_unlock_entry( const char *key );
+
+#endif /* __LIB_GENCACHE_GENCACHE_H__ */
+
diff --git a/source4/rules.mk b/source4/rules.mk
index 1ef751b00a..4e7841fa93 100644
--- a/source4/rules.mk
+++ b/source4/rules.mk
@@ -37,6 +37,9 @@ PCHCOMPILE = @$(CC) -Ilib/replace \
$(CFLAGS) `$(PERL) $(srcdir)/script/cflags.pl $@` \
$(PICFLAG) $(CPPFLAGS) -c $(FIRST_PREREQ) -o $@
+# Partial linking
+PARTLINK = @$(PROG_LD) -r
+
include/config.h:
@echo "include/config.h not present"
@echo "You need to rerun ./autogen.sh and ./configure"
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index d30eaf3d7f..3e88b68509 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -335,9 +335,9 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
schemadn_ldb = ldap_backend
if ldap_backend_type == "fedora-ds":
- backend_modules = ["nsuniqueid","paged_searches"]
+ backend_modules = ["nsuniqueid", "paged_searches"]
elif ldap_backend_type == "openldap":
- backend_modules = ["normalise","entryuuid","paged_searches"]
+ backend_modules = ["normalise", "entryuuid", "paged_searches"]
elif serverrole == "domain controller":
backend_modules = ["repl_meta_data"]
else:
@@ -695,6 +695,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
samdb.transaction_commit()
return samdb
+
FILL_FULL = "FULL"
FILL_NT4SYNC = "NT4SYNC"
FILL_DRS = "DRS"