diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-12 11:15:38 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-12 11:15:38 +1000 |
commit | fe36b8af64195f10acead12d4a4f426cc8772a8c (patch) | |
tree | af98810b529728d46a10f0ac1e2d3203b63323a2 | |
parent | 51fd80647de9cb531181eb1eeefe9ad2c473f784 (diff) | |
parent | bbc0a56da59df8b7cd6f19f99cfaac9c3909779f (diff) | |
download | samba-fe36b8af64195f10acead12d4a4f426cc8772a8c.tar.gz samba-fe36b8af64195f10acead12d4a4f426cc8772a8c.tar.bz2 samba-fe36b8af64195f10acead12d4a4f426cc8772a8c.zip |
Merge branch 'master' of /home/tridge/samba/git/combined
27 files changed, 529 insertions, 44 deletions
diff --git a/lib/talloc/script/mksigs.pl b/lib/talloc/script/mksigs.pl index 28a2e747a0..755cd79603 100755 --- a/lib/talloc/script/mksigs.pl +++ b/lib/talloc/script/mksigs.pl @@ -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"; } diff --git a/lib/talloc/script/mksyms.awk b/lib/talloc/script/mksyms.awk index a30bea4d34..ca14da0f21 100644 --- a/lib/talloc/script/mksyms.awk +++ b/lib/talloc/script/mksyms.awk @@ -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/tdb/script/mksigs.pl b/lib/tdb/script/mksigs.pl index 28a2e747a0..755cd79603 100755 --- a/lib/tdb/script/mksigs.pl +++ b/lib/tdb/script/mksigs.pl @@ -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"; } diff --git a/lib/tdb/script/mksyms.awk b/lib/tdb/script/mksyms.awk index a30bea4d34..ca14da0f21 100644 --- a/lib/tdb/script/mksyms.awk +++ b/lib/tdb/script/mksyms.awk @@ -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 index 0000000000..c34a659d73 --- /dev/null +++ b/lib/tevent/script/abi_checks.sh @@ -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/abi_checks.sh b/lib/tevent/script/abi_checks_gcc.sh index 95182097d5..95182097d5 100755 --- a/lib/tevent/abi_checks.sh +++ b/lib/tevent/script/abi_checks_gcc.sh diff --git a/lib/tevent/script/mksigs.pl b/lib/tevent/script/mksigs.pl new file mode 100755 index 0000000000..755cd79603 --- /dev/null +++ b/lib/tevent/script/mksigs.pl @@ -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 index 0000000000..94a405ca68 --- /dev/null +++ b/lib/tevent/script/mksyms.awk @@ -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 index 0000000000..7fb4031e2b --- /dev/null +++ b/lib/tevent/script/mksyms.sh @@ -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 diff --git a/lib/tevent/tevent.exports b/lib/tevent/tevent.exports index b1554dff4e..01d547ad85 100644 --- a/lib/tevent/tevent.exports +++ b/lib/tevent/tevent.exports @@ -55,6 +55,8 @@ tevent_timeval_zero; tevent_wakeup_recv; tevent_wakeup_send; + _tevent_req_cancel; + tevent_req_set_cancel_fn; local: *; }; diff --git a/lib/tevent/tevent.mk b/lib/tevent/tevent.mk index 480366e938..694d082c4a 100644 --- a/lib/tevent/tevent.mk +++ b/lib/tevent/tevent.mk @@ -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 diff --git a/lib/tevent/tevent.signatures b/lib/tevent/tevent.signatures index 75f43affb2..c752b9e933 100644 --- a/lib/tevent/tevent.signatures +++ b/lib/tevent/tevent.signatures @@ -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); diff --git a/librpc/gen_ndr/ndr_netlogon.c b/librpc/gen_ndr/ndr_netlogon.c index daba526e65..823c174ba5 100644 --- a/librpc/gen_ndr/ndr_netlogon.c +++ b/librpc/gen_ndr/ndr_netlogon.c @@ -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)); diff --git a/librpc/gen_ndr/netlogon.h b/librpc/gen_ndr/netlogon.h index 0a314e13c5..234ea10ff3 100644 --- a/librpc/gen_ndr/netlogon.h +++ b/librpc/gen_ndr/netlogon.h @@ -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; diff --git a/librpc/idl/netlogon.idl b/librpc/idl/netlogon.idl index 7ffc9f2e08..1cc0f2bc20 100644 --- a/librpc/idl/netlogon.idl +++ b/librpc/idl/netlogon.idl @@ -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; diff --git a/source3/lib/dbwrap_ctdb.c b/source3/lib/dbwrap_ctdb.c index e38f76fcf6..07dde1e408 100644 --- a/source3/lib/dbwrap_ctdb.c +++ b/source3/lib/dbwrap_ctdb.c @@ -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) { diff --git a/source3/script/mksyms.awk b/source3/script/mksyms.awk index a30bea4d34..94a405ca68 100644 --- a/source3/script/mksyms.awk +++ b/source3/script/mksyms.awk @@ -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; } diff --git a/source3/script/mksyms.sh b/source3/script/mksyms.sh index 714d55abae..7fb4031e2b 100755 --- a/source3/script/mksyms.sh +++ b/source3/script/mksyms.sh @@ -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 diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c index e7ca074779..5000c56d4e 100644 --- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c +++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c @@ -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; diff --git a/source4/lib/ldb/Makefile.in b/source4/lib/ldb/Makefile.in index 663dea9f80..c1f403d550 100644 --- a/source4/lib/ldb/Makefile.in +++ b/source4/lib/ldb/Makefile.in @@ -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 diff --git a/source4/lib/ldb/common/ldb_modules.c b/source4/lib/ldb/common/ldb_modules.c index 79a97cabed..206b225ca8 100644 --- a/source4/lib/ldb/common/ldb_modules.c +++ b/source4/lib/ldb/common/ldb_modules.c @@ -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), \ diff --git a/source4/lib/ldb/include/ldb_private.h b/source4/lib/ldb/include/ldb_private.h index a70d9c704d..c12f33495b 100644 --- a/source4/lib/ldb/include/ldb_private.h +++ b/source4/lib/ldb/include/ldb_private.h @@ -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; diff --git a/source4/lib/ldb/ldb.mk b/source4/lib/ldb/ldb.mk index 4b73a455c9..e87db64574 100644 --- a/source4/lib/ldb/ldb.mk +++ b/source4/lib/ldb/ldb.mk @@ -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) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 07dfc62e00..19149e92e2 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -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, diff --git a/source4/setup/provision b/source4/setup/provision index 27a33122be..8bf08b9e39 100755 --- a/source4/setup/provision +++ b/source4/setup/provision @@ -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, diff --git a/source4/setup/provision.ldif b/source4/setup/provision.ldif index bd224ee60d..b6ad528205 100644 --- a/source4/setup/provision.ldif +++ b/source4/setup/provision.ldif @@ -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" diff --git a/source4/setup/provision_group_policy.ldif b/source4/setup/provision_group_policy.ldif index 65ab1eaf5f..00f0bee4cc 100644 --- a/source4/setup/provision_group_policy.ldif +++ b/source4/setup/provision_group_policy.ldif @@ -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 + |