1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

367 Commits

Author SHA1 Message Date
Ralph Boehme
df079962ef librpc/ndr: add flag LIBNDR_FLAG_NO_COMPRESSION
This flag can be used to change marshalling behaviour with regard to
compression.

Example: DNS packets make use of so called DNS name compression which
means that for identical strings in a DNS packet, the second string is
replaced with a reference (an offset) to the first.

Setting this flag requests to turns off the marshalling compression.

This will be used in the next commit to prevent name compression in DNS
TSIG records.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11520

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-06-16 00:06:27 +02:00
Andrew Bartlett
98712e9bda libndr: Add ndr_pull_struct_blob_all_noalloc
This allows us to remove talloc() calls from GUID_from_ndr_blob().

To do this the struct ndr_pull is placed on the stack, and filled in there.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-05-03 08:10:10 +02:00
Garming Sam
89f5bbc971 dns: remove double talloc for strings
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-05-03 08:10:09 +02:00
Douglas Bagnall
c20e7b8c01 ndr: inline search for ndr_token_peek()
This is often a hot path, particularly with complex structures like
nt-acls.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-03-22 08:00:31 +01:00
Douglas Bagnall
7261433fe1 librpc ndr: add ndr_pull_steal_switch_value()
Switch values currently only have a peek variant, instead of a retrieve
variant for getting their values. This can create performance issues
with complex structures as the token list simply grows longer.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2016-03-22 08:00:31 +01:00
Stefan Metzmacher
c1e2a1f0a7 librpc/ndr: add ndr_ntlmssp_find_av() helper function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2016-03-10 06:52:29 +01:00
Stefan Metzmacher
ee8d777bbf CVE-2016-0771: s4:dns_server: fix idl for dns_txt_record
From RFC 1035:

    3.3.14. TXT RDATA format

        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
        /                   TXT-DATA                    /
        +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

    where:

    TXT-DATA        One or more <character-string>s.

    TXT RRs are used to hold descriptive text.  The semantics of the text
    depends on the domain where it is found.

Each record contains an array of strings instead of just one string.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11128
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11686

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-03-10 06:52:24 +01:00
Stefan Metzmacher
1cc57a98d4 CVE-2016-0771: librpc: add ndr_dnsp_string_list_copy() helper function
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11128
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11686

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2016-03-10 06:52:23 +01:00
Jelmer Vernooij
ffbd9c4584 Add a new header file for functions in lib/util/util.c.
This allows public headers to not include samba_util.h, but rather
specific header files under lib/util.

Signed-Off-By: Jelmer Vernooij <jelmer@samba.org>
Reviewed-By: Andrew Bartlett <abartlet@samba.org>
Reviewed-By: Stefan Metzmacher <metze@samba.org>
2016-01-13 04:43:23 +01:00
Stefan Metzmacher
bf1fa9e080 negoex.idl: use DATA_BLOB for negoex_BYTE_VECTOR
That's much easier for the callers.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Dec 18 04:07:56 CET 2015 on sn-devel-144
2015-12-18 04:07:56 +01:00
Stefan Metzmacher
a4fa489705 negoex.idl: initial version
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2015-12-18 01:03:20 +01:00
Volker Lendecke
0fd68d0cf5 librpc: Fix typos
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
2015-12-16 04:14:20 +01:00
Volker Lendecke
2bb0b473c1 lib: Avoid a includes.h
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-12-08 23:01:27 +01:00
Stefan Metzmacher
38d547bc0d dcerpc.idl: accept invalid dcerpc_bind_nak pdus
Older Samba versions (<= 4.1) had a bug in the dcerpc_bind_nak
idl, see commit f73ef3028c.

