1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-28 17:47:29 +03:00

80 Commits

Author SHA1 Message Date
Stefan Metzmacher
1a2b836958 r9373: - create a hierachical memory tree with recursiv ndr_pull_* functions
- with this it's also possible to talloc_free() the ndr_pull structure
  and talloc_steal(ndr->current_mem_ctx); to fetch the whole data of the hierachical tree
- if the toplevel struct is a valid talloc pointer it's also possible to use
  NDR_PULL_SET_MEM_CTX(ndr, mem_ctx); to the the toplevel pointer with the struct pointer

(NOTE: no callers are using this yet, but they shortly will)

metze
2007-10-10 13:33:29 -05:00
Andrew Tridgell
22f7fd7634 r8500: greatly reduce the number of build warnings on x86-64 (every NDR macro
in the generated code from pidl generated a warning)
2007-10-10 13:23:10 -05:00
Stefan Metzmacher
cdd03fe87d r8227: add STR_LARGE_SIZE flag, to support strings where the size is length+1,
metze
2007-10-10 13:19:22 -05:00
Stefan Metzmacher
d18303a0e2 r8212: fix pushing of nbt_string's:
- we now use an ndr_token_list, for the nbt string label pointer offsets
  this avoids to scan the whole buffer

- we need to check for already send string on a per component basis
  not only for the fullname

e.g.
w2k3 response this in the CLDAP netlogon replies

forest: w2k3.vmnet1.vm.base
dns_name: sub1.
pdc_dns_name: w2k3-104.

and this will be interpreted like

forest: w2k3.vmnet1.vm.base
dns_name: sub1.w2k3.vmnet1.vm.base
pdc_dns_name: w2k3-104.w2k3.vmnet1.vm.base

metze
2007-10-10 13:19:20 -05:00
Stefan Metzmacher
0eee179415 r8148: - make the PAC generation code a bit more readable and add some outof memory checks
- move to handmodified pull/push code for PAC_BUFFER
  to get the _ndr_size field and the subcontext size right

- after looking closely to the sample w2k3 PAC in our torture test (and some more in my archive)
  I found out that the first uint32 before the netr_SamInfo3 was also a pointer,
  (and we passed a NULL pointer there before, so I think that was the reason why the windows clients doesn't want our PAC)

  w2k3 uses this for unique pointers:

  ptr = ndr->ptr_count * 4;
  ptr |= 0x00020000;
  ndr->ptr_count;

- do one more pull/push round with the sample PAC

metze
2007-10-10 13:19:13 -05:00
Andrew Tridgell
eee528be97 r7865: changed pidl to take a "const void *" instead of a "void *" for the
structure in ndr_push_*() and ndr_print_*(). The push and print
functions really should not modify the structure.

metze, to make this work I had to change your spoolss hand
marshaller. Can you please check it is OK? I think that the IN and OUT
sides of that function are not ever called on the same structure, so I
think that attempt at remembering the value by assigning to
r->in._offered was not doing anything anyway, but please correct me if
I have misunderstood it.

If you really do need to remember something on those structures I'd
suggest the ndr_token_store() and ndr_token_retrieve() functions,
which are used by pidl for just this sort of thing.
2007-10-10 13:18:44 -05:00
Stefan Metzmacher
c0dd18326c r7186: add [relative_base] property, which is allowed on typedef's
(maybe we could add them to elements latter...)

with this property all relative pointers from inside the struct or union
are relative to the struct/union start

metze
2007-10-10 13:17:24 -05:00
Stefan Metzmacher
9a4e9f68fb r7182: remove current support for RELATIVE_CURRENT, this will be replaced with a better aproach later
metze
2007-10-10 13:17:23 -05:00
Jelmer Vernooij
13cf227615 r6973: Merge new version of pidl into the main SAMBA_4_0 branch.
The main difference in this new version is the extra data structure generated
between the IDL data structure and the NDR parser:

IDL -> NDR -> { ndr_parser, ndr_header, eparser, etc }

This makes the ndr_parser.pm internals much more sane.

Other changes include:

- Remove unnecessary calls with NDR_BUFFERS (for example, GUID doesn't have any buffers, just scalars) as well as some (unnecessary) nested setting of flags.
- Parse array loops in the C code rather then calling ndr_pull_array(). This allows us to have, for example, arrays of pointers or arrays of pointers to arrays, etc..
- Use if() {} rather then if () goto foo; everywhere
- NDR_IN no longer implies LIBNDR_FLAG_REF_ALLOC
- By default, top level pointers are now "ref" (as is the default in
  most other IDL compilers). This can be overridden using the
  default_pointer_top() property.
- initial work on new ethereal parser generators by Alan DeKok and me
- pidl now writes errors in the standard format used by compilers, which
  is parsable by most editors
- ability to warn about the fact that pidl extension(s) have been used,
  useful for making sure IDL files work with other IDL compilers.

oh, and there's probably some other things I can't think of right now..
2007-10-10 13:17:01 -05:00
Andrew Tridgell
bd27e626c2 r6720: added support for the remaining 2 types of CLDAP netlogon
response.

To work around the fact that the type of the returned data is not
encoded in the packet, this required adding ndr_pull_union_blob()
which allows us to pull a blob into a union with a specified switch
value, in this case the switch value comes from the calling NtVer field.
2007-10-10 13:16:37 -05:00
Stefan Metzmacher
a29d52817c r6519: move string handling functions to a seperate file
metze
2007-10-10 13:16:21 -05:00
Jelmer Vernooij
f66e11137e r6180: Use token_lists for storing switch values 2007-10-10 13:11:23 -05:00
Stefan Metzmacher
5e8558c5b4 r6129: - add our own MSZIP decompression implementation
(taken from cabextract.c from KDE)
  this code maybe need to be rewritten and the
  compression side needs to be done,
  but for now it seems to works

- remove the dependency to zlib

metze
2007-10-10 13:11:20 -05:00
Stefan Metzmacher
335adef370 r6061: add start of compression support in our rpc code
this is not complete cuurently...

but I want other people to test it and help me on finishing it.
(try to change the #if 0 in torture/rpc/drsuapi.c into #if 1)

metze
2007-10-10 13:11:16 -05:00
Jelmer Vernooij
e193555f0e r5775: Remove some unused functions (unions are no longer as special as they used to be)
Add oxid mapping table support in DCOM
2007-10-10 13:11:02 -05:00
Stefan Metzmacher
eaac0f2147 r5736: fix to avoid endless recursion in ndr_size_*() calculation
metze
2007-10-10 13:11:00 -05:00
Jelmer Vernooij
dc6b4ffc82 r5672: Use switch_type() and the token storage mechanism for unions:
- Makes union handling less special
 - Allows unions in arrays, etc
 - Compatible with midl
 - Pidl will warn about switch_type() and the type of the switch_is() variable being different
2007-10-10 13:10:58 -05:00
Jelmer Vernooij
54e0be6f1e r5663: Revert some changes I didn't mean to commit... 2007-10-10 13:10:57 -05:00
Jelmer Vernooij
a416de5825 r5661: Be a little stricter on syntax regarding arrays. A pointer to an
array can now only be :

 type *name[];

rather then :

 type *name;

which was supported in the past. Warnings will be given when the first
syntax is used. Reasons for this change in behaviour include improved
readability and the fact that the second format makes dealing with multiple
levels of pointers harder.
2007-10-10 13:10:57 -05:00
Jelmer Vernooij
d8a0a69721 r5360: Remove a couple of unused functions. 2007-10-10 13:09:45 -05:00
Jelmer Vernooij
ab490c0c88 r5286: Some first steps in making the pidl code somewhat more generic for the
various data types:

Add ndr_flags argument to all ndr push/pull scalar functions
2007-10-10 13:09:36 -05:00
Andrew Tridgell
61c43509f7 r5084: - handle arbitrary data in the NULL record reply type for nbt name queries
- fixed unaligned pulls at the end of the packet in the ndr lib
2007-10-10 13:09:20 -05:00
Andrew Tridgell
f86521677d r5034: - added a type mapping function in pidl, so the type names in our IDL
files don't need to match the type names in the generated headers

- with this type mapping we no longer need definitions for the
  deprecated "int32", "uint8" etc form of types. We can now force
  everyone to use the standard types int32_t, uint8_t etc.

- fixed all the code that used the deprecated types

- converted the IDL types "int64" and "uint64" to "dlong" and
  "udlong". These are the 4 byte aligned 64 bit integers that
  Microsoft internally define as two 32 bit integers in a
  structure. After discussions with Ronnie Sahlberg we decided that
  calling these "int64" was confusing, as it implied a true 8 byte
  aligned type

- fixed all the cases where we incorrectly used things like
  "NTTIME_hyper" in our C code. The generated API now uses a NTTIME for
  those. The fact that it is hyper-aligned on the wire is not relevant
  to the API, and should remain just a IDL property
2007-10-10 13:09:15 -05:00
Andrew Tridgell
ae7e625bfa r4885: added a new NBT client library. Features include:
- structures defined using IDL in nbt.idl
 - build around our events structure, and talloc
 - fully async
 - supports all NBT packet fields as per rfc1002
 - easy interfaces for name query and status

For the moment there are just a couple of test functions in
namequery.c, test_name_query() and test_name_status(). These will be
removed when we hook the new library into libcli/ fully

The new library will also be a fairly good basis for a nbt
server. Although it can't be a server as-is, I wrote it with the needs
of a server in mind (for example, extremely scalable idtree based
packet handling)
2007-10-10 13:09:01 -05:00
Andrew Tridgell
6e7754abd0 r4591: - converted the other _p talloc functions to not need _p
- added #if TALLOC_DEPRECATED around the _p functions

- fixes the code that broke from the above

while doing this I fixed quite a number of places that were
incorrectly using the non type-safe talloc functions to use the type
safe ones. Some were even doing multiplies for array allocation, which
is potentially unsafe.
2007-10-10 13:08:30 -05:00
Andrew Tridgell
2011bbeb84 r4550: talloc() is now typesafe. It is exactly equivalent to the old talloc_p() macro. Use
talloc_size() if you want the old behaviour.

I have kept talloc_p() as an alias for now. Once we change all calls
to be plain talloc() then we can remove it.
2007-10-10 13:08:26 -05:00
Andrew Tridgell
e839b19ec5 r4110: fixed pidl to allow arrays to have size_is() and length_is() elements
that depend on variables that come after the array in the structure or function.

This has been something that has been problematic for a while, but the
winreg QueryValue problem finally prompted me to fix it properly. We
should now go back and fix up all the ugly workarounds we have used to
avoid this problem in other calls.

Unfortunately the solution is fairly complex, and involves the use of
the internal ndr token lists (similar to the solution for relative
pointers). I wonder if anyone else will be able to follow the logic if
I get run over by a bus :-)
2007-10-10 13:06:27 -05:00
Stefan Metzmacher
717454eb2f r4102: more uint64 vs HYPER_T fixes
NOTE:
 [u]int64 uses 4 Byte alignment
 and HYPER_T uses 8 Byte alignment

metze
2007-10-10 13:06:26 -05:00
Andrew Tridgell
90cdfd921e r4051: use talloc_array() instead of talloc() when allocating arrays in auto-generated ndr code 2007-10-10 13:06:18 -05:00
Stefan Metzmacher
56c66f4a09 r3984: success full parse the repsFrom/repsTo LDAP fields
metze
2007-10-10 13:06:11 -05:00
Stefan Metzmacher
44f168c44d r3956: start to decode the repsFrom and repsTo fileds but not ready
metze
2007-10-10 13:06:07 -05:00
Jelmer Vernooij
8693344772 r3611: DCOM client support works!!
The torture test DCOM-SIMPLE now successfully does an
IStream_Read and a IStream_Write call.

This test can now be run successfully against the "Simple DCOM" Visual
Studio example.

(You have to quote out line 337 in pidl. pidl complains if the variable
 that contains the array size follows the array. I still need to fix this
 properly)

Next goals:
 - Clean up code
 - Server side support
 - Support custom marshalling
 - Support DCOM interfaces in files other then dcom.idl
2007-10-10 13:05:39 -05:00
Andrew Tridgell
bad6a88371 r3549: added support for DOS extended attribute lists (name/value pairs)
stored in posix xattrs
2007-10-10 13:05:31 -05:00
Stefan Metzmacher
8251d8b3e5 r3484: - add support for conformant string arrays at the end of a struct
- add support for strings where the length excludes the NULLTERM

metze
2007-10-10 13:05:21 -05:00
Andrew Tridgell
e694aeefe7 r3424: don't run mkproto.pl on pidl generated code, instead rely on pidl generating the
prototypes itself
2007-10-10 13:05:08 -05:00
Andrew Tridgell
2cf35cb4d2 r3395: added support for "string32" type, to fix the fixed width string
problem that tim found.
2007-10-10 13:05:05 -05:00
Jelmer Vernooij
7c823f886a r2990: Add support to pidl for autogenerating ndr_size_*() functions. Adding
the [gensize] property to a struct or union will make pidl generate a
ndr_size_*() function.

(not all nasty bits of NDR are completely covered yet by the
 ndr_size*() functions, support for those will be added when necessary)

I also have a local patch (not applied now) that simplifies the pidl output
and eliminates the number of functions required. It would, however, make
pidl more complex.
2007-10-10 12:59:55 -05:00
Andrew Tridgell
dbe6430d78 r2948: added support for the [range(low,high)] attribute in pidl. This allows
range checking of any integer value, to help protect against denial of
service attacks (which could otherwise cause large memory allocations)
2007-10-10 12:59:50 -05:00
Andrew Tridgell
bd45329a3f r2204: added [flag(RELATIVE_CURRENT)] to change [relative] pointer behaviour
for this struct and all sub-structures to be like spoolss relative
pointers (where offset is relative to current position).

volker will test this for me :)
2007-10-10 12:58:31 -05:00
Andrew Tridgell
7fdb778f81 r2180: added RPC flags "padcheck" which enables checking of all received pad
bytes to make sure they are zero. Non-zero values usually indicate one
of two things:

 - the server is leaking data through sending uninitialised memory
 - we have mistaken a real field in the IDL for padding

to differentiate between the two you really need to run with
"print,padcheck" and look carefully at whether the non-zero pad bytes
are random or appear to be deliberate.
2007-10-10 12:58:29 -05:00
Andrew Tridgell
6ffdfd7799 r1985: take advantage of the new talloc in a few more places 2007-10-10 12:58:14 -05:00
Stefan Metzmacher
874d450609 r1884: remove empty header file
metze
2007-10-10 12:58:08 -05:00
Stefan Metzmacher
7f1fceeb7f r1848: fix LIBNDR_STRING_FLAGS to include LIBNDR_STRING_BYTESIZE
metze
2007-10-10 12:58:01 -05:00
Stefan Metzmacher
6d094d60d3 r1847: add STR_BYTESIZE flag, to handle cases where
the size is in bytes not in unicode chars

metze
2007-10-10 12:58:01 -05:00
Andrew Tridgell
ecb7378bbc r1757: much simpler (and smaller, faster etc) way of doing relative pointers
in pidl. This mechanism should be much easier to extend to the
"retrospective subcontexts" that jelmer needs.

also produced more standards complient full-pointer offsets. This
keeps ethereal happy with decoding our epmapper frames.
2007-10-10 12:57:54 -05:00
Tim Potter
d379dcdfd5 r1269: Add a 'base' field to the ndr_ofs_list structure which is the base to
which the offset applies to.  In an array of structures containing
relative members, the offset applies to the start of the array element
being marshalled.  Previously, there was no way to access the relevant
structure start as by the time we have hit buffers, the head of the
offset list will be the last structure being marshalled.

Interestingly enough, this makes relstrs go away.  I think we thought
they were a special case in samba 3 but it turns out they are just
regular relative elements in the idl.  This makes spoolss a lot simpler
than I thought it would be.

I've run the samr and lsa tests and this doesn't seem to break anything.
It looks like security descriptors are the only structures that contain
relative members.

Oh yeah, this will probably require a 'make clean && make' otherwise you
will get bizzare errors.
2007-10-10 12:56:47 -05:00
Stefan Metzmacher
0e5517d937 r884: convert samba4 to use [u]int32_t instead of [u]int32
metze
2007-10-10 12:56:15 -05:00
Andrew Tridgell
1f89d89954 the endpoint mapper now works in bigendian mode -
Andrew Tridgell
3dd978b12b * netr_ServerPasswordSet() now works - the test suite changes the
machine account password.

  * neater handling on value() options in IDL. The auto-print code
    will now display the right value so you don't need to initialise
    it in your C code
-
Andrew Tridgell
bb42107dcc added netr_ServerReqChallenge and cleaned up byte array printing -