1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-12 20:58:37 +03:00

359 Commits

Author SHA1 Message Date
Stefan Metzmacher
c730d7d638 r3096: typo
metze
2007-10-10 13:02:20 -05:00
Stefan Metzmacher
f1d8f4bc5d r3094: import all LDAP error codes from the RFC 2251
metze
2007-10-10 13:02:20 -05:00
Andrew Tridgell
3457c1836c r3081: several updates to ntvfs and server side async request handling in
preparation for the full share modes and ntcreatex code that I am
working on.

highlights include:

 - changed the way a backend determines if it is allowed to process a
   request asynchronously. The previous method of looking at the
   send_fn caused problems when an intermediate ntvfs module disabled
   it, and the caller then wanted to finished processing using this
   function. The new method is a REQ_CONTROL_MAY_ASYNC flag in
   req->control_flags, which is also a bit easier to read

 - fixed 2 bugs in the readbraw server code. One related to trying to
   answer a readbraw with smb signing (which can't work, and crashed
   our signing code), the second related to error handling, which
   attempted to send a normal SMB error packet, when readbraw must
   send a 0 read reply (as it has no header)

 - added several more ntvfs_generic.c generic mapping functions. This
   means that backends no longer need to implement such esoteric
   functions as SMBwriteunlock() if they don't want to. The backend
   can just request the mapping layer turn it into a write followed by
   an unlock. This makes the backends considerably simpler as they
   only need to implement one style of each function for lock, read,
   write, open etc, rather than the full host of functions that SMB
   provides. A backend can still choose to implement them
   individually, of course, and the CIFS backend does that.

 - simplified the generic structures to make them identical to the
   principal call for several common SMB calls (such as
   RAW_WRITE_GENERIC now being an alias for RAW_WRITE_WRITEX).

 - started rewriting the pvfs_open() code in preparation for the full
   ntcreatex semantics.

 - in pvfs_open and ipc_open, initially allocate the open file
   structure as a child of the request, so on error we don't need to
   clean up. Then when we are going to succeed the open steal the
   pointer into the long term backend context. This makes for much
   simpler error handling (and fixes some bugs)

 - use a destructor in the ipc backend to make sure that everthing is
   cleaned up on receive error conditions.

 - switched the ipc backend to using idtree for fnum allocation

 - in the ntvfs_generic mapping routines, use a allocated secondary
   structure not a stack structure to ensure the request pointer
   remains valid even if the backend replies async.
2007-10-10 13:01:57 -05:00
Andrew Bartlett
9c911b361c r3079: make code more pretty :-)
Andrew Bartlett
2007-10-10 13:01:56 -05:00
Andrew Bartlett
173f29a1d8 r3075: Initialise (and check for intialisation) of the private pointer to
ensure we don't segfault on the cleanup from an incomplete schannel
bind.

Andrew Bartlett
2007-10-10 13:01:56 -05:00
Stefan Metzmacher
c79bbe54b4 r3044: resolve the error code for WERR_DS_OBJ_NOT_FOUND to the name
metze
2007-10-10 13:01:53 -05:00
Andrew Tridgell
1cef44505e r3017: nicer memory handling for event_context_merge() 2007-10-10 12:59:58 -05:00
Andrew Tridgell
3af06478da r3016: - converted the events code to talloc
- added the new messaging system, based on unix domain sockets. It
  gets over 10k messages/second on my laptop without any socket
  cacheing, which is better than I expected.

- added a LOCAL-MESSAGING torture test
2007-10-10 12:59:57 -05:00
Andrew Tridgell
04e1171996 r3005: added talloc wrappers around tdb_open() and ldb_connect(), so that the
caller doesn't have to worry about the constraint of only opening a
database a single time in a process. These wrappers will ensure that
only a single open is done, and will auto-close when the last instance
is gone.

When you are finished with a database pointer, use talloc_free() to
close it.

note that this code does not take account of the threads process
model, and does not yet take account of symlinks or hard links to tdb
files.
2007-10-10 12:59:56 -05:00
Stefan Metzmacher
e23dcb1887 r2884: parse LDAP Control messages
metze
2007-10-10 12:59:42 -05:00
Stefan Metzmacher
ad7b0385cf r2883: set BOOL to the internal values not the wire ones
metze
2007-10-10 12:59:42 -05:00
Stefan Metzmacher
cc77baf729 r2861: encode and decode BindRequest/Response correct
and some minor changes
- make ldap_encode/decode_response maore usable

metze
2007-10-10 12:59:40 -05:00
Stefan Metzmacher
30aa8af044 r2860: add gensec_have_feature() to check what feature are used in the connection
metze
2007-10-10 12:59:39 -05:00
Andrew Bartlett
18367c4235 r2859: It seems useful to allow the seal/unseal functions in gensec to pass
though to the sign/check_sig functions.

