The branch, master has been updated via 225d701 correct sense of macro variable name in SMB2 durable open test via 69e511e Avoid casting pointer to unsigned long long for NULL check via 8ed6523 Use large enough unsigned values in server_id IDL via 8a3d548 remove trailing whitespace in Pidl/Samba4/Python.pm via 3c9f795 Treat unsigned 64 bit IDL values as unsigned long long in Python via c3cf813 Byte order reversal shouldn't assume size_t is 64 bit. from fa4f4fe s4:gensec/gssapi: make use of add gssapi_get_sig_size() and gssapi_{seal,unseal,sign,check}_packet() helper functions
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 225d70154620d7029918cb9c549aec15d99c2de7 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Wed Jun 17 13:21:28 2015 +1200 correct sense of macro variable name in SMB2 durable open test Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> Autobuild-User(master): Andrew Bartlett <abart...@samba.org> Autobuild-Date(master): Wed Jun 24 08:54:23 CEST 2015 on sn-devel-104 commit 69e511e47876443a70357e02e9dbe3385f28f21d Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Wed Jun 17 13:20:29 2015 +1200 Avoid casting pointer to unsigned long long for NULL check This allows compilation on i386 with -WError. Otherwise we see this: ../source4/torture/smb2/durable_open.c:41:23: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] __location__, #v, (unsigned long long)v, (unsigned long long)correct); \ because the pointer is 32 bits, while long long is 64. Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 8ed6523b6cf456d50cf4b127687aa0dcb43d88ba Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Wed Jun 17 16:08:18 2015 +1200 Use large enough unsigned values in server_id IDL This matches what we have in struct server_id. Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 8a3d548ee70edf5770ba5a21a569311d662557a4 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Wed Jun 17 16:07:00 2015 +1200 remove trailing whitespace in Pidl/Samba4/Python.pm Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit 3c9f7957c94b8c84d03d7980cfed6ec8f7e8423b Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Wed Jun 17 11:37:03 2015 +1200 Treat unsigned 64 bit IDL values as unsigned long long in Python This caused a compilation error on i386: default/librpc/gen_ndr/py_server_id.c:216:75: error: overflow in implicit constant conversion [-Werror=overflow] PyModule_AddObject(m, "SERVERID_UNIQUE_ID_NOT_TO_VERIFY", PyInt_FromLong(0xFFFFFFFFFFFFFFFFULL)); Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> commit c3cf81324744737e9a9e8d8d7435d39bf95034f3 Author: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Date: Wed Jun 17 11:01:10 2015 +1200 Byte order reversal shouldn't assume size_t is 64 bit. This fixes compilation on 32 bit i386 with -WError. ../lib/crypto/aes_gcm_128.c:213:2: error: right shift count >= width of type [-Werror] ../lib/crypto/aes_gcm_128.c:213:2: error: left shift count >= width of type [-Werror] Signed-off-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Andrew Bartlett <abart...@samba.org> ----------------------------------------------------------------------- Summary of changes: lib/util/byteorder.h | 2 +- librpc/idl/server_id.idl | 4 ++-- pidl/lib/Parse/Pidl/Samba4/Python.pm | 34 +++++++++++++++++++--------------- source4/torture/smb2/durable_open.c | 15 +++++++++++---- 4 files changed, 33 insertions(+), 22 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/util/byteorder.h b/lib/util/byteorder.h index 297be52..77afba5 100644 --- a/lib/util/byteorder.h +++ b/lib/util/byteorder.h @@ -164,7 +164,7 @@ static __inline__ void st_le32(uint32_t *addr, const uint32_t val) /* now the reverse routines - these are used in nmb packets (mostly) */ #define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) #define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16))) -#define BREV(x) ((IREV(x)<<32) | (IREV((x)>>32))) +#define BREV(x) ((IREV((uint64_t)x)<<32) | (IREV(((uint64_t)x)>>32))) #define RSVAL(buf,pos) SREV(SVAL(buf,pos)) #define RSVALS(buf,pos) SREV(SVALS(buf,pos)) diff --git a/librpc/idl/server_id.idl b/librpc/idl/server_id.idl index 554e428..8ebffc5 100644 --- a/librpc/idl/server_id.idl +++ b/librpc/idl/server_id.idl @@ -9,10 +9,10 @@ interface server_id * Ctdbd sets this, we retrieve our vnn from it. */ - const int NONCLUSTER_VNN = 0xFFFFFFFF; + const uint32 NONCLUSTER_VNN = 0xFFFFFFFF; /** Don't verify this unique id */ - const int SERVERID_UNIQUE_ID_NOT_TO_VERIFY = 0xFFFFFFFFFFFFFFFFULL; + const hyper SERVERID_UNIQUE_ID_NOT_TO_VERIFY = 0xFFFFFFFFFFFFFFFFULL; /* used to look like the following, note that unique_id was not * marshalled at all... diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index b0a7099..0f54944 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -112,7 +112,7 @@ sub EnumAndBitmapConsts($$$) foreach my $e (@{$d->{ELEMENTS}}) { $e =~ /^([A-Za-z0-9_]+)/; my $cname = $1; - + $self->register_constant($cname, $d, $cname); } } @@ -221,7 +221,7 @@ sub PythonStruct($$$$$$) my $mem_ctx = "pytalloc_get_mem_ctx(py_obj)"; my $l = $e->{LEVELS}[0]; my $nl = GetNextLevel($e, $l); - if ($l->{TYPE} eq "POINTER" and + if ($l->{TYPE} eq "POINTER" and not ($nl->{TYPE} eq "ARRAY" and ($nl->{IS_FIXED} or is_charset_array($e, $nl))) and not ($nl->{TYPE} eq "DATA" and Parse::Pidl::Typelist::scalar_is_reference($nl->{DATA_TYPE}))) { $self->pidl("talloc_unlink(pytalloc_get_mem_ctx(py_obj), discard_const($varname));"); @@ -255,7 +255,7 @@ sub PythonStruct($$$$$$) my $py_methods = "NULL"; - # If the struct is not public there ndr_pull/ndr_push functions will + # If the struct is not public there ndr_pull/ndr_push functions will # be static so not callable from here if (has_property($d, "public")) { $self->pidl("static PyObject *py_$name\_ndr_pack(PyObject *py_obj)"); @@ -405,8 +405,8 @@ sub find_metadata_args($) foreach my $e (@{$fn->{ELEMENTS}}) { foreach my $dir (@{$e->{DIRECTION}}) { my $main = get_metadata_var($e); - if ($main) { - $metadata_args->{$dir}->{$main} = $e->{NAME}; + if ($main) { + $metadata_args->{$dir}->{$main} = $e->{NAME}; } } } @@ -432,7 +432,7 @@ sub PythonFunctionUnpackOut($$$) $self->pidl("PyObject *result;"); foreach my $e (@{$fn->{ELEMENTS}}) { next unless (grep(/out/,@{$e->{DIRECTION}})); - next if (($metadata_args->{in}->{$e->{NAME}} and grep(/in/, @{$e->{DIRECTION}})) or + next if (($metadata_args->{in}->{$e->{NAME}} and grep(/in/, @{$e->{DIRECTION}})) or ($metadata_args->{out}->{$e->{NAME}}) and grep(/out/, @{$e->{DIRECTION}})); $self->pidl("PyObject *py_$e->{NAME};"); $result_size++; @@ -515,7 +515,7 @@ sub PythonFunctionPackIn($$$) foreach my $e (@{$fn->{ELEMENTS}}) { next unless (grep(/in/,@{$e->{DIRECTION}})); - next if (($metadata_args->{in}->{$e->{NAME}} and grep(/in/, @{$e->{DIRECTION}})) or + next if (($metadata_args->{in}->{$e->{NAME}} and grep(/in/, @{$e->{DIRECTION}})) or ($metadata_args->{out}->{$e->{NAME}}) and grep(/out/, @{$e->{DIRECTION}})); $self->pidl("PyObject *py_$e->{NAME};"); $args_format .= "O"; @@ -739,10 +739,10 @@ sub Interface($$$) $self->pidl("return py_dcerpc_interface_init_helper(type, args, kwargs, &ndr_table_$interface->{NAME});"); $self->deindent; $self->pidl("}"); - + $self->pidl(""); - my $signature = + my $signature = "\"$interface->{NAME}(binding, lp_ctx=None, credentials=None) -> connection\\n\" \"\\n\" \"binding should be a DCE/RPC binding string (for example: ncacn_ip_tcp:127.0.0.1)\\n\" @@ -876,7 +876,7 @@ sub import_type_variable($$$) sub use_type_variable($$) { my ($self, $orig_ctype) = @_; - # FIXME: Have a global lookup table for types that look different on the + # FIXME: Have a global lookup table for types that look different on the # wire than they are named in C? if ($orig_ctype->{NAME} eq "dom_sid2" or $orig_ctype->{NAME} eq "dom_sid28" or @@ -1020,7 +1020,7 @@ sub ConvertObjectFromPythonData($$$$$$;$) return; } - if ($actual_ctype->{TYPE} eq "SCALAR" and + if ($actual_ctype->{TYPE} eq "SCALAR" and ($actual_ctype->{NAME} eq "string" or $actual_ctype->{NAME} eq "nbt_string" or $actual_ctype->{NAME} eq "nbt_name" or $actual_ctype->{NAME} eq "wrepl_nbt_name")) { $self->pidl("$target = talloc_strdup($mem_ctx, PyString_AS_STRING($cvar));"); return; @@ -1199,10 +1199,14 @@ sub ConvertScalarToPython($$$) $ctypename = expandAlias($ctypename); - if ($ctypename =~ /^(u?int64|hyper|dlong|udlong|udlongr|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) { + if ($ctypename =~ /^(int64|dlong)$/) { return "PyLong_FromLongLong($cvar)"; } + if ($ctypename =~ /^(uint64|hyper|udlong|udlongr|NTTIME_hyper|NTTIME|NTTIME_1sec)$/) { + return "PyLong_FromUnsignedLongLong($cvar)"; + } + if ($ctypename =~ /^(char|u?int[0-9]*|time_t|uid_t|gid_t)$/) { return "PyInt_FromLong($cvar)"; } @@ -1255,8 +1259,8 @@ sub ConvertObjectToPythonData($$$$$;$) my $actual_ctype = $ctype; if ($actual_ctype->{TYPE} eq "TYPEDEF") { $actual_ctype = $actual_ctype->{DATA}; - } - + } + if ($actual_ctype->{TYPE} eq "ENUM") { return $self->ConvertScalarToPython(Parse::Pidl::Typelist::enum_type_fn($actual_ctype), $cvar); } elsif ($actual_ctype->{TYPE} eq "BITMAP") { @@ -1408,7 +1412,7 @@ sub Parse($$$$$) ($x->{TYPE} eq "IMPORT") && $self->Import(@{$x->{PATHS}}); ($x->{TYPE} eq "INTERFACE") && $self->Interface($x, $basename); } - + $self->pidl("static PyMethodDef $basename\_methods[] = {"); $self->indent; foreach (@{$self->{module_methods}}) { diff --git a/source4/torture/smb2/durable_open.c b/source4/torture/smb2/durable_open.c index c3d63d1..fd6af33 100644 --- a/source4/torture/smb2/durable_open.c +++ b/source4/torture/smb2/durable_open.c @@ -35,10 +35,17 @@ ret = false; \ }} while (0) -#define CHECK_NOT_VAL(v, correct) do { \ - if ((v) == (correct)) { \ +#define CHECK_NOT_VAL(v, incorrect) do { \ + if ((v) == (incorrect)) { \ torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got 0x%llx - should not be 0x%llx\n", \ - __location__, #v, (unsigned long long)v, (unsigned long long)correct); \ + __location__, #v, (unsigned long long)v, (unsigned long long)incorrect); \ + ret = false; \ + }} while (0) + +#define CHECK_NOT_NULL(p) do { \ + if ((p) == NULL) { \ + torture_result(tctx, TORTURE_FAIL, "(%s): %s is NULL but it should not be.\n", \ + __location__, #p); \ ret = false; \ }} while (0) @@ -2267,7 +2274,7 @@ static bool test_durable_open_alloc_size(struct torture_context *tctx, /* prepare buffer */ b = talloc_zero_size(mem_ctx, alloc_size_step); - CHECK_NOT_VAL(b, NULL); + CHECK_NOT_NULL(b); previous_session_id = smb2cli_session_current_id(tree->session->smbXcli); -- Samba Shared Repository