Merge branch 'master' of /home/tridge/samba/git/combined
authorAndrew Tridgell <tridge@samba.org>
Sat, 12 Sep 2009 01:15:38 +0000 (11:15 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sat, 12 Sep 2009 01:15:38 +0000 (11:15 +1000)
27 files changed:
lib/talloc/script/mksigs.pl
lib/talloc/script/mksyms.awk
lib/tdb/script/mksigs.pl
lib/tdb/script/mksyms.awk
lib/tevent/script/abi_checks.sh [new file with mode: 0755]
lib/tevent/script/abi_checks_gcc.sh [moved from lib/tevent/abi_checks.sh with 100% similarity]
lib/tevent/script/mksigs.pl [new file with mode: 0755]
lib/tevent/script/mksyms.awk [new file with mode: 0644]
lib/tevent/script/mksyms.sh [new file with mode: 0755]
lib/tevent/tevent.exports
lib/tevent/tevent.mk
lib/tevent/tevent.signatures
librpc/gen_ndr/ndr_netlogon.c
librpc/gen_ndr/netlogon.h
librpc/idl/netlogon.idl
source3/lib/dbwrap_ctdb.c
source3/script/mksyms.awk
source3/script/mksyms.sh
source4/dsdb/samdb/ldb_modules/repl_meta_data.c
source4/lib/ldb/Makefile.in
source4/lib/ldb/common/ldb_modules.c
source4/lib/ldb/include/ldb_private.h
source4/lib/ldb/ldb.mk
source4/scripting/python/samba/provision.py
source4/setup/provision
source4/setup/provision.ldif
source4/setup/provision_group_policy.ldif

index 28a2e747a07d70629e812ec2f75c74f3e23e5c4b..755cd796039724869970e6d6f2a51ca0417f0e71 100755 (executable)
@@ -118,10 +118,6 @@ while (my $LINE = <>) {
                }
        }
 
-       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;
@@ -155,10 +151,16 @@ while (my $LINE = <>) {
                }
        }
 
+       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;
@@ -174,5 +176,8 @@ while (my $LINE = <>) {
        # normalize unsigned
        $LINE =~ s/([\s,\(])unsigned([,\)])/$1unsigned int$2/g;
 
+       # normalize bool
+       $LINE =~ s/(\b)bool(\b)/_Bool/g;
+
        print $LINE . "\n";
 }
index a30bea4d340ba7b8ad2d4e8d8c391a25be68d735..ca14da0f2177bf2005a3e5835d9e6679c813669f 100644 (file)
@@ -28,7 +28,7 @@ END {
                current_file=FILENAME
        }
        if (inheader) {
-               if (match($0,"[)][ \t]*[;][ \t]*$")) {
+               if (match($0,"[)][^()]*[;][ \t]*$")) {
                        inheader = 0;
                }
                next;
@@ -57,10 +57,10 @@ END {
        }
 }
 
-/[_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;
 }
index 28a2e747a07d70629e812ec2f75c74f3e23e5c4b..755cd796039724869970e6d6f2a51ca0417f0e71 100755 (executable)
@@ -118,10 +118,6 @@ while (my $LINE = <>) {
                }
        }
 
-       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;
@@ -155,10 +151,16 @@ while (my $LINE = <>) {
                }
        }
 
+       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;
@@ -174,5 +176,8 @@ while (my $LINE = <>) {
        # normalize unsigned
        $LINE =~ s/([\s,\(])unsigned([,\)])/$1unsigned int$2/g;
 
+       # normalize bool
+       $LINE =~ s/(\b)bool(\b)/_Bool/g;
+
        print $LINE . "\n";
 }