Andrew Bartlett
2007-10-10 12:59:39 -05:00
Andrew Tridgell
814881f0e5 r2857: this commit gets rid of smb_ucs2_t, wpstring and fpstring, plus lots of associated functions.
The motivation for this change was to avoid having to convert to/from
ucs2 strings for so many operations. Doing that was slow, used many
static buffers, and was also incorrect as it didn't cope properly with
unicode codepoints above 65536 (which could not be represented
correctly as smb_ucs2_t chars)

The two core functions that allowed this change are next_codepoint()
and push_codepoint(). These functions allow you to correctly walk a
arbitrary multi-byte string a character at a time without converting
the whole string to ucs2.

While doing this cleanup I also fixed several ucs2 string handling
bugs. See the commit for details.

The following code (which counts the number of occuraces of 'c' in a
string) shows how to use the new interface:

size_t count_chars(const char *s, char c)
{
	size_t count = 0;

	while (*s) {
		size_t size;
		codepoint_t c2 = next_codepoint(s, &size);
		if (c2 == c) count++;
		s += size;
	}

	return count;
}
2007-10-10 12:59:39 -05:00
Stefan Metzmacher
1dabd04e26 r2853: add torture test to find the defaultNamingContext on the RootDSE
try a sasl sealed CompareRequest

