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

245 Commits

Author SHA1 Message Date
Alexander Bokovoy
95d96c79a5 r9321: Fix potential bug found by Coverity. src_len has to be int but later we do pass it as size_t. In case src_len is negative, we need to register a failure and return to the caller 2007-10-10 13:33:24 -05:00
Andrew Tridgell
cf1a7bbe96 r8893: fixed the valgrind error on stream termination due to prototol errors 2007-10-10 13:30:15 -05:00
Jelmer Vernooij
fac77f5fa2 r8811: Fix the build.. 2007-10-10 13:30:07 -05:00
Andrew Bartlett
c3cc14542e r8706: My previous patch oversimplied the previous change to session setup -
we didn't cope with the 'anonymous NTLM under SPNEGO' login.

Andrew Bartlett
2007-10-10 13:29:56 -05:00
Andrew Bartlett
ecbd2235a3 r8700: Propmted by tridge's need to do plaintext auth in ejs, rework the
user_info strcture in auth/

This moves it to a pattern much like that found in ntvfs, with
functions to migrate between PAIN, HASH and RESPONSE passwords.

Instead of make_user_info*() functions, we simply fill in the control
block in the callers, per recent dicussions on the lists.  This
removed a lot of data copies as well as error paths, as we can grab
much of it with talloc.

Andrew Bartlett
2007-10-10 13:29:55 -05:00
Andrew Tridgell
b1d577f48d r8658: move use of lp_security() and lp_nt_status_support() into the connection structure.
This massively reduces the number of lp_*() calls made
2007-10-10 13:29:50 -05:00
Andrew Tridgell
b40fb6a456 r8627: fixed a big memory leak in the spnego gensec code in session
setup. Andrew, please check over this.

What happens is this:

 - run the BASE-SECLEAK test
 - with each failed session setup using spnego a gensec ctx is leaked into the smb_conn structure
 - after the client disconnects these are finally cleaned up as they
   are all children of the connection structure
 - the cleanup of the millions of memory objects takes long enough
   that the next operation in test_posix.sh sometimes fails with a timeout

Andrew, can you also look at the talloc_reference() on line 332 of
sesssetup.c ? I suspect it isn't needed (I don't think it does any
actual harm though)
2007-10-10 13:29:45 -05:00
Andrew Tridgell
658befc1e4 r8577: added management calls to list current tree connects 2007-10-10 13:29:40 -05:00
Andrew Tridgell
391cfe3c96 r8574: added server side irpc calls for listing the current sessions 2007-10-10 13:29:39 -05:00
Andrew Tridgell
9eebd240d8 r8527: found an uninitialised variable in 'make valgrindtest' 2007-10-10 13:29:35 -05:00
Andrew Tridgell
adae47c829 r8487: kfixed a typo 2007-10-10 13:23:08 -05:00
Andrew Tridgell
8f69867867 r8272: added the hooks for adding a name to a messaging context, so we will
be able to send a message to the "ldap_server" task without having to
know its task ID.
2007-10-10 13:19:29 -05:00
Andrew Tridgell
5521060c08 r8119: fixed two error code returns in the smb server now that we have
torture code that can tell the difference between dos and ntstatus
codes without mapping
2007-10-10 13:19:10 -05:00
Stefan Metzmacher
a2e34475d7 r8028: fix a crash bug in ulogoff, when the tree_connect failed before
metze
2007-10-10 13:19:00 -05:00
Andrew Tridgell
6ee98c5f65 r7857: improved the handling of end-of-file on sockets in the smb server 2007-10-10 13:18:43 -05:00
Andrew Tridgell
45487e8a14 r7782: fixed an ordering problem with smb requests. I found this when I had "sam database"
set to the internal ldap server over loopback. The following happened:

  - DCERPC_AUTH3 request
     - auth requests calls ldb
     - ldb calls ldap
     - ldap calls our internal ldap server, triggering events
  - samrConnect from client
     - connect refused
  - SMBclose from client
     - causes dcerpc_pipe to be destroyed
  - AUTH3 continues
     - dies on freed pipe

I chose this solution as it provides a guarantee that backends only have to think about
async issues when they mark a request async. When they don't, this code guarantees that
a second request won't happen on the same connection while processing the first one
2007-10-10 13:18:36 -05:00
Andrew Bartlett
eb1d37c5a9 r7676: Make VUID and TID choice random, as this gives us protection against
replay attacks under SMB signing, where the session key is a fixed
derivitive of the user's password.

This removes the VID offset, but I'm not worried about random client
bytes mattering here, given the space (and the fact that it applies to
very, very old clients).

Andrew Bartlett
2007-10-10 13:18:21 -05:00
Andrew Bartlett
36dc2491d7 r7675: Use correct memory context for anonymous session setup auth context
(no need for it to hang around forever).

Add test for this behaviour.