Note: ndr_pull_dcerpc_bind_nak() was generated by pidl and
has been extended by the (_available == 0) check.
That's why we ignore the 80 char per line limit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11327

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct 21 20:34:28 CEST 2015 on sn-devel-104
2015-10-21 20:34:28 +02:00
Michael Adam
117e87d804 librpc:ndr:witness: remove an unneeded block, reducing indentation.
Check with "git diff -w".

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Jul  7 23:37:05 CEST 2015 on sn-devel-104
2015-07-07 23:37:04 +02:00
Michael Adam
dd0f79df94 librpc:ndr:witness: move variables into scope
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2015-07-07 20:36:26 +02:00
Michael Adam
fd16861839 librpc:ndr:witness: fix CID 1311245: Memory - illegal accesses (UNINIT)
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2015-07-07 20:36:25 +02:00
Stefan Metzmacher
2b163012aa librpc/ndr: make use of dump_data_cb() in ndr_dump_data()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2015-07-03 02:00:28 +02:00
Günther Deschner
5b95572a09 libndr: better debug message in ndr_pull_subcontext_start().
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-07-03 02:00:27 +02:00
Günther Deschner
82c4b92661 witness: autogenerate the marshalling of the witness_notifyResponse_message.
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-07-03 02:00:27 +02:00
Stefan Metzmacher
e6e2ec0001 librpc/ndr_nbt: we need to keep a trailing '.' in the last component of an nbt_string
Windows uses a username of 'domain.example.com.' as username and we need to
return it that way in the NETLOGON_SAM_LOGON_RESPONSE_EX reply.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2015-03-27 01:26:15 +01:00
Günther Deschner
a22246516a librpc/ndr: add ndr_{pull|push|print}_HRESULT and release new 0.0.5 ABI.
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-03-13 23:58:07 +01:00
Arvid Requate
6af3cf60e3 s4-backupkey: Initialize ndr->switchlist for print
ndr_print_bkrp_data_in_blob requires the level to be set in the
proper ndr->switch_list context.

Signed-off-by: Arvid Requate <requate@univention.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2015-02-25 01:08:11 +01:00
Stefan Metzmacher
bade65dac3 librpc/ndr: add NDR_SCALAR_PTR_PROTO() helper macro
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-11-14 23:27:05 +01:00
Matthieu Patou
0d1e326a68 librpc: simplify ndr_pull_dnsp_string
total_len is 1 and never varies.

Signed-off-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-10-03 11:01:42 +02:00
Matthieu Patou
f1d03e7837 idl: add nt backup blobs format
Change-Id: I4a43e1fe5fcebf2a4647ea2fbc9985663c0d7af2
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Matthieu Patou <mat@matws.net>
2014-10-02 12:02:01 +02:00
Volker Lendecke
072bf227a7 lib: Use GUID_buf_string in GUID_string
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Matthieu Patou <mat@matws.net>
2014-10-02 12:02:01 +02:00
Matthieu Patou
82c7ab2266 Create talloc-less functions for formating GUID
Signed-off-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
Change-Id: I84adc45d2476dd225315bfc7dbb313f1b36b31e7
2014-10-02 12:02:01 +02:00
Matthieu Patou
1ac96a416d librpc/ndr_drsuapi: Allow ndrdump to dump dsinfo52 blobs
Change-Id: I6968b25c67587296b928b2193a9d48093c69c01a
Signed-off-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-09-27 01:35:36 +02:00
Anubhav Rakshit
09fb44d122 librpc: Add NETWORK_INTERFACE_INFO IDL data structure
This is in preparation for adding NETWORK_INTERFACE_INFO Ioctl smbtorture test
case. This data structure is described in MS-SMB2 Sec. 2.2.32.5

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Anubhav Rakshit <anubhav.rakshit@gmail.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-24 19:07:06 +02:00
Volker Lendecke
e22a0675c2 libndr: Use GUID_compare in GUID_equal
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2014-06-10 19:19:13 +02:00
Stefan Metzmacher
eabdbc8860 dcerpc.idl: hide (ndr->flags & LIBNDR_FLAG_OBJECT_PRESENT) logic behind a define
This way we can alter the define depending on the generated code.

E.g python bindings won't have an 'ndr' struct available.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-03-28 08:34:25 +01:00
Günther Deschner
4e05bad0d1 librpc/nbt: increase MAX_COMPONENTS limit for nbt_names.
domains with more then 10 subdomains are not so uncommon.

https://bugzilla.samba.org/show_bug.cgi?id=10439

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Feb 13 16:30:50 CET 2014 on sn-devel-104
2014-02-13 16:30:49 +01:00
Stefan Metzmacher
d6c91502c0 librpc/ndr: add ndr_table_by_syntax()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-02-11 16:20:28 +01:00
Stefan Metzmacher
3b2b0aa4d4 librpc/ndr: add ndr_syntax_id_[from|to]_string()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-02-11 16:02:14 +01:00
Stefan Metzmacher
7b5717058a librpc/ndr: add ndr_pull_append/pop()
They can be used to parse a fragmented NDR byte stream.

ndr_pull_append() appends more data that can be processed
and ndr_pull_pop() removed already processed data.