abartlet: we need to check how SINGING only can work,
          it failed for me:-(

metze
2007-10-10 12:59:38 -05:00
Stefan Metzmacher
778cf6d92b r2851: don't destroy the gensec context it's used for sign and seal
check the result of ldap_receive()

metze
2007-10-10 12:59:38 -05:00
Stefan Metzmacher
d02fab41f8 r2850: - check for GENSEC_WANT_SEAL in gensec_unseal_packet()
- pass functions to the subcontext in spnego

metze
2007-10-10 12:59:38 -05:00
Andrew Tridgell
ad5a5ea08d r2787: force masktest to use RAW_SEARCH_BOTH_DIRECTORY_INFO so it can obtain the short name 2007-10-10 12:59:33 -05:00
Stefan Metzmacher
4233067921 r2750: decode AbandonRequest correct (untested:-)
metze
2007-10-10 12:59:30 -05:00
Stefan Metzmacher
a62fbcb30f r2749: add asn1_read_implicit_Integer()
metze
2007-10-10 12:59:30 -05:00
Stefan Metzmacher
72dfea2b07 r2747: use DATA_BLOB for attribute values
en/decode CompareRequest/Response correct

metze
2007-10-10 12:59:29 -05:00
Andrew Tridgell
e14ee428ec 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.
2007-10-10 12:59:25 -05:00
Simo Sorce
ddd74dae8e r2695: revert "Del" renaming 2007-10-10 12:59:24 -05:00
Simo Sorce
3d587a7141 r2690: deleted by mistake 2007-10-10 12:59:22 -05:00
Simo Sorce
5ed9a6eb18 r2689: Use consistent naming Del -> Delete
Add delete functionality to ldb simple lda server backend
add some const in ldap.h
2007-10-10 12:59:22 -05:00
Andrew Tridgell
c82a9cf750 r2680: switched the libcli/raw/ code over to use talloc_reference(), which simplifies things quite a bit 2007-10-10 12:59:21 -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
278cef77f0 r2669: convert make_user_info() and associated functions from malloc to talloc 2007-10-10 12:59:19 -05:00
Andrew Tridgell
1ff41bbcae r2664: fixed the final server leak for normal operation. We now get a clean report from --leak-check 2007-10-10 12:59:19 -05:00
Andrew Tridgell
bd813dfb1b r2661: fixed a client side memory leak in the clilist code.
This sort of bug happens quite easily with the new talloc_realloc()
interface. talloc_realloc() now looks like this:

  void *talloc_realloc(void *ptr, size_t size);

and if ptr is not NULL then everything is fine. If ptr is NULL then
talloc_realloc() presumes you want to allocate in the NULL context,
which is probably not what is wanted.

For now the solution is to initialise ptr like this:
  ptr = talloc(mem_ctx, 0);
so when the realloc happens it has a context to get hold of.

I might change the interface of talloc_realloc() later to prevent this
problem in a more robust manner
2007-10-10 12:59:18 -05:00
Andrew Tridgell
c315d6ac1c 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
2007-10-10 12:59:18 -05:00
Andrew Tridgell
d5fd638875 r2655: fixed an error in the shutdown of the sock->transport->session->tree
smbcli raw context handling
2007-10-10 12:59:17 -05:00
Andrew Tridgell
2f1b788e09 r2654: fixed some more server memory leaks. We are now down to a single leak
of 16 bytes, caused by the 16 byte data_blob in the smb_signing
code.
2007-10-10 12:59:17 -05:00
Andrew Tridgell
4aba6e7101 r2650: fixed a memory leak in make_server_info() 2007-10-10 12:59:16 -05:00
Andrew Tridgell
6e721393d0 r2649: - used some cpp tricks to make users of talloc() and talloc_realloc()
to get auto-naming of pointers very cheaply.

- fixed a couple of memory leaks found with the new tricks

A typical exit report for smbd is now:

talloc report on 'null_context' (total 811 bytes in 54 blocks)
        auth/auth_sam.c:334            contains     20 bytes in   1 blocks
        struct auth_serversupplied_info contains    498 bytes in  33 blocks
        UNNAMED                        contains      8 bytes in   1 blocks
        lib/data_blob.c:40             contains     16 bytes in   1 blocks
        iconv(CP850,UTF8)              contains     61 bytes in   4 blocks
        iconv(UTF8,CP850)              contains     61 bytes in   4 blocks
        iconv(UTF8,UTF-16LE)           contains     67 bytes in   4 blocks
        iconv(UTF-16LE,UTF8)           contains     67 bytes in   4 blocks
        UNNAMED                        contains     13 bytes in   1 blocks

which is much better than before
2007-10-10 12:59:16 -05:00
Andrew Tridgell
230e1cd777 r2648: - use a destructor on struct server_connection to simplify the
connection termination cleanup, and to ensure that the event
  contexts are properly removed for every process model

- gave auth_context the new talloc treatment, which removes another
  source of memory leaks.
2007-10-10 12:59:16 -05:00
Andrew Tridgell
2dc334a328 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
2007-10-10 12:59:16 -05:00
Andrew Tridgell
b378aae95d r2645: converted the NTLMSSP code to the new style of talloc 2007-10-10 12:59:16 -05:00
Andrew Tridgell
f19201ea27 r2643: convert more of the auth subsyystem to the new talloc methods. This
also fixes a memory leak found with --leak-check.
2007-10-10 12:59:15 -05:00
Andrew Tridgell
f12ee2f241 r2629: convert gensec to the new talloc model
by making our gensec structures a talloc child of the open connection
we can be sure that it will be destroyed when the connection is
dropped.
2007-10-10 12:59:14 -05:00
Andrew Tridgell
e95e5c591f r2624: - save some system calls by only trying read/write operations that select has indicated are possible
- when a socket is dead, don't try to do anything more on it
2007-10-10 12:59:13 -05:00
Andrew Tridgell
e73b4ae4e5 r2621: - now that the client code is non-blocking, we no longer need
write_data and read_data, which are inherently blocking operations

- got rid of some old NBT keepalive routines that are not needed
2007-10-10 12:59:12 -05:00
Andrew Tridgell
5b967c1cbb r2587: fixed a couple of authentication memory leaks. There are more to be
fixed - I'll commit a little test suite soon.
2007-10-10 12:59:08 -05:00
Andrew Bartlett
dfecb01506 r2552: Character set conversion and string handling updates.
The intial motivation for this commit was to merge in some of the
bugfixes present in Samba3's chrcnv and string handling code into
Samba4.  However, along the way I found a lot of unused functions, and
decided to do a bit more...

The strlen_m code now does not use a fixed buffer, but more work is
needed to finish off other functions in str_util.c.  These fixed
length buffers hav caused very nasty, hard to chase down bugs at some
sites.

The strupper_m() function has a strupper_talloc() to replace it (we
need to go around and fix more uses, but it's a start).  Use of these
new functions will avoid bugs where the upper or lowercase version of
a string is a different length.

I have removed the push_*_allocate functions, which are replaced by
calls to push_*_talloc.  Likewise, pstring and other 'fixed length'
wrappers are removed, where possible.

I have removed the first ('base pointer') argument, used by push_ucs2,
as the Samba4 way of doing things ensures that this is always on an
even boundary anyway.  (It was used in only one place, in any case).
2007-10-10 12:59:05 -05:00
Andrew Bartlett
0e081ecb9d r2535: Make certain, that even if we have invalid ASN.1 here, and the caller does not check the return value, that we don't return uninitialised memory here.
Andrew Bartlett
2007-10-10 12:59:03 -05:00
Andrew Bartlett
69163500e0 r2534: Change NTLMSSP parsing to avoid a seperate str_chrnum() call - storing
away the string as a data blob to be put in the buffers later.

This also avoids a length-limited push_str, moving to push_ucs2_talloc().

Andrew Bartlett
2007-10-10 12:59:03 -05:00
Andrew Tridgell
4e4859c06b r2520: - finished implementing the server side of the old style search requests 2007-10-10 12:59:01 -05:00
Tim Potter
dff6262e4f r2516: Remove duplicate line. 2007-10-10 12:59:01 -05:00
Stefan Metzmacher
e942f414c5 r2508: - implemented ldap_decode() for UnbindRequest and ExtendedRequest
- fail when we got a wrong tag in ldap_decode()

metze
2007-10-10 12:59:00 -05:00