}
}
- next if ($LINE =~ /^typedef\s/);
- next if ($LINE =~ /^enum\s+[^\{\(]+\s+\{/);
- next if ($LINE =~ /^struct\s+[^\{\(]+\s+\{.*\}\s*;/);
-
# concetenate function prototypes that stretch over multiple lines
$REST = $LINE;
my $parenthesis = 0;
}
}
+ next if ($LINE =~ /^typedef\s/);
+ next if ($LINE =~ /^enum\s+[^\{\(]+\s+\{/);
+ next if ($LINE =~ /^struct\s+[^\{\(]+\s+\{.*\}\s*;/);
+ next if ($LINE =~ /^struct\s+[a-zA-Z0-9_]+\s*;/);
+
# remove trailing spaces
$LINE =~ s/(.*?)\s*$/$1/;
- $LINE =~ s/^(.*\))\s+PRINTF_ATTRIBUTE\(.*\);$/$1;/;
+ $LINE =~ s/^(.*\))\s+PRINTF_ATTRIBUTE\([^\)]*\)(\s*[;,])/$1$2/;
+ $LINE =~ s/^(.*\))\s*[a-zA-Z0-9_]+\s*;$/$1;/;
# remove parameter names - slightly too coarse probably
$LINE =~ s/([\s\(]\*?)[_0-9a-zA-Z]+\s*([,\)])/$1$2/g;
# normalize unsigned
$LINE =~ s/([\s,\(])unsigned([,\)])/$1unsigned int$2/g;
+ # normalize bool
+ $LINE =~ s/(\b)bool(\b)/_Bool/g;
+
print $LINE . "\n";
}
current_file=FILENAME
}
if (inheader) {
- if (match($0,"[)][ \t]*[;][ \t]*$")) {
+ if (match($0,"[)][^()]*[;][ \t]*$")) {
inheader = 0;
}
next;
}
}
-/[_A-Za-z0-9]+[ \t]*[(].*[)][ \t]*;[ \t]*$/ {
+/[_A-Za-z0-9]+[ \t]*[(].*[)][^()]*;[ \t]*$/ {
sub(/[(].*$/, "");
gsub(/[^ \t]+[ \t]+/, "");
- gsub(/^[*]/, "");
+ gsub(/^[*]+/, "");
printf "\t\t%s;\n",$0;
next;
}
}
}
- next if ($LINE =~ /^typedef\s/);
- next if ($LINE =~ /^enum\s+[^\{\(]+\s+\{/);
- next if ($LINE =~ /^struct\s+[^\{\(]+\s+\{.*\}\s*;/);
-
# concetenate function prototypes that stretch over multiple lines
$REST = $LINE;
my $parenthesis = 0;
}
}
+ next if ($LINE =~ /^typedef\s/);
+ next if ($LINE =~ /^enum\s+[^\{\(]+\s+\{/);
+ next if ($LINE =~ /^struct\s+[^\{\(]+\s+\{.*\}\s*;/);
+ next if ($LINE =~ /^struct\s+[a-zA-Z0-9_]+\s*;/);
+
# remove trailing spaces
$LINE =~ s/(.*?)\s*$/$1/;
- $LINE =~ s/^(.*\))\s+PRINTF_ATTRIBUTE\(.*\);$/$1;/;
+ $LINE =~ s/^(.*\))\s+PRINTF_ATTRIBUTE\([^\)]*\)(\s*[;,])/$1$2/;
+ $LINE =~ s/^(.*\))\s*[a-zA-Z0-9_]+\s*;$/$1;/;
# remove parameter names - slightly too coarse probably
$LINE =~ s/([\s\(]\*?)[_0-9a-zA-Z]+\s*([,\)])/$1$2/g;
# normalize unsigned
$LINE =~ s/([\s,\(])unsigned([,\)])/$1unsigned int$2/g;
+ # normalize bool
+ $LINE =~ s/(\b)bool(\b)/_Bool/g;
+
print $LINE . "\n";
}
current_file=FILENAME
}
if (inheader) {
- if (match($0,"[)][ \t]*[;][ \t]*$")) {
+ if (match($0,"[)][^()]*[;][ \t]*$")) {
inheader = 0;
}
next;
}
}
-/[_A-Za-z0-9]+[ \t]*[(].*[)][ \t]*;[ \t]*$/ {
+/[_A-Za-z0-9]+[ \t]*[(].*[)][^()]*;[ \t]*$/ {
sub(/[(].*$/, "");
gsub(/[^ \t]+[ \t]+/, "");
- gsub(/^[*]/, "");
+ gsub(/^[*]+/, "");
printf "\t\t%s;\n",$0;
next;
}
--- /dev/null
+#!/bin/sh
+
+#
+# abi_checks.sh - check for possible abi changes
+#
+# Copyright (C) 2009 Micheal Adam <obnox@samba.org>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, see <http://www.gnu.org/licenses/>.
+#
+
+#
+# USAGE: abi_checks.sh LIBNAME header1 [header2 ...]
+#
+# This script creates symbol and signature lists from the provided header
+# files with the aid of the mksyms.sh and mksigs.pl scripts (saved as
+# $LIBNAME.exports.check and $LIBNAME.sigatures.check). It then compares
+# the resulting files with the files $LIBNAME.exports and $LIBNME.signatures
+# which it expects to find in the current directory.
+#
+
+LANG=C; export LANG
+LC_ALL=C; export LC_ALL
+LC_COLLATE=C; export LC_COLLATE
+
+script=$0
+dir_name=$(dirname ${script})
+
+if test x"$1" = "x" ; then
+ echo "USAGE: ${script} libname header [header ...]"
+ exit 1
+fi
+
+libname="$1"
+shift
+
+if test x"$1" = "x" ; then
+ echo "USAGE: ${script} libname header [header ...]"
+ exit 1
+fi
+
+headers="$*"
+
+exports_file=${libname}.exports
+exports_file_check=${exports_file}.check
+signatures_file=${libname}.signatures
+signatures_file_check=${signatures_file}.check
+
+
+${dir_name}/mksyms.sh awk ${exports_file_check} ${headers} 2>&1 > /dev/null
+
+cat ${headers} | ${dir_name}/mksigs.pl > ${signatures_file_check} 2> /dev/null
+
+normalize_exports_file() {
+ filename=$1
+ cat ${filename} \
+ | sed -e 's/^[ \t]*//g' \
+ | sed -e 's/^$//g' \
+ | sed -e 's/^#.*$//g' \
+ | sort | uniq > ${filename}.sort
+}
+
+normalize_exports_file ${exports_file}
+normalize_exports_file ${exports_file_check}
+
+normalize_exports_file ${signatures_file}
+normalize_exports_file ${signatures_file_check}
+
+diff -u ${exports_file}.sort ${exports_file_check}.sort
+if test "x$?" != "x0" ; then
+ echo "WARNING: possible ABI change detected in exports!"
+else
+ echo "exports check: OK"
+fi
+
+diff -u ${signatures_file}.sort ${signatures_file_check}.sort
+if test "x$?" != "x0" ; then
+ echo "WARNING: possible ABI change detected in signatures!"
+else
+ echo "signatures check: OK"
+fi
--- /dev/null
+#!/usr/bin/perl
+
+# mksigs.pl - extract signatures from C headers
+#
+# Copyright (C) Michael Adam 2009
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 3 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+# more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# this program; if not, see <http://www.gnu.org/licenses/>.
+
+# USAGE: cat $header_files | mksigs.pl > $signature_file
+#
+# The header files to parse are read from stdin.
+# The output is in a form as produced by gcc with the -aux-info switch
+# and printed to stdout.
+
+use strict;
+use warnings;
+
+my $in_comment = 0;
+my $extern_C_block = 0;
+
+while (my $LINE = <>) {
+ # find end of started multi-line-comment
+ if ($in_comment) {
+ if ($LINE =~ /^.*?\*\/(.*)$/) {
+ $LINE = $1;
+ $in_comment = 0;
+ } else {
+ # whole line within comment
+ next;
+ }
+ }
+
+ # strip C++-style comments
+ $LINE =~ s/^(.*?)\/\/.*$/$1/;
+
+ # strip in-line-comments:
+ while ($LINE =~ /\/\*.*?\*\//) {
+ $LINE =~ s/\/\*.*?\*\///;
+ }
+
+ # find starts of multi-line-comments
+ if ($LINE =~ /^(.*)\/\*/) {
+ $in_comment = 1;
+ $LINE = $1;
+ }
+
+ # skip empty lines
+ next if $LINE =~ /^\s*$/;
+
+ # remove leading spaces
+ $LINE =~ s/^\s*(.*)$/$1/;
+
+ # concatenate lines split with "\" (usually macro defines)
+ while ($LINE =~ /^(.*?)\s+\\$/) {
+ my $LINE2 = <>;
+ $LINE = $1;
+ $LINE2 =~ s/^\s*(.*)$/$1/;
+ $LINE .= " " . $LINE2;
+ }
+
+ # remove all preprocessor directives
+ next if ($LINE =~ /^#/);
+
+ if ($LINE =~ /^extern\s+"C"\s+\{/) {
+ $extern_C_block = 1;
+ next;
+ }
+
+ if (($LINE =~ /^[^\{]*\}/) and $extern_C_block) {
+ $extern_C_block = 0;
+ next;
+ }
+
+ $LINE =~ s/^extern\s//;
+
+ # concatenate braces stretched over multiple lines
+ # (from structs or enums)
+ my $REST = $LINE;
+ my $braces = 0;
+ while (($REST =~ /[\{\}]/) or ($braces)) {
+ while ($REST =~ /[\{\}]/) {
+ # collect opening
+ while ($REST =~ /^[^\{\}]*\{(.*)$/) {
+ $braces++;
+ $REST = $1;
+ }
+
+ # collect closing
+ while ($REST =~ /^[^\{\}]*\}(.*)$/) {
+ $braces--;
+ $REST = $1;
+ }
+ }
+
+ # concatenate if not balanced
+ if ($braces) {
+ if (my $LINE2 = <>) {
+ $LINE2 =~ s/^\s*(.*)$/$1/;
+ chomp($LINE);
+ $LINE .= " " . $LINE2;
+ chomp $REST;
+ $REST .= " " . $LINE2;
+ } else {
+ print "ERROR: unbalanced braces ($braces)\n";
+ last;
+ }
+ }
+ }
+
+ # concetenate function prototypes that stretch over multiple lines
+ $REST = $LINE;
+ my $parenthesis = 0;
+ while (($REST =~ /[\(\)]/) or ($parenthesis)) {
+ while ($REST =~ /[\(\)]/) {
+ # collect opening
+ while ($REST =~ /^[^\(\)]*\((.*)$/) {
+ $parenthesis++;
+ $REST = $1;
+ }
+
+ # collect closing
+ while ($REST =~ /^[^\(\)]*\)(.*)$/) {
+ $parenthesis--;
+ $REST = $1;
+ }
+ }
+
+ # concatenate if not balanced
+ if ($parenthesis) {
+ if (my $LINE2 = <>) {
+ $LINE2 =~ s/^\s*(.*)$/$1/;
+ chomp($LINE);
+ $LINE .= " " . $LINE2;
+ chomp($REST);
+ $REST .= " " . $LINE2;
+ } else {
+ print "ERROR: unbalanced parantheses ($parenthesis)\n";
+ last;
+ }
+ }
+ }
+
+ next if ($LINE =~ /^typedef\s/);
+ next if ($LINE =~ /^enum\s+[^\{\(]+\s+\{/);
+ next if ($LINE =~ /^struct\s+[^\{\(]+\s+\{.*\}\s*;/);
+ next if ($LINE =~ /^struct\s+[a-zA-Z0-9_]+\s*;/);
+
+ # remove trailing spaces
+ $LINE =~ s/(.*?)\s*$/$1/;
+
+ $LINE =~ s/^(.*\))\s+PRINTF_ATTRIBUTE\([^\)]*\)(\s*[;,])/$1$2/;
+ $LINE =~ s/^(.*\))\s*[a-zA-Z0-9_]+\s*;$/$1;/;
+
+ # remove parameter names - slightly too coarse probably
+ $LINE =~ s/([\s\(]\*?)[_0-9a-zA-Z]+\s*([,\)])/$1$2/g;
+
+ # remedy (void) from last line
+ $LINE =~ s/\(\)/(void)/g;
+
+ # normalize spaces
+ $LINE =~ s/\s*\)\s*/)/g;
+ $LINE =~ s/\s*\(\s*/ (/g;
+ $LINE =~ s/\s*,\s*/, /g;
+
+ # normalize unsigned
+ $LINE =~ s/([\s,\(])unsigned([,\)])/$1unsigned int$2/g;
+
+ # normalize bool
+ $LINE =~ s/(\b)bool(\b)/_Bool/g;
+
+ print $LINE . "\n";
+}
--- /dev/null
+#
+# mksyms.awk
+#
+# Extract symbols to export from C-header files.
+# output in version-script format for linking shared libraries.
+#
+# Copyright (C) 2008 Michael Adam <obnox@samba.org>
+#
+BEGIN {
+ inheader=0;
+ current_file="";
+ print "#"
+ print "# This file is automatically generated with \"make symbols\". DO NOT EDIT "
+ print "#"
+ print "{"
+ print "\tglobal:"
+}
+
+END {
+ print""
+ print "\tlocal: *;"
+ print "};"
+}
+
+{
+ if (FILENAME!=current_file) {
+ print "\t\t# The following definitions come from",FILENAME
+ current_file=FILENAME
+ }
+ if (inheader) {
+ if (match($0,"[)][^()]*[;][ \t]*$")) {
+ inheader = 0;
+ }
+ next;
+ }
+}
+
+/^static/ || /^[ \t]*typedef/ || !/^[a-zA-Z\_]/ {
+ next;
+}
+
+/^extern[ \t]+[^()]+[;][ \t]*$/ {
+ gsub(/[^ \t]+[ \t]+/, "");
+ sub(/[;][ \t]*$/, "");
+ printf "\t\t%s;\n", $0;
+ next;
+}
+
+# look for function headers:
+{
+ gotstart = 0;
+ if ($0 ~ /^[A-Za-z_][A-Za-z0-9_]+/) {
+ gotstart = 1;
+ }
+ if(!gotstart) {
+ next;
+ }
+}
+
+/[_A-Za-z0-9]+[ \t]*[(].*[)][^()]*;[ \t]*$/ {
+ sub(/[(].*$/, "");
+ gsub(/[^ \t]+[ \t]+/, "");
+ gsub(/^[*]+/, "");
+ printf "\t\t%s;\n",$0;
+ next;
+}
+
+/[_A-Za-z0-9]+[ \t]*[(]/ {
+ inheader=1;
+ sub(/[(].*$/, "");
+ gsub(/[^ \t]+[ \t]+/, "");
+ gsub(/^[*]/, "");
+ printf "\t\t%s;\n",$0;
+ next;
+}
+
--- /dev/null
+#! /bin/sh
+
+#
+# mksyms.sh
+#
+# Extract symbols to export from C-header files.
+# output in version-script format for linking shared libraries.
+#
+# This is the shell wrapper for the mksyms.awk core script.
+#
+# Copyright (C) 2008 Michael Adam <obnox@samba.org>
+#
+
+LANG=C; export LANG
+LC_ALL=C; export LC_ALL
+LC_COLLATE=C; export LC_COLLATE
+
+if [ $# -lt 2 ]
+then
+ echo "Usage: $0 awk output_file header_files"
+ exit 1
+fi
+
+awk="$1"
+shift
+
+symsfile="$1"
+shift
+symsfile_tmp="$symsfile.$$.tmp~"
+
+proto_src="`echo $@ | tr ' ' '\n' | sort | uniq `"
+
+echo creating $symsfile
+
+mkdir -p `dirname $symsfile`
+
+${awk} -f `dirname $0`/mksyms.awk $proto_src > $symsfile_tmp
+
+if cmp -s $symsfile $symsfile_tmp 2>/dev/null
+then
+ echo "$symsfile unchanged"
+ rm $symsfile_tmp
+else
+ mv $symsfile_tmp $symsfile
+fi
tevent_timeval_zero;
tevent_wakeup_recv;
tevent_wakeup_send;
+ _tevent_req_cancel;
+ tevent_req_set_cancel_fn;
local: *;
};
install:: all installdirs installheaders installlibs $(PYTHON_INSTALL_TARGET)
+abi_checks::
+ @echo ABI checks:
+ @./script/abi_checks.sh tevent tevent.h
+
+test:: abi_checks
+
clean::
rm -f $(TEVENT_SOBASE) $(TEVENT_SONAME) $(TEVENT_SOLIB) $(TEVENT_STLIB)
rm -f tevent.pc
+ rm -f tevent.exports.sort tevent.exports.check tevent.exports.check.sort
+ rm -f tevent.signatures.sort tevent.signatures.check tevent.signatures.check.sort
void _tevent_schedule_immediate (struct tevent_immediate *, struct tevent_context *, tevent_immediate_handler_t, void *, const char *, const char *);
void tevent_set_abort_fn (void (*) (const char *));
void tevent_set_default_backend (const char *);
+_Bool _tevent_req_cancel (struct tevent_req *, const char *);
+void tevent_req_set_cancel_fn (struct tevent_req *, tevent_req_cancel_fn);
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->MinorVersion));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->BuildNumber));
NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->PlatformId));
- NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->CSDVersion, 128, sizeof(uint16_t), CH_UTF16));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ {
+ struct ndr_push *_ndr_CSDVersion;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_CSDVersion, 0, 256));
+ NDR_CHECK(ndr_push_string(_ndr_CSDVersion, NDR_SCALARS, r->CSDVersion));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_CSDVersion, 0, 256));
+ }
+ ndr->flags = _flags_save_string;
+ }
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->ServicePackMajor));
NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->ServicePackMinor));
NDR_CHECK(ndr_push_netr_SuiteMask(ndr, NDR_SCALARS, r->SuiteMask));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->MinorVersion));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->BuildNumber));
NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->PlatformId));
- NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->CSDVersion, 128, sizeof(uint16_t), CH_UTF16));
+ {
+ uint32_t _flags_save_string = ndr->flags;
+ ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_NULLTERM);
+ {
+ struct ndr_pull *_ndr_CSDVersion;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_CSDVersion, 0, 256));
+ NDR_CHECK(ndr_pull_string(_ndr_CSDVersion, NDR_SCALARS, &r->CSDVersion));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_CSDVersion, 0, 256));
+ }
+ ndr->flags = _flags_save_string;
+ }
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->ServicePackMajor));
NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->ServicePackMinor));
NDR_CHECK(ndr_pull_netr_SuiteMask(ndr, NDR_SCALARS, &r->SuiteMask));
uint32_t MinorVersion;
uint32_t BuildNumber;
uint32_t PlatformId;
- const char *CSDVersion;/* [charset(UTF16)] */
+ const char * CSDVersion;/* [subcontext_size(256),subcontext(0),flag(LIBNDR_FLAG_STR_NULLTERM)] */
uint16_t ServicePackMajor;
uint16_t ServicePackMinor;
uint16_t SuiteMask;
uint32 MinorVersion;
uint32 BuildNumber;
uint32 PlatformId;
- [charset(UTF16)] uint16 CSDVersion[128];
+ [subcontext(0),subcontext_size(256)] nstring CSDVersion;
uint16 ServicePackMajor;
uint16 ServicePackMinor;
netr_SuiteMask SuiteMask;
This is only safe because we are in a transaction and this
is a persistent database */
ZERO_STRUCT(header);
- header.dmaster = get_my_vnn();
} else {
memcpy(&header, rec.dptr, sizeof(struct ctdb_ltdb_header));
rec.dsize -= sizeof(struct ctdb_ltdb_header);
SAFE_FREE(rec.dptr);
}
+ header.dmaster = get_my_vnn();
header.rsn++;
if (!h->in_replay) {
# Extract symbols to export from C-header files.
# output in version-script format for linking shared libraries.
#
-# Copyright (C) 2008 Micheal Adam <obnox@samba.org>
+# Copyright (C) 2008 Michael Adam <obnox@samba.org>
#
BEGIN {
inheader=0;
current_file=FILENAME
}
if (inheader) {
- if (match($0,"[)][ \t]*[;][ \t]*$")) {
+ if (match($0,"[)][^()]*[;][ \t]*$")) {
inheader = 0;
}
next;
}
}
-/[_A-Za-z0-9]+[ \t]*[(].*[)][ \t]*;[ \t]*$/ {
+/[_A-Za-z0-9]+[ \t]*[(].*[)][^()]*;[ \t]*$/ {
sub(/[(].*$/, "");
gsub(/[^ \t]+[ \t]+/, "");
- gsub(/^[*]/, "");
+ gsub(/^[*]+/, "");
printf "\t\t%s;\n",$0;
next;
}
#
# This is the shell wrapper for the mksyms.awk core script.
#
-# Copyright (C) 2008 Micheal Adam <obnox@samba.org>
+# Copyright (C) 2008 Michael Adam <obnox@samba.org>
#
LANG=C; export LANG
#include "librpc/gen_ndr/ndr_drsblobs.h"
#include "param/param.h"
#include "libcli/security/dom_sid.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
struct replmd_private {
struct la_entry *la_list;
PYTHON = @PYTHON@
PYTHON_CONFIG = @PYTHON_CONFIG@
ldbdir = $(srcdir)
+LIB_PATH_VAR = @LIB_PATH_VAR@
LDB_MODULESDIR = @LDB_MODULESDIR@
check:: test @PYTHON_CHECK_TARGET@
check-soloading: sample.$(SHLIBEXT)
- LDB_MODULES_PATH=$(builddir) $(srcdir)/tests/test-soloading.sh
+ $(LIB_PATH_VAR)=lib LDB_MODULES_PATH=$(builddir) $(srcdir)/tests/test-soloading.sh
test:: all check-soloading
- for t in $(TESTS); do echo STARTING $${t}; $(srcdir)/tests/$${t} || exit 1; done
+ for t in $(TESTS); do echo STARTING $${t}; $(LIB_PATH_VAR)=lib $(srcdir)/tests/$${t} || exit 1; done
valgrindtest:: all
for t in $(TESTS); do echo STARTING $${t}; VALGRIND="valgrind -q --db-attach=yes --num-callers=30" $(srcdir)/tests/$${t} || exit 1; done
LDB_BACKEND(tdb), \
LDAP_BACKEND \
SQLITE3_BACKEND \
- LDB_MODULE(operational), \
LDB_MODULE(rdn_name), \
LDB_MODULE(paged_results), \
LDB_MODULE(server_sort), \
extern const struct ldb_module_ops ldb_objectclass_module_ops;
-extern const struct ldb_module_ops ldb_operational_module_ops;
extern const struct ldb_module_ops ldb_paged_results_module_ops;
extern const struct ldb_module_ops ldb_rdn_name_module_ops;
extern const struct ldb_module_ops ldb_schema_module_ops;
mkdir -p $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
cp ldb.$(SHLIBEXT) $(DESTDIR)`$(PYTHON) -c "import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1, prefix='$(prefix)')"`
-check-python:: build-python
- LD_LIBRARY_PATH=lib PYTHONPATH=.:$(ldbdir) $(PYTHON) $(ldbdir)/tests/python/api.py
+check-python:: build-python lib/$(SONAME)
+ $(LIB_PATH_VAR)=lib PYTHONPATH=.:$(ldbdir) $(PYTHON) $(ldbdir)/tests/python/api.py
clean::
rm -f ldb.$(SHLIBEXT)
def setup_self_join(samdb, names,
machinepass, dnspass,
domainsid, invocationid, setup_path,
- policyguid, domainControllerFunctionality):
+ policyguid, policyguid_dc, domainControllerFunctionality):
"""Join a host to its own domain."""
assert isinstance(invocationid, str)
setup_add_ldif(samdb, setup_path("provision_self_join.ldif"), {
setup_add_ldif(samdb, setup_path("provision_group_policy.ldif"), {
"POLICYGUID": policyguid,
+ "POLICYGUID_DC": policyguid_dc,
"DNSDOMAIN": names.dnsdomain,
"DOMAINSID": str(domainsid),
"DOMAINDN": names.domaindn})
def setup_samdb(path, setup_path, session_info, credentials, lp,
names, message,
- domainsid, domainguid, policyguid,
+ domainsid, domainguid, policyguid, policyguid_dc,
fill, adminpass, krbtgtpass,
machinepass, invocationid, dnspass,
serverrole, schema=None, ldap_backend=None):
"NETBIOSNAME": names.netbiosname,
"DEFAULTSITE": names.sitename,
"CONFIGDN": names.configdn,
- "SERVERDN": names.serverdn
+ "SERVERDN": names.serverdn,
+ "POLICYGUID_DC": policyguid_dc
})
if fill == FILL_FULL:
dnspass=dnspass,
machinepass=machinepass,
domainsid=domainsid, policyguid=policyguid,
+ policyguid_dc=policyguid_dc,
setup_path=setup_path,
domainControllerFunctionality=domainControllerFunctionality)
# add the NTDSGUID based SPNs
domain=None, hostname=None, hostip=None, hostip6=None,
domainsid=None, adminpass=None, ldapadminpass=None,
krbtgtpass=None, domainguid=None,
- policyguid=None, invocationid=None, machinepass=None,
+ policyguid=None, policyguid_dc=None, invocationid=None,
+ machinepass=None,
dnspass=None, root=None, nobody=None, users=None,
wheel=None, backup=None, aci=None, serverrole=None,
ldap_backend_extra_port=None, ldap_backend_type=None,
if policyguid is None:
policyguid = str(uuid.uuid4())
+ if policyguid_dc is None:
+ policyguid_dc = str(uuid.uuid4())
if adminpass is None:
adminpass = glue.generate_random_str(12)
if krbtgtpass is None:
credentials=credentials, lp=lp, names=names,
message=message,
domainsid=domainsid,
- schema=schema, domainguid=domainguid, policyguid=policyguid,
+ schema=schema, domainguid=domainguid,
+ policyguid=policyguid, policyguid_dc=policyguid_dc,
fill=samdb_fill,
adminpass=adminpass, krbtgtpass=krbtgtpass,
invocationid=invocationid,
(paths.smbconf, setup_path("provision.smb.conf.dc")))
assert(paths.sysvol is not None)
- policy_path = os.path.join(paths.sysvol, names.dnsdomain, "Policies",
+ # Set up group policies (domain policy and domain controller policy)
+
+ policy_path = os.path.join(paths.sysvol, names.dnsdomain, "Policies",
"{" + policyguid + "}")
os.makedirs(policy_path, 0755)
- open(os.path.join(policy_path, "GPT.INI"), 'w').write("")
+ open(os.path.join(policy_path, "GPT.INI"), 'w').write(
+ "[General]\r\nVersion=65544")
os.makedirs(os.path.join(policy_path, "Machine"), 0755)
os.makedirs(os.path.join(policy_path, "User"), 0755)
+
+ policy_path_dc = os.path.join(paths.sysvol, names.dnsdomain, "Policies",
+ "{" + policyguid_dc + "}")
+ os.makedirs(policy_path_dc, 0755)
+ open(os.path.join(policy_path_dc, "GPT.INI"), 'w').write(
+ "[General]\r\nVersion=2")
+ os.makedirs(os.path.join(policy_path_dc, "Machine"), 0755)
+ os.makedirs(os.path.join(policy_path_dc, "User"), 0755)
+
if not os.path.isdir(paths.netlogon):
os.makedirs(paths.netlogon, 0755)
configdn=None, serverdn=None,
domain=None, hostname=None, domainsid=None,
adminpass=None, krbtgtpass=None, domainguid=None,
- policyguid=None, invocationid=None, machinepass=None,
+ policyguid=None, policyguid_dc=None, invocationid=None,
+ machinepass=None,
dnspass=None, root=None, nobody=None, users=None,
wheel=None, backup=None, serverrole=None,
ldap_backend=None, ldap_backend_type=None,
parser.add_option("--domain-sid", type="string", metavar="SID",
help="set domainsid (otherwise random)")
parser.add_option("--policy-guid", type="string", metavar="GUID",
- help="set policy guid")
+ help="set guid for domain policy")
+parser.add_option("--policy-guid-dc", type="string", metavar="GUID",
+ help="set guid for domain controller policy")
parser.add_option("--invocationid", type="string", metavar="GUID",
help="set invocationid (otherwise random)")
parser.add_option("--host-name", type="string", metavar="HOSTNAME",
session, creds, smbconf=smbconf, targetdir=opts.targetdir,
samdb_fill=samdb_fill, realm=opts.realm, domain=opts.domain,
domainguid=opts.domain_guid, domainsid=opts.domain_sid,
- policyguid=opts.policy_guid, hostname=opts.host_name,
+ policyguid=opts.policy_guid, policyguid_dc=opts.policy_guid_dc,
+ hostname=opts.host_name,
hostip=opts.host_ip, hostip6=opts.host_ip6,
invocationid=opts.invocationid, adminpass=opts.adminpass,
krbtgtpass=opts.krbtgtpass, machinepass=opts.machinepass,
systemFlags: -1946157056
isCriticalSystemObject: TRUE
showInAdvancedViewOnly: FALSE
+gPLink: [LDAP://CN={${POLICYGUID_DC}},CN=Policies,CN=System,${DOMAINDN};0]
# Joined DC located in "provision_self_join.ldif"
displayName: Default Domain Policy
gPCFunctionalityVersion: 2
gPCFileSysPath: \\${DNSDOMAIN}\sysvol\${DNSDOMAIN}\Policies\{${POLICYGUID}}
-versionNumber: 65543
+versionNumber: 65544
flags: 0
gPCMachineExtensionNames: [{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{53D6AB1B-248
8-11D1-A28C-00C04FB94F17}][{827D319E-6EAC-11D2-A4EA-00C04F79F83A}{803E14A0-B4
objectClass: top
objectClass: container
systemFlags: -1946157056
+
+dn: CN={${POLICYGUID_DC}},CN=Policies,CN=System,${DOMAINDN}
+objectClass: top
+objectClass: container
+objectClass: groupPolicyContainer
+displayName: Default Domain Controllers Policy
+gPCFunctionalityVersion: 2
+gPCFileSysPath: \\${DNSDOMAIN}\sysvol\${DNSDOMAIN}\Policies\{${POLICYGUID_DC}}
+versionNumber: 2
+flags: 0
+gPCMachineExtensionNames: [{827D319E-6EAC-11D2-A4EA-00C04F79F83A}{803E14A0-B4
+ FB-11D0-A0D0-00A0C90F574B}]
+nTSecurityDescriptor: O:${DOMAINSID}-512G:${DOMAINSID}-512D:PAI(A;CI;RPWPCCDCLCLORCWOWDSDDTSW;;;${DOMAINSID}-512)(A;CI;RPWPCCDCLCLORCWOWDSDDTSW;;;${DOMAINSID}-519)(A;;RPWPCCDCLCLORCWOWDSDDTSW;;;${DOMAINSID}-512)(A;CIIO;RPWPCCDCLCLORCWOWDSDDTSW;;;CO)(A;CI;RPWPCCDCLCLORCWOWDSDDTSW;;;SY)(A;CI;RPLCLORC;;;AU)(OA;CI;CR;edacfd8f-ffb3-11d1-b41d-00a0c968f939;;AU)(A;CI;RPLCLORC;;;ED)S:AI(OU;CIIDSA;WPWD;;f30e3bc2-9ff0-11d1-b603-0000f80367c1;WD)(OU;CIIOIDSA;WP;f30e3bbe-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)(OU;CIIOIDSA;WP;f30e3bbf-9ff0-11d1-b603-0000f80367c1;bf967aa5-0de6-11d0-a285-00aa003049e2;WD)
+systemFlags: -1946157056
+
+dn: CN=User,CN={${POLICYGUID_DC}},CN=Policies,CN=System,${DOMAINDN}
+objectClass: top
+objectClass: container
+systemFlags: -1946157056
+
+dn: CN=Machine,CN={${POLICYGUID_DC}},CN=Policies,CN=System,${DOMAINDN}
+objectClass: top
+objectClass: container
+systemFlags: -1946157056
+