This will be used to implement dcerpc pipes, where we can get
a verify large amount of pipe chunks, once we processed a chunk
we can forget about the related data, but we may need to keep some
bytes in order to get the alignment right.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-02-11 16:02:14 +01:00
Stefan Metzmacher
53e0ceddff librpc/ndr: add support for a shallow copy to ndr_pull_subcontext_start/end
This will be usefull to try parsing DCERPC pipe chunks for
LIBNDR_FLAG_INCOMPLETE_BUFFER.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-02-11 16:02:14 +01:00
Stefan Metzmacher
ef5e0b7339 librpc/ndr: remember INCOMPLETE_BUFFER missing bytes in relative_highest_offset
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-02-11 16:02:14 +01:00
Stefan Metzmacher
e2a621466e librpc/ndr: add NDR_ERR_INCOMPLETE_BUFFER and LIBNDR_FLAG_INCOMPLETE_BUFFER
If we pull a pipe chunk we need a way to check if we
have enough bytes to parse the complete chunk.

Setting ndr_pull->flags |= LIBNDR_FLAG_INCOMPLETE_BUFFER
would change NDR_ERR_BUFSIZE (and later maybe others)
into NDR_ERR_INCOMPLETE_BUFFER.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-02-11 16:02:13 +01:00
Gregor Beck
91b3e415d5 librpc/ndr: fix headers in ndr_dcerpc.c
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2014-02-11 16:02:13 +01:00
Gregor Beck
0f3848a863 librpc/ndr: add ndr_pop_dcerpc_sec_verification_trailer()
This extracts the dcerpc_sec_verification_trailer from the end
of an ndr_pull structure, it found it reduces ndr->data_size.

NDR_ERR_ALLOC is the only possible error, all other errors
are ignored and a trailer with command count = 0 is returned.

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2014-01-08 14:34:49 +01:00
Gregor Beck
4289750211 librpc: fix possible memory leak
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-01-07 08:37:35 +01:00
Stefan Metzmacher
c0dc2fb7e1 dcerpc.idl: add dcerpc_sec_verification_trailer
See [MS-RPCE] 2.2.2.13 Verification Trailer for details.

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

Signed-off-by: Gregor Beck <gbeck@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-01-07 00:27:12 +01:00
Stefan Metzmacher
b62308ed99 librpc/ndr: add LIBNDR_FLAG_SUBCONTEXT_NO_UNREAD_BYTES
This lets ndr_pull_subcontext_end() make sure that all
subcontext bytes are consumed otherwise it returns NDR_ERR_UNREAD_BYTES.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2014-01-07 00:27:11 +01:00
Matthieu Patou
8dc931bafc librpc-idl: change the drsuapi_DsBindInfoCtr so that it match what is on the wire both in NDR32 and NDR64.
Previous implementation had a problem with NDR64 with uint32 and
uint3264 being in the wrong order

Signed-off-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct 30 10:16:02 CET 2013 on sn-devel-104
2013-10-30 10:16:02 +01:00
Günther Deschner
b197de754f libndr: Avoid ommitting display of unset bitmap flags.
In 816e68f94f the display of unset bits has been
effectively disabled while only the check for 0 bits was supposed to be avoided
(because it creates the infite loop).

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Oct  9 19:56:39 CEST 2013 on sn-devel-104
2013-10-09 19:56:39 +02:00
Volker Lendecke
7c0277c923 librpc: Fix blank line endings
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct  2 15:02:07 CEST 2013 on sn-devel-104
2013-10-02 15:02:07 +02:00
Volker Lendecke
816e68f94f libndr: Fix ndr_print_bitmap_flag for value=0
Don't endlessly loop

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-02 13:08:01 +02:00
Matthieu Patou
9ac32866db librpc: return a ndr_pull_error instead of just NDR_ERR_NDR64 when upper bits of 64 bit value are not 0
Signed-off-by: Matthieu Patou <mat@matws.net>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2013-10-02 13:07:33 +02:00
Stefan Metzmacher
c18c6c9fb5 librpc/ndr: make use of ndr_dump_data() in ndr_print_array_uint8()
It's much easier to look at hexdump -C style output than
a few thousand lines with 1 byte each.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Matthieu Patou <mat@matws.net>
2013-09-24 00:11:07 +02:00
Stefan Metzmacher
3d3e8b53bf librpc/ndr: make ndr_pull/push_DATA_BLOB NDR64 aware
Pair-Programmed-With: Matthieu Patou <mat@matws.net>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Matthieu Patou <mat@matws.net>
2013-09-24 00:10:57 +02:00
Günther Deschner
21200b12dc librpc/ndr: make sure ndr_table_list() always calls ndr_init_table() first.
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-09-20 13:07:01 +02:00
Günther Deschner
88c1dbf722 librpc/ndr: call ndr_table_list() from all ndr_X functions.
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-09-20 13:06:50 +02:00
Volker Lendecke
ecff2b2534 librpc: Fix some "ignored asprint result" warnings
While there, it removes some alloc/free calls

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-06-11 13:21:12 -07:00
Kai Blin
0f5e9d29f6 librpc: Add NDR_PRINT_DEBUGC to ndr print to a debug class
Signed-off-by: Kai Blin <kai@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-05-18 10:58:05 +02:00
Andreas Schneider
c8abc6f138 ndr: Pass down string_flags in ndr_pull_ntprinting_printer().
Reviewed-by: Günther Deschner <gd@samba.org>
2013-03-15 12:11:03 +01:00
Andreas Schneider
cc09762cb8 ndr: Add ndr_ntprinting_string_flags() function.
It defaults to utf8string.