Andrew Bartlett
2007-10-10 13:18:21 -05:00
Andrew Tridgell
3a3025485b r7633: this patch started as an attempt to make the dcerpc code use a given
event_context for the socket_connect() call, so that when things that
use dcerpc are running alongside anything else it doesn't block the
whole process during a connect.

Then of course I needed to change any code that created a dcerpc
connection (such as the auth code) to also take an event context, and
anything that called that and so on .... thus the size of the patch.

There were 3 places where I punted:

  - abartlet wanted me to add a gensec_set_event_context() call
    instead of adding it to the gensec init calls. Andrew, my
    apologies for not doing this. I didn't do it as adding a new
    parameter allowed me to catch all the callers with the
    compiler. Now that its done, we could go back and use
    gensec_set_event_context()

  - the ejs code calls auth initialisation, which means it should pass
    in the event context from the web server. I punted on that. Needs fixing.

  - I used a NULL event context in dcom_get_pipe(). This is equivalent
    to what we did already, but should be fixed to use a callers event
    context. Jelmer, can you think of a clean way to do that?

I also cleaned up a couple of things:

 - libnet_context_destroy() makes no sense. I removed it.

 - removed some unused vars in various places
2007-10-10 13:18:15 -05:00
Stefan Metzmacher
d9a0c61801 r7631: - remove unused function, as the disgn of samba4 doesn't allow the old style
auto homedir share stuff
- add TODO: for checking the password on share mode security

metze
2007-10-10 13:18:15 -05:00
Andrew Tridgell
9dab036fbe r7523: blergh
the error code for an invalid tid depends on the command
2007-10-10 13:18:06 -05:00
Andrew Tridgell
79112d81cb r7510: fixed error code for using a bad tid.
amazingly, I have seen w2k do a session setup followed by an immediate
attempted opening of \netlogon, with no tconx to ipc$ first. So this
error code can matter.
2007-10-10 13:18:02 -05:00
Simo Sorce
615618f192 r7222: remove double call to the same function in the same place, probable cut&paste error 2007-10-10 13:17:27 -05:00
Andrew Tridgell
2acc069185 r6342: fixed a bad union assumption that caused ACLs to fail on 64 bit machines
Thanks to lars and agruen for finding this
2007-10-10 13:11:33 -05:00
Andrew Bartlett
c2c8b6abf3 r6313: Much better handling of LogoffAndX when the vuid is invalid (ie, don't
segfault).  This should fix another of the issues that Richard came up
with last week.

Andrew Bartlett
2007-10-10 13:11:30 -05:00
Andrew Bartlett
c67a9370c4 r6312: Metze reminds me this header is no longer required.
Andrew Bartlett
2007-10-10 13:11:30 -05:00
Andrew Bartlett
0cbd11a0f2 r6310: Rename password.c to session.c, and remove the linked list of all
outstanding sessions, as we don't use it.

Andrew Bartlett
2007-10-10 13:11:30 -05:00
Andrew Bartlett
0bba8da460 r6309: Remove this file it is empty and unreferenced. (In preperation for
renaming password.c over the top, as it deals with sessions, not
passwords).

Andrew Bartlett
2007-10-10 13:11:30 -05:00
Andrew Bartlett
3e5775146d r6270: Move the VUID handling to a IDR tree. This should avoid O(n)
behaviour on session setups, and because we no longer need do deal
with the linked list as much, the code is much simpiler too.

We may be able to compleatly remove the tid and vuid linked lists, but
I need to check.

This patch also tries to clean up the VUID handling and session setups
in general.  To avoid security issues, we now have a distinction
between VUIDs allocated for the session setup (to tie togeather the
multiple round trips) and those used after authentication.

Andrew Bartlett
2007-10-10 13:11:29 -05:00
Andrew Tridgell
54c0284679 r6031: don't try to send errors when the socket has been destroyed 2007-10-10 13:11:16 -05:00
Andrew Bartlett
2301a4b38a r6028: A MAJOR update to intergrate the new credentails system fully with
GENSEC, and to pull SCHANNEL into GENSEC, by making it less 'special'.

GENSEC now no longer has it's own handling of 'set username' etc,
instead it uses cli_credentials calls.

In order to link the credentails code right though Samba, a lot of
interfaces have changed to remove 'username, domain, password'
arguments, and these have been replaced with a single 'struct
cli_credentials'.

In the session setup code, a new parameter 'workgroup' contains the
client/server current workgroup, which seems unrelated to the
authentication exchange (it was being filled in from the auth info).

This allows in particular kerberos to only call back for passwords
when it actually needs to perform the kinit.

The kerberos code has been modified not to use the SPNEGO provided
'principal name' (in the mechListMIC), but to instead use the name the
host was connected to as.  This better matches Microsoft behaviour,
is more secure and allows better use of standard kerberos functions.

