1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

259 Commits

Author SHA1 Message Date
Andrew Tridgell
f021c2da15 r7755: fixed an uninitialised event_ctx found by abartlet
(This used to be commit 1462da3b6d)
2007-10-10 13:18:31 -05:00
Jelmer Vernooij
fcc74fc060 r7313: Prefix a few functions with ncacn_ rather then dcerpc_ because they are
ncacn_ specific
(This used to be commit 875cce1268)
2007-10-10 13:17:41 -05:00
Jelmer Vernooij
430dc36c1a r7312: Add IDL for ncadg packets.
(This used to be commit 2009a430b0)
2007-10-10 13:17:40 -05:00
Jelmer Vernooij
e427f58622 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..
(This used to be commit 13cf227615)
2007-10-10 13:17:01 -05:00
Andrew Bartlett
b5da6b2c85 r6714: We can only ask GENSEC questions if we are authenticated.
Andrew Bartlett
(This used to be commit b429712f1e)
2007-10-10 13:16:37 -05:00
Stefan Metzmacher
fa24196d0d r6705: let the gensec module decide if messages can be signed and sealed in a different
order than a strict request - reply sequence

Note: we should also fix the client code...

metze
(This used to be commit 0a61d1f651)
2007-10-10 13:16:36 -05:00
Andrew Bartlett
6b6bb89c91 r6526: Rename this RPC fault. Everybody else calls this ACCESS_DENIED, and
it certainly doesn't make sense as LOGON_FAILURE.

Andrew Bartlett
(This used to be commit 4bec3d3f37)
2007-10-10 13:16:22 -05:00
Andrew Bartlett
df64302213 r5902: A rather large change...
I wanted to add a simple 'workstation' argument to the DCERPC
authenticated binding calls, but this patch kind of grew from there.

With SCHANNEL, the 'workstation' name (the netbios name of the client)
matters, as this is what ties the session between the NETLOGON ops and
the SCHANNEL bind.  This changes a lot of files, and these will again
be changed when jelmer does the credentials work.

I also correct some schannel IDL to distinguish between workstation
names and account names.  The distinction matters for domain trust
accounts.

Issues in handling this (issues with lifetime of talloc pointers)
caused me to change the 'creds_CredentialsState' and 'struct
dcerpc_binding' pointers to always be talloc()ed pointers.

In the schannel DB, we now store both the domain and computername, and
query on both.  This should ensure we fault correctly when the domain
is specified incorrectly in the SCHANNEL bind.

In the RPC-SCHANNEL test, I finally fixed a bug that vl pointed out,
where the comment claimed we re-used a connection, but in fact we made
a new connection.

This was achived by breaking apart some of the
dcerpc_secondary_connection() logic.

The addition of workstation handling was also propogated to NTLMSSP
and GENSEC, for completeness.