Reviewed-by: Günther Deschner <gd@samba.org>
2013-03-15 12:11:02 +01:00
Andreas Schneider
8bfbb81bcd ndr: Comparing an array to null is always true.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2013-02-22 16:36:12 +01:00
Günther Deschner
4990080210 krb5pac: make sure to correctly store the highest relative pointer offset.
Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Fri Feb  1 21:19:28 CET 2013 on sn-devel-104
2013-02-01 21:19:28 +01:00
Andreas Schneider
4d02e868f6 ndr: Check return code of ndr_pull_advance().
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
2012-12-21 13:56:00 +01:00
Günther Deschner
8835eab013 ntprinting: mark the final 4 byte null pointer for printer data in ndr_pull_ntprinting_printer as read.
Guenther
2012-07-06 19:03:19 +02:00
David Disseldorp
0d3249b927 ndr: fix push/pull DATA_BLOB with NDR_NOALIGN
This change addresses bug 9026.
There are 3 use cases for DATA_BLOB marshalling/unmarshalling:

1)
ndr_push_DATA_BLOB and ndr_pull_DATA_BLOB when called with
LIBNDR_FLAG_ALIGN* alignment flags set, are used to push/pull padding
bytes _only_. The length is determined by the alignment required and
the current ndr offset.
e.g. dcerpc.idl:
        typedef struct {
...
                [flag(NDR_ALIGN8)]    DATA_BLOB _pad;
        } dcerpc_request;

2)
When called with the LIBNDR_FLAG_REMAINING flag, all remaining bytes in
the ndr buffer are pushed/pulled.
e.g. dcerpc.idl:
        typedef struct {
...
                [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
        } dcerpc_request;

3)
When called without alignment flags, push/pull a uint32 length _and_ a
corresponding byte array to/from the ndr buffer.
e.g. drsblobs.idl
        typedef [public] struct {
...
                DATA_BLOB data;
        } DsCompressedChunk;

The fix for bug 8373 changed the definition of "alignment flags", such
that when called with LIBNDR_FLAG_NOALIGN ndr_push/pull_DATA_BLOB
behaves as (1: padding bytes) rather than (3: uint32 length + byte
array).

This breaks marshalling/unmarshalling for the following structures.
eventlog.idl:
        typedef [flag(NDR_NOALIGN|NDR_PAHEX),public] struct {
...
                DATA_BLOB sid;
...
        } eventlog_Record_tdb;

ntprinting.idl:
        typedef [flag(NDR_NOALIGN),public] struct {
...
                DATA_BLOB *nt_dev_private;
        } ntprinting_devicemode;

        typedef [flag(NDR_NOALIGN),public] struct {
...
                DATA_BLOB data;
        } ntprinting_printer_data;

Signed-off-by: Günther Deschner <gd@samba.org>
2012-07-06 19:03:19 +02:00
Andrew Bartlett
15b9198644 librpc/ndr: Initilaise the remainder of struct dom_sid after a pull
This copes with the fact that r->sub_auths is a fixed-size array, not
an allocated pointer, and so will still have some bytes no filled in
if the sid did not have a MAX_SUB_AUTHS sub-authorities.

Andrew Bartlett
2012-06-28 18:46:23 +02:00
Stefan Metzmacher
9997b0ae39 Revert "s3: Fix bug 8371"
This reverts commit 2642f38588.