To achieve this, I made changes to our socket code so that the
hostname (before name resolution) is now recorded on the socket.

In schannel, most of the code from librpc/rpc/dcerpc_schannel.c is now
in libcli/auth/schannel.c, and it looks much more like a standard
GENSEC module.  The actual sign/seal code moved to
libcli/auth/schannel_sign.c in a previous commit.

The schannel credentails structure is now merged with the rest of the
credentails, as many of the values (username, workstation, domain)
where already present there.  This makes handling this in a generic
manner much easier, as there is no longer a custom entry-point.

The auth_domain module continues to be developed, but is now just as
functional as auth_winbind.  The changes here are consequential to the
schannel changes.

The only removed function at this point is the RPC-LOGIN test
(simulating the load of a WinXP login), which needs much more work to
clean it up (it contains copies of too much code from all over the
torture suite, and I havn't been able to penetrate its 'structure').

Andrew Bartlett
2007-10-10 13:11:15 -05:00
Andrew Bartlett
50af206477 r5899: Fix spelling.
Andrew Bartlett
2007-10-10 13:11:07 -05:00
Andrew Tridgell
bf43c9bdcf r5308: trimmed back a lot of the old macros from smb_macros.h 2007-10-10 13:09:40 -05:00
Andrew Tridgell
bb1ab11d8e r5294: - added a separate NBT-WINS test for WINS operations (register, refresh, release and query)
- change the iface_n_*() functions to return a "const char *" instead of a "struct ipv4_addr"
  I think that in general we should move towards "const char *" for
  all IP addresses, as this makes IPv6 much easier, and is also easier
  to debug. Andrew, when you get a chance, could you fix some of the
  auth code to use strings for IPs ?

- return a NTSTATUS error on bad name queries and node status instead
  of using rcode. This makes the calling code simpler.

- added low level name release code in libcli/nbt/

- use a real IP in the register and wins nbt torture tests, as w2k3
  WINS server silently rejects some operations that don't come from the
  IP being used (eg. it says "yes" to a release, but does not in fact
  release the name)
2007-10-10 13:09:37 -05:00
Andrew Tridgell
7f54c8a339 r5197: moved events code to lib/events/ (suggestion from metze) 2007-10-10 13:09:30 -05:00
Andrew Tridgell
236403cc4d r5195: most events don't need the time of the event, so save a gettimeofday() call
and just use timeval_current() when its actually needed
2007-10-10 13:09:30 -05:00
Andrew Tridgell
90535bab95 r5193: make sure we mark the event dead when we free it on a dead connection 2007-10-10 13:09:29 -05:00
Andrew Tridgell
d7b4b6de51 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)
2007-10-10 13:09:29 -05:00
Andrew Tridgell
cf6a46c3cb 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
2007-10-10 13:09:22 -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
b06b8dd2f4 r4927: parse the NBT session request in the smb server. This gets rid of that
annoying "not parsing session request" message on each SMB connection
2007-10-10 13:09:06 -05:00
Andrew Tridgell
e54a97f8a6 r4819: its just not my day today .... 2007-10-10 13:08:59 -05:00
Andrew Tridgell
080d0518bc r4777: added a smb_composite_sesssetup() async composite function. This
encapsulates all the different session setup methods, including the
multi-pass spnego code.

I have hooked this into all the places that previously used the
RAW_SESSSETUP_GENERIC method, and have removed the old
RAW_SESSSETUP_GENERIC code from clisession.c and clitree.c. A nice
side effect is that these two modules are now very simple again, back
to being "raw" session setup handling, which was what was originally
intended.

I have also used this to replace the session setup code in the
smb_composite_connect() code, and used that to build a very simple
replacement for smbcli_tree_full_connection().

As a result, smbclient, smbtorture and all our other SMB connection
code now goes via these composite async functions. That should give
them a good workout!
2007-10-10 13:08:53 -05:00
Stefan Metzmacher
9ea9e1ced5 r4730: remove unused struct elements
part of this went in in the last commit...

metze
2007-10-10 13:08:49 -05:00
Stefan Metzmacher
d5fa02746c 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
2007-10-10 13:08:49 -05:00
Stefan Metzmacher
8308da6ce4 r4726: - use the name tcon and tid instead of conn and cnum
- make use of talloc destructors

metze
2007-10-10 13:08:48 -05:00
Stefan Metzmacher
f85ebd1e8e r4684: the smbsrv code should not know about rpc stuff
just vfs_ipc

metze
2007-10-10 13:08:43 -05:00
Stefan Metzmacher
3c0d16b823 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
2007-10-10 13:08:34 -05:00
Andrew Tridgell
76d905d12e r4611: - renamed add_socket() to smb_add_socket() as that is less confusing
- removed the spurious call to set_blocking() in the smb server setup.
2007-10-10 13:08:33 -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