index a30bea4d340ba7b8ad2d4e8d8c391a25be68d735..ca14da0f2177bf2005a3e5835d9e6679c813669f 100644 (file)
@@ -28,7 +28,7 @@ END {
                current_file=FILENAME
        }
        if (inheader) {
-               if (match($0,"[)][ \t]*[;][ \t]*$")) {
+               if (match($0,"[)][^()]*[;][ \t]*$")) {
                        inheader = 0;
                }
                next;
@@ -57,10 +57,10 @@ END {
        }
 }
 
-/[_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;
 }
diff --git a/lib/tevent/script/abi_checks.sh b/lib/tevent/script/abi_checks.sh
new file mode 100755 (executable)
index 0000000..c34a659
--- /dev/null
@@ -0,0 +1,91 @@
+#!/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
diff --git a/lib/tevent/script/mksigs.pl b/lib/tevent/script/mksigs.pl
new file mode 100755 (executable)
index 0000000..755cd79
--- /dev/null
@@ -0,0 +1,183 @@
+#!/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";
+}
diff --git a/lib/tevent/script/mksyms.awk b/lib/tevent/script/mksyms.awk
new file mode 100644 (file)
index 0000000..94a405c
--- /dev/null
@@ -0,0 +1,76 @@
+#
+# 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;
+}
+
diff --git a/lib/tevent/script/mksyms.sh b/lib/tevent/script/mksyms.sh
new file mode 100755 (executable)
index 0000000..7fb4031
--- /dev/null
@@ -0,0 +1,45 @@
+#! /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
index b1554dff4ee26fbad060577c2aa481a5e57cc1ef..01d547ad8556dff0f0736801e68bef9cafd15581 100644 (file)
@@ -55,6 +55,8 @@
            tevent_timeval_zero;
            tevent_wakeup_recv;
            tevent_wakeup_send;
+           _tevent_req_cancel;
+           tevent_req_set_cancel_fn;
 
     local: *;
 };
index 480366e9387d9a99e6745ea6669dd129b9d64eca..694d082c4a9f2eeb5313b5085a8f1db4fc7fa544 100644 (file)
@@ -29,6 +29,14 @@ installlibs:: installdirs
 
 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
index 75f43affb2c3acfa33ef780fab01761afb552205..c752b9e933e3509482ab289e17dd622ad1e4988f 100644 (file)
@@ -53,3 +53,5 @@ void tevent_req_set_print_fn (struct tevent_req *, tevent_req_print_fn);
 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);
index daba526e655452495563c9f59fa3789cea9cd579..823c174ba51f5005fab4f7eaebad8fd202aceafe 100644 (file)
@@ -7393,7 +7393,17 @@ static enum ndr_err_code ndr_push_netr_OsVersionInfoEx(struct ndr_push *ndr, int
                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));
@@ -7414,7 +7424,17 @@ static enum ndr_err_code ndr_pull_netr_OsVersionInfoEx(struct ndr_pull *ndr, int
                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));
index 0a314e13c5ceb760eb3acc798280d2a37041fe35..234ea10ff3d37b71bccae61ad5b9fd161f58a07d 100644 (file)
@@ -930,7 +930,7 @@ struct netr_OsVersionInfoEx {
        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;
index 7ffc9f2e081513c16357e11d2fcadf409d75b81b..1cc0f2bc20091dea4d00e0c6e51f9b140e51c1e2 100644 (file)
@@ -1287,7 +1287,7 @@ interface netlogon
                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;
index e38f76fcf6e910d39885229475a177495182918e..07dde1e408720b9a59e8199880a29d47d7f1abbf 100644 (file)
@@ -478,7 +478,6 @@ static int db_ctdb_transaction_store(struct db_ctdb_transaction_handle *h,
                   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);
@@ -492,6 +491,7 @@ static int db_ctdb_transaction_store(struct db_ctdb_transaction_handle *h,
                SAFE_FREE(rec.dptr);
        }
 
+       header.dmaster = get_my_vnn();
        header.rsn++;
 
        if (!h->in_replay) {
index a30bea4d340ba7b8ad2d4e8d8c391a25be68d735..94a405ca689ff8741a8b188df27be210efb378f6 100644 (file)
@@ -4,7 +4,7 @@
 # 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;
@@ -28,7 +28,7 @@ END {
                current_file=FILENAME
        }
        if (inheader) {
-               if (match($0,"[)][ \t]*[;][ \t]*$")) {
+               if (match($0,"[)][^()]*[;][ \t]*$")) {
                        inheader = 0;
                }
                next;
@@ -57,10 +57,10 @@ END {
        }
 }
 
-/[_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;
 }
index 714d55abae6a7369e1bb1da1f0d5cc5f7f29734d..7fb4031e2bf8db7a8e2a813e63ea7fd67777e370 100755 (executable)
@@ -8,7 +8,7 @@
 #
 # 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
index e7ca074779bcbd202a9ec4d656d1d8be4f2cb97a..5000c56d4e01c3b049d33721e21e7b103c5cc4aa 100644 (file)
@@ -48,7 +48,7 @@
 #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;
index 663dea9f807d5481692d229c0b15628fa180619c..c1f403d5500d6bb560cb67c3959d3756e12fbb20 100644 (file)
@@ -23,6 +23,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
 PYTHON = @PYTHON@
 PYTHON_CONFIG = @PYTHON_CONFIG@
 ldbdir = $(srcdir)
+LIB_PATH_VAR = @LIB_PATH_VAR@
 
 LDB_MODULESDIR = @LDB_MODULESDIR@
 
@@ -146,10 +147,10 @@ realdistclean:: distclean
 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
index 79a97cabeda040d8568ba6e2a945cc556d724c56..206b225ca83be6595fd9c9df88a6c97de2eec391 100644 (file)
@@ -785,7 +785,6 @@ int ldb_mod_register_control(struct ldb_module *module, const char *oid)
        LDB_BACKEND(tdb),       \
        LDAP_BACKEND    \
        SQLITE3_BACKEND \
-       LDB_MODULE(operational),        \
        LDB_MODULE(rdn_name),   \
        LDB_MODULE(paged_results),      \
        LDB_MODULE(server_sort),                \
index a70d9c704de59868e231b859eecacdde3f13f507..c12f33495bfef97a04eec723ad38d4087b5be00b 100644 (file)
@@ -123,7 +123,6 @@ int ldb_connect_backend(struct ldb_context *ldb, const char *url, const char *op
 
 
 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;
index 4b73a455c9322fc1558f0fac64557f4ea1b511ff..e87db6457425382a41307621e5bbfda913b872fa 100644 (file)
@@ -74,8 +74,8 @@ install-python:: build-python
        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)
index 07dfc62e009c84905f16a6fd9af2a8ad1d04d6c2..19149e92e26cc3a902c6ec6062dabefb2d7a2395 100644 (file)
@@ -766,7 +766,7 @@ def setup_samdb_rootdse(samdb, setup_path, names):
 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"), { 
@@ -788,6 +788,7 @@ def setup_self_join(samdb, names,
 
     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})
@@ -814,7 +815,7 @@ def setup_self_join(samdb, names,
 
 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):
@@ -969,7 +970,8 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
             "NETBIOSNAME": names.netbiosname,
             "DEFAULTSITE": names.sitename,
             "CONFIGDN": names.configdn,
-            "SERVERDN": names.serverdn
+            "SERVERDN": names.serverdn,
+            "POLICYGUID_DC": policyguid_dc
             })
 
         if fill == FILL_FULL:
@@ -988,6 +990,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
                                 dnspass=dnspass,  
                                 machinepass=machinepass, 
                                 domainsid=domainsid, policyguid=policyguid,
+                                policyguid_dc=policyguid_dc,
                                 setup_path=setup_path,
                                 domainControllerFunctionality=domainControllerFunctionality)
                 # add the NTDSGUID based SPNs
@@ -1017,7 +1020,8 @@ def provision(setup_dir, message, session_info,
               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,
@@ -1038,6 +1042,8 @@ def provision(setup_dir, message, session_info,
 
     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:
@@ -1157,7 +1163,8 @@ def provision(setup_dir, message, session_info,
                         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, 
@@ -1177,12 +1184,24 @@ def provision(setup_dir, message, session_info,
                     (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)
 
@@ -1316,7 +1335,8 @@ def provision_become_dc(setup_dir=None,
                         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,
index 27a33122be7ef85a488d1103e2c66a6a9a1f3f69..8bf08b9e39892d16c9a56c5e95316674ffa09d35 100755 (executable)
@@ -53,7 +53,9 @@ parser.add_option("--domain-guid", type="string", metavar="GUID",
 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", 
@@ -181,7 +183,8 @@ provision(setup_dir, message,
           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,
index bd224ee60d3c498e3307372b0bfe7e6f2a6be9ed..b6ad52820551882f967b9d245ca47b6074f6a6d9 100644 (file)
@@ -34,6 +34,7 @@ description: Default container for domain controllers
 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"
 
index 65ab1eaf5f77e3b9964d1d2cd0a7fec7f1a1a0aa..00f0bee4cc5c00285e07108c2d9abdbc2f2e3ff4 100644 (file)
@@ -5,7 +5,7 @@ objectClass: groupPolicyContainer
 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
@@ -26,3 +26,28 @@ dn: CN=Machine,CN={${POLICYGUID}},CN=Policies,CN=System,${DOMAINDN}
 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
+