This is not needed anymore, as 035342c117
"Fix bug #8373 - Can't join XP Pro workstations to 3.6.1 DC." is
the more generic fix for the problem.

metze
2012-06-03 21:33:10 +02:00
Volker Lendecke
6f133c911f librpc: Fix an incompatible pointer type warning
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
2012-05-30 14:58:56 +02:00
Volker Lendecke
5bc261fff1 librpc: Fix some typos
Signed-off-by: Kai Blin <kai@samba.org>
2012-05-30 00:37:54 +02:00
Jeremy Allison
035342c117 Fix bug #8373 - Can't join XP Pro workstations to 3.6.1 DC.
Treat LIBNDR_FLAG_NOALIGN and LIBNDR_FLAG_REMAINING the same as the
other align flags - make them mutually exclusive.

Combined work from Metze, Günther and Jeremy.
2012-05-25 09:16:50 -07:00
Jelmer Vernooij
d875327b10 Move NS_GUID_string and NS_GUID_from_string to dsdb-common. 2012-03-20 13:54:07 +01:00
Jelmer Vernooij
0b6dea9d66 libndr: Define trivial is_valid_policy_hnd as macro.
This makes the NDR namespace a bit clearer, in preparation of ABI checking.
2012-03-20 13:54:07 +01:00
Jelmer Vernooij
b4d35bee38 libndr: Rename policy_handle_empty to ndr_policy_handle_empty.
This makes the NDR namespace a bit clearer, in preparation of ABI checking.
2012-03-20 13:54:07 +01:00
Jelmer Vernooij
f92b05b955 libndr: Rename policy_handle_equal to ndr_policy_handle_equal.
This makes the NDR namespace a bit clearer, in preparation of ABI checking.
2012-03-20 13:54:07 +01:00
Jelmer Vernooij
95ca5fbadd libndr: Rename ndr64_transfer_syntax and null_ndr_syntax_id so they have a ndr_ prefix.
This makes the NDR namespace a bit clearer, in preparation of ABI checking.
2012-03-20 13:54:07 +01:00
Amitay Isaacs
a0d6904ed3 ndr: dnsserver: Add pull and push functions for DNS_RPC_RECORD_STRING 2012-03-02 00:24:50 +11:00
Amitay Isaacs
7b8cd6fcf3 ndr: Add NDR pull, push, print functions for dnsp_string_list 2012-03-02 00:24:50 +11:00
Amitay Isaacs
c46763419a ndr: Fix NDR push function for dnsp_string
Push the actual length of the string not including null-termination.
2012-03-02 00:24:49 +11:00
Amitay Isaacs
ad1ef79486 ndr: Fix the error messages, add correct data type name 2012-03-02 00:24:49 +11:00
Volker Lendecke
e34e95feae libndr: Add ndr_map_error2errno
Autobuild-User: Volker Lendecke <vl@samba.org>
Autobuild-Date: Mon Feb 13 15:06:29 CET 2012 on sn-devel-104
2012-02-13 15:06:28 +01:00
David Disseldorp
ee292bf5f3 ndr: add ndr_pull_charset_to_null()
The same as ndr_pull_charset(), however only perform character
conversion on bytes prior to and including the null terminator.

Signed-off-by: Jeremy Allison <jra@samba.org>
2012-01-13 09:37:37 -08:00
Volker Lendecke
27d95cc8a6 librpc: Add support for struct timeval 2011-12-02 22:43:05 +01:00
Volker Lendecke
de1cd125ad librpc: Add support for struct timespec 2011-12-02 22:43:05 +01:00
Volker Lendecke
2642f38588 s3: Fix bug 8371
ndr_set_flag or's in the given flag (ALIGN4). At this point, ndr->flags
contains NOALIGN, which will persist. In ndr_push_DATA_BLOB NOALIGN overrides
everything else, so that the ALIGN4 is not respected.

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Nov 18 09:33:37 CET 2011 on sn-devel-104
2011-11-18 09:33:37 +01:00
Kai Blin
468fcfd8be dns: Fix offset check in ndr_pull_component
Autobuild-User: Kai Blin <kai@samba.org>
Autobuild-Date: Fri Nov  4 17:25:16 CET 2011 on sn-devel-104
2011-11-04 17:25:16 +01:00
Kai Blin
7f24a2b913 nbt: Fix offset check in ndr_pull_component 2011-11-04 15:51:59 +01:00
Günther Deschner
3978422fe1 nbt: create standard ndr_pull/push interface for common netlogon samlogon replies.
Guenther
2011-11-03 18:35:09 +01:00
Günther Deschner
768b42f334 nbt: move netlogon_samlogon_response into librpc/ndr/ndr_nbt.h.
Guenther
2011-11-03 18:35:08 +01:00
Günther Deschner
0de2bf97ff nbt: move nbt_string ndr functions to ndr/ndr_nbt.c helper.
Guenther
2011-11-03 18:35:08 +01:00
Günther Deschner
72879f491f nbt: merge in LIBCLI_NDR_NETLOGON helper into NDR_NBT.
Guenther
2011-11-03 18:35:08 +01:00
Amitay Isaacs
65f9a13dc3 s4-dns: Added support for multiple DNS_RPC_RECORDS structures
Windows returns multiple DNS_RPC_RECORDS structures, but there is
no well defined structure in [MS-DNSP] doc. Added hand-written
code to parse ndr.

Pair-Programmed-With: Andrew Tridgell <tridge@samba.org>

Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-10-20 05:53:05 +02:00
Andrew Bartlett
d40fe50a67 build: avoid util.h as a public header name due to conflict with MacOS 2011-09-23 09:24:03 +02:00
Andrew Tridgell
a19fd96ab8 libndr: add checking to all pull/push functions of base types
this checks that the passed in ndr_flags are valid

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-09-08 03:35:27 +02:00
Andrew Tridgell
1c25f5ebca libndr: moved the NDR_* flags to have less overlap
We have 3 different types of flags values in our NDR layer. We've
recently found bugs where these types of flags have been mixed up,
especially by people adding hand written ndr code for tricky
structures. We previously got away with this because (for example)
NDR_SCALARS and NDR_IN had the same value, so mixing up the two
concepts sometimes worked. Unfortunately it also led to bugs where we
didn't do what was expected, such as in our smbtorture ndr test suite,
where passing a ndr_flags value of zero led to only checking that two
empty structures were equal.

This changes the values of the NDR_IN|NDR_OUT and
NDR_SCALARS|NDR_BUFFERS values to be in different bit ranges, and adds
macros for checking the validity of passed in flags. A followup patch
modifies the ndr calls to use these macros, and pidl to generate
them. This should catch misuse of the APIs.

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-09-08 03:35:27 +02:00
Andrew Tridgell
3fbdd3fa01 ndr: range check on push of dom_sid blob
this ensures we get an error if we try to push a dom_sid with too many
sub_auths

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-09-05 11:19:25 +02:00
Andrew Tridgell
7d94c8ae19 drsblobs: fixed alignment of drs blobs authentication information
the two types of ndr flags were being mixed up, so NDR_BUFFERS was
being interpreted as LIBNDR_FLAG_NOALIGN

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
2011-09-05 11:19:25 +02:00
Stefan Metzmacher
857ad72cac ndr_drsuapi: fix compiler warning
metze
2011-08-09 13:53:01 +02:00
Andrew Bartlett
c1f8a74320 librpc/ndr remove _SAMBA_BUILD_ conditionals 2011-07-06 12:23:40 +10:00
Andrew Bartlett
125a2ff262 lib/util/charset: Remove 'display charset'
As discussed in 'CH_DISPLAY and gettext' on the samba-technical list:
http://lists.samba.org/archive/samba-technical/2011-June/078190.html

Setting this to a value other than 'unix charset' does not make sense,
as any system where the filesytem charset does not equal the terminal
charset will already have problems with programs as simple as 'ls'.
It also means that our output could not be pasted as our input in
interactive programs or onto our command line, as we never did
translate in the DISPLAY -> UNIX direction.

The d_printf() calls are retained in case we need to revisit this, and
to support display_set_stderr().

Andrew Bartlett
2011-06-23 13:47:27 +02:00
Günther Deschner
1dbe9706bc librpc: fix buildwarning in NDR_WMI.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Wed Jun 15 17:23:49 CEST 2011 on sn-devel-104
2011-06-15 17:23:48 +02:00
Günther Deschner
768ed8b985 librpc/ndr/ndr_table.h: fix licence/copyright
Guenther
2011-06-10 15:11:55 +02:00
Günther Deschner
8b75b65b36 librpc/ndr/ndr_spoolss_buf.h: fix licence/copyright
Guenther
2011-06-10 15:11:53 +02:00
Günther Deschner
4dadee3adf librpc/ndr/ndr_dns.h: fix licence/copyright
Guenther
2011-06-10 15:11:52 +02:00