The RPC-SAMSYNC test has been cleaned up a little, using a loop over
usernames/passwords rather than manually expanded tests.  This will be
expanded further (the code in #if 0 in this patch) to use a newly
created user account for testing.

In making this test pass test_rpc.sh, I found a bug in the RPC-ECHO
server, caused by the removal of [ref] and the assoicated pointer from
the IDL.  This has been re-added, until the underlying pidl issues are
solved.
(This used to be commit 824289dcc2)
2007-10-10 13:11:07 -05:00
Andrew Tridgell
e82aad1ce3 r5298: - got rid of pstring.h from includes.h. This at least makes it a bit
less likely that anyone will use pstring for new code

 - got rid of winbind_client.h from includes.h. This one triggered a
   huge change, as winbind_client.h was including system/filesys.h and
   defining the old uint32 and uint16 types, as well as its own
   pstring and fstring.
(This used to be commit 9db6c79e90)
2007-10-10 13:09:38 -05:00
Andrew Tridgell
131dc76d56 r5197: moved events code to lib/events/ (suggestion from metze)
(This used to be commit 7f54c8a339)
2007-10-10 13:09:30 -05:00
Andrew Tridgell
66170ef8b3 r5185: make all the events data structures private to events.c. This will
make it possible to add optimisations to the events code such as
keeping the next timed event in a sorted list, and using epoll for
file descriptor events.

I also removed the loop events code, as it wasn't being used anywhere,
and changed timed events to always be one-shot (as adding a new timed
event in the event handler is so easy to do if needed)
(This used to be commit d7b4b6de51)
2007-10-10 13:09:29 -05:00
Andrew Tridgell
55d4d36993 r5102: This is a major simplification of the logic for controlling top level
servers in smbd. The old code still contained a fairly bit of legacy
from the time when smbd was only handling SMB connection. The new code
gets rid of all of the smb_server specific code in smbd/, and creates
a much simpler infrastructures for new server code.

Major changes include:

 - simplified the process model code a lot.

 - got rid of the top level server and service structures
   completely. The top level context is now the event_context. This
   got rid of service.h and server.h completely (they were the most
   confusing parts of the old code)

 - added service_stream.[ch] for the helper functions that are
   specific to stream type services (services that handle streams, and
   use a logically separate process per connection)

 - got rid of the builtin idle_handler code in the service logic, as
   none of the servers were using it, and it can easily be handled by
   a server in future by adding its own timed_event to the event
   context.

 - fixed some major memory leaks in the rpc server code.

 - added registration of servers, rather than hard coding our list of
   possible servers. This allows for servers as modules in the future.

 - temporarily disabled the winbind code until I add the helper
   functions for that type of server

 - added error checking on service startup. If a configured server
   fails to startup then smbd doesn't startup.

 - cleaned up the command line handling in smbd, removing unused options
(This used to be commit cf6a46c3cb)
2007-10-10 13:09:22 -05:00
Andrew Tridgell
759da3b915 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.
(This used to be commit ec32b22ed5)
2007-10-10 13:09:15 -05:00
Andrew Tridgell
61a3d370b9 r4758: - added async support to the session request code
- added async support to the negprot client code

- removed two unused parameters from smbcli_full_connection() code

- converted smbclient to use smbcli_full_connection() rather than
  reinventing everything itself
(This used to be commit 71cbe28734)
2007-10-10 13:08:50 -05:00
Stefan Metzmacher
9327ec51d1 r4728: split up server_services into:
- stream_socket services
  the smb, ldap and rpc service which sets up a srtam socket end then
  waits for connections
and
- task services
  which this you can create a seperate task that do something
  (this is also going through the process_model subsystem
  so with -M standard a new process for this created
  with -M thread a new thread ...

I'll add datagram services later when we whave support for datagram sockets in lib/socket/

see the next commit as an example for service_task's

metze
(This used to be commit d5fa02746c)
2007-10-10 13:08:49 -05:00
Andrew Tridgell
a2e754c294 r4712: slight tidy up in alter_context server
(This used to be commit 20ab5bed34)
2007-10-10 13:08:47 -05:00
Stefan Metzmacher
fae215266b r4690: - add support for async rpc server replies
the backend should check for
(dce_call->state_flags & DCESRV_CALL_STATE_FLAG_MAY_ASYNC)
then it's allowed to reply async

then the backend should mark that call as async with
dce_call->state_flags |= DCESRV_CALL_STATE_FLAG_ASYNC;

later it has to manualy set r->out.result
and then send the reply by calling

status = dcesrv_reply(p->dce_call);

NOTE: that ncacn_np doesn't support async replies yet

- implement an async version of echo_TestSleep

- reenable the echo_TestSleep torture test
  (this need to be more strict when we have support for async ncacn_np)

metze
(This used to be commit f0a0dbeb25)
2007-10-10 13:08:43 -05:00
Andrew Tridgell
34f6485dda r4642: added support for alter_context in the server for adding new interfaces to an existing pipe
(This used to be commit b6af57c868)
2007-10-10 13:08:38 -05:00
Andrew Tridgell
577218b2ad r4640: first stage in the server side support for multiple context_ids on one pipe
this stage does the following:

 - simplifies the dcerpc_handle handling, and all the callers of it

 - split out the context_id depenent state into a linked list of established contexts

 - fixed some talloc handling in several rpc servers that i noticed while doing the above
(This used to be commit fde042b3fc)
2007-10-10 13:08:38 -05:00
Stefan Metzmacher
46a32687da r4620: - add interface functions to the auth subsystem so that callers doesn't need to
use function pointers anymore
- make the module init much easier
- a lot of cleanups

don't try to read the diff in auth/ better read the new files

it passes test_echo.sh and test_rpc.sh

abartlet: please fix spelling fixes

metze
(This used to be commit 3c0d16b823)
2007-10-10 13:08:34 -05:00
Andrew Tridgell
e74b3ed6f1 r4618: - tidied up the alter_context client code a bit
- there is no alter_nak or alter_ack packet, its all done in an
  alter_response

- auto-allocated the contex_ids

- tried to fix up the dcom code to work again with
  alter_context. Jelmer, please take a look :)
(This used to be commit dd1c54add8)
2007-10-10 13:08:34 -05:00
Andrew Tridgell
11ce2cfd70 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.
(This used to be commit 6e7754abd0)
2007-10-10 13:08:30 -05:00
Stefan Metzmacher
4620625ea3 r4359: using talloc_free() of a child struct in a talloc_destructor is useless
metze
(This used to be commit e51f2cf43f)
2007-10-10 13:07:38 -05:00
Andrew Bartlett
0f1444b772 r4358: At metze's request, the Christmas elves have removed gensec_end in
favor of talloc_free().

Andrew Bartlett
(This used to be commit 1933cd12fb)
2007-10-10 13:07:37 -05:00
Stefan Metzmacher
bb072199b1 r4288: don't use struct dcerpc_interface_table anymore in the
main rpc server code. let the backends specify a ndr_push/ndr_pull function
like we already do with the dispatch() function.

this allows an interface implmentation to work as real proxy
without needing to know the idl for an interface that means
just the plain decrypted payload can be forwarded

If someone want to write such a backend, patches are wellcome

metze
(This used to be commit a150bdf140)
2007-10-10 13:07:32 -05:00
Andrew Tridgell
1960714669 r4161: two more fixes for NT4 clients. Bugs found by kukks.
- nt4 doesn't setup the pfc flags correctly for rpc packet types
   other than normal requests, so don't check for fragmented packets
   unless they are of type request

 - ensure we give STATUS_BUFFER_OVERFLOW when we return a partial
   fragment in SMBtrans requests on ncacn_np
(This used to be commit 83ebffec32)
2007-10-10 13:07:20 -05:00
Stefan Metzmacher
10918b7b70 r4082: support alter_context requests
metze
(This used to be commit ab6ec6b5f4)
2007-10-10 13:06:25 -05:00
Andrew Tridgell
58c326809a r4052: fixed a bunch of code to use the type safe _p allocation macros
(This used to be commit 80d15fa340)
2007-10-10 13:06:18 -05:00
Stefan Metzmacher
15543f18ac r4000: DATA_BLOB.data is uint8_t * not void * :-)
(thanks abartlet for telling me)

metze
(This used to be commit 2783bf393f)
2007-10-10 13:06:13 -05:00
Stefan Metzmacher
c199c2af1f r3968: fix compiler warnings
metze
(This used to be commit 6440476f7f)
2007-10-10 13:06:09 -05:00
Stefan Metzmacher
856ee66537 r3810: create a LIB_SECURITY subsystem
- move dom_sid, security_descriptor, security_* funtions to one place
  and rename some of them

metze
(This used to be commit b620bdd672)
2007-10-10 13:05:56 -05:00
Jelmer Vernooij
46badf1908 r3790: use a registration function that is called from dcerpc_*_init functions
rather then a large table in librpc/gen_ndr/tables.c. This will allow us
to only link in only the required gen_ndr files (speeds up linking quite a
bit, makes binaries smaller).

Each gen_ndr_* file now has a init function that calls the init functions
of the interfaces it contains. I did it this way to keep pidl's code simple,
though it might hurt startup time a bit. I'd be happy to change it if
people like one function better.
(This used to be commit 3c436590ae)
2007-10-10 13:05:53 -05:00
Jelmer Vernooij
31ded4901b r3737: - Get rid of the register_subsystem() and register_backend() functions.
- Re-disable tdbtool (it was building fine on my Debian box but other
					machines were having problems)
(This used to be commit 0d7bb2c40b)
2007-10-10 13:05:48 -05:00
Jelmer Vernooij
0639758dd9 r3630: More work on DCOM server side
(This used to be commit e995a1c0e5)
2007-10-10 13:05:40 -05:00
Jelmer Vernooij
71db46ea66 r3586: Fix some of the issues with the module init functions.
Both subsystems and modules can now have init functions, which can be
specified in .mk files (INIT_FUNCTION = ...)

The build system will define :
 - SUBSYSTEM_init_static_modules that calls the init functions of all statically compiled modules. Failing to load will generate an error which is not fatal
 - BINARY_init_subsystems that calls the init functions (if defined) for the subsystems the binary depends on

This removes the hack with the "static bool Initialised = " and the
"lazy_init" functions
(This used to be commit 7a8244761b)
2007-10-10 13:05:36 -05:00
Andrew Tridgell
dde0705807 r3507: - added deferred replies on sharing violation in pvfs open. The
deferred reply is short-circuited immediately when the file is
  closed by another user, allowing it to be opened by the waiting user.

- added a sane set of timeval manipulation routines

- converted all the events code and code that uses it to use struct
  timeval instead of time_t, which allows for microsecond resolution
  instead of 1 second resolution. This was needed for doing the pvfs
  deferred open code, and is why the patch is so big.
(This used to be commit 0d51511d40)
2007-10-10 13:05:23 -05:00
Andrew Tridgell
02785df1b0 r3497: removed some include cruft, and split out librpc/gen_ndr/tables.h
(This used to be commit 7dd3a5a6da)
2007-10-10 13:05:22 -05:00
Andrew Tridgell
c051779a0a r3468: split out dcerpc_server.h
(This used to be commit 729e0026e4)
2007-10-10 13:05:17 -05:00
Andrew Tridgell
3643fb1109 r3463: separated out some more headers (asn_1.h, messages.h, dlinklist.h and ioctl.h)
(This used to be commit b97e395c81)
2007-10-10 13:05:17 -05:00
Andrew Tridgell
edbfc0f6e7 r3453: - split out the auth and popt includes
- tidied up some of the system includes

- moved a few more structures back from misc.idl to netlogon.idl and samr.idl now that pidl
  knows about inter-IDL dependencies
(This used to be commit 7b7477ac42)
2007-10-10 13:05:13 -05:00
Andrew Tridgell
90067934cd r3428: switched to using minimal includes for the auto-generated RPC code.
The thing that finally convinced me that minimal includes was worth
pursuing for rpc was a compiler (tcc) that failed to build Samba due
to reaching internal limits of the size of include files. Also the
fact that includes.h.gch was 16MB, which really seems excessive. This
patch brings it back to 12M, which is still too large, but
better. Note that this patch speeds up compile times for both the pch
and non-pch case.

This change also includes the addition iof a "depends()" option in our
IDL files, allowing you to specify that one IDL file depends on
another. This capability was needed for the auto-includes generation.
(This used to be commit b8f5fa8ac8)
2007-10-10 13:05:09 -05:00
Andrew Tridgell
a6ae640313 r3323: more warning reductions
(This used to be commit 5921587ec2)
2007-10-10 13:04:55 -05:00
Andrew Tridgell
8262efeb0b r3320: fixed bugs in the rpc_server code in handling partial packet receives and sends
it now passes the non-blocking test suite
(This used to be commit 6cdf485fb2)
2007-10-10 13:04:54 -05:00
Jelmer Vernooij
06b3879c8f r3167: Add a member 'endpoint' to the dcerpc_binding struct to use instead of
options[0].
(This used to be commit 18582083af)
2007-10-10 13:02:28 -05:00
Jelmer Vernooij
026bae22de r3165: Support local connections in Gtk+ tools
(This used to be commit 3de0cf22dd)
2007-10-10 13:02:28 -05:00
Jelmer Vernooij
78e5bc76b6 r3163: Add server side support for ncalrpc: and ncacn_unix_stream:
Examples of binding strings are :

ncalrpc:[EPMAPPER]
ncacn_unix_stream:[/tmp/epmapper]

N.B. The unix socket support in lib/socket/ appears to close and remove the
socket it is listening on after the first client disconnects so until
that has been fixed, it is only possible to do one ncalrpc: or ncacn_unix_stream: request per instance of smbd :-)

Support for looking up NCALRPC names via the endpoint mapper will be added later.
(This used to be commit 426f3e63ca)
2007-10-10 13:02:28 -05:00
Jelmer Vernooij
a9081b527b r3118: Eliminate struct dcesrv_ep_description and replace it with
struct dcerpc_binding.
(This used to be commit 2046e14cf8)
2007-10-10 13:02:23 -05:00
Jelmer Vernooij
ac989eda6d r3114: - More work on merging the various structs that describe endpoints
- Add protocol sequence to dcerpc transports (will be used later on)
- Add more transports to the list
(This used to be commit ab110192e6)
2007-10-10 13:02:23 -05:00
Jelmer Vernooij
31403d548e r3043: Use binding strings for specifying endpoints. The property for
specifying a endpoint is now also 'endpoint' instead of 'endpoints'. The
default endpoint (if none is specified) is still "ncacn_np:[\\pipe\\ifacename]",
where ifacename is the name of the interface.

Examples:

[
  uuid(60a15ec5-4de8-11d7-a637-005056a20182),
  endpoint("ncacn_np:[\\pipe\\rpcecho]", "ncacn_ip_tcp:")
]
interface rpcecho
{
	void dummy();
}

dcerpc_binding is now converted to ep_description in the server, but I hope to
completely eliminate ep_description later on.

The eventual goal of all these changes is to make it easier to add
 transports as I'm going to add support for
 ncalrpc (local RPC over named pipes) and ncacn_unix_stream (Unix sockets).
(This used to be commit f3da7c8b44)
2007-10-10 13:01:53 -05:00
Andrew Tridgell
b2f1a29e43 r2710: continue with the new style of providing a parent context whenever
possible to a structure creation routine. This makes for much easier
global cleanup.
(This used to be commit e14ee428ec)
2007-10-10 12:59:25 -05:00
Andrew Tridgell
0be5523afb r2673: in the rpc server, free up the old call when we decide to extend an
existing call rather than creating a new one. This prevents call
structures hanging around on the rpc connection context until it is
closed
(This used to be commit c51ca7c0e7)
2007-10-10 12:59:20 -05:00
Andrew Tridgell
5b44130afa 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.
(This used to be commit 8dc23821c9)
2007-10-10 12:59:20 -05:00
Andrew Tridgell
e3880fa759 r2660: - converted the libcli/raw/ library to use talloc_increase_ref_count()
rather than manual reference counts

- properly support SMBexit in the cifs and posix backends

- added a logoff method to all backends

With these changes the RAW-CONTEXT test now passes against the posix backend
(This used to be commit c315d6ac1c)
2007-10-10 12:59:18 -05:00
Andrew Tridgell
764eddb696 r2646: - use a talloc destructor to ensure that sockets from the new socket
library are closed on abnormal termination

- convert the service.h structures to the new talloc methods
(This used to be commit 2dc334a328)
2007-10-10 12:59:16 -05:00
Andrew Tridgell
d79c7d41da r2627: use the new talloc capabilities in a bunch more places in the rpc
server code. This fixes a number of memory leaks I found when testing
with valgrind and smbtorture, as the cascading effect of a
talloc_free() ensures that anything derived from the top level object
is destroyed on disconnect.
(This used to be commit 76d0b8206c)
2007-10-10 12:59:13 -05:00
Stefan Metzmacher
7d06a06584 r2447: let the server code use the new lib/socket/ stuff
metze
(This used to be commit 2fd577d241)
2007-10-10 12:58:54 -05:00
Andrew Tridgell
2d5ca36872 r2301: add a server side warning when we receive more RPC data than we
expect. It isn't an error as w2k3 does this on its first packet when
NTLM2 signing is used.
(This used to be commit daaee86d14)
2007-10-10 12:58:41 -05:00
Andrew Bartlett
15a96c4298 r2290: Fix 'lsakey' for the server-side, it is static for
'authenticated' connections.

Fix kerberos session key issues - we need to call the
routine for extracting the session key, not just read the cache.

Andrew Bartlett
(This used to be commit b80d849b6b)
2007-10-10 12:58:40 -05:00
Andrew Tridgell
fa419c9255 r2280: fixed the session key choice for ncacn_np and ncacn_ip_tcp in the rpc server
(This used to be commit 3b4ed24f4b)
2007-10-10 12:58:38 -05:00
Tim Potter
8293df91bc r2247: talloc_destroy -> talloc_free
(This used to be commit 6c1a72c5d6)
2007-10-10 12:58:34 -05:00
Andrew Tridgell
294f6f1694 r2050: fixed a case where code assumed you could Realloc the result of a data_blob()
(This used to be commit 1fdccf8dc7)
2007-10-10 12:58:21 -05:00
Andrew Tridgell
2ed3ab021d r2038: get rid of the optimisation in the dcerpc server that tries to avoid a
data copy by playing internal games with DATA_BLOB and free().
(This used to be commit 5894b5c0f3)
2007-10-10 12:58:19 -05:00
Andrew Bartlett
aca6a1e1ee r1993: Allow WinXP domain logon to progress a bit further (it seems broken for me).
Fix indent, and add a few more useful debug messages.

Send a fault, if the bind is not accepted - don't just leave the client hanging.

Andrew Bartlett
(This used to be commit 486215edc1)
2007-10-10 12:58:15 -05:00
Andrew Tridgell
b83ba93eae 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().
(This used to be commit e35bb094c5)
2007-10-10 12:58:14 -05:00
Stefan Metzmacher
b1be11a13b r1843: return DCERPC_FAULT_LOGON_FAILURE when the auth fails
metze
(This used to be commit a6ce6ee878)
2007-10-10 12:58:00 -05:00
Andrew Tridgell
e2357c67f5 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.
(This used to be commit ecb7378bbc)
2007-10-10 12:57:54 -05:00
Stefan Metzmacher
3d4879fdc9 r1513: change DEBUG level to 1
metze
(This used to be commit d7dd5347dd)
2007-10-10 12:57:37 -05:00
Stefan Metzmacher
45a85bdd35 r1486: commit the start of the generic server infastructure
the idea is to have services as modules (smb, dcerpc, swat, ...)

the process_model don't know about the service it self anymore.

TODO:
- the smbsrv should use the smbsrv_send function
- the service subsystem init should be done like for other modules
- we need to have a generic socket subsystem, which handle stream, datagram,
  and virtuell other sockets( e.g. for the ntvfs_ipc module to connect to the dcerpc server
  , or for smb or dcerpc or whatever to connect to a server wide auth service)
- and other fixes...

NOTE: process model pthread seems to be broken( but also before this patch!)

metze
(This used to be commit bbe5e00715)
2007-10-10 12:57:35 -05:00
Andrew Bartlett
dc9f55dbec 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
(This used to be commit 07fd885fd4)
2007-10-10 12:56:49 -05:00
Tim Potter
62aabf5630 r1204: decrpc -> dcerpc
(This used to be commit a5e3a26fc9)
2007-10-10 12:56:45 -05:00
Andrew Tridgell
b00103dac1 r1165: fixed handling of SMBtrans replies that should return STATUS_BUFFER_OVERFLOW when more data is present.
(This used to be commit 0e557fe857)
2007-10-10 12:56:42 -05:00
Andrew Tridgell
bccac81d87 r1136: - added IDL for netr_LogonGetDomainInfo()
- added workstation to auth_session_info in rpc servers

- added session key fetch hook in crypto backends in dcesrv

- store and fetch seed as well as a session key in schannel ldb

- when a client uses schannel to setup a netlogon pipe connection we
  also need to setup the credentials from the schannel negotiation so
  credentials chaining works

- added server side netr_LogonGetDomainInfo() call
(This used to be commit a35459387d)
2007-10-10 12:56:39 -05:00
Stefan Metzmacher
b717b40235 r1078: the dxesrv_crypto_* implementations should now explicit set
the dce_conn->auth_state.session_info
( the ntlmssp one works fine, but the schannel one isn't implemented yet)

this is also set by the ntvfs_ipc backend on the endpoint connect.

metze
(This used to be commit ad3dd1789e)
2007-10-10 12:56:37 -05:00
Andrew Tridgell
f5108651ee r1057: added rpc packet logging for packets that generate rpc faults. This
makes it much easier to develop the IDL for new requests, especially
for sealed pipes, where ethereal cannot easily extract the data.
(This used to be commit 0cde043592)
2007-10-10 12:56:35 -05:00
Stefan Metzmacher
5165fec02e r1004: continue tridge's work on dcerpc server auth/crypto code
I made it much more generic, and we should be able to add a
module interface to this code, so that other DCERPC_AUTH types can be added
via modules...

metze
(This used to be commit d09abeb686)
2007-10-10 12:56:25 -05:00
Andrew Tridgell
8087d844ef r995: - renamed many of our crypto routines to use the industry standard
names rather than our crazy naming scheme. So DES is now called
  des_crypt() rather than smbhash()

- added the code from the solution of the ADS crypto challenge that
  allows Samba to correctly handle a 128 bit session key in all of the
  netr_ServerAuthenticateX() varients. A huge thanks to Luke Howard
  from PADL for solving this one!

- restructured the server side rpc authentication to allow for other
  than NTLMSSP sign and seal. This commit just adds the structure, the
  next commit will add schannel server side support.

- added 128 bit session key support to our client side code, and
  testing against w2k3 with smbtorture. Works well.
(This used to be commit 729b2f41c9)
2007-10-10 12:56:25 -05:00
Andrew Tridgell
7a6d86fbc9 r918: - dcerpc endpoint name are case insensitive
this fix allows samba3 to join a samba4 domain using "net rpc join"
(This used to be commit 876a6eecc3)
2007-10-10 12:56:19 -05:00
Stefan Metzmacher
f88bf54c7f r889: convert samba4 to use [u]int16_t instead of [u]int16
metze
(This used to be commit af6f1f8a01)
2007-10-10 12:56:16 -05:00
Stefan Metzmacher
f9d8f8843d r884: convert samba4 to use [u]int32_t instead of [u]int32
metze
(This used to be commit 0e5517d937)
2007-10-10 12:56:15 -05:00
Stefan Metzmacher
b5edc0fc05 r649: return unknown interface when the client not yet
binds succesful to an interface

metze
(This used to be commit c39e450702)
2007-10-10 12:51:56 -05:00
Andrew Tridgell
0f581e4af9 r623: setUserInfo level 24 (password set) now works in the SAMR server. This includes all
of the password complexity, password history and other password restrictions.
(This used to be commit cb070b9084)
2007-10-10 12:51:55 -05:00
Andrew Tridgell
21e6b1531b r464: a big improvement to the API for writing server-side RPC
servers. Previously the server pipe code needed to return the RPC
level status (nearly always "OK") and separately set the function call
return using r->out.result. All the programmers writing servers
(metze, jelmer and me) were often getting this wrong, by doing things
like "return NT_STATUS_NO_MEMORY" which was really quite meaningless
as there is no code like that at the dcerpc level.

I have now modified pidl to generate the necessary boilerplate so that
just returning the status you want from the function will work. So for
a NTSTATUS function you return NT_STATUS_XXX and from a WERROR
function you return WERR_XXX. If you really want to generate a DCERPC
level fault rather than just a return value in your function then you
should use the DCESRV_FAULT() macro which will correctly generate a
fault for you.

As a side effect, this also adds automatic type checking of all of our
server side rpc functions, which was impossible with the old API. When
I changed the API I found and fixed quite a few functions with the
wrong type information, so this is definately useful.

I have also changed the server side template generation to generate a
DCERPC "operation range error" by default when you have not yet filled
in a server side function. This allows us to correctly implement
functions in any order in our rpc pipe servers and give the client the
right information about the fault.
(This used to be commit a4df5c7cf8)
2007-10-10 12:51:44 -05:00
Andrew Tridgell
cac54feea8 r445: fixed the bind_nak code
(This used to be commit f3799e7720)
2007-10-10 12:51:42 -05:00
Andrew Tridgell
1c5de896bc r67: added a destroy hook in the policy handle -> wire handle code to allow backends
to cleanup handle data
(This used to be commit af0c21c1e1)
2007-10-10 12:50:41 -05:00
Stefan Metzmacher
894e02f80c some DEBUG and comment fixes
metze
(This used to be commit 5ac4f87868)
2004-02-02 13:28:29 +00:00
Andrew Tridgell
7a4da9654e dcerpc server output now copes with the client blocking part way
through a read. This happens to also avoid a memcpy on output for
dcerpc over tcp.
(This used to be commit e7c53ad185)
2004-01-20 05:54:17 +00:00
Andrew Tridgell
4d39861f99 avoid a copy of the data being input to the dcerpc server in the most
common case of there being no pending partial data and a full dcerpc
packet being received.

We should use this same model for the smb server. It gives us
efficient memory usage while allowing for completely async socket
operations.
(This used to be commit 9aab321fb6)
2004-01-20 04:32:17 +00:00
Stefan Metzmacher
7e6cf43756 This patch adds a better dcerpc server infastructure.
1.) We now register endpoint servers add startup via register_backend()
    and later use the smb.conf 'dcerpc endpoint servers' parameter to setup the dcesrv_context

2.) each endpoint server can register at context creation time as much interfaces as it wants
    (multiple interfaces on one endpoint are supported!)
    (NOTE:  there's a difference between 'endpoint server' and 'endpoint'!
	    for details look at rpc_server/dcesrv_server.h)

3.) one endpoint can have a security descriptor registered to it self
    this will be checked in the future when a client wants to connect
    to an smb pipe endpoint.

4.) we now have a 'remote' endpoint server, which works like the ntvfs_cifs module
    it takes this options in the [globals] section:

    dcerpc remote:interfaces = srvsvc, winreg, w32time, epmapper
    dcerpc remote:binding = ...
    dcerpc remote:user = ...
    dcerpc remote:password = ...

5.) we currently have tree endpoint servers: epmapper, rpcecho and remote

    the default for the 'dcerpc endpiont servers = epmapper, rpcecho'

    for testing you can also do
    dcerpc endpoint servers = rpcecho, remote, epmapper
    dcerpc remote:interfaces = srvsvc, samr, netlogon

6,) please notice the the epmapper now only returns NO_ENTRIES
    (but I think we'll find a solution for this too:-)

7.) also there're some other stuff left, but step by step :-)

This patch also includes updates for the
register_subsystem() , ntvfs_init(), and some other funtions
to check for duplicate subsystem registration


metze

(hmmm, my first large commit...I hope it works as supposed :-)
(This used to be commit 917e45dafd)
2004-01-08 22:55:27 +00:00
Andrew Tridgell
7efa19cd22 added a smb.conf flag "rpc big endian" that tells our rpc server to
send packets in bigendian format.
(This used to be commit 44df662960)
2003-12-17 02:06:44 +00:00
Andrew Tridgell
6f12e4ace1 it turns out that a wire policy handle isn't a blob either, its a
uint32 followed by a GUID. I needed to fix this to support running in
mixed-mode rpc (where smbtorture is bigendian and w2k3 is
little-endian). Otherwise when you send back a policy handle the
server doesn't recognise it.
(This used to be commit 9b1c76a8e9)
2003-12-16 09:50:49 +00:00
Andrew Tridgell
24c22aef90 a fairly large commit!
This adds support for bigendian rpc in the client. I have installed
SUN pcnetlink locally and am using it to test the samba4 rpc
code. This allows us to easily find places where we have stuffed up
the types (such as 2 uint16 versus a uint32), as testing both
big-endian and little-endian easily shows which is correct. I have now
used this to fix several bugs like that in the samba4 IDL.

In order to make this work I also had to redefine a GUID as a true
structure, not a blob. From the pcnetlink wire it is clear that it is
indeed defined as a structure (the byte order changes). This required
changing lots of Samba code to use a GUID as a structure.

I also had to fix the if_version code in dcerpc syntax IDs, as it
turns out they are a single uint32 not two uint16s.

The big-endian support is a bit ugly at the moment, and breaks the
layering in some places. More work is needed, especially on the server
side.
(This used to be commit bb1af644a5)
2003-12-16 09:02:58 +00:00
Andrew Tridgell
79990c727c fixed the transfer syntax in the dcerpc bind reply
(This used to be commit 39a7c660f4)
2003-12-15 00:40:57 +00:00
Andrew Tridgell
f6eb8342cb added auto-generation of the server side boilerplate code for each
pipe.

The server side code gets generated as librpc/gen_ndr/ndr_NAME_s.c and
gets included in the pipe module
(This used to be commit bd3dcfe582)
2003-12-14 13:22:12 +00:00
Andrew Tridgell
a05882b34b fixed fragmented signed connections to our rpc server over SMB
(This used to be commit f5df126c25)
2003-12-14 12:21:21 +00:00
Andrew Tridgell
d009dc61f9 ntlmssp over rpc over tcp now fully works
I needed to hack the ntlmssp code a little, as the auth code in samba4
is out of date relative to the samba3 auth code. I need to do a merge :)
(This used to be commit 6ee0935afe)
2003-12-14 10:45:50 +00:00
Andrew Tridgell
089ae5e435 fixed some memory leaks in the rpc server code
(This used to be commit 2045855601)
2003-12-14 03:51:48 +00:00
Andrew Tridgell
8f6b3eb1a9 fixed a bug handling multiple PDUs being read from a socket at one
time in the rpc server.

started on the framework for the dcerpc authentication server code
(This used to be commit 74041b6a0a)
2003-12-14 01:09:10 +00:00
Andrew Tridgell
d262b8c3c7 completed the linkage between the endpoint mapper and the dcerpc
server endpoints. We can now successfully setup listening endpoints on
high ports, then use our endpoint mapper redirect incoming clients to
the right port.

also greatly cleanup the rpc over tcp session handling.
(This used to be commit 593bc29bbe)
2003-12-13 23:25:15 +00:00
Andrew Tridgell
8d79eb52f1 make the IO in the dcerpc over TCP server completely async, handling
partial packets on both input and output
(This used to be commit 4f46606af8)
2003-12-13 11:44:28 +00:00
Andrew Tridgell
d4705378ce dcerpc over tcp in the samba4 server now works to some extent. It
needs quite a bit more work to get it finished. The biggest missing
feature is the lack of NTLMSSP which is needed for basic
authentication over tcp
(This used to be commit 9fb0f03693)
2003-12-13 10:58:48 +00:00
Andrew Tridgell
8faa77f177 rpcdump.exe now works fine against a Samba4 server
for some reason the epm_Lookup replies can't be parsed by ethereal,
although w2k parses then fine as does the Samba4 NDR code.
(This used to be commit 097e7ca99d)
2003-12-13 04:46:50 +00:00
Andrew Tridgell
da86d3af31 added the epm_Map() call.
the RPC-EPMAPPER torture test now passes
(This used to be commit fbdcf9ef54)
2003-12-13 03:23:41 +00:00
Andrew Tridgell
340d9b71f9 added a basic dcerpc endpoint mapper to Samba4. Currently only
implements the epm_Lookup() call, I'll add the other important calls
soon. I was rather pleased to find that epm_Lookup() worked first
time, which is particularly surprising given its complexity.

This required quite a bit of new infrastructure:

  * a generic way of handling dcerpc policy handles in the rpc server

  * added type checked varients of talloc. These are much less error
    prone. I'd like to move to using these for nearly all uses of
    talloc.

  * added more dcerpc fault handling code, and translation from
    NTSTATUS to a dcerpc fault code

  * added data_blob_talloc_zero() for allocating an initially zero
    blob

  * added a endpoint enumeration hook in the dcerpc endpoint server
    operations
(This used to be commit 3f85f9b782)
2003-12-13 02:20:40 +00:00
Andrew Tridgell
fece5b7aba added support for sending bind_nak replies in the rpc server
(This used to be commit 6e7c50bcd9)
2003-12-12 06:12:41 +00:00
Andrew Tridgell
9d8ef74eac we now support pdu fragmentation on both input and output in the rpc
server code
(This used to be commit 4dac951718)
2003-12-12 05:30:00 +00:00
Andrew Tridgell
dab0deae83 added handling of fragmented requests in the rpc server
now we just need to handle fragmented replies ....
(This used to be commit 14005c95d7)
2003-12-12 05:01:41 +00:00
Andrew Tridgell
16309de71d * 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
(This used to be commit 46e0a35819)
2003-12-12 03:59:09 +00:00
Andrew Tridgell
fcc4efd1ea the next step in the dcerpc server code. Added the link between the
IPC IO routines and the dcerpc endpoint servers.
(This used to be commit 4929c53bc8)
2003-12-11 09:07:45 +00:00
Andrew Tridgell
188b2054a8 initial rpc server side infrastructure
(This used to be commit 3706af7a6c)
2003-12-10 22:21:04 +00:00