diff options
66 files changed, 215 insertions, 1708 deletions
diff --git a/source4/auth/gensec/gensec.c b/source4/auth/gensec/gensec.c index c82b719dfd..0edb34d740 100644 --- a/source4/auth/gensec/gensec.c +++ b/source4/auth/gensec/gensec.c @@ -23,7 +23,6 @@ #include "includes.h" #include "auth/auth.h" #include "lib/events/events.h" -#include "build.h" #include "librpc/rpc/dcerpc.h" #include "auth/credentials/credentials.h" #include "auth/gensec/gensec.h" diff --git a/source4/auth/ntlm/auth.c b/source4/auth/ntlm/auth.c index dc4303dd5c..0f1ef3ccdb 100644 --- a/source4/auth/ntlm/auth.c +++ b/source4/auth/ntlm/auth.c @@ -23,7 +23,6 @@ #include "auth/auth.h" #include "auth/ntlm/auth_proto.h" #include "lib/events/events.h" -#include "build.h" #include "param/param.h" /*************************************************************************** diff --git a/source4/build/m4/check_ld.m4 b/source4/build/m4/check_ld.m4 index 0d0742e5d2..3a74ffc239 100644 --- a/source4/build/m4/check_ld.m4 +++ b/source4/build/m4/check_ld.m4 @@ -151,36 +151,12 @@ if test $BLDSHARED = true; then ac_cv_shmod_works=yes rm -f shlib.${SHLIBEXT} shlib.o ]) - if test $ac_cv_shlib_works = no -o $ac_cv_shmod_works = no; then - BLDSHARED=false + if test $ac_cv_shlib_works = no; then + AC_MSG_ERROR(unable to build shared libraries) + fi + if test $ac_cv_shmod_works = no; then + AC_MSG_ERROR(unable to build shared modules) fi -fi - -if test $BLDSHARED != true; then - SHLD="shared-libraries-disabled" - SHLD_FLAGS="shared-libraries-disabled" - MDLD="shared-modules-disabled" - MDLD_FLAGS="shared-modules-disabled" - SHLIBEXT="shared_libraries_disabled" - SONAMEFLAG="shared-libraries-disabled" - PICFLAG="" - AC_MSG_CHECKING([SHLD]) - AC_MSG_RESULT([$SHLD]) - AC_MSG_CHECKING([SHLD_FLAGS]) - AC_MSG_RESULT([$SHLD_FLAGS]) - - AC_MSG_CHECKING([MDLD]) - AC_MSG_RESULT([$MDLD]) - AC_MSG_CHECKING([MDLD_FLAGS]) - AC_MSG_RESULT([$MDLD_FLAGS]) - - AC_MSG_CHECKING([SHLIBEXT]) - AC_MSG_RESULT([$SHLIBEXT]) - AC_MSG_CHECKING([SONAMEFLAG]) - AC_MSG_RESULT([$SONAMEFLAG]) - - AC_MSG_CHECKING([PICFLAG]) - AC_MSG_RESULT([$PICFLAG]) fi AC_DEFINE_UNQUOTED(SHLIBEXT, "$SHLIBEXT", [Shared library extension]) diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index 1eae998ca4..ba8251e65d 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -37,13 +37,13 @@ ENABLE = YES " ]) -dnl SMB_LIBRARY(name,obj_files,required_subsystems,version,so_version,cflags,ldflags) +dnl SMB_LIBRARY(name,obj_files,required_subsystems,cflags,ldflags) AC_DEFUN([SMB_LIBRARY], [ MAKE_SETTINGS="$MAKE_SETTINGS $1_CFLAGS = $6 $1_LDFLAGS = $7 -$1_ENABLE = YES +n1_ENABLE = YES $1_OBJ_FILES = $2 " diff --git a/source4/build/make/python.mk b/source4/build/make/python.mk index 6c1798212e..c243b88e27 100644 --- a/source4/build/make/python.mk +++ b/source4/build/make/python.mk @@ -1,14 +1,18 @@ pythonbuilddir = $(builddir)/bin/python +installpython:: + mkdir -p $(DESTDIR)$(pythondir) + # Install Python # Arguments: Module path define python_module_template installpython:: $$(pythonbuilddir)/$(1) ; - cp $$< $$(DESTDIR)$$(PYTHONDIR)/$(1) + mkdir -p $$(DESTDIR)$$(pythondir)/$$(dir $(1)) + cp $$< $$(DESTDIR)$$(pythondir)/$(1) uninstallpython:: - rm -f $$(DESTDIR)$$(PYTHONDIR)/$(1) ; + rm -f $$(DESTDIR)$$(pythondir)/$(1) ; pythonmods:: $$(pythonbuilddir)/$(1) ; diff --git a/source4/build/make/rules.mk b/source4/build/make/rules.mk index 1fc5e23569..c0359a8297 100644 --- a/source4/build/make/rules.mk +++ b/source4/build/make/rules.mk @@ -176,7 +176,7 @@ endef define shared_module_install_template installplugins:: bin/modules/$(1)/$(2) - @echo Installing$(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2) + @echo Installing $(2) as $$(DESTDIR)$$(modulesdir)/$(1)/$(2) @mkdir -p $$(DESTDIR)$$(modulesdir)/$(1)/ @cp bin/modules/$(1)/$(2) $$(DESTDIR)$$(modulesdir)/$(1)/$(2) uninstallplugins:: @@ -212,8 +212,7 @@ include/includes.d: include/includes.h @-mkdir -p `dirname $@` @$(COMPILE) && exit 0 ; \ echo "The following command failed:" 1>&2;\ - echo "$(COMPILE)" 1>&2 && exit 1 - + echo "$(subst ",\",$(COMPILE))" 1>&2 && exit 1 .c.ho: @@ -221,7 +220,7 @@ include/includes.d: include/includes.h @-mkdir -p `dirname $@` @$(HCOMPILE) && exit 0;\ echo "The following command failed:" 1>&2;\ - echo "$(HCOMPILE)" 1>&2;\ + echo "$(subst ",\",$(HCOMPILE))" 1>&2;\ $(HCOMPILE) >/dev/null 2>&1 .h.h.gch: diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 307c391e07..81c3363cfb 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -244,7 +244,6 @@ sub run_config_mk($$$$) $infragment = 1; next; } - # Assignment if ($line =~ /^([a-zA-Z0-9_]+)[\t ]*=(.*)$/) { @@ -254,7 +253,7 @@ sub run_config_mk($$$$) next; } - die("$parsing_file:$linenum: Bad line while parsing $parsing_file"); + die("$parsing_file:$linenum: Bad line"); } $makefile .= "# }END $parsing_file\n"; diff --git a/source4/build/smb_build/dot.pl b/source4/build/smb_build/dot.pl index e50ee50f95..b30c320c6e 100755 --- a/source4/build/smb_build/dot.pl +++ b/source4/build/smb_build/dot.pl @@ -26,10 +26,10 @@ sub generate($$$) foreach my $part (values %{$depend}) { next if (defined($only) and not contains($only,$part->{NAME})); foreach my $elem (@{$part->{PUBLIC_DEPENDENCIES}}) { - $res .= "\t\"$part->{NAME}\" -> \"$elem\"; /* public */\n"; + $res .= "\t\"$part->{NAME}\" -> \"$elem\" [style=filled]; /* public */\n"; } foreach my $elem (@{$part->{PRIVATE_DEPENDENCIES}}) { - $res .= "\t\"$part->{NAME}\" -> \"$elem\"; /* private */\n"; + $res .= "\t\"$part->{NAME}\" -> \"$elem\" [style=dotted]; /* private */\n"; } } diff --git a/source4/build/smb_build/header.pm b/source4/build/smb_build/header.pm deleted file mode 100644 index dfb7c62e54..0000000000 --- a/source4/build/smb_build/header.pm +++ /dev/null @@ -1,82 +0,0 @@ -# SMB Build System -# - create output for build.h -# -# Copyright (C) Stefan (metze) Metzmacher 2004 -# Copyright (C) Jelmer Vernooij 2005 -# Released under the GNU GPL - -package header; -use strict; - -sub _add_define_section($) -{ - my $DEFINE = shift; - my $output = ""; - - $output .= " -/* $DEFINE->{COMMENT} */ -#define $DEFINE->{KEY} $DEFINE->{VAL} -"; - - return $output; -} - -sub _prepare_build_h($) -{ - my $depend = shift; - my @defines = (); - my $output = ""; - - foreach my $key (values %$depend) { - my $DEFINE = (); - next if ($key->{TYPE} ne "LIBRARY" and - $key->{TYPE} ne "MODULE" and - $key->{TYPE} ne "SUBSYSTEM" and - $key->{TYPE} ne "BINARY"); - next unless defined($key->{INIT_FUNCTIONS}); - - my $name = $key->{NAME}; - $name =~ s/-/_/g; - $DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT"; - $DEFINE->{KEY} = "STATIC_$name\_MODULES"; - $DEFINE->{VAL} = "\\\n"; - foreach (@{$key->{INIT_FUNCTIONS}}) { - $DEFINE->{VAL} .= "\t$_, \\\n"; - } - - die("Invalid sentinel") unless ($key->{INIT_FUNCTION_SENTINEL}); - $DEFINE->{VAL} .= "\t$key->{INIT_FUNCTION_SENTINEL} \n"; - - push(@defines,$DEFINE); - } - - # - # loop over all BUILD_H define sections - # - foreach (@defines) { $output .= _add_define_section($_); } - - return $output; -} - -########################################################### -# This function creates include/build.h from the SMB_BUILD -# context -# -# create_build_h($SMB_BUILD_CTX) -# -# $SMB_BUILD_CTX - the global SMB_BUILD context -# -# $output - the resulting output buffer -sub create_smb_build_h($$) -{ - my ($CTX, $file) = @_; - - open(BUILD_H,">$file") || die ("Can't open `$file'\n"); - print BUILD_H "/* autogenerated by build/smb_build/main.pl */\n"; - print BUILD_H _prepare_build_h($CTX); - close(BUILD_H); - - print __FILE__.": creating $file\n"; -} - -1; diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index 3ca2f22f0c..7028d2ab17 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -94,10 +94,8 @@ sub check_module($$$) unless (defined($mod->{INIT_FUNCTION_SENTINEL})) { $mod->{INIT_FUNCTION_SENTINEL} = "NULL"; } if (not defined($mod->{OUTPUT_TYPE})) { - if (not defined($INPUT->{$mod->{SUBSYSTEM}}->{TYPE})) { - die("Invalid type for subsystem $mod->{SUBSYSTEM}"); - } - if ($INPUT->{$mod->{SUBSYSTEM}}->{TYPE} eq "EXT_LIB") { + if ((not defined($INPUT->{$mod->{SUBSYSTEM}}->{TYPE})) or + $INPUT->{$mod->{SUBSYSTEM}}->{TYPE} eq "EXT_LIB") { $mod->{OUTPUT_TYPE} = undef; } else { $mod->{OUTPUT_TYPE} = $default_ot; @@ -172,6 +170,8 @@ sub check_binary($$) return if ($bin->{ENABLE} ne "YES"); ($bin->{BINARY} = (lc $bin->{NAME})) if not defined($bin->{BINARY}); + unless (defined($bin->{INIT_FUNCTION_SENTINEL})) { $bin->{INIT_FUNCTION_SENTINEL} = "NULL"; } + unless (defined($bin->{INIT_FUNCTION_TYPE})) { $bin->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; } $bin->{OUTPUT_TYPE} = ["BINARY"]; add_libreplace($bin); @@ -181,15 +181,13 @@ sub add_implicit($$) { my ($INPUT, $n) = @_; - $INPUT->{$n} = { - TYPE => "MAKE_RULE", - NAME => $n, - OUTPUT_TYPE => undef, - LIBS => ["\$(".uc($n)."_LIBS)"], - LDFLAGS => ["\$(".uc($n)."_LDFLAGS)"], - CFLAGS => ["\$(".uc($n)."_CFLAGS)"], - CPPFLAGS => ["\$(".uc($n)."_CPPFLAGS)"] - }; + $INPUT->{$n}->{TYPE} = "MAKE_RULE"; + $INPUT->{$n}->{NAME} = $n; + $INPUT->{$n}->{OUTPUT_TYPE} = undef; + $INPUT->{$n}->{LIBS} = ["\$(".uc($n)."_LIBS)"]; + $INPUT->{$n}->{LDFLAGS} = ["\$(".uc($n)."_LDFLAGS)"]; + $INPUT->{$n}->{CFLAGS} = ["\$(".uc($n)."_CFLAGS)"]; + $INPUT->{$n}->{CPPFLAGS} = ["\$(".uc($n)."_CPPFLAGS)"]; } sub calc_unique_deps($$$$$$$$) @@ -198,7 +196,7 @@ sub calc_unique_deps($$$$$$$$) my ($name, $INPUT, $deps, $udeps, $withlibs, $forward, $pubonly, $busy) = @_; foreach my $n (@$deps) { - add_implicit($INPUT, $n) unless (defined($INPUT->{$n})); + add_implicit($INPUT, $n) unless (defined($INPUT->{$n}) and defined($INPUT->{$n}->{TYPE})); my $dep = $INPUT->{$n}; if (grep (/^$n$/, @$busy)) { next if (@{$dep->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ"); @@ -206,19 +204,19 @@ sub calc_unique_deps($$$$$$$$) } next if (grep /^$n$/, @$udeps); - push (@{$udeps}, $dep->{NAME}) if $forward; + push (@{$udeps}, $n) if $forward; if (defined ($dep->{OUTPUT_TYPE}) && ($withlibs 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); - calc_unique_deps($dep->{NAME}, $INPUT, $dep->{PRIVATE_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy) unless $pubonly; + push (@$busy, $n); + calc_unique_deps($n, $INPUT, $dep->{PUBLIC_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy); + calc_unique_deps($n, $INPUT, $dep->{PRIVATE_DEPENDENCIES}, $udeps, $withlibs, $forward, $pubonly, $busy) unless $pubonly; pop (@$busy); } - unshift (@{$udeps}, $dep->{NAME}) unless $forward; + unshift (@{$udeps}, $n) unless $forward; } } diff --git a/source4/build/smb_build/main.pl b/source4/build/smb_build/main.pl index 14897840a6..d31bea73f3 100644 --- a/source4/build/smb_build/main.pl +++ b/source4/build/smb_build/main.pl @@ -6,7 +6,6 @@ # Released under the GNU GPL use smb_build::makefile; -use smb_build::header; use smb_build::input; use smb_build::config_mk; use smb_build::output; @@ -50,21 +49,18 @@ foreach my $key (values %$OUTPUT) { foreach my $key (values %$OUTPUT) { next unless defined $key->{OUTPUT_TYPE}; + $mkenv->StaticLibraryPrimitives($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}}); - $mkenv->StaticLibraryPrimitives($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}}); - if (defined($key->{PC_FILE})) { - $mkenv->output("PC_FILES += $key->{BASEDIR}/$key->{PC_FILE}\n"); - } $mkenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); if ($key->{TYPE} eq "LIBRARY" and ${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") { $shared_libs_used = 1; } - $mkenv->SharedModulePrimitives($key) if ($key->{TYPE} eq "MODULE" or - $key->{TYPE} eq "PYTHON") and - grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES}); + if ($key->{TYPE} eq "MODULE" and @{$key->{OUTPUT_TYPE}}[0] eq "MERGED_OBJ" and defined($key->{INIT_FUNCTION})) { + $mkenv->output("$key->{SUBSYSTEM}_INIT_FUNCTIONS += $key->{INIT_FUNCTION},\n"); + } $mkenv->CFlags($key); } @@ -80,15 +76,15 @@ foreach my $key (values %$OUTPUT) { $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); - $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or - $key->{TYPE} eq "PYTHON") and - grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}); + $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" and + grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}})); + $mkenv->PythonModule($key) if ($key->{TYPE} eq "PYTHON"); $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}}); $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER}); + $mkenv->InitFunctions($key) if defined($key->{INIT_FUNCTIONS}); } $mkenv->write("data.mk"); -header::create_smb_build_h($OUTPUT, "include/build.h"); summary::show($OUTPUT, \%config::config); diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 8f3f1701b7..43c4252f9d 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -72,17 +72,7 @@ sub _prepare_mk_files($) push (@tmp, $_); } - $self->output(" -ifneq (\$(MAKECMDGOALS),clean) -ifneq (\$(MAKECMDGOALS),distclean) -ifneq (\$(MAKECMDGOALS),realdistclean) -"); $self->output("MK_FILES = " . array2oneperline(\@tmp) . "\n"); - $self->output(" -endif -endif -endif -"); } sub array2oneperline($) @@ -112,94 +102,41 @@ sub _prepare_list($$$) $self->output("$ctx->{NAME}_$var =$tmplist\n"); } -sub SharedModulePrimitives($$) +sub PythonModule($$) { my ($self,$ctx) = @_; - - #FIXME + + $self->_prepare_list($ctx, "FULL_OBJ_LIST"); + $self->_prepare_list($ctx, "DEPEND_LIST"); + $self->_prepare_list($ctx, "LINK_FLAGS"); + + $self->output("\$(eval \$(call python_c_module_template,$ctx->{LIBRARY_REALNAME},\$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}\_FULL_OBJ_LIST) \$($ctx->{NAME}_LINK_FLAGS)))\n"); } sub SharedModule($$) { my ($self,$ctx) = @_; - my $init_obj = ""; - my $sane_subsystem = lc($ctx->{SUBSYSTEM}); $sane_subsystem =~ s/^lib//; - if ($ctx->{TYPE} eq "PYTHON") { - $self->output("PYTHON_DSOS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); - } else { - $self->output("PLUGINS += $ctx->{SHAREDDIR}/$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->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"); + $self->output("PLUGINS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("\$(eval \$(call shared_module_install_template,$sane_subsystem,$ctx->{LIBRARY_REALNAME}))\n"); - if (defined($ctx->{ALIASES})) { - foreach (@{$ctx->{ALIASES}}) { - $self->output("\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n"); - } - } - } - - $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); $self->_prepare_list($ctx, "FULL_OBJ_LIST"); $self->_prepare_list($ctx, "DEPEND_LIST"); $self->_prepare_list($ctx, "LINK_FLAGS"); - if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON" and - $ctx->{INIT_FUNCTION_TYPE} =~ /\(\*\)/) { - my $init_fn = $ctx->{INIT_FUNCTION_TYPE}; - $init_fn =~ s/\(\*\)/init_module/; - my $proto_fn = $ctx->{INIT_FUNCTION_TYPE}; - $proto_fn =~ s/\(\*\)/$ctx->{INIT_FUNCTION}/; - - $self->output(<< "__EOD__" -bin/$ctx->{NAME}_init_module.c: - \@echo Creating \$\@ - \@echo \"#include \\\"includes.h\\\"\" > \$\@ - \@echo \"$proto_fn;\" >> \$\@ - \@echo \"_PUBLIC_ $init_fn\" >> \$\@ - \@echo \"{\" >> \$\@ - \@echo \" return $ctx->{INIT_FUNCTION}();\" >> \$\@ - \@echo \"}\" >> \$\@ - \@echo \"\" >> \$\@ -__EOD__ -); - $init_obj = "bin/$ctx->{NAME}_init_module.o"; + if (defined($ctx->{INIT_FUNCTION}) and $ctx->{INIT_FUNCTION_TYPE} =~ /\(\*\)/ and not ($ctx->{INIT_FUNCTION} =~ /\(/)) { + $self->output("\$($ctx->{NAME}_OBJ_FILES): CFLAGS+=-D$ctx->{INIT_FUNCTION}=init_module\n"); } - $self->output(<< "__EOD__" -# + $self->output("\$(eval \$(call shared_module_template,$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}, \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}\_FULL_OBJ_LIST) \$($ctx->{NAME}_LINK_FLAGS)))\n"); -$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST) $init_obj - \@echo Linking \$\@ - \@mkdir -p $ctx->{SHAREDDIR} - \@\$(MDLD) \$(LDFLAGS) \$(MDLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\ - \$($ctx->{NAME}\_FULL_OBJ_LIST) $init_obj \\ - \$($ctx->{NAME}_LINK_FLAGS) -__EOD__ -); if (defined($ctx->{ALIASES})) { - foreach (@{$ctx->{ALIASES}}) { - $self->output("\t\@rm -f $ctx->{SHAREDDIR}/$_.\$(SHLIBEXT)\n"); - $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$_.\$(SHLIBEXT)\n"); - } + $self->output("\$(eval \$(foreach alias,". join(' ', @{$ctx->{ALIASES}}) . ",\$(call shared_module_alias_template,$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME},$sane_subsystem,\$(alias))))\n"); } - $self->output("\n"); } sub StaticLibraryPrimitives($$) @@ -224,59 +161,33 @@ sub SharedLibrary($$) { my ($self,$ctx) = @_; - if (!defined($ctx->{LIBRARY_SONAME})) { - $ctx->{LIBRARY_SONAME} = ""; - } - - $self->output("SHARED_LIBS += $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}\n"); + $self->output("SHARED_LIBS += $ctx->{RESULT_SHARED_LIBRARY}\n"); $self->_prepare_list($ctx, "DEPEND_LIST"); $self->_prepare_list($ctx, "LINK_FLAGS"); - $self->output(<< "__EOD__" -$ctx->{RESULT_SHARED_LIBRARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST) - \@echo Linking \$\@ - \@mkdir -p \$(\@D) - \@\$(SHLD) \$(LDFLAGS) \$(SHLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\ - \$($ctx->{NAME}\_FULL_OBJ_LIST) \\ - \$($ctx->{NAME}_LINK_FLAGS) \\ - \$(if \$(SONAMEFLAG), \$(SONAMEFLAG)$ctx->{LIBRARY_SONAME}) -__EOD__ -); - if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) { - $self->output("ifneq (\$($ctx->{NAME}_VERSION),\$($ctx->{NAME}_SOVERSION))\n"); - $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}\n"); - $self->output("endif\n"); - } - $self->output("ifdef $ctx->{NAME}_SOVERSION\n"); - $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}\n"); - $self->output("endif\n"); + $self->output("\$(eval \$(call shared_library_template,$ctx->{RESULT_SHARED_LIBRARY}, \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}\_FULL_OBJ_LIST) \$($ctx->{NAME}_LINK_FLAGS),$ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME},$ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}))\n"); } sub MergedObj($$) { my ($self, $ctx) = @_; - return unless defined($ctx->{OUTPUT}); - - $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); - $self->output(<< "__EOD__" -# -$ctx->{RESULT_MERGED_OBJ}: \$($ctx->{NAME}_OBJ_FILES) - \@echo Partially linking \$@ - \@mkdir -p \$(\@D) - \$(PARTLINK) -o \$@ \$($ctx->{NAME}_OBJ_FILES) + $self->output("\$(call partial_link_template, $ctx->{OUTPUT}, \$($ctx->{NAME}_OBJ_FILES))\n"); +} -__EOD__ -); +sub InitFunctions($$) +{ + my ($self, $ctx) = @_; + $self->output("\$($ctx->{NAME}_OBJ_FILES): CFLAGS+=-DSTATIC_$ctx->{NAME}_MODULES=\"\$($ctx->{NAME}_INIT_FUNCTIONS)$ctx->{INIT_FUNCTION_SENTINEL}\"\n"); } sub StaticLibrary($$) { my ($self,$ctx) = @_; - $self->output("STATIC_LIBS += $ctx->{TARGET_STATIC_LIBRARY}\n") if ($ctx->{TYPE} eq "LIBRARY"); - + $self->output("STATIC_LIBS += $ctx->{RESULT_STATIC_LIBRARY}\n") if ($ctx->{TYPE} eq "LIBRARY"); + $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n"); $self->output("$ctx->{RESULT_STATIC_LIBRARY}: \$($ctx->{NAME}_FULL_OBJ_LIST)\n"); } @@ -285,37 +196,21 @@ sub Binary($$) my ($self,$ctx) = @_; unless (defined($ctx->{INSTALLDIR})) { + $self->output("BINARIES += $ctx->{TARGET_BINARY}\n"); } elsif ($ctx->{INSTALLDIR} eq "SBINDIR") { - $self->output("SBIN_PROGS += bin/$ctx->{BINARY}\n"); + $self->output("SBIN_PROGS += $ctx->{RESULT_BINARY}\n"); } elsif ($ctx->{INSTALLDIR} eq "BINDIR") { - $self->output("BIN_PROGS += bin/$ctx->{BINARY}\n"); + $self->output("BIN_PROGS += $ctx->{RESULT_BINARY}\n"); } - $self->output("binaries:: $ctx->{TARGET_BINARY}\n"); - $self->_prepare_list($ctx, "FULL_OBJ_LIST"); $self->_prepare_list($ctx, "DEPEND_LIST"); $self->_prepare_list($ctx, "LINK_FLAGS"); -$self->output(<< "__EOD__" -$ctx->{RESULT_BINARY}: \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST) - \@echo Linking \$\@ -__EOD__ - ); - if (defined($ctx->{USE_HOSTCC}) && $ctx->{USE_HOSTCC} eq "YES") { - $self->output(<< "__EOD__" - \@\$(HOSTLD) \$(HOSTLD_FLAGS) -L\${builddir}/bin/static -o \$\@ \$(INSTALL_LINK_FLAGS) \\ - \$\($ctx->{NAME}_LINK_FLAGS) -__EOD__ - ); +$self->output("\$(call host_binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}_LINK_FLAGS))\n"); } else { - $self->output(<< "__EOD__" - \@\$(BNLD) \$(BNLD_FLAGS) \$(INTERN_LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\ - \$\($ctx->{NAME}_LINK_FLAGS) - -__EOD__ - ); +$self->output("\$(call binary_link_template, $ctx->{RESULT_BINARY}, \$($ctx->{NAME}_DEPEND_LIST) \$($ctx->{NAME}_FULL_OBJ_LIST), \$($ctx->{NAME}_LINK_FLAGS))\n"); } } @@ -324,10 +219,7 @@ sub PythonFiles($$) my ($self,$ctx) = @_; foreach (@{$ctx->{PYTHON_FILES}}) { - my $target = "bin/python/".basename($_); - my $source = "\$(addprefix $ctx->{BASEDIR}/, $_)"; - $self->output("$target: $source\n\n"); - $self->output("PYTHON_PYS += $target\n"); + $self->output("\$(eval \$(call python_py_module_template," . basename($_) . ",\$(addprefix $ctx->{BASEDIR}/, $_)))\n"); } } @@ -335,25 +227,17 @@ sub ProtoHeader($$) { my ($self,$ctx) = @_; - my $priv = "$ctx->{BASEDIR}/$ctx->{PRIVATE_PROTO_HEADER}"; - $self->output("PROTO_HEADERS += $priv\n"); - - $self->output("$priv: $ctx->{MK_FILE} \$($ctx->{NAME}_OBJ_FILES:.o=.c) \$(srcdir)/script/mkproto.pl\n"); - $self->output("\t\@echo \"Creating \$@\"\n"); - $self->output("\t\@mkdir -p \$(\@D)\n"); - $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --public=/dev/null --private=\$@ \$($ctx->{NAME}_OBJ_FILES)\n\n"); + my $target = "\$(addprefix $ctx->{BASEDIR}/, $ctx->{PRIVATE_PROTO_HEADER})"; + $self->output("PROTO_HEADERS += $target\n"); + $self->output("\$(call proto_header_template, $target, \$($ctx->{NAME}_OBJ_FILES:.o=.c))\n"); } sub write($$) { my ($self, $file) = @_; - $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n"); - $self->_prepare_mk_files(); - $self->output($self->{mkfile}); - open(MAKEFILE,">$file") || die ("Can't open $file\n"); print MAKEFILE $self->{output}; close(MAKEFILE); diff --git a/source4/build/smb_build/output.pm b/source4/build/smb_build/output.pm index aeff7d48ce..f9f12c3a73 100644 --- a/source4/build/smb_build/output.pm +++ b/source4/build/smb_build/output.pm @@ -154,7 +154,7 @@ sub create_output($$) push (@{$part->{FULL_OBJ_LIST}}, $elem->{TARGET}); } else { push(@{$part->{LINK_FLAGS}}, "\$($elem->{NAME}_OUTPUT)") if defined($elem->{OUTPUT}); - push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if defined($elem->{TARGET}); + push(@{$part->{DEPEND_LIST}}, $elem->{TARGET}) if (defined($elem->{TARGET})); } } } diff --git a/source4/cldap_server/config.mk b/source4/cldap_server/config.mk index c10cf57b5b..0773412bfd 100644 --- a/source4/cldap_server/config.mk +++ b/source4/cldap_server/config.mk @@ -4,7 +4,7 @@ # Start SUBSYSTEM CLDAPD [MODULE::CLDAPD] INIT_FUNCTION = server_service_cldapd_init -SUBSYSTEM = service +SUBSYSTEM = smbd PRIVATE_PROTO_HEADER = proto.h PRIVATE_DEPENDENCIES = \ LIBCLI_CLDAP LIBNETIF process_model diff --git a/source4/configure.ac b/source4/configure.ac index 66fb69694e..d07632a291 100644 --- a/source4/configure.ac +++ b/source4/configure.ac @@ -31,7 +31,7 @@ m4_include(pidl/config.m4) AC_CONFIG_FILES(lib/registry/registry.pc) AC_CONFIG_FILES(librpc/dcerpc.pc) AC_CONFIG_FILES(librpc/ndr.pc) -AC_CONFIG_FILES(torture/torture.pc) +AC_CONFIG_FILES(lib/torture/torture.pc) AC_CONFIG_FILES(auth/gensec/gensec.pc) AC_CONFIG_FILES(param/samba-hostconfig.pc) AC_CONFIG_FILES(librpc/dcerpc_samr.pc) @@ -59,7 +59,6 @@ SMB_EXT_LIB_FROM_PKGCONFIG(LIBLDB, ldb >= 0.9.1, [ SMB_INCLUDE_MK(lib/ldb/ldb_ildap/config.mk) SMB_INCLUDE_MK(lib/ldb/tools/config.mk) - SMB_SUBSYSTEM(ldb_map, [], [LIBLDB]) define_ldb_modulesdir=no ], [ diff --git a/source4/dsdb/config.mk b/source4/dsdb/config.mk index e334e4c6e3..e621391617 100644 --- a/source4/dsdb/config.mk +++ b/source4/dsdb/config.mk @@ -44,7 +44,7 @@ SAMDB_SCHEMA_OBJ_FILES = $(addprefix dsdb/schema/, \ # Start SUBSYSTEM DREPL_SRV [MODULE::DREPL_SRV] INIT_FUNCTION = server_service_drepl_init -SUBSYSTEM = service +SUBSYSTEM = smbd PRIVATE_PROTO_HEADER = repl/drepl_service_proto.h PRIVATE_DEPENDENCIES = \ SAMDB \ diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk index 414b449ba8..a5f5bc4895 100644 --- a/source4/dsdb/samdb/ldb_modules/config.mk +++ b/source4/dsdb/samdb/ldb_modules/config.mk @@ -4,7 +4,7 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR NDR_MISC -INIT_FUNCTION = objectguid_module_module_ops +INIT_FUNCTION = LDB_MODULE(objectguid) # End MODULE ldb_objectguid ################################################ @@ -17,7 +17,7 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC LIBNDR NDR_MISC NDR_DRSUAPI \ NDR_DRSBLOBS LIBNDR -INIT_FUNCTION = repl_meta_data_module_module_ops +INIT_FUNCTION = LDB_MODULE(repl_meta_data) # End MODULE ldb_repl_meta_data ################################################ @@ -30,7 +30,7 @@ ldb_repl_meta_data_OBJ_FILES = \ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC -INIT_FUNCTION = dsdb_cache_module_module_ops +INIT_FUNCTION = LDB_MODULE(dsdb_cache) # End MODULE ldb_dsdb_cache ################################################ @@ -43,7 +43,7 @@ ldb_dsdb_cache_OBJ_FILES = \ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC -INIT_FUNCTION = schema_fsmo_module_module_ops +INIT_FUNCTION = LDB_MODULE(schema_fsmo) # End MODULE ldb_schema_fsmo ################################################ @@ -56,7 +56,7 @@ ldb_schema_fsmo_OBJ_FILES = \ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC -INIT_FUNCTION = naming_fsmo_module_module_ops +INIT_FUNCTION = LDB_MODULE(naming_fsmo) # End MODULE ldb_naming_fsmo ################################################ @@ -69,7 +69,7 @@ ldb_naming_fsmo_OBJ_FILES = \ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = SAMDB LIBTALLOC -INIT_FUNCTION = pdc_fsmo_module_module_ops +INIT_FUNCTION = LDB_MODULE(pdc_fsmo) # End MODULE ldb_pdc_fsmo ################################################ @@ -82,7 +82,7 @@ ldb_pdc_fsmo_OBJ_FILES = \ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LDAP_ENCODE NDR_MISC SAMDB -INIT_FUNCTION = samldb_module_module_ops +INIT_FUNCTION = LDB_MODULE(samldb) # # End MODULE ldb_samldb ################################################ @@ -95,10 +95,9 @@ ldb_samldb_OBJ_FILES = \ [MODULE::ldb_samba3sam] SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY -INIT_FUNCTION = &ldb_samba3sam_module_module_ops -PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map SMBPASSWD NSS_WRAPPER LIBSECURITY \ +INIT_FUNCTION = LDB_MODULE(samba3sam) +PRIVATE_DEPENDENCIES = LIBTALLOC SMBPASSWD NSS_WRAPPER LIBSECURITY \ NDR_SECURITY -# # End MODULE ldb_samldb ################################################ @@ -110,11 +109,10 @@ ldb_samba3sam_OBJ_FILES = \ [MODULE::ldb_simple_ldap_map] SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY -INIT_FUNCTION = &ldb_simple_ldap_map_module_module_ops -PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map LIBNDR NDR_MISC +INIT_FUNCTION = LDB_MODULE(simple_ldap_map) +PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR NDR_MISC ENABLE = YES ALIASES = entryuuid nsuniqueid -# # End MODULE ldb_entryuuid ################################################ @@ -125,7 +123,7 @@ ldb_simple_ldap_map_OBJ_FILES = \ # # Start MODULE ldb_proxy # [MODULE::ldb_proxy] # SUBSYSTEM = LIBLDB -# INIT_FUNCTION = proxy_module_module_ops +# INIT_FUNCTION = LDB_MODULE(proxy) # OBJ_FILES = \ # proxy.o # @@ -139,7 +137,7 @@ ldb_simple_ldap_map_OBJ_FILES = \ SUBSYSTEM = LIBLDB PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB OUTPUT_TYPE = SHARED_LIBRARY -INIT_FUNCTION = rootdse_module_module_ops +INIT_FUNCTION = LDB_MODULE(rootdse) # End MODULE ldb_rootdse ################################################ @@ -150,7 +148,7 @@ ldb_rootdse_OBJ_FILES = dsdb/samdb/ldb_modules/rootdse.o [MODULE::ldb_password_hash] SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY -INIT_FUNCTION = password_hash_module_module_ops +INIT_FUNCTION = LDB_MODULE(password_hash) PRIVATE_DEPENDENCIES = HEIMDAL_HDB_KEYS LIBTALLOC HEIMDAL_KRB5 LDAP_ENCODE \ LIBCLI_AUTH NDR_DRSBLOBS KERBEROS SAMDB # End MODULE ldb_password_hash @@ -164,7 +162,7 @@ ldb_password_hash_OBJ_FILES = dsdb/samdb/ldb_modules/password_hash.o PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR SAMDB OUTPUT_TYPE = SHARED_LIBRARY SUBSYSTEM = LIBLDB -INIT_FUNCTION = local_password_module_module_ops +INIT_FUNCTION = LDB_MODULE(local_password) # End MODULE ldb_local_password ################################################ @@ -176,7 +174,7 @@ ldb_local_password_OBJ_FILES = dsdb/samdb/ldb_modules/local_password.o PRIVATE_DEPENDENCIES = LIBTALLOC LIBSECURITY SAMDB OUTPUT_TYPE = SHARED_LIBRARY SUBSYSTEM = LIBLDB -INIT_FUNCTION = &ldb_kludge_acl_module_ops +INIT_FUNCTION = LDB_MODULE(kludge_acl) # End MODULE ldb_kludge_acl ################################################ @@ -189,7 +187,7 @@ ldb_kludge_acl_OBJ_FILES = dsdb/samdb/ldb_modules/kludge_acl.o SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR LIBSECURITY SAMDB -INIT_FUNCTION = &ldb_extended_dn_module_ops +INIT_FUNCTION = LDB_MODULE(extended_dn) # End MODULE ldb_extended_dn ################################################ @@ -201,7 +199,7 @@ ldb_extended_dn_OBJ_FILES = dsdb/samdb/ldb_modules/extended_dn.o SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = &ldb_show_deleted_module_ops +INIT_FUNCTION = LDB_MODULE(show_deleted) # End MODULE ldb_show_deleted ################################################ @@ -213,7 +211,7 @@ ldb_show_deleted_OBJ_FILES = dsdb/samdb/ldb_modules/show_deleted.o SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB -INIT_FUNCTION = &ldb_partition_module_ops +INIT_FUNCTION = LDB_MODULE(partition) # End MODULE ldb_partition ################################################ @@ -225,7 +223,7 @@ ldb_partition_OBJ_FILES = dsdb/samdb/ldb_modules/partition.o SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBLDB -INIT_FUNCTION = &ldb_schema_module_ops +INIT_FUNCTION = LDB_MODULE(schema) # End MODULE ldb_schema ################################################ @@ -238,7 +236,7 @@ SUBSYSTEM = LIBLDB OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC CREDENTIALS #Also depends on credentials, but that would loop -INIT_FUNCTION = &ldb_update_kt_module_ops +INIT_FUNCTION = LDB_MODULE(update_kt) # End MODULE ldb_update_kt ################################################ @@ -247,7 +245,7 @@ ldb_update_keytab_OBJ_FILES = dsdb/samdb/ldb_modules/update_keytab.o ################################################ # Start MODULE ldb_objectclass [MODULE::ldb_objectclass] -INIT_FUNCTION = &ldb_objectclass_module_ops +INIT_FUNCTION = LDB_MODULE(objectclass) OUTPUT_TYPE = SHARED_LIBRARY CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC LIBSECURITY NDR_SECURITY SAMDB @@ -260,7 +258,7 @@ ldb_objectclass_OBJ_FILES = dsdb/samdb/ldb_modules/objectclass.o ################################################ # Start MODULE ldb_subtree_rename [MODULE::ldb_subtree_rename] -INIT_FUNCTION = &ldb_subtree_rename_module_ops +INIT_FUNCTION = LDB_MODULE(subtree_rename) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -272,7 +270,7 @@ ldb_subtree_rename_OBJ_FILES = dsdb/samdb/ldb_modules/subtree_rename.o ################################################ # Start MODULE ldb_subtree_rename [MODULE::ldb_subtree_delete] -INIT_FUNCTION = &ldb_subtree_delete_module_ops +INIT_FUNCTION = LDB_MODULE(subtree_delete) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -284,7 +282,7 @@ ldb_subtree_delete_OBJ_FILES = dsdb/samdb/ldb_modules/subtree_delete.o ################################################ # Start MODULE ldb_linked_attributes [MODULE::ldb_linked_attributes] -INIT_FUNCTION = &ldb_linked_attributes_module_ops +INIT_FUNCTION = LDB_MODULE(linked_attributes) CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC SAMDB @@ -297,7 +295,7 @@ ldb_linked_attributes_OBJ_FILES = dsdb/samdb/ldb_modules/linked_attributes.o ################################################ # Start MODULE ldb_ranged_results [MODULE::ldb_ranged_results] -INIT_FUNCTION = &ldb_ranged_results_module_ops +INIT_FUNCTION = LDB_MODULE(ranged_results) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -309,7 +307,7 @@ ldb_ranged_results_OBJ_FILES = dsdb/samdb/ldb_modules/ranged_results.o ################################################ # Start MODULE ldb_anr [MODULE::ldb_anr] -INIT_FUNCTION = &ldb_anr_module_ops +INIT_FUNCTION = LDB_MODULE(anr) CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB @@ -322,7 +320,7 @@ ldb_anr_OBJ_FILES = dsdb/samdb/ldb_modules/anr.o ################################################ # Start MODULE ldb_normalise [MODULE::ldb_normalise] -INIT_FUNCTION = &ldb_normalise_module_ops +INIT_FUNCTION = LDB_MODULE(normalise) CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL SAMDB @@ -335,7 +333,7 @@ ldb_normalise_OBJ_FILES = dsdb/samdb/ldb_modules/normalise.o ################################################ # Start MODULE ldb_instancetype [MODULE::ldb_instancetype] -INIT_FUNCTION = &ldb_instancetype_module_ops +INIT_FUNCTION = LDB_MODULE(instancetype) CFLAGS = -Ilib/ldb/include OUTPUT_TYPE = SHARED_LIBRARY PRIVATE_DEPENDENCIES = LIBTALLOC diff --git a/source4/heimdal_build/config.mk b/source4/heimdal_build/config.mk index 33d2edb67b..fc46381a23 100644 --- a/source4/heimdal_build/config.mk +++ b/source4/heimdal_build/config.mk @@ -175,7 +175,7 @@ HEIMDAL_GSSAPI_OBJ_FILES = \ ####################### # Start SUBSYSTEM HEIMDAL_KRB5 [SUBSYSTEM::HEIMDAL_KRB5] -CFLAGS = -Iheimdal_build -Iheimdal/lib/krb5 +CFLAGS = -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/asn1 -Iheimdal/lib/com_err PRIVATE_DEPENDENCIES = HEIMDAL_ROKEN HEIMDAL_PKINIT_ASN1 HEIMDAL_WIND PUBLIC_DEPENDENCIES = HEIMDAL_KRB5_ASN1 HEIMDAL_GLUE HEIMDAL_HX509 HEIMDAL_HCRYPTO # End SUBSYSTEM HEIMDAL_KRB5 diff --git a/source4/kdc/config.mk b/source4/kdc/config.mk index 94ba933e57..7a96cf6432 100644 --- a/source4/kdc/config.mk +++ b/source4/kdc/config.mk @@ -4,7 +4,7 @@ # Start SUBSYSTEM KDC [MODULE::KDC] INIT_FUNCTION = server_service_kdc_init -SUBSYSTEM = service +SUBSYSTEM = smbd PRIVATE_DEPENDENCIES = \ LIBLDB HEIMDAL HEIMDAL_KDC HEIMDAL_HDB SAMDB # End SUBSYSTEM KDC diff --git a/source4/ldap_server/config.mk b/source4/ldap_server/config.mk index 03cc41d69d..47eb85cab9 100644 --- a/source4/ldap_server/config.mk +++ b/source4/ldap_server/config.mk @@ -4,7 +4,7 @@ # Start SUBSYSTEM LDAP [MODULE::LDAP] INIT_FUNCTION = server_service_ldap_init -SUBSYSTEM = service +SUBSYSTEM = smbd PRIVATE_PROTO_HEADER = proto.h PRIVATE_DEPENDENCIES = CREDENTIALS \ LIBCLI_LDAP SAMDB \ diff --git a/source4/lib/crypto/config.mk b/source4/lib/crypto/config.mk index 82dbe4a4cb..8e0cba17f0 100644 --- a/source4/lib/crypto/config.mk +++ b/source4/lib/crypto/config.mk @@ -10,7 +10,7 @@ LIBCRYPTO_OBJ_FILES = $(addprefix lib/crypto/, \ [MODULE::TORTURE_LIBCRYPTO] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture PRIVATE_DEPENDENCIES = LIBCRYPTO PRIVATE_PROTO_HEADER = test_proto.h diff --git a/source4/lib/events/config.mk b/source4/lib/events/config.mk index e5a1316c47..058ce7f793 100644 --- a/source4/lib/events/config.mk +++ b/source4/lib/events/config.mk @@ -44,6 +44,6 @@ PUBLIC_HEADERS += $(addprefix lib/events/, events.h events_internal.h) [PYTHON::swig_events] SWIG_FILE = events.i -PRIVATE_DEPENDENCIES = LIBEVENTS +PRIVATE_DEPENDENCIES = LIBEVENTS LIBSAMBA-HOSTCONFIG swig_events_OBJ_FILES = lib/events/events_wrap.o diff --git a/source4/lib/events/events.c b/source4/lib/events/events.c index 568aadc31e..6f45db512a 100644 --- a/source4/lib/events/events.c +++ b/source4/lib/events/events.c @@ -58,9 +58,6 @@ #include "lib/events/events_internal.h" #include "lib/util/dlinklist.h" #include "param/param.h" -#if _SAMBA_BUILD_ -#include "build.h" -#endif struct event_ops_list { struct event_ops_list *next, *prev; diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index eece9af5f7..ddbe0f23a6 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -35,7 +35,6 @@ #if (_SAMBA_BUILD_ >= 4) #include "includes.h" -#include "build.h" #endif #define LDB_MODULE_PREFIX "modules:" diff --git a/source4/lib/ldb/config.mk b/source4/lib/ldb/config.mk index 25219eb8b0..e8852980f6 100644 --- a/source4/lib/ldb/config.mk +++ b/source4/lib/ldb/config.mk @@ -3,7 +3,7 @@ [MODULE::ldb_asq] PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include -INIT_FUNCTION = &ldb_asq_module_ops +INIT_FUNCTION = LDB_MODULE(asq) SUBSYSTEM = LIBLDB ldb_asq_OBJ_FILES = lib/ldb/modules/asq.o @@ -15,7 +15,7 @@ ldb_asq_OBJ_FILES = lib/ldb/modules/asq.o [MODULE::ldb_server_sort] PRIVATE_DEPENDENCIES = LIBTALLOC CFLAGS = -Ilib/ldb/include -INIT_FUNCTION = &ldb_server_sort_module_ops +INIT_FUNCTION = LDB_MODULE(server_sort) SUBSYSTEM = LIBLDB # End MODULE ldb_sort @@ -25,7 +25,7 @@ ldb_server_sort_OBJ_FILES = lib/ldb/modules/sort.o ################################################ # Start MODULE ldb_paged_results [MODULE::ldb_paged_results] -INIT_FUNCTION = &ldb_paged_results_module_ops +INIT_FUNCTION = LDB_MODULE(paged_results) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -37,7 +37,7 @@ ldb_paged_results_OBJ_FILES = lib/ldb/modules/paged_results.o ################################################ # Start MODULE ldb_paged_results [MODULE::ldb_paged_searches] -INIT_FUNCTION = &ldb_paged_searches_module_ops +INIT_FUNCTION = LDB_MODULE(paged_searches) CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC SUBSYSTEM = LIBLDB @@ -52,7 +52,7 @@ ldb_paged_searches_OBJ_FILES = lib/ldb/modules/paged_searches.o SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = &ldb_operational_module_ops +INIT_FUNCTION = LDB_MODULE(operational) # End MODULE ldb_operational ################################################ @@ -64,29 +64,23 @@ ldb_operational_OBJ_FILES = lib/ldb/modules/operational.o SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = &ldb_rdn_name_module_ops +INIT_FUNCTION = LDB_MODULE(rdn_name) # End MODULE ldb_rdn_name ################################################ ldb_rdn_name_OBJ_FILES = lib/ldb/modules/rdn_name.o -################################################ -# Start MODULE ldb_map -[SUBSYSTEM::ldb_map] -PRIVATE_DEPENDENCIES = LIBTALLOC -CFLAGS = -Ilib/ldb/include -Ilib/ldb/ldb_map -# End MODULE ldb_map -################################################ - ldb_map_OBJ_FILES = $(addprefix lib/ldb/ldb_map/, ldb_map_inbound.o ldb_map_outbound.o ldb_map.o) +$(ldb_map_OBJ_FILES): CFLAGS+=-Ilib/ldb/ldb_map + ################################################ # Start MODULE ldb_skel [MODULE::ldb_skel] SUBSYSTEM = LIBLDB CFLAGS = -Ilib/ldb/include PRIVATE_DEPENDENCIES = LIBTALLOC -INIT_FUNCTION = &ldb_skel_module_ops +INIT_FUNCTION = LDB_MODULE(skel) # End MODULE ldb_skel ################################################ @@ -134,7 +128,7 @@ PC_FILES += $(ldbdir)/ldb.pc LIBLDB_VERSION = 0.0.1 LIBLDB_SOVERSION = 0 -LIBLDB_OBJ_FILES = $(addprefix lib/ldb/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) +LIBLDB_OBJ_FILES = $(addprefix lib/ldb/common/, ldb.o ldb_ldif.o ldb_parse.o ldb_msg.o ldb_utf8.o ldb_debug.o ldb_modules.o ldb_match.o ldb_attributes.o attrib_handlers.o ldb_dn.o ldb_controls.o qsort.o) $(ldb_map_OBJ_FILES) PUBLIC_HEADERS += $(ldbdir)/include/ldb.h $(ldbdir)/include/ldb_errors.h diff --git a/source4/lib/registry/interface.c b/source4/lib/registry/interface.c index a18fd2c28c..ff3ddf0a35 100644 --- a/source4/lib/registry/interface.c +++ b/source4/lib/registry/interface.c @@ -21,7 +21,6 @@ #include "lib/util/dlinklist.h" #include "lib/registry/registry.h" #include "system/filesys.h" -#include "build.h" /** diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c index 903bbb0b80..47d6d4cd32 100644 --- a/source4/lib/registry/local.c +++ b/source4/lib/registry/local.c @@ -22,7 +22,6 @@ #include "lib/util/dlinklist.h" #include "lib/registry/registry.h" #include "system/filesys.h" -#include "build.h" struct reg_key_path { uint32_t predefined_key; diff --git a/source4/lib/torture/config.mk b/source4/lib/torture/config.mk index e981ee0c99..888e285e95 100644 --- a/source4/lib/torture/config.mk +++ b/source4/lib/torture/config.mk @@ -5,6 +5,9 @@ PUBLIC_DEPENDENCIES = \ LIBSAMBA-UTIL \ LIBTALLOC +torture_VERSION = 0.0.1 +torture_SOVERSION = 0 + PC_FILES += lib/torture/torture.pc torture_OBJ_FILES = $(addprefix lib/torture/, torture.o) diff --git a/source4/lib/torture/torture.c b/source4/lib/torture/torture.c index 3f2c7848aa..33959ded16 100644 --- a/source4/lib/torture/torture.c +++ b/source4/lib/torture/torture.c @@ -23,8 +23,6 @@ #include "lib/util/dlinklist.h" #include "param/param.h" #include "system/filesys.h" -#include "auth/credentials/credentials.h" -#include "lib/cmdline/popt_common.h" struct torture_context *torture_context_init(struct event_context *event_ctx, const struct torture_ui_ops *ui_ops) diff --git a/source4/torture/torture.pc.in b/source4/lib/torture/torture.pc.in index 6582816cb5..6582816cb5 100644 --- a/source4/torture/torture.pc.in +++ b/source4/lib/torture/torture.pc.in diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 11a320a583..24fad8c9c4 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -340,7 +340,7 @@ NDR_WINSREPL_OBJ_FILES = librpc/gen_ndr/ndr_winsrepl.o PUBLIC_DEPENDENCIES = LIBNDR NDR_NETLOGON NDR_WINBIND_OBJ_FILES = librpc/gen_ndr/ndr_winbind.o -PUBLIC_HEADERS += librpc/gen_ndr/winbind.h +#PUBLIC_HEADERS += librpc/gen_ndr/winbind.h librpc/idl-deps: ./librpc/idl-deps.pl librpc/idl/*.idl >$@ @@ -589,8 +589,7 @@ PC_FILES += librpc/dcerpc.pc dcerpc_VERSION = 0.0.1 dcerpc_SOVERSION = 0 -dcerpc_OBJ_FILES = $(addprefix librpc/rpc/, dcerpc.o dcerpc_auth.o dcerpc_schannel.o dcerpc_util.o \ - binding.o \ +dcerpc_OBJ_FILES = $(addprefix librpc/rpc/, dcerpc.o dcerpc_auth.o dcerpc_schannel.o dcerpc_util.o binding.o \ dcerpc_error.o dcerpc_smb.o dcerpc_smb2.o dcerpc_sock.o dcerpc_connect.o dcerpc_secondary.o) @@ -720,12 +719,12 @@ PUBLIC_DEPENDENCIES = LIBCLI_SMB NDR_MISC LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG dcer swig_dcerpc_OBJ_FILES = librpc/rpc/dcerpc_wrap.o [PYTHON::python_echo] -PRIVATE_DEPENDENCIES = RPC_NDR_ECHO PYTALLOC +PRIVATE_DEPENDENCIES = RPC_NDR_ECHO PYTALLOC param swig_credentials python_echo_OBJ_FILES = librpc/gen_ndr/py_echo.o [PYTHON::python_winreg] -PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc PYTALLOC +PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc PYTALLOC param swig_credentials python_winreg_OBJ_FILES = librpc/gen_ndr/py_winreg.o @@ -735,57 +734,57 @@ PRIVATE_DEPENDENCIES = PYTALLOC python_dcerpc_misc_OBJ_FILES = librpc/gen_ndr/py_misc.o [PYTHON::python_initshutdown] -PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN PYTALLOC +PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN PYTALLOC param swig_credentials python_initshutdown_OBJ_FILES = librpc/gen_ndr/py_initshutdown.o [PYTHON::python_epmapper] -PRIVATE_DEPENDENCIES = PYTALLOC +PRIVATE_DEPENDENCIES = PYTALLOC param swig_credentials python_epmapper_OBJ_FILES = librpc/gen_ndr/py_epmapper.o [PYTHON::python_mgmt] -PRIVATE_DEPENDENCIES = dcerpc_mgmt PYTALLOC +PRIVATE_DEPENDENCIES = dcerpc_mgmt PYTALLOC param swig_credentials python_mgmt_OBJ_FILES = librpc/gen_ndr/py_mgmt.o [PYTHON::python_atsvc] -PRIVATE_DEPENDENCIES = dcerpc_atsvc PYTALLOC +PRIVATE_DEPENDENCIES = dcerpc_atsvc PYTALLOC param swig_credentials python_atsvc_OBJ_FILES = librpc/gen_ndr/py_atsvc.o [PYTHON::python_samr] -PRIVATE_DEPENDENCIES = dcerpc_samr PYTALLOC +PRIVATE_DEPENDENCIES = dcerpc_samr PYTALLOC python_dcerpc_security python_lsa python_dcerpc_misc swig_credentials param python_samr_OBJ_FILES = librpc/gen_ndr/py_samr.o [PYTHON::python_svcctl] -PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL PYTALLOC +PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL PYTALLOC param swig_credentials python_svcctl_OBJ_FILES = librpc/gen_ndr/py_svcctl.o [PYTHON::python_lsa] -PRIVATE_DEPENDENCIES = RPC_NDR_LSA PYTALLOC +PRIVATE_DEPENDENCIES = RPC_NDR_LSA PYTALLOC param swig_credentials python_lsa_OBJ_FILES = librpc/gen_ndr/py_lsa.o [PYTHON::python_wkssvc] -PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC PYTALLOC +PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC PYTALLOC param swig_credentials python_wkssvc_OBJ_FILES = librpc/gen_ndr/py_wkssvc.o [PYTHON::python_dfs] -PRIVATE_DEPENDENCIES = RPC_NDR_DFS PYTALLOC +PRIVATE_DEPENDENCIES = RPC_NDR_DFS PYTALLOC param swig_credentials python_dfs_OBJ_FILES = librpc/gen_ndr/py_dfs.o [PYTHON::python_unixinfo] -PRIVATE_DEPENDENCIES = RPC_NDR_UNIXINFO PYTALLOC +PRIVATE_DEPENDENCIES = RPC_NDR_UNIXINFO PYTALLOC param swig_credentials python_dcerpc_security python_dcerpc_misc python_unixinfo_OBJ_FILES = librpc/gen_ndr/py_unixinfo.o [PYTHON::python_drsuapi] -PRIVATE_DEPENDENCIES = RPC_NDR_DRSUAPI PYTALLOC +PRIVATE_DEPENDENCIES = RPC_NDR_DRSUAPI PYTALLOC param swig_credentials python_drsuapi_OBJ_FILES = librpc/gen_ndr/py_drsuapi.o diff --git a/source4/nbt_server/config.mk b/source4/nbt_server/config.mk index cb2b47d15e..84e6b661bf 100644 --- a/source4/nbt_server/config.mk +++ b/source4/nbt_server/config.mk @@ -66,7 +66,7 @@ NBT_SERVER_OBJ_FILES = $(addprefix nbt_server/, \ [MODULE::service_nbtd] INIT_FUNCTION = server_service_nbtd_init -SUBSYSTEM = service +SUBSYSTEM = smbd PRIVATE_DEPENDENCIES = NBT_SERVER process_model service_nbtd_OBJ_FILES = \ diff --git a/source4/ntptr/ntptr_base.c b/source4/ntptr/ntptr_base.c index 1165631b18..a7004be90b 100644 --- a/source4/ntptr/ntptr_base.c +++ b/source4/ntptr/ntptr_base.c @@ -24,7 +24,6 @@ #include "includes.h" #include "ntptr/ntptr.h" -#include "build.h" #include "param/param.h" /* the list of currently registered NTPTR backends */ diff --git a/source4/ntvfs/ntvfs_base.c b/source4/ntvfs/ntvfs_base.c index 8f574fa96b..3706cd172c 100644 --- a/source4/ntvfs/ntvfs_base.c +++ b/source4/ntvfs/ntvfs_base.c @@ -24,7 +24,6 @@ #include "includes.h" #include "lib/util/dlinklist.h" -#include "build.h" #include "ntvfs/ntvfs.h" #include "param/param.h" diff --git a/source4/ntvfs/sysdep/config.mk b/source4/ntvfs/sysdep/config.mk index de445bff7b..68be660049 100644 --- a/source4/ntvfs/sysdep/config.mk +++ b/source4/ntvfs/sysdep/config.mk @@ -16,8 +16,7 @@ sys_notify_inotify_OBJ_FILES = ntvfs/sysdep/inotify.o sys_notify_OBJ_FILES = ntvfs/sysdep/sys_notify.o -[MODULE::sys_lease_linux] -SUBSYSTEM = sys_lease +[SUBSYSTEM::sys_lease_linux] sys_lease_linux_OBJ_FILES = ntvfs/sysdep/sys_lease_linux.o diff --git a/source4/ntvfs/sysdep/sys_lease.c b/source4/ntvfs/sysdep/sys_lease.c index e6b11c450a..a0322bbcc1 100644 --- a/source4/ntvfs/sysdep/sys_lease.c +++ b/source4/ntvfs/sysdep/sys_lease.c @@ -28,7 +28,6 @@ #include "lib/events/events.h" #include "lib/util/dlinklist.h" #include "param/param.h" -#include "build.h" /* list of registered backends */ static struct sys_lease_ops *backends; @@ -109,6 +108,10 @@ _PUBLIC_ NTSTATUS sys_lease_register(const struct sys_lease_ops *backend) return NT_STATUS_OK; } +#ifndef STATIC_sys_lease_MODULES +#define STATIC_sys_lease_MODULES NULL +#endif + _PUBLIC_ NTSTATUS sys_lease_init(void) { static bool initialized = false; diff --git a/source4/ntvfs/sysdep/sys_notify.c b/source4/ntvfs/sysdep/sys_notify.c index 22b72c4d63..9770323c3f 100644 --- a/source4/ntvfs/sysdep/sys_notify.c +++ b/source4/ntvfs/sysdep/sys_notify.c @@ -28,7 +28,6 @@ #include "lib/events/events.h" #include "lib/util/dlinklist.h" #include "param/param.h" -#include "build.h" /* list of registered backends */ static struct sys_notify_backend *backends; diff --git a/source4/param/config.mk b/source4/param/config.mk index 42cb6f3c1c..4c202dc6de 100644 --- a/source4/param/config.mk +++ b/source4/param/config.mk @@ -3,13 +3,19 @@ PUBLIC_DEPENDENCIES = LIBSAMBA-UTIL PRIVATE_DEPENDENCIES = DYNCONFIG LIBREPLACE_EXT CHARSET LIBSAMBA-HOSTCONFIG_VERSION = 0.0.1 -LIBSAMBA-HOSTCONFIG-SOVERSION = 0 +LIBSAMBA-HOSTCONFIG_SOVERSION = 0 LIBSAMBA-HOSTCONFIG_OBJ_FILES = param/loadparm.o \ param/generic.o \ param/util.o \ lib/version.o +LIBSAMBA-CONFIG_OBJ_FILES = param/loadparm.o \ + param/params.o \ + param/generic.o \ + param/util.o \ + lib/version.o + PUBLIC_HEADERS += param/param.h PC_FILES += param/samba-hostconfig.pc diff --git a/source4/param/share.c b/source4/param/share.c index f8ee468054..47aea55751 100644 --- a/source4/param/share.c +++ b/source4/param/share.c @@ -21,7 +21,6 @@ #include "includes.h" #include "param/share.h" -#include "build.h" #include "param/param.h" const char *share_string_option(struct share_config *scfg, const char *opt_name, const char *defval) diff --git a/source4/pidl/config.mk b/source4/pidl/config.mk index 25cea495a7..19b2d53659 100644 --- a/source4/pidl/config.mk +++ b/source4/pidl/config.mk @@ -6,7 +6,7 @@ pidl-testcov: pidl/Makefile installpidl:: pidl/Makefile $(MAKE) -C pidl install_vendor VENDORPREFIX=$(prefix) \ - INSTALLVENDORLIB=$(libdir) \ + INSTALLVENDORLIB=$(datarootdir)/perl5 \ INSTALLVENDORBIN=$(bindir) \ INSTALLVENDORSCRIPT=$(bindir) \ INSTALLVENDORMAN1DIR=$(mandir)/man1 \ diff --git a/source4/rpc_server/config.mk b/source4/rpc_server/config.mk index 807853fa16..974d12c882 100644 --- a/source4/rpc_server/config.mk +++ b/source4/rpc_server/config.mk @@ -16,7 +16,7 @@ PUBLIC_HEADERS += rpc_server/common/common.h # Start MODULE dcerpc_rpcecho [MODULE::dcerpc_rpcecho] INIT_FUNCTION = dcerpc_server_rpcecho_init -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV PRIVATE_DEPENDENCIES = NDR_ECHO # End MODULE dcerpc_rpcecho ################################################ @@ -27,7 +27,7 @@ dcerpc_rpcecho_OBJ_FILES = rpc_server/echo/rpc_echo.o # Start MODULE dcerpc_epmapper [MODULE::dcerpc_epmapper] INIT_FUNCTION = dcerpc_server_epmapper_init -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV PRIVATE_DEPENDENCIES = NDR_EPMAPPER # End MODULE dcerpc_epmapper ################################################ @@ -38,7 +38,7 @@ dcerpc_epmapper_OBJ_FILES = rpc_server/epmapper/rpc_epmapper.o # Start MODULE dcerpc_remote [MODULE::dcerpc_remote] INIT_FUNCTION = dcerpc_server_remote_init -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV PRIVATE_DEPENDENCIES = \ LIBCLI_SMB NDR_TABLE # End MODULE dcerpc_remote @@ -51,7 +51,7 @@ dcerpc_remote_OBJ_FILES = rpc_server/remote/dcesrv_remote.o [MODULE::dcerpc_srvsvc] INIT_FUNCTION = dcerpc_server_srvsvc_init PRIVATE_PROTO_HEADER = srvsvc/proto.h -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV PRIVATE_DEPENDENCIES = \ DCERPC_COMMON NDR_SRVSVC share # End MODULE dcerpc_srvsvc @@ -63,7 +63,7 @@ dcerpc_srvsvc_OBJ_FILES = $(addprefix rpc_server/srvsvc/, dcesrv_srvsvc.o srvsvc # Start MODULE dcerpc_wkssvc [MODULE::dcerpc_wkssvc] INIT_FUNCTION = dcerpc_server_wkssvc_init -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV PRIVATE_DEPENDENCIES = \ DCERPC_COMMON NDR_WKSSVC # End MODULE dcerpc_wkssvc @@ -75,7 +75,7 @@ dcerpc_wkssvc_OBJ_FILES = rpc_server/wkssvc/dcesrv_wkssvc.o # Start MODULE dcerpc_unixinfo [MODULE::dcerpc_unixinfo] INIT_FUNCTION = dcerpc_server_unixinfo_init -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV PRIVATE_DEPENDENCIES = \ DCERPC_COMMON \ SAMDB \ @@ -92,7 +92,7 @@ dcerpc_unixinfo_OBJ_FILES = rpc_server/unixinfo/dcesrv_unixinfo.o [MODULE::dcesrv_samr] INIT_FUNCTION = dcerpc_server_samr_init PRIVATE_PROTO_HEADER = samr/proto.h -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV PRIVATE_DEPENDENCIES = \ SAMDB \ DCERPC_COMMON \ @@ -106,7 +106,7 @@ dcesrv_samr_OBJ_FILES = $(addprefix rpc_server/samr/, dcesrv_samr.o samr_passwor # Start MODULE dcerpc_winreg [MODULE::dcerpc_winreg] INIT_FUNCTION = dcerpc_server_winreg_init -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV OUTPUT_TYPE = MERGED_OBJ PRIVATE_DEPENDENCIES = \ registry NDR_WINREG @@ -119,7 +119,7 @@ dcerpc_winreg_OBJ_FILES = rpc_server/winreg/rpc_winreg.o # Start MODULE dcerpc_netlogon [MODULE::dcerpc_netlogon] INIT_FUNCTION = dcerpc_server_netlogon_init -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV PRIVATE_DEPENDENCIES = \ DCERPC_COMMON \ SCHANNELDB \ @@ -134,7 +134,7 @@ dcerpc_netlogon_OBJ_FILES = rpc_server/netlogon/dcerpc_netlogon.o # Start MODULE dcerpc_lsa [MODULE::dcerpc_lsarpc] INIT_FUNCTION = dcerpc_server_lsa_init -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV PRIVATE_PROTO_HEADER= lsa/proto.h PRIVATE_DEPENDENCIES = \ SAMDB \ @@ -152,7 +152,7 @@ dcerpc_lsarpc_OBJ_FILES = $(addprefix rpc_server/lsa/, dcesrv_lsa.o lsa_init.o l # Start MODULE dcerpc_spoolss [MODULE::dcerpc_spoolss] INIT_FUNCTION = dcerpc_server_spoolss_init -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV OUTPUT_TYPE = MERGED_OBJ PRIVATE_DEPENDENCIES = \ DCERPC_COMMON \ @@ -168,7 +168,7 @@ dcerpc_spoolss_OBJ_FILES = rpc_server/spoolss/dcesrv_spoolss.o # Start MODULE dcerpc_drsuapi [MODULE::dcerpc_drsuapi] INIT_FUNCTION = dcerpc_server_drsuapi_init -SUBSYSTEM = dcerpc_server +SUBSYSTEM = DCESRV PRIVATE_DEPENDENCIES = \ SAMDB \ DCERPC_COMMON \ @@ -200,7 +200,7 @@ PUBLIC_HEADERS += rpc_server/dcerpc_server.h [MODULE::DCESRV] INIT_FUNCTION = server_service_rpc_init -SUBSYSTEM = service +SUBSYSTEM = smbd PRIVATE_DEPENDENCIES = dcerpc_server DCESRV_OBJ_FILES = rpc_server/service_rpc.o diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index beb795ea22..1962a97d5b 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -34,7 +34,6 @@ #include "smbd/service.h" #include "system/filesys.h" #include "libcli/security/security.h" -#include "build.h" #include "param/param.h" extern const struct dcesrv_interface dcesrv_mgmt_interface; diff --git a/source4/rpc_server/service_rpc.c b/source4/rpc_server/service_rpc.c index 27f3fe41c2..00f0d261ca 100644 --- a/source4/rpc_server/service_rpc.c +++ b/source4/rpc_server/service_rpc.c @@ -37,7 +37,6 @@ #include "lib/messaging/irpc.h" #include "system/network.h" #include "lib/socket/netif.h" -#include "build.h" #include "param/param.h" struct dcesrv_socket_context { @@ -471,7 +470,7 @@ NTSTATUS server_service_rpc_init(void) extern NTSTATUS dcerpc_server_samr_init(void); extern NTSTATUS dcerpc_server_remote_init(void); extern NTSTATUS dcerpc_server_lsa_init(void); - init_module_fn static_init[] = { STATIC_dcerpc_server_MODULES }; + init_module_fn static_init[] = { STATIC_DCESRV_MODULES }; init_module_fn *shared_init = load_samba_modules(NULL, global_loadparm, "dcerpc_server"); run_init_functions(static_init); diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk index cadd71673c..896b292e23 100644 --- a/source4/scripting/ejs/config.mk +++ b/source4/scripting/ejs/config.mk @@ -58,7 +58,9 @@ smbcalls_data_OBJ_FILES = scripting/ejs/smbcalls_data.o OUTPUT_TYPE = MERGED_OBJ SUBSYSTEM = smbcalls INIT_FUNCTION = smb_setup_ejs_auth -PRIVATE_DEPENDENCIES = auth +PRIVATE_DEPENDENCIES = service_auth + +smbcalls_auth_OBJ_FILES = scripting/ejs/smbcalls_auth.o smbcalls_auth_OBJ_FILES = scripting/ejs/smbcalls_auth.o diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c index b1a2f6a37b..98d6be07bf 100644 --- a/source4/scripting/ejs/smbcalls.c +++ b/source4/scripting/ejs/smbcalls.c @@ -23,7 +23,6 @@ #include "includes.h" #include "param/param.h" #include "scripting/ejs/smbcalls.h" -#include "build.h" #include "version.h" /* diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js deleted file mode 100644 index 51e2785762..0000000000 --- a/source4/scripting/libjs/provision.js +++ /dev/null @@ -1,1254 +0,0 @@ -/* - backend code for provisioning a Samba4 server - Copyright Andrew Tridgell 2005 - Released under the GNU GPL version 3 or later -*/ - -sys = sys_init(); - -/* - return true if the current install seems to be OK -*/ -function install_ok(session_info, credentials) -{ - var lp = loadparm_init(); - var ldb = ldb_init(); - ldb.session_info = session_info; - ldb.credentials = credentials; - if (lp.get("realm") == "") { - return false; - } - var ok = ldb.connect(lp.get("sam database")); - if (!ok) { - return false; - } - var res = ldb.search("(cn=Administrator)"); - if (res.error != 0 || res.msgs.length != 1) { - return false; - } - return true; -} - -/* - find a user or group from a list of possibilities -*/ -function findnss() -{ - var i; - assert(arguments.length >= 2); - var nssfn = arguments[0]; - for (i=1;i<arguments.length;i++) { - if (nssfn(arguments[i]) != undefined) { - return arguments[i]; - } - } - printf("Unable to find user/group for %s\n", arguments[1]); - assert(i<arguments.length); -} - -/* - add a foreign security principle - */ -function add_foreign(ldb, subobj, sid, desc) -{ - var add = sprintf(" -dn: CN=%s,CN=ForeignSecurityPrincipals,%s -objectClass: top -objectClass: foreignSecurityPrincipal -description: %s -", - sid, subobj.DOMAINDN, desc); - /* deliberately ignore errors from this, as the records may - already exist */ - ldb.add(add); -} - - -/* - setup a mapping between a sam name and a unix name - */ -function setup_name_mapping(info, ldb, sid, unixname) -{ - var attrs = new Array("dn"); - var res = ldb.search(sprintf("objectSid=%s", sid), - info.subobj.DOMAINDN, ldb.SCOPE_SUBTREE, attrs); - if (res.error != 0 || res.msgs.length != 1) { - info.message("Failed to find record for objectSid %s\n", sid); - return false; - } - var mod = sprintf(" -dn: %s -changetype: modify -replace: unixName -unixName: %s -", - res.msgs[0].dn, unixname); - var ok = ldb.modify(mod); - if (ok.error != 0) { - info.message("name mapping for %s failed - %s\n", - sid, ldb.errstring()); - return false; - } - return true; -} - -/* - return current time as a nt time string -*/ -function nttime() -{ - return "" + sys.nttime(); -} - -/* - return current time as a ldap time string -*/ -function ldaptime() -{ - return sys.ldaptime(sys.nttime()); -} - -/* - return a date string suitable for a dns zone serial number -*/ -function datestring() -{ - var t = sys.ntgmtime(sys.nttime()); - return sprintf("%04u%02u%02u%02u", - t.tm_year+1900, t.tm_mon+1, t.tm_mday, t.tm_hour); -} - -/* - return first host IP -*/ -function hostip() -{ - var list = sys.interfaces(); - return list[0]; -} - - -/* - return first part of hostname -*/ -function hostname() -{ - var s = split(".", sys.hostname()); - return s[0]; -} - -/* the ldb is in bad shape, possibly due to being built from an - incompatible previous version of the code, so delete it - completely */ -function ldb_delete(info, ldb) -{ - info.message("Deleting " + ldb.filename + "\n"); - var lp = loadparm_init(); - sys.unlink(sprintf("%s/%s", lp.get("private dir"), ldb.filename)); - ldb.transaction_cancel(); - ldb.close(); - var ok = ldb.connect(ldb.filename); - ldb.transaction_start(); - assert(ok); -} - -/* - erase an ldb, removing all records -*/ -function ldb_erase(info, ldb) -{ - var res; - - /* delete the specials */ - ldb.del("@INDEXLIST"); - ldb.del("@ATTRIBUTES"); - ldb.del("@OPTIONS"); - ldb.del("@MODULES"); - ldb.del("@PARTITION"); - ldb.del("@KLUDGEACL"); - - /* and the rest */ - attrs = new Array("dn"); - var basedn = ""; - var res = ldb.search("(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs); - var i; - if (res.error != 0) { - ldb_delete(info, ldb); - return; - } - for (i=0;i<res.msgs.length;i++) { - ldb.del(res.msgs[i].dn); - } - - var res = ldb.search("(&(|(objectclass=*)(distinguishedName=*))(!(distinguishedName=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs); - if (res.error != 0 || res.msgs.length != 0) { - ldb_delete(info, ldb); - return; - } - assert(res.msgs.length == 0); -} - -/* - erase an ldb, removing all records -*/ -function ldb_erase_partitions(info, ldb, ldapbackend) -{ - var rootDSE_attrs = new Array("namingContexts"); - var lp = loadparm_init(); - var j; - - var res = ldb.search("(objectClass=*)", "", ldb.SCOPE_BASE, rootDSE_attrs); - if (res.error != 0) { - info.message("rootdse search failed: " + res.errstr + "\n"); - assert(res.error == 0); - } - assert(res.msgs.length == 1); - if (typeof(res.msgs[0].namingContexts) == "undefined") { - return; - } - for (j=0; j<res.msgs[0].namingContexts.length; j++) { - var anything = "(|(objectclass=*)(distinguishedName=*))"; - var attrs = new Array("distinguishedName"); - var basedn = res.msgs[0].namingContexts[j]; - var k; - var previous_remaining = 1; - var current_remaining = 0; - - if (ldapbackend && (basedn == info.subobj.DOMAINDN)) { - /* Only delete objects that were created by provision */ - anything = "(objectcategory=*)"; - } - - for (k=0; k < 10 && (previous_remaining != current_remaining); k++) { - /* and the rest */ - var res2 = ldb.search(anything, basedn, ldb.SCOPE_SUBTREE, attrs); - var i; - if (res2.error != 0) { - if (res2.error == 32) { - break; - } else { - info.message("ldb search(2) failed: " + res2.errstr + "\n"); - continue; - } - } - previous_remaining = current_remaining; - current_remaining = res2.msgs.length; - for (i=0;i<res2.msgs.length;i++) { - ldb.del(res2.msgs[i].dn); - } - - var res3 = ldb.search(anything, basedn, ldb.SCOPE_SUBTREE, attrs); - if (res3.error != 0) { - info.message("ldb search(3) failed: " + res3.errstr + "\n"); - continue; - } - if (res3.msgs.length != 0) { - info.message("Failed to delete all records under " + basedn + ", " + res3.msgs.length + " records remaining\n"); - } - } - } -} - -function open_ldb(info, dbname, erase) -{ - var ldb = ldb_init(); - ldb.session_info = info.session_info; - ldb.credentials = info.credentials; - ldb.filename = dbname; - - var connect_ok = ldb.connect(dbname); - if (!connect_ok) { - var lp = loadparm_init(); - sys.unlink(sprintf("%s/%s", lp.get("private dir"), dbname)); - connect_ok = ldb.connect(dbname); - assert(connect_ok); - } - - ldb.transaction_start(); - - if (erase) { - ldb_erase(info, ldb); - } - return ldb; -} - - -/* - setup a ldb in the private dir - */ -function setup_add_ldif(ldif, info, ldb, failok) -{ - var lp = loadparm_init(); - var src = lp.get("setup directory") + "/" + ldif; - - var data = sys.file_load(src); - data = substitute_var(data, info.subobj); - - var add_res = ldb.add(data); - if (add_res.error != 0) { - info.message("ldb load failed: " + add_res.errstr + "\n"); - if (!failok) { - assert(add_res.error == 0); - } - } - return (add_res.error == 0); -} - -function setup_modify_ldif(ldif, info, ldb, failok) -{ - var lp = loadparm_init(); - var src = lp.get("setup directory") + "/" + ldif; - - var data = sys.file_load(src); - data = substitute_var(data, info.subobj); - - var mod_res = ldb.modify(data); - if (mod_res.error != 0) { - info.message("ldb load failed: " + mod_res.errstr + "\n"); - if (!failok) { - assert(mod_res.error == 0); - } - } - return (mod_res.error == 0); -} - - -function setup_ldb(ldif, info, dbname) -{ - var erase = true; - var failok = false; - - if (arguments.length >= 4) { - erase = arguments[3]; - } - if (arguments.length == 5) { - failok = arguments[4]; - } - var ldb = open_ldb(info, dbname, erase); - if (setup_add_ldif(ldif, info, ldb, failok)) { - var commit_ok = ldb.transaction_commit(); - if (!commit_ok) { - info.message("ldb commit failed: " + ldb.errstring() + "\n"); - assert(commit_ok); - } - } -} - -/* - setup a ldb in the private dir - */ -function setup_ldb_modify(ldif, info, ldb) -{ - var lp = loadparm_init(); - - var src = lp.get("setup directory") + "/" + ldif; - - var data = sys.file_load(src); - data = substitute_var(data, info.subobj); - - var mod_res = ldb.modify(data); - if (mod_res.error != 0) { - info.message("ldb load failed: " + mod_res.errstr + "\n"); - return (mod_res.error == 0); - } - return (mod_res.error == 0); -} - -/* - setup a file in the private dir - */ -function setup_file(template, message, fname, subobj) -{ - var lp = loadparm_init(); - var f = fname; - var src = lp.get("setup directory") + "/" + template; - - if (! sys.stat(src)) { - message("Template file not found: %s\n",src); - assert(0); - } - - sys.unlink(f); - - var data = sys.file_load(src); - data = substitute_var(data, subobj); - - ok = sys.file_save(f, data); - if (!ok) { - message("failed to create file: " + f + "\n"); - assert(ok); - } -} - -function provision_default_paths(subobj) -{ - /* subobj.DNSDOMAIN isn't available at this point */ - var dnsdomain = strlower(subobj.REALM); - var lp = loadparm_init(); - var paths = new Object(); - paths.smbconf = lp.filename() - paths.shareconf = lp.get("private dir") + "/" + "share.ldb"; - paths.samdb = lp.get("sam database"); - paths.idmapdb = lp.get("idmap database"); - paths.secrets = lp.get("secrets database"); - paths.templates = lp.get("private dir") + "/" + "templates.ldb"; - paths.keytab = "secrets.keytab"; - paths.dns_keytab = "dns.keytab"; - paths.dns_keytab_abs = lp.get("private dir") + "/" + paths.dns_keytab; - paths.dns = lp.get("private dir") + "/" + dnsdomain + ".zone"; - paths.named_conf = lp.get("private dir") + "/named.conf"; - paths.winsdb = "wins.ldb"; - paths.ldapdir = lp.get("private dir") + "/ldap"; - - paths.s4_ldapi_socket = lp.get("private dir") + "/ldapi"; - paths.phpldapadminconfig = lp.get("private dir") + "/phpldapadmin-config.php"; - - paths.sysvol = lp.get("sysvol", "path"); - - if (paths.sysvol == undefined) { - paths.sysvol = lp.get("lock dir") + "/sysvol"; - } - - paths.netlogon = lp.get("netlogon", "path"); - - if (paths.netlogon == undefined) { - paths.netlogon = paths.sysvol + "/" + dnsdomain + "/scripts"; - } - - return paths; -} - - -/* - setup reasonable name mappings for sam names to unix names -*/ -function setup_name_mappings(info, ldb) -{ - var lp = loadparm_init(); - var attrs = new Array("objectSid"); - var subobj = info.subobj; - - res = ldb.search("objectSid=*", subobj.DOMAINDN, ldb.SCOPE_BASE, attrs); - assert(res.error == 0); - assert(res.msgs.length == 1 && res.msgs[0].objectSid != undefined); - var sid = res.msgs[0].objectSid; - - /* add some foreign sids if they are not present already */ - add_foreign(ldb, subobj, "S-1-5-7", "Anonymous"); - add_foreign(ldb, subobj, "S-1-1-0", "World"); - add_foreign(ldb, subobj, "S-1-5-2", "Network"); - add_foreign(ldb, subobj, "S-1-5-18", "System"); - add_foreign(ldb, subobj, "S-1-5-11", "Authenticated Users"); - - /* some well known sids */ - setup_name_mapping(info, ldb, "S-1-5-7", subobj.NOBODY); - setup_name_mapping(info, ldb, "S-1-1-0", subobj.NOGROUP); - setup_name_mapping(info, ldb, "S-1-5-2", subobj.NOGROUP); - setup_name_mapping(info, ldb, "S-1-5-18", subobj.ROOT); - setup_name_mapping(info, ldb, "S-1-5-11", subobj.USERS); - setup_name_mapping(info, ldb, "S-1-5-32-544", subobj.WHEEL); - setup_name_mapping(info, ldb, "S-1-5-32-545", subobj.USERS); - setup_name_mapping(info, ldb, "S-1-5-32-546", subobj.NOGROUP); - setup_name_mapping(info, ldb, "S-1-5-32-551", subobj.BACKUP); - - /* and some well known domain rids */ - setup_name_mapping(info, ldb, sid + "-500", subobj.ROOT); - setup_name_mapping(info, ldb, sid + "-518", subobj.WHEEL); - setup_name_mapping(info, ldb, sid + "-519", subobj.WHEEL); - setup_name_mapping(info, ldb, sid + "-512", subobj.WHEEL); - setup_name_mapping(info, ldb, sid + "-513", subobj.USERS); - setup_name_mapping(info, ldb, sid + "-520", subobj.WHEEL); - - return true; -} - -function provision_fix_subobj(subobj, paths) -{ - var ldb = ldb_init(); - - subobj.REALM = strupper(subobj.REALM); - subobj.HOSTNAME = strlower(subobj.HOSTNAME); - subobj.DOMAIN = strupper(subobj.DOMAIN); - subobj.NETBIOSNAME = strupper(subobj.HOSTNAME); - subobj.DNSDOMAIN = strlower(subobj.REALM); - subobj.DNSNAME = sprintf("%s.%s", - strlower(subobj.HOSTNAME), - subobj.DNSDOMAIN); - var rdn_list = split(".", subobj.DNSDOMAIN); - subobj.DOMAINDN = "DC=" + join(",DC=", rdn_list); - subobj.ROOTDN = subobj.DOMAINDN; - subobj.CONFIGDN = "CN=Configuration," + subobj.ROOTDN; - subobj.SCHEMADN = "CN=Schema," + subobj.CONFIGDN; - - subobj.MACHINEPASS_B64 = ldb.encode(subobj.MACHINEPASS); - subobj.KRBTGTPASS_B64 = ldb.encode(subobj.KRBTGTPASS); - subobj.ADMINPASS_B64 = ldb.encode(subobj.ADMINPASS); - subobj.DNSPASS_B64 = ldb.encode(subobj.DNSPASS); - - subobj.SAM_LDB = "tdb://" + paths.samdb; - subobj.SECRETS_KEYTAB = paths.keytab; - subobj.DNS_KEYTAB = paths.dns_keytab; - subobj.DNS_KEYTAB_ABS = paths.dns_keytab_abs; - - subobj.LDAPDIR = paths.ldapdir; - var ldap_path_list = split("/", paths.ldapdir); - subobj.LDAPI_URI = "ldapi://" + join("%2F", ldap_path_list) + "%2Fldapi"; - - var s4ldap_path_list = split("/", paths.s4_ldapi_socket); - subobj.S4_LDAPI_URI = "ldapi://" + join("%2F", s4ldap_path_list); - - subobj.LDAPMANAGERDN = "cn=Manager," + subobj.DOMAINDN; - - subobj.NETLOGONPATH = paths.netlogon; - subobj.SYSVOLPATH = paths.sysvol; - - if (subobj.DOMAIN_CONF == undefined) { - subobj.DOMAIN_CONF = subobj.DOMAIN; - } - if (subobj.REALM_CONF == undefined) { - subobj.REALM_CONF = subobj.REALM; - } - if (strlower(subobj.SERVERROLE) != strlower("domain controller")) { - subobj.REALM = subobj.HOSTNAME; - subobj.DOMAIN = subobj.HOSTNAME; - } - - return true; -} - -function provision_become_dc(subobj, message, erase, paths, session_info) -{ - var lp = loadparm_init(); - var sys = sys_init(); - var info = new Object(); - - var ok = provision_fix_subobj(subobj, paths); - assert(ok); - - if (subobj.BACKEND_MOD == undefined) { - subobj.BACKEND_MOD = "repl_meta_data"; - } - - info.subobj = subobj; - info.message = message; - info.session_info = session_info; - - message("Setting up templates into " + paths.templates + "\n"); - setup_ldb("provision_templates.ldif", info, paths.templates); - - /* Also wipes the database */ - message("Setting up " + paths.samdb + " partitions\n"); - setup_ldb("provision_partitions.ldif", info, paths.samdb); - - var samdb = open_ldb(info, paths.samdb, false); - - message("Setting up " + paths.samdb + " attributes\n"); - setup_add_ldif("provision_init.ldif", info, samdb, false); - - message("Setting up " + paths.samdb + " rootDSE\n"); - setup_add_ldif("provision_rootdse_add.ldif", info, samdb, false); - - if (erase) { - message("Erasing data from partitions\n"); - ldb_erase_partitions(info, samdb, undefined); - } - - message("Setting up " + paths.samdb + " indexes\n"); - setup_add_ldif("provision_index.ldif", info, samdb, false); - - ok = samdb.transaction_commit(); - assert(ok); - - message("Setting up " + paths.secrets + "\n"); - setup_ldb("secrets_init.ldif", info, paths.secrets); - - setup_ldb("secrets.ldif", info, paths.secrets, false); - - setup_ldb("secrets_dc.ldif", info, paths.secrets, false); - - return true; -} - -function load_schema(subobj, message, samdb) -{ - var lp = loadparm_init(); - var src = lp.get("setup directory") + "/" + "schema.ldif"; - - if (! sys.stat(src)) { - message("Template file not found: %s\n",src); - assert(0); - } - - var schema_data = sys.file_load(src); - - src = lp.get("setup directory") + "/" + "schema_samba4.ldif"; - - if (! sys.stat(src)) { - message("Template file not found: %s\n",src); - assert(0); - } - - schema_data = schema_data + sys.file_load(src); - - schema_data = substitute_var(schema_data, subobj); - - src = lp.get("setup directory") + "/" + "provision_schema_basedn_modify.ldif"; - - if (! sys.stat(src)) { - message("Template file not found: %s\n",src); - assert(0); - } - - var head_data = sys.file_load(src); - head_data = substitute_var(head_data, subobj); - - var ok = samdb.attach_dsdb_schema_from_ldif(head_data, schema_data); - return ok; -} - - -/* - provision samba4 - caution, this wipes all existing data! -*/ -function provision(subobj, message, blank, paths, session_info, credentials, ldapbackend) -{ - var lp = loadparm_init(); - var sys = sys_init(); - var info = new Object(); - random_init(local); - - var ok = provision_fix_subobj(subobj, paths); - assert(ok); - - if (strlower(subobj.SERVERROLE) == strlower("domain controller")) { - if (subobj.BACKEND_MOD == undefined) { - subobj.BACKEND_MOD = "repl_meta_data"; - } - } else { - if (subobj.BACKEND_MOD == undefined) { - subobj.BACKEND_MOD = "objectguid"; - } - } - - if (subobj.DOMAINGUID != undefined) { - subobj.DOMAINGUID_MOD = sprintf("replace: objectGUID\nobjectGUID: %s\n-", subobj.DOMAINGUID); - } else { - subobj.DOMAINGUID_MOD = ""; - } - - if (subobj.HOSTGUID != undefined) { - subobj.HOSTGUID_ADD = sprintf("objectGUID: %s", subobj.HOSTGUID); - } else { - subobj.HOSTGUID_ADD = ""; - } - - info.subobj = subobj; - info.message = message; - info.credentials = credentials; - info.session_info = session_info; - - /* only install a new smb.conf if there isn't one there already */ - var st = sys.stat(paths.smbconf); - if (st == undefined) { - var smbconfsuffix; - if (strlower(subobj.SERVERROLE) == strlower("domain controller")) { - smbconfsuffix = "dc"; - } else if (strlower(subobj.SERVERROLE) == strlower("member server")) { - smbconfsuffix = "member"; - } else { - smbconfsuffix = subobj.SERVERROLE; - } - message("Setting up " + paths.smbconf +"\n"); - setup_file("provision.smb.conf." + smbconfsuffix, info.message, paths.smbconf, subobj); - lp.reload(); - } - /* only install a new shares config db if there is none */ - st = sys.stat(paths.shareconf); - if (st == undefined) { - message("Setting up share.ldb\n"); - setup_ldb("share.ldif", info, paths.shareconf); - } - - message("Setting up " + paths.secrets + "\n"); - setup_ldb("secrets_init.ldif", info, paths.secrets); - setup_ldb("secrets.ldif", info, paths.secrets, false); - - message("Setting up the registry\n"); - var reg = reg_open(); - reg.apply_patchfile(lp.get("setup directory") + "/provision.reg") - - message("Setting up templates into " + paths.templates + "\n"); - setup_ldb("provision_templates.ldif", info, paths.templates); - - message("Setting up " + paths.idmapdb +"\n"); - setup_ldb("idmap_init.ldif", info, paths.idmapdb); - - message("Setting up sam.ldb partitions\n"); - /* Also wipes the database */ - setup_ldb("provision_partitions.ldif", info, paths.samdb); - - var samdb = open_ldb(info, paths.samdb, false); - - message("Setting up sam.ldb attributes\n"); - setup_add_ldif("provision_init.ldif", info, samdb, false); - - message("Setting up sam.ldb rootDSE\n"); - setup_add_ldif("provision_rootdse_add.ldif", info, samdb, false); - - message("Erasing data from partitions\n"); - ldb_erase_partitions(info, samdb, ldapbackend); - - // (hack) Reload, now we have the partitions and rootdse loaded. - var commit_ok = samdb.transaction_commit(); - if (!commit_ok) { - info.message("samdb commit failed: " + samdb.errstring() + "\n"); - assert(commit_ok); - } - samdb.close(); - - message("Pre-loading the Samba4 and AD schema\n"); - - samdb = open_ldb(info, paths.samdb, false); - - samdb.set_domain_sid(subobj.DOMAINSID); - - if (strlower(subobj.SERVERROLE) == strlower("domain controller")) { - if (subobj.INVOCATIONID == undefined) { - subobj.INVOCATIONID = randguid(); - } - samdb.set_ntds_invocationId(subobj.INVOCATIONID); - if (subobj.BACKEND_MOD == undefined) { - subobj.BACKEND_MOD = "repl_meta_data"; - } - } else { - if (subobj.BACKEND_MOD == undefined) { - subobj.BACKEND_MOD = "objectguid"; - } - } - - var load_schema_ok = load_schema(subobj, message, samdb); - assert(load_schema_ok.is_ok); - - message("Adding DomainDN: " + subobj.DOMAINDN + " (permitted to fail)\n"); - var add_ok = setup_add_ldif("provision_basedn.ldif", info, samdb, true); - message("Modifying DomainDN: " + subobj.DOMAINDN + "\n"); - var modify_basedn_ok = setup_ldb_modify("provision_basedn_modify.ldif", info, samdb); - if (!modify_basedn_ok) { - if (!add_ok) { - message("%s", "Failed to both add and modify " + subobj.DOMAINDN + " in target " + subobj.DOMAINDN_LDB + ": " + samdb.errstring() + "\n"); - message("Perhaps you need to run the provision script with the --ldap-base-dn option, and add this record to the backend manually\n"); - }; - assert(modify_basedn_ok); - }; - - message("Adding configuration container (permitted to fail)\n"); - var add_config_ok = setup_add_ldif("provision_configuration_basedn.ldif", info, samdb, true); - message("Modifying configuration container\n"); - var modify_config_ok = setup_ldb_modify("provision_configuration_basedn_modify.ldif", info, samdb); - if (!modify_config_ok) { - if (!add_config_ok) { - message("%s", "Failed to both add and modify " + subobj.CONFIGDN + " in target " + subobj.CONFIGDN_LDB + ": " + samdb.errstring() + "\n"); - message("Perhaps you need to run the provision script with the --ldap-base-dn option, and add this record to the backend manually\n"); - } - assert(modify_config_ok); - } - - message("Adding schema container (permitted to fail)\n"); - var add_schema_ok = setup_add_ldif("provision_schema_basedn.ldif", info, samdb, true); - message("Modifying schema container\n"); - var modify_schema_ok = setup_ldb_modify("provision_schema_basedn_modify.ldif", info, samdb); - if (!modify_schema_ok) { - if (!add_schema_ok) { - message("%s", "Failed to both add and modify " + subobj.SCHEMADN + " in target " + subobj.SCHEMADN_LDB + ": " + samdb.errstring() + "\n"); - message("Perhaps you need to run the provision script with the --ldap-base-dn option, and add this record to the backend manually\n"); - } - message("Failed to modify the schema container: " + samdb.errstring() + "\n"); - assert(modify_schema_ok); - } - - message("Setting up sam.ldb Samba4 schema\n"); - setup_add_ldif("schema_samba4.ldif", info, samdb, false); - message("Setting up sam.ldb AD schema\n"); - setup_add_ldif("schema.ldif", info, samdb, false); - - message("Setting up sam.ldb configuration data\n"); - setup_add_ldif("provision_configuration.ldif", info, samdb, false); - - message("Setting up display specifiers\n"); - setup_add_ldif("display_specifiers.ldif", info, samdb, false); - - message("Adding users container (permitted to fail)\n"); - var add_users_ok = setup_add_ldif("provision_users_add.ldif", info, samdb, true); - message("Modifying users container\n"); - var modify_users_ok = setup_ldb_modify("provision_users_modify.ldif", info, samdb); - if (!modify_users_ok) { - if (!add_users_ok) { - message("Failed to both add and modify the users container\n"); - } - assert(modify_users_ok); - } - message("Adding computers container (permitted to fail)\n"); - var add_computers_ok = setup_add_ldif("provision_computers_add.ldif", info, samdb, true); - message("Modifying computers container\n"); - var modify_computers_ok = setup_ldb_modify("provision_computers_modify.ldif", info, samdb); - if (!modify_computers_ok) { - if (!add_computers_ok) { - message("Failed to both add and modify the computers container\n"); - } - assert(modify_computers_ok); - } - - message("Setting up sam.ldb data\n"); - setup_add_ldif("provision.ldif", info, samdb, false); - - if (blank != false) { - message("Setting up sam.ldb index\n"); - setup_add_ldif("provision_index.ldif", info, samdb, false); - - message("Setting up sam.ldb rootDSE marking as syncronized\n"); - setup_modify_ldif("provision_rootdse_modify.ldif", info, samdb, false); - - var commit_ok = samdb.transaction_commit(); - if (!commit_ok) { - info.message("ldb commit failed: " + samdb.errstring() + "\n"); - assert(commit_ok); - } - return true; - } - -// message("Activate schema module"); -// setup_modify_ldif("schema_activation.ldif", info, samdb, false); -// -// // (hack) Reload, now we have the schema loaded. -// var commit_ok = samdb.transaction_commit(); -// if (!commit_ok) { -// info.message("samdb commit failed: " + samdb.errstring() + "\n"); -// assert(commit_ok); -// } -// samdb.close(); -// -// samdb = open_ldb(info, paths.samdb, false); -// - message("Setting up sam.ldb users and groups\n"); - setup_add_ldif("provision_users.ldif", info, samdb, false); - - if (strlower(subobj.SERVERROLE) == strlower("domain controller")) { - message("Setting up self join\n"); - setup_add_ldif("provision_self_join.ldif", info, samdb, false); - setup_add_ldif("provision_group_policy.ldif", info, samdb, false); - - sys.mkdir(paths.sysvol, 0755); - sys.mkdir(paths.sysvol + "/"+ subobj.DNSDOMAIN, 0755); - sys.mkdir(paths.sysvol + "/"+ subobj.DNSDOMAIN + "/Policies", 0755); - sys.mkdir(paths.sysvol + "/"+ subobj.DNSDOMAIN + "/Policies/{" + subobj.POLICYGUID + "}", 0755); - sys.mkdir(paths.sysvol + "/"+ subobj.DNSDOMAIN + "/Policies/{" + subobj.POLICYGUID + "}/Machine", 0755); - sys.mkdir(paths.sysvol + "/"+ subobj.DNSDOMAIN + "/Policies/{" + subobj.POLICYGUID + "}/User", 0755); - - sys.mkdir(paths.netlogon, 0755); - - setup_ldb("secrets_dc.ldif", info, paths.secrets, false); - - } - - if (setup_name_mappings(info, samdb) == false) { - return false; - } - - message("Setting up sam.ldb index\n"); - setup_add_ldif("provision_index.ldif", info, samdb, false); - - message("Setting up sam.ldb rootDSE marking as syncronized\n"); - setup_modify_ldif("provision_rootdse_modify.ldif", info, samdb, false); - - var commit_ok = samdb.transaction_commit(); - if (!commit_ok) { - info.message("samdb commit failed: " + samdb.errstring() + "\n"); - assert(commit_ok); - } - - message("Setting up phpLDAPadmin configuration\n"); - setup_file("phpldapadmin-config.php", info.message, paths.phpldapadminconfig, subobj); - message("Please install the phpLDAPadmin configuration located at " + paths.phpldapadminconfig + " into /etc/phpldapadmin/config.php\n"); - - return true; -} - -/* - provision just the schema into a temporary ldb, so we can run ad2oLschema on it -*/ -function provision_schema(subobj, message, tmp_schema_path, paths) -{ - var lp = loadparm_init(); - var sys = sys_init(); - var info = new Object(); - - var ok = provision_fix_subobj(subobj, paths); - assert(ok); - - info.subobj = subobj; - info.message = message; - - message("Setting up sam.ldb partitions\n"); - - /* This will erase anything in the tmp db */ - var samdb = open_ldb(info, tmp_schema_path, true); - - message("Setting up sam.ldb attributes\n"); - setup_add_ldif("provision_init.ldif", info, samdb, false); - - message("Setting up sam.ldb rootDSE\n"); - setup_add_ldif("provision_rootdse_add.ldif", info, samdb, false); - - message("Adding schema container (permitted to fail)\n"); - var add_ok = setup_add_ldif("provision_schema_basedn.ldif", info, samdb, true); - message("Modifying schema container\n"); - var modify_ok = setup_ldb_modify("provision_schema_basedn_modify.ldif", info, samdb); - if (!modify_ok) { - if (!add_ok) { - message("Failed to both add and modify schema dn: " + samdb.errstring() + "\n"); - message("Perhaps you need to run the provision script with the --ldap-base-dn option, and add this record to the backend manually\n"); - assert(modify_ok); - } - message("Failed to modify the schema container: " + samdb.errstring() + "\n"); - assert(modify_ok); - } - - message("Setting up sam.ldb Samba4 schema\n"); - setup_add_ldif("schema_samba4.ldif", info, samdb, false); - message("Setting up sam.ldb AD schema\n"); - setup_add_ldif("schema.ldif", info, samdb, false); - - var commit_ok = samdb.transaction_commit(); - if (!commit_ok) { - info.message("samdb commit failed: " + samdb.errstring() + "\n"); - assert(commit_ok); - } - samdb.close(); -} - -/* Write out a DNS zone file, from the info in the current database */ -function provision_dns(subobj, message, paths, session_info, credentials) -{ - var lp = loadparm_init(); - if (strlower(subobj.SERVERROLE) != strlower("domain controller")) { - message("No DNS zone required for role %s\n", subobj.SERVERROLE); - return; - } - message("Setting up DNS zone: " + subobj.DNSDOMAIN + " \n"); - var ldb = ldb_init(); - ldb.session_info = session_info; - ldb.credentials = credentials; - - /* connect to the sam */ - var ok = ldb.connect(paths.samdb); - assert(ok); - - /* These values may have changed, due to an incoming SamSync, - or may not have been specified, so fetch them from the database */ - - var attrs = new Array("objectGUID"); - res = ldb.search("objectGUID=*", subobj.DOMAINDN, ldb.SCOPE_BASE, attrs); - assert(res.error == 0); - assert(res.msgs.length == 1); - assert(res.msgs[0].objectGUID != undefined); - subobj.DOMAINGUID = res.msgs[0].objectGUID; - - subobj.HOSTGUID = searchone(ldb, subobj.DOMAINDN, "(&(objectClass=computer)(cn=" + subobj.NETBIOSNAME + "))", "objectGUID"); - assert(subobj.HOSTGUID != undefined); - - setup_file("provision.zone", - message, paths.dns, - subobj); - - setup_file("named.conf", - message, paths.named_conf, - subobj); - - message("Please install the zone located in " + paths.dns + " into your DNS server. A sample BIND configuration snippit is at " + paths.named_conf + "\n"); -} - - -/* - guess reasonably default options for provisioning -*/ -function provision_guess() -{ - var subobj = new Object(); - var nss = nss_init(); - var lp = loadparm_init(); - var rdn_list; - random_init(local); - - subobj.SERVERROLE = strlower(lp.get("server role")); - subobj.REALM = strupper(lp.get("realm")); - subobj.DOMAIN = lp.get("workgroup"); - subobj.HOSTNAME = hostname(); - - assert(subobj.REALM); - assert(subobj.DOMAIN); - assert(subobj.HOSTNAME); - - subobj.VERSION = version(); - subobj.HOSTIP = hostip(); - subobj.DOMAINSID = randsid(); - subobj.POLICYGUID = randguid(); - subobj.KRBTGTPASS = randpass(12); - subobj.MACHINEPASS = randpass(12); - subobj.DNSPASS = randpass(12); - subobj.ADMINPASS = randpass(12); - subobj.LDAPMANAGERPASS = randpass(12); - subobj.DEFAULTSITE = "Default-First-Site-Name"; - subobj.DATESTRING = datestring; - subobj.ROOT = findnss(nss.getpwnam, "root"); - subobj.NOBODY = findnss(nss.getpwnam, "nobody"); - subobj.NOGROUP = findnss(nss.getgrnam, "nogroup", "nobody"); - subobj.WHEEL = findnss(nss.getgrnam, "wheel", "root", "staff", "adm"); - subobj.BACKUP = findnss(nss.getgrnam, "backup", "wheel", "root", "staff"); - subobj.USERS = findnss(nss.getgrnam, "users", "guest", "other", "unknown", "usr"); - - //Add modules to the list to activate them by default - //beware often order is important - // - // Some Known ordering constraints: - // - rootdse must be first, as it makes redirects from "" -> cn=rootdse - // - objectclass must be before password_hash, because password_hash checks - // that the objectclass is of type person (filled in by the objectclass - // module when expanding the objectclass list) - // - partition must be last - // - each partition has its own module list then - var modules_list = new Array("rootdse", - "paged_results", - "ranged_results", - "anr", - "server_sort", - "extended_dn", - "asq", - "samldb", - "rdn_name", - "objectclass", - "kludge_acl", - "operational"); - var tdb_modules_list = new Array("subtree_rename", - "subtree_delete", - "linked_attributes"); - var modules_list2 = new Array("show_deleted", - "partition"); - subobj.MODULES_LIST = join(",", modules_list); - subobj.TDB_MODULES_LIST = "," + join(",", tdb_modules_list); - subobj.MODULES_LIST2 = join(",", modules_list2); - subobj.DOMAINDN_LDB = "users.ldb"; - subobj.CONFIGDN_LDB = "configuration.ldb"; - subobj.SCHEMADN_LDB = "schema.ldb"; - subobj.DOMAINDN_MOD = "pdc_fsmo,password_hash,instancetype"; - subobj.CONFIGDN_MOD = "naming_fsmo,instancetype"; - subobj.SCHEMADN_MOD = "schema_fsmo,instancetype"; - - subobj.ACI = "# no aci for local ldb"; - - return subobj; -} - -/* - search for one attribute as a string - */ -function searchone(ldb, basedn, expression, attribute) -{ - var attrs = new Array(attribute); - res = ldb.search(expression, basedn, ldb.SCOPE_SUBTREE, attrs); - if (res.error != 0 || - res.msgs.length != 1 || - res.msgs[0][attribute] == undefined) { - return undefined; - } - return res.msgs[0][attribute]; -} - -/* - modify an account to remove the -*/ -function enable_account(ldb, user_dn) -{ - var attrs = new Array("userAccountControl"); - var res = ldb.search(NULL, user_dn, ldb.SCOPE_ONELEVEL, attrs); - assert(res.error == 0); - assert(res.msgs.length == 1); - var userAccountControl = res.msgs[0].userAccountControl; - userAccountControl = userAccountControl - 2; /* remove disabled bit */ - var mod = sprintf(" -dn: %s -changetype: modify -replace: userAccountControl -userAccountControl: %u -", - user_dn, userAccountControl); - var ok = ldb.modify(mod); - return (ok.error == 0); -} - - -/* - add a new user record -*/ -function newuser(username, unixname, password, message, session_info, credentials) -{ - var lp = loadparm_init(); - var samdb = lp.get("sam database"); - var ldb = ldb_init(); - random_init(local); - ldb.session_info = session_info; - ldb.credentials = credentials; - - /* connect to the sam */ - var ok = ldb.connect(samdb); - assert(ok); - - ldb.transaction_start(); - - /* find the DNs for the domain and the domain users group */ - var attrs = new Array("defaultNamingContext"); - res = ldb.search("defaultNamingContext=*", "", ldb.SCOPE_BASE, attrs); - assert(res.error == 0); - assert(res.msgs.length == 1 && res.msgs[0].defaultNamingContext != undefined); - var domain_dn = res.msgs[0].defaultNamingContext; - assert(domain_dn != undefined); - var dom_users = searchone(ldb, domain_dn, "name=Domain Users", "dn"); - assert(dom_users != undefined); - - var user_dn = sprintf("CN=%s,CN=Users,%s", username, domain_dn); - - - /* - the new user record. note the reliance on the samdb module to fill - in a sid, guid etc - */ - var ldif = sprintf(" -dn: %s -sAMAccountName: %s -unixName: %s -sambaPassword: %s -objectClass: user -", - user_dn, username, - unixname, password); - /* - add the user to the users group as well - */ - var modgroup = sprintf(" -dn: %s -changetype: modify -add: member -member: %s -", - dom_users, user_dn); - - - /* - now the real work - */ - message("Adding user %s\n", user_dn); - ok = ldb.add(ldif); - if (ok.error != 0) { - message("Failed to add %s - %s\n", user_dn, ok.errstr); - return false; - } - - message("Modifying group %s\n", dom_users); - ok = ldb.modify(modgroup); - if (ok.error != 0) { - message("Failed to modify %s - %s\n", dom_users, ok.errstr); - return false; - } - - /* - modify the userAccountControl to remove the disabled bit - */ - ok = enable_account(ldb, user_dn); - if (ok) { - ldb.transaction_commit(); - } - return ok; -} - -// Check whether a name is valid as a NetBIOS name. -// FIXME: There are probably more constraints here. -// crh has a paragraph on this in his book (1.4.1.1) -function valid_netbios_name(name) -{ - if (strlen(name) > 15) return false; - return true; -} - -function provision_validate(subobj, message) -{ - var lp = loadparm_init(); - - if (!valid_netbios_name(subobj.DOMAIN)) { - message("Invalid NetBIOS name for domain\n"); - return false; - } - - if (!valid_netbios_name(subobj.NETBIOSNAME)) { - message("Invalid NetBIOS name for host\n"); - return false; - } - - - if (strupper(lp.get("workgroup")) != strupper(subobj.DOMAIN_CONF)) { - message("workgroup '%s' in smb.conf must match chosen domain '%s'\n", - lp.get("workgroup"), subobj.DOMAIN_CONF); - return false; - } - - if (strupper(lp.get("realm")) != strupper(subobj.REALM_CONF)) { - message("realm '%s' in smb.conf must match chosen realm '%s'\n", - lp.get("realm"), subobj.REALM_CONF); - return false; - } - - if (strlower(lp.get("server role")) != strlower(subobj.SERVERROLE)) { - message("server role '%s' in smb.conf must match chosen role '%s'\n", - lp.get("server role"), subobj.SERVERROLE); - return false; - } - - return true; -} - -function join_domain(domain, netbios_name, join_type, creds, message) -{ - var ctx = NetContext(creds); - var joindom = new Object(); - joindom.domain = domain; - joindom.join_type = join_type; - joindom.netbios_name = netbios_name; - if (!ctx.JoinDomain(joindom)) { - message("Domain Join failed: " + joindom.error_string); - return false; - } - return true; -} - -/* Vampire a remote domain. Session info and credentials are required for for - * access to our local database (might be remote ldap) - */ - -function vampire(domain, session_info, credentials, message) { - var ctx = NetContext(credentials); - var vampire_ctx = new Object(); - var machine_creds = credentials_init(); - machine_creds.set_domain(form.DOMAIN); - if (!machine_creds.set_machine_account()) { - message("Failed to access domain join information!"); - return false; - } - vampire_ctx.machine_creds = machine_creds; - vampire_ctx.session_info = session_info; - if (!ctx.SamSyncLdb(vampire_ctx)) { - message("Migration of remote domain to Samba failed: " + vampire_ctx.error_string); - return false; - } - - return true; -} - -return 0; diff --git a/source4/scripting/python/config.m4 b/source4/scripting/python/config.m4 index 3790071ba8..a61d541049 100644 --- a/source4/scripting/python/config.m4 +++ b/source4/scripting/python/config.m4 @@ -71,3 +71,8 @@ else AC_MSG_ERROR([Python not found. Please install Python 2.x and its development headers/libraries.]) fi +AC_MSG_CHECKING(python library directory) +pythondir=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib(1, 0, '\\${prefix}')"` +AC_MSG_RESULT($pythondir) + +AC_SUBST(pythondir) diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk index 59f628fe18..e57ff1d1ac 100644 --- a/source4/scripting/python/config.mk +++ b/source4/scripting/python/config.mk @@ -5,9 +5,15 @@ smbpython_OBJ_FILES = scripting/python/smbpython.o [SUBSYSTEM::LIBPYTHON] PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON +PRIVATE_DEPENDENCIES = PYTALLOC INIT_FUNCTION_SENTINEL = { NULL, NULL } -LIBPYTHON_OBJ_FILES = $(addprefix scripting/python/, modules.o pytalloc.o) +LIBPYTHON_OBJ_FILES = $(addprefix scripting/python/, modules.o) + +[SUBSYSTEM::PYTALLOC] +PUBLIC_DEPENDENCIES = EXT_LIB_PYTHON + +PYTALLOC_OBJ_FILES = $(addprefix scripting/python/, pytalloc.o) [PYTHON::python_uuid] PRIVATE_DEPENDENCIES = LIBNDR @@ -20,10 +26,6 @@ SWIG_FILE = misc.i python_misc_OBJ_FILES = scripting/python/misc_wrap.o -PYDOCTOR_MODULES=bin/python/ldb.py bin/python/auth.py bin/python/credentials.py bin/python/registry.py bin/python/tdb.py bin/python/security.py bin/python/events.py bin/python/net.py +_PY_FILES = $(shell find scripting/python -name "*.py") -installpython:: pythonmods - @$(SHELL) $(srcdir)/script/installpython.sh \ - $(INSTALLPERMS) \ - $(DESTDIR)$(PYTHONDIR) \ - scripting/python bin/python +$(foreach pyfile, $(_PY_FILES),$(eval $(call python_py_module_template,$(patsubst scripting/python/%,%,$(pyfile)),$(pyfile)))) diff --git a/source4/scripting/python/modules.c b/source4/scripting/python/modules.c index 6cd975c1a9..0fe15b2fda 100644 --- a/source4/scripting/python/modules.c +++ b/source4/scripting/python/modules.c @@ -19,7 +19,6 @@ #include "includes.h" #include <Python.h> -#include "build.h" extern void init_ldb(void); extern void init_security(void); @@ -40,12 +39,10 @@ extern void initdrsuapi(void); extern void initwinreg(void); extern void initepmapper(void); extern void initinitshutdown(void); -static void initdcerpc_misc(void) {} extern void initmgmt(void); extern void initnet(void); extern void initatsvc(void); extern void initsamr(void); -static void initdcerpc_security(void) {} extern void initlsa(void); extern void initsvcctl(void); extern void initwkssvc(void); diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 0e8840646c..ad8eb8bffd 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -689,6 +689,7 @@ def setup_self_join(samdb, names, domainsid, invocationid, setup_path, policyguid): """Join a host to its own domain.""" + assert isinstance(invocationid, str) setup_add_ldif(samdb, setup_path("provision_self_join.ldif"), { "CONFIGDN": names.configdn, "SCHEMADN": names.schemadn, @@ -910,7 +911,7 @@ def provision(setup_dir, message, session_info, domainsid = security.Sid(domainsid) if policyguid is None: - policyguid = uuid.random() + policyguid = str(uuid.uuid4()) if adminpass is None: adminpass = misc.random_password(12) if krbtgtpass is None: @@ -960,7 +961,7 @@ def provision(setup_dir, message, session_info, assert serverrole in ("domain controller", "member server", "standalone") if invocationid is None and serverrole == "domain controller": - invocationid = uuid.random() + invocationid = str(uuid.uuid4()) if not os.path.exists(paths.private_dir): os.mkdir(paths.private_dir) diff --git a/source4/scripting/python/samba/tests/samdb.py b/source4/scripting/python/samba/tests/samdb.py index 0e175bf936..0d4f7bde0e 100644 --- a/source4/scripting/python/samba/tests/samdb.py +++ b/source4/scripting/python/samba/tests/samdb.py @@ -29,18 +29,18 @@ import uuid class SamDBTestCase(TestCaseInTempDir): def setUp(self): super(SamDBTestCase, self).setUp() - invocationid = uuid.random() + invocationid = str(uuid.uuid4()) domaindn = "DC=COM,DC=EXAMPLE" self.domaindn = domaindn configdn = "CN=Configuration," + domaindn schemadn = "CN=Schema," + configdn - domainguid = uuid.random() - policyguid = uuid.random() + domainguid = str(uuid.uuid4()) + policyguid = str(uuid.uuid4()) setup_path = lambda x: os.path.join("setup", x) creds = Credentials() creds.set_anonymous() domainsid = security.random_sid() - hostguid = uuid.random() + hostguid = str(uuid.uuid4()) path = os.path.join(self.tempdir, "samdb.ldb") self.samdb = setup_samdb(path, setup_path, system_session(), creds, cmdline_loadparm, schemadn, configdn, diff --git a/source4/scripting/python/uuidmodule.c b/source4/scripting/python/uuidmodule.c index 18cfb6ce32..98ef9adaa9 100644 --- a/source4/scripting/python/uuidmodule.c +++ b/source4/scripting/python/uuidmodule.c @@ -46,7 +46,7 @@ static PyObject *uuid_random(PyObject *self, PyObject *args) } static PyMethodDef methods[] = { - { "random", (PyCFunction)uuid_random, METH_VARARGS, NULL}, + { "uuid4", (PyCFunction)uuid_random, METH_VARARGS, NULL}, { NULL, NULL } }; diff --git a/source4/selftest/samba4_tests.sh b/source4/selftest/samba4_tests.sh index 725fde2c7d..9c7e93906c 100755 --- a/source4/selftest/samba4_tests.sh +++ b/source4/selftest/samba4_tests.sh @@ -351,7 +351,7 @@ plantest "winreg.python" dc $SUBUNITRUN -U\$USERNAME%\$PASSWORD samba.tests.dcer plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN plantest "blackbox.samba3dump" none $PYTHON scripting/bin/samba3dump $samba4srcdir/../testdata/samba3 rm -rf $PREFIX/upgrade -plantest "blackbox.upgrade" none $PYTHON setup/upgrade.py $CONFIGURATION --targetdir=$PREFIX/upgrade ../testdata/samba3 ../testdata/samba3/smb.conf +plantest "blackbox.upgrade" none $PYTHON setup/upgrade $CONFIGURATION --targetdir=$PREFIX/upgrade ../testdata/samba3 ../testdata/samba3/smb.conf rm -rf $PREFIX/provision mkdir $PREFIX/provision plantest "blackbox.provision.py" none PYTHON="$PYTHON" $samba4srcdir/setup/tests/blackbox_provision.sh "$PREFIX/provision" "$CONFIGURATION" diff --git a/source4/setup/upgrade.py b/source4/setup/upgrade index 3bcc57ab64..3bcc57ab64 100755 --- a/source4/setup/upgrade.py +++ b/source4/setup/upgrade diff --git a/source4/smb_server/config.mk b/source4/smb_server/config.mk index 8b6ae308f9..1e3da1fab6 100644 --- a/source4/smb_server/config.mk +++ b/source4/smb_server/config.mk @@ -2,7 +2,7 @@ # [MODULE::SERVICE_SMB] INIT_FUNCTION = server_service_smb_init -SUBSYSTEM = service +SUBSYSTEM = smbd PRIVATE_PROTO_HEADER = service_smb_proto.h PRIVATE_DEPENDENCIES = SMB_SERVER diff --git a/source4/smbd/process_model.c b/source4/smbd/process_model.c index 2cb551a520..e631975b37 100644 --- a/source4/smbd/process_model.c +++ b/source4/smbd/process_model.c @@ -20,7 +20,6 @@ #include "includes.h" #include "smbd/process_model.h" -#include "build.h" #include "param/param.h" /* diff --git a/source4/smbd/server.c b/source4/smbd/server.c index 3f6cb48013..e1ebd133ce 100644 --- a/source4/smbd/server.c +++ b/source4/smbd/server.c @@ -28,7 +28,6 @@ #include "lib/cmdline/popt_common.h" #include "system/dir.h" #include "system/filesys.h" -#include "build.h" #include "ldb/include/ldb.h" #include "registry/registry.h" #include "ntvfs/ntvfs.h" @@ -199,7 +198,7 @@ static int binary_smbd_main(const char *binary_name, int argc, const char *argv[ extern NTSTATUS server_service_smb_init(void); extern NTSTATUS server_service_drepl_init(void); extern NTSTATUS server_service_rpc_init(void); - init_module_fn static_init[] = { STATIC_service_MODULES }; + init_module_fn static_init[] = { STATIC_smbd_MODULES }; init_module_fn *shared_init; struct event_context *event_ctx; NTSTATUS status; diff --git a/source4/torture/config.mk b/source4/torture/config.mk index 4113cab064..ee9f8b71b5 100644 --- a/source4/torture/config.mk +++ b/source4/torture/config.mk @@ -7,7 +7,7 @@ TORTURE_UTIL_OBJ_FILES = $(addprefix torture/, util_smb.o) ################################# # Start SUBSYSTEM TORTURE_BASIC [MODULE::TORTURE_BASIC] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_base_init PRIVATE_PROTO_HEADER = \ basic/proto.h @@ -42,7 +42,7 @@ TORTURE_BASIC_OBJ_FILES = $(addprefix torture/basic/, \ ################################# # Start SUBSYSTEM TORTURE_RAW [MODULE::TORTURE_RAW] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_raw_init PRIVATE_PROTO_HEADER = \ raw/proto.h @@ -97,7 +97,7 @@ TORTURE_NDR_OBJ_FILES = $(addprefix torture/ndr/, ndr.o winreg.o atsvc.o lsa.o e [MODULE::torture_rpc] # TORTURE_NET and TORTURE_NBT use functions from torture_rpc... #OUTPUT_TYPE = MERGED_OBJ -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_rpc_init PRIVATE_PROTO_HEADER = \ rpc/proto.h @@ -123,7 +123,7 @@ torture_rpc_OBJ_FILES = $(addprefix torture/rpc/, \ ################################# # Start SUBSYSTEM TORTURE_RAP [MODULE::TORTURE_RAP] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_rap_init PRIVATE_PROTO_HEADER = \ rap/proto.h @@ -136,7 +136,7 @@ TORTURE_RAP_OBJ_FILES = torture/rap/rap.o ################################# # Start SUBSYSTEM TORTURE_AUTH [MODULE::TORTURE_AUTH] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture PRIVATE_PROTO_HEADER = \ auth/proto.h PRIVATE_DEPENDENCIES = \ @@ -152,7 +152,7 @@ mkinclude local/config.mk ################################# # Start MODULE TORTURE_NBENCH [MODULE::TORTURE_NBENCH] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_nbench_init PRIVATE_DEPENDENCIES = TORTURE_UTIL PRIVATE_PROTO_HEADER = \ @@ -165,7 +165,7 @@ TORTURE_NBENCH_OBJ_FILES = $(addprefix torture/nbench/, nbio.o nbench.o) ################################# # Start MODULE TORTURE_UNIX [MODULE::TORTURE_UNIX] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_unix_init PRIVATE_DEPENDENCIES = TORTURE_UTIL PRIVATE_PROTO_HEADER = \ @@ -178,7 +178,7 @@ TORTURE_UNIX_OBJ_FILES = $(addprefix torture/unix/, unix.o whoami.o unix_info2.o ################################# # Start SUBSYSTEM TORTURE_LDAP [MODULE::TORTURE_LDAP] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_ldap_init PRIVATE_PROTO_HEADER = \ ldap/proto.h @@ -193,7 +193,7 @@ TORTURE_LDAP_OBJ_FILES = $(addprefix torture/ldap/, common.o basic.o schema.o up ################################# # Start SUBSYSTEM TORTURE_NBT [MODULE::TORTURE_NBT] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_nbt_init PRIVATE_PROTO_HEADER = \ nbt/proto.h @@ -209,7 +209,7 @@ TORTURE_NBT_OBJ_FILES = $(addprefix torture/nbt/, query.o register.o \ ################################# # Start SUBSYSTEM TORTURE_NET [MODULE::TORTURE_NET] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_net_init PRIVATE_PROTO_HEADER = \ libnet/proto.h diff --git a/source4/torture/local/config.mk b/source4/torture/local/config.mk index efdea7f66a..d7cac101df 100644 --- a/source4/torture/local/config.mk +++ b/source4/torture/local/config.mk @@ -1,7 +1,7 @@ ################################# # Start SUBSYSTEM TORTURE_LOCAL [MODULE::TORTURE_LOCAL] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_local_init PRIVATE_PROTO_HEADER = \ proto.h diff --git a/source4/torture/smb2/config.mk b/source4/torture/smb2/config.mk index f3318bb736..4e0cac0029 100644 --- a/source4/torture/smb2/config.mk +++ b/source4/torture/smb2/config.mk @@ -2,7 +2,7 @@ ################################# # Start SUBSYSTEM TORTURE_SMB2 [MODULE::TORTURE_SMB2] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_smb2_init PRIVATE_PROTO_HEADER = \ proto.h diff --git a/source4/torture/smbtorture.c b/source4/torture/smbtorture.c index 511f58cd7c..418f933993 100644 --- a/source4/torture/smbtorture.c +++ b/source4/torture/smbtorture.c @@ -31,7 +31,6 @@ #include "dynconfig.h" #include "torture/smbtorture.h" -#include "build.h" #include "lib/util/dlinklist.h" #include "librpc/rpc/dcerpc.h" #include "param/param.h" diff --git a/source4/torture/torture.c b/source4/torture/torture.c index 8a41b72249..54fe0ead27 100644 --- a/source4/torture/torture.c +++ b/source4/torture/torture.c @@ -21,7 +21,6 @@ #include "includes.h" #include "system/time.h" #include "torture/torture.h" -#include "build.h" #include "lib/util/dlinklist.h" #include "param/param.h" #include "lib/cmdline/popt_common.h" @@ -60,7 +59,7 @@ _PUBLIC_ int torture_init(void) extern NTSTATUS torture_raw_init(void); extern NTSTATUS torture_unix_init(void); extern NTSTATUS torture_winbind_init(void); - init_module_fn static_init[] = { STATIC_torture_MODULES }; + init_module_fn static_init[] = { STATIC_smbtorture_MODULES }; init_module_fn *shared_init = load_samba_modules(NULL, cmdline_lp_ctx, "torture"); run_init_functions(static_init); diff --git a/source4/torture/winbind/config.mk b/source4/torture/winbind/config.mk index 155766a677..ee8ff950a6 100644 --- a/source4/torture/winbind/config.mk +++ b/source4/torture/winbind/config.mk @@ -2,7 +2,7 @@ ################################# # Start SUBSYSTEM TORTURE_WINBIND [MODULE::TORTURE_WINBIND] -SUBSYSTEM = torture +SUBSYSTEM = smbtorture INIT_FUNCTION = torture_winbind_init PRIVATE_PROTO_HEADER = \ proto.h diff --git a/source4/web_server/config.mk b/source4/web_server/config.mk index e218aa8ddc..86ad04fb7e 100644 --- a/source4/web_server/config.mk +++ b/source4/web_server/config.mk @@ -4,7 +4,7 @@ # Start SUBSYSTEM WEB [MODULE::WEB] INIT_FUNCTION = server_service_web_init -SUBSYSTEM = service +SUBSYSTEM = smbd PRIVATE_PROTO_HEADER = proto.h PRIVATE_DEPENDENCIES = ESP LIBTLS smbcalls process_model # End SUBSYSTEM WEB diff --git a/source4/winbind/config.mk b/source4/winbind/config.mk index 3165fc2d21..3c5b740e68 100644 --- a/source4/winbind/config.mk +++ b/source4/winbind/config.mk @@ -4,7 +4,7 @@ # Start SUBSYSTEM WINBIND [MODULE::WINBIND] INIT_FUNCTION = server_service_winbind_init -SUBSYSTEM = service +SUBSYSTEM = smbd PRIVATE_PROTO_HEADER = wb_proto.h PRIVATE_DEPENDENCIES = \ WB_HELPER \ diff --git a/source4/wrepl_server/config.mk b/source4/wrepl_server/config.mk index e339d223aa..6428a353b1 100644 --- a/source4/wrepl_server/config.mk +++ b/source4/wrepl_server/config.mk @@ -4,7 +4,7 @@ # Start SUBSYSTEM WREPL_SRV [MODULE::WREPL_SRV] INIT_FUNCTION = server_service_wrepl_init -SUBSYSTEM = service +SUBSYSTEM = smbd PRIVATE_PROTO_HEADER = wrepl_server_proto.h PRIVATE_DEPENDENCIES = \ LIBCLI_WREPL WINSDB process_model |