1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-31 01:48:16 +03:00

81 Commits

Author SHA1 Message Date
Stefan Metzmacher
483bb1418f r5797: - add idl property [subcontext_size()]
this can be used like this
  [subcontext_size(28),subcontext(0)] dom_sid sid;

  this descripes a fixed 28 byte buffer which contains a dom_sid,
  and the rest of the buffer is padded with zero bytes if the dom_sid doesn't
  need all 28 byte in it's ndr encoding.

- only push and pull the subcontext when we are in the NDR_SCALARS section
  (tridge, jelmer: I hope this is correct for all cases...!?:-)

metze
2007-10-10 13:11:04 -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
48d54a9b57 r5506: Simplify the use of subcontexts and make them a bit less a special case. 2007-10-10 13:10:52 -05:00
Jelmer Vernooij
53b4ecbcc7 r5363: - ndr_%_ptr -> ndr_%_unique_ptr
- ndr_%_relative% -> ndr_%_relative_ptr%
- Change pointer_default() default to "unique"
  (DCE uses "ptr" as default, MIDL doesn't follow the standard and uses "unique")
2007-10-10 13:09:46 -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
5707ebc9ec r5109: - fixed handling of zero-length subcontexts in the ndr library
- added error checking on socket startup in nbtd
2007-10-10 13:09:23 -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
ec32b22ed5 r5037: got rid of all of the TALLOC_DEPRECATED stuff. My apologies for the
large commit. I thought this was worthwhile to get done for
consistency.
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
89b74b5354 r4549: got rid of a lot more uses of plain talloc(), instead using
talloc_size() or talloc_array_p() where appropriate.

also fixed a memory leak in pvfs_copy_file() (failed to free a memory
context)
2007-10-10 13:08:25 -05:00
Andrew Tridgell
1a24a50384 r4526: - much simpler (and more accurate!) ndr_size_*() code generation. It
is less efficient, but I really doubt that matters.

- use enum in epmapper.idl for protocol type

- added support for "enum8bit" flag, used in epmapper.idl
2007-10-10 13:08:18 -05:00
Andrew Tridgell
3040cd6515 r4139: 2nd attempt at fixing the null ptr in size_is() problem. 2007-10-10 13:06:30 -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
Andrew Tridgell
80d15fa340 r4052: fixed a bunch of code to use the type safe _p allocation macros 2007-10-10 13:06:18 -05:00
Andrew Tridgell
c54253ed1b r3545: initial support for using extended attributes to hold extended dos attributes of files.
I decided to use IDL/NDR to encode the attribute, as it gives us a
simple way to describe and extend the saved attributes.

The xattr code needs to hook into quite a few more places in the pvfs
code, but this at least gets the basics done. I will start encoding
alternate data streams streams, DOS EAs etc soon using the same basic
mechanism.

I'll probably stick to "version 1" for the xattr.idl for quite a while
even though it will be changing, as I don't expect anyone to be
deploying this in production just yet. Once we have production users
we will need to keep compatibility by supporting all the old version
numbers in xattr.idl.
2007-10-10 13:05:30 -05:00
Andrew Tridgell
b97e395c81 r3463: separated out some more headers (asn_1.h, messages.h, dlinklist.h and ioctl.h) 2007-10-10 13:05:17 -05:00
Andrew Tridgell
02d5d0f685 r3322: fixed a bunch of warnings in the build, including one case where it was a real bug 2007-10-10 13:04:55 -05:00
Tim Potter
e080a2483d r3036: Add function to pull an array of structures. Abstracts away the
individual routines in ndr_spoolss_buf.c.
2007-10-10 13:00:01 -05:00
Andrew Tridgell
cc00f9b6b8 r2968: fixed the byte order problem with the new RHS parsing on ncacn_ip_tcp 2007-10-10 12:59:53 -05:00
Andrew Tridgell
8dc23821c9 r2671: we're getting too many errors caused by the talloc_realloc() API not
taking a context (so when you pass a NULL pointer you end up with
memory in a top level context). Fixed it by changing the API to take a
context. The context is only used if the pointer you are reallocing is
NULL.
2007-10-10 12:59:20 -05:00
Andrew Tridgell
dabc7ddd9f r2625: use talloc_p, not talloc when possible (when allocating a structure in particular), as it gives us type checking. 2007-10-10 12:59:13 -05:00
Tim Potter
6c1a72c5d6 r2247: talloc_destroy -> talloc_free 2007-10-10 12:58:34 -05:00
Volker Lendecke
ef5414676e r2208: little attempt to (almost) fix spoolss relative 2007-10-10 12:58:31 -05:00
Andrew Tridgell
8ffe136ad2 r2206: another (untested) attempt to make RELATIVE_CURRENT work for volker,
plus removed unused ndr_pull_relative() function

once volker commits a test for this I'll be able to ensure it really works as expected
2007-10-10 12:58:31 -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
Stefan Metzmacher
2de544181e r2121: fix compiler warning
metze
2007-10-10 12:58:26 -05:00
Andrew Tridgell
f5d004d8eb r2100: rework the dcerpc client side library so that it is async. We now
generate a separate *_send() async function for every RPC call, and
there is a single dcerpc_ndr_request_recv() call that processes the
receive side of any rpc call. The caller can use
dcerpc_event_context() to get a pointer to the event context for the
pipe so that events can be waited for asynchronously.

The only part that remains synchronous is the initial bind
calls. These could also be made async if necessary, although I suspect
most applications won't need them to be.
2007-10-10 12:58:24 -05:00
Andrew Bartlett
8115e44d47 r2055: Add PRINTF_ATTRIBUTE to many more parts of the code, and a new
--enable-developer warning for when they are missing.

Andrew Bartlett
2007-10-10 12:58:21 -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
Andrew Tridgell
e35bb094c5 r1983: a completely new implementation of talloc
This version does the following:

  1) talloc_free(), talloc_realloc() and talloc_steal() lose their
     (redundent) first arguments

  2) you can use _any_ talloc pointer as a talloc context to allocate
     more memory. This allows you to create complex data structures
     where the top level structure is the logical parent of the next
     level down, and those are the parents of the level below
     that. Then destroy either the lot with a single talloc_free() or
     destroy any sub-part with a talloc_free() of that part

  3) you can name any pointer. Use talloc_named() which is just like
     talloc() but takes the printf style name argument as well as the
     parent context and the size.

The whole thing ends up being a very simple piece of code, although
some of the pointer walking gets hairy.

So far, I'm just using the new talloc() like the old one. The next
step is to actually take advantage of the new interface
properly. Expect some new commits soon that simplify some common
coding styles in samba4 by using the new talloc().
2007-10-10 12:58:14 -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
Andrew Tridgell
0d063725e1 r1671: make [relative] pointers in idl much more generic, treating them just
like normal pointers in most cases. This means we can now support
relative pointers to unions, builtin types etc, whereas we could only
previously support relative pointers to structures.

metze needs this for the PAC decoding.
2007-10-10 12:57:48 -05:00
Andrew Tridgell
573f56a447 r1644: changed the way [relative] pointers work in pidl, making them much
simpler. This doesn't appear to hurt any of the existing uses of
[relative], but fixes its use for svcctl that jelmer is working on.
2007-10-10 12:57:46 -05:00
Andrew Bartlett
07fd885fd4 r1294: A nice, large, commit...
This implements gensec for Samba's server side, and brings gensec up
to the standards of a full subsystem.

This means that use of the subsystem is by gensec_* functions, not
function pointers in structures (this is internal).  This causes
changes in all the existing gensec users.

Our RPC server no longer contains it's own generalised security
scheme, and now calls gensec directly.

Gensec has also taken over the role of auth/auth_ntlmssp.c

An important part of gensec, is the output of the 'session_info'
struct.  This is now reference counted, so that we can correctly free
it when a pipe is closed, no matter if it was inherited, or created by
per-pipe authentication.

The schannel code is reworked, to be in the same file for client and
server.

ntlm_auth is reworked to use gensec.

The major problem with this code is the way it relies on subsystem
auto-initialisation.  The primary reason for this commit now.is to
allow these problems to be looked at, and fixed.

There are problems with the new code:
- I've tested it with smbtorture, but currently don't have VMware and
  valgrind working (this I'll fix soon).
- The SPNEGO code is client-only at this point.
- We still do not do kerberos.

Andrew Bartlett
2007-10-10 12:56:49 -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
Tim Potter
6a39b17f6d r1264: Make sure to initialize ofs_list when creating new ndr_{push,pull}
structures.
2007-10-10 12:56:46 -05:00
Andrew Tridgell
f0940f1912 r1132: add a PRINTF_ATTRIBUTE to ndr_pull_error() to catch printf style coding errors 2007-10-10 12:56:39 -05:00
Andrew Tridgell
55e0b014fe r1048: - moved the schannel definitions into a separate schannel.idl
- added server side support for schannel type 23. This allows WinXP to establish a schannel connection
  to Samba4 as an ADS DC

- added client side support for schannel type 23, but disabled it as currently the client
  code has now way of getting the fully qualified domain name (which is needed)

- report dcerpc faults in the server code in the log
2007-10-10 12:56:34 -05:00
Stefan Metzmacher
af6f1f8a01 r889: convert samba4 to use [u]int16_t instead of [u]int16
metze
2007-10-10 12:56:16 -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
10844cf925 r327: fixed an uninitialised variable found by valgrind 2007-10-10 12:51:33 -05:00
Stefan Metzmacher
40abf3c584 - add 'print' to the DCERPC binding strings
e.g.
  ncacn_np:myserver:[samr,sign,print]

  will now enable the packet debugging

  and the debugging is not bound anymore to the debuglevel >= 2
  in the torture tests

- also the dcesrv_remote module now supports debugging of the packets
  use the 'dcerpc_remote:binding' smb.conf parameter.

metze
-
Andrew Tridgell
9cd0a0b8b9 addition of samr_SetSecurity() from kai
we needed to adjust the alignment of [relative] buffers for this to
work. I wonder if they are always 4 byte aligned?
-
Andrew Tridgell
46e0a35819 * the RPC-ECHO pipe now works in smbd, as long as the data sizes
don't cause fragmented pdus (I'll add fragments shortly)

 * change data_blob_talloc() to not zero memory when the 2nd argument
   is NULL. The zeroing just masks bugs, and can't even allow a DOS
   attack

 * modified pidl to ensure that [ref] arguments to the out side of
   functions are allocated when parsing the in side. This allows rpc
   backends to assume that [ref] variables are all setup. Doesn't work
   correctly for [ref] arrays yet

 * changed DLIST_ADD_END() to take the type instead of a tmp
   variable. This means you don't need to declare a silly tmp variable in
   the caller
-