1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00
Commit Graph

46 Commits

Author SHA1 Message Date
Andrew Tridgell
b902ea546d r5304: removed lib/socket/socket.h from includes.h 2007-10-10 13:09:39 -05:00
Andrew Tridgell
9db6c79e90 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.
2007-10-10 13:09:38 -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
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
c06b25c269 r4832: added simple testing of tcp sockets to LOCAL-SOCKET test 2007-10-10 13:08:59 -05:00
Andrew Tridgell
9f12a45a05 r4831: added udp support to our generic sockets library.
I decided to incorporate the udp support into the socket_ipv4.c
backend (and later in socket_ipv6.c) rather than doing a separate
backend, as so much of the code is shareable. Basically this adds a
socket_sendto() and a socket_recvfrom() call and not much all.

For udp servers, I decided to keep the call as socket_listen(), even
though dgram servers don't actually call listen(). This keeps the API
consistent.

I also added a simple local sockets testsuite in smbtorture,
LOCAL-SOCKET
2007-10-10 13:08:59 -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
e6c81d7c9f r4547: - added talloc_new(ctx) macro that is a neater form of the common talloc(ctx, 0) call.
- cleaned up some talloc usage in various files

I'd like to get to the point that we have no calls to talloc(), at
which point we will rename talloc_p() to talloc(), to encourage
everyone to use the typesafe functions.
2007-10-10 13:08:20 -05:00
Andrew Tridgell
98b5f73c1b r4473: - moved talloc into its own lib/talloc/ area
- added gcov flags to Makefile.talloc

- expanded talloc testsuite to add a test for realloc with a child ptr

- fixed a bug in talloc_realloc() with realloc of a ptr that has child ptrs
2007-10-10 13:07:55 -05:00
Andrew Tridgell
09e98c8745 r4466: rather than defining "STANDALONE" for building tdb, ldb and talloc
outside the tree, instead defined _SAMBA_BUILD_ inside the Samba
build. This makes it easier to pull code out of Samba for external
use.
2007-10-10 13:07:54 -05:00
Stefan Metzmacher
2783bf393f r4000: DATA_BLOB.data is uint8_t * not void * :-)
(thanks abartlet for telling me)

metze
2007-10-10 13:06:13 -05:00
Stefan Metzmacher
3f2c3ce2f0 r3967: fix compiler warnings
metze
2007-10-10 13:06:09 -05:00
Andrew Tridgell
02595c14ac r3749: don't consider it a failure if we fail to re-encode a codepoint above
1M, or in the case of non-UTF charsets, above 256
2007-10-10 13:05:50 -05:00
Andrew Bartlett
59757c7f9d r3553: Allow talloc_reference to take a NULL pointer for the "ptr" argument.
This allows potentially NULL pointers to be referenced, without an if ()
for every use.  (previously, it would segfault).

Update doco, and allow talloc_unlink to match.

Andrew Bartlett
2007-10-10 13:05:31 -05:00
Andrew Tridgell
0d51511d40 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.
2007-10-10 13:05:23 -05:00
Andrew Tridgell
264ce91810 r3447: more include/system/XXX.h include files 2007-10-10 13:05:12 -05:00
Andrew Tridgell
70055fb1f4 r3446: created include/system/iconv.h and include/system/shmem.h 2007-10-10 13:05:12 -05:00
Andrew Tridgell
b8f5fa8ac8 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.
2007-10-10 13:05:09 -05:00
Andrew Tridgell
7067bb9b52 r3324: made the smbtorture code completely warning free 2007-10-10 13:04:55 -05:00
Andrew Tridgell
cc93813e4a r3271: use "struct messaging_context *" instead of "void *" in messaging API 2007-10-10 13:04:48 -05:00
Jelmer Vernooij
18582083af r3167: Add a member 'endpoint' to the dcerpc_binding struct to use instead of
options[0].
2007-10-10 13:02:28 -05:00
Jelmer Vernooij
a0c4138edf r3157: Add ncacn_http 2007-10-10 13:02:27 -05:00
Jelmer Vernooij
f41dfc6c5a r3156: Couple of fixes in the conversion functions between binding structs and
protocol towers
2007-10-10 13:02:26 -05:00
Jelmer Vernooij
d560dcbdb8 r3136: - Allow specifying socket type when adding smbd service
- Make sure a epm_tower struct is completely initialized
- Some more minor fixes
2007-10-10 13:02:25 -05:00
Andrew Tridgell
f8d12d4b4a r3130: - added a LOCAL-IDTREE test suite
- made idtree return a "struct idr_context *" instead of a void*

- more efficient idr_remove for ids that are not present (patch from Jim Houston)
2007-10-10 13:02:24 -05:00
Jelmer Vernooij
0609f410ef r3125: Store object UUID directly instead of using a pointer (struct dcerpc_binding)
Let test fail if messaging_init() fails instead of generating segfault in the LOCAL-MESSAGING test
2007-10-10 13:02:23 -05:00
Jelmer Vernooij
88c6d34bba r3124: Add dcerpc_binding_from_tower()
Add tests for dcerpc_binding_from_tower()
2007-10-10 13:02:23 -05:00
Jelmer Vernooij
7a07c2c769 r3123: Add dcerpc_binding_build_tower()
Add local test for testing the functions dcerpc_parse_binding(),
	dcerpc_binding_string() and dcerpc_binding_build_tower()
2007-10-10 13:02:23 -05:00
Andrew Tridgell
8cddc610a2 r3026: - added automatic retry to messages when the servers listen queue is
full. This means callers can just "send and forget" rather than
  having to check for a temporary failure. The mechanism takes nice
  advantage of the timed events handling is our events code. A message
  will only fail now if we completely run out of some resource (such
  as memory).

- changed the test code not to do retries itself, but only to warn on real failures
2007-10-10 12:59:59 -05:00
Andrew Tridgell
8380225d32 r3023: added immediate send of messages when they are first queued. This makes things a bit more efficient 2007-10-10 12:59:59 -05:00
Andrew Tridgell
2c568d4dc2 r3021: under heavy load the listen queue for messaging unix domain socket can fill up, leading to refused
connections. The caller needs to retry. This adds testing of the retry in LOCAL-MESSAGING
2007-10-10 12:59:58 -05:00
Andrew Tridgell
68890247c1 r3019: make the LOCAL-MESSAGING test a 2 process test 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
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
Andrew Tridgell
5045482b14 r2799: removed one last occurance of torture_ldb_alloc() 2007-10-10 12:59:35 -05:00
Andrew Tridgell
6c563887f1 r2791: got rid of talloc_unreference() and instead created talloc_unlink(),
which is much clearer and simpler to use. It removes a specific parent
from a pointer, no matter whether that parent is a "reference" or a
direct parent. This gives complete control over the free process.
2007-10-10 12:59:34 -05:00
Andrew Tridgell
8d4dc99b82 r2744: ben elliston taught me about gcov today, which allows you to measure
the % coverage in terms of lines of code of a test suite. I thought a
good first place to start with gcov was the talloc test suite. When I
started the test suite covered about 60% of all lines of code in
talloc.c, and now it covers about 99%. The only lines not covered are
talloc corruption errors, as that would cause smb_panic() to fire.

It will be interesting to try gcov on the main Samba test suite for
smbd. We won't achieve 100% coverage, but it would be nice to get to
90% or more.

I also modified the talloc.c sources to be able to be build standalone, using:

  gcc -c -D_STANDALONE_ -Iinlcude lib/talloc.c

that should make it much easier to re-use talloc in other projects
2007-10-10 12:59:29 -05:00
Andrew Tridgell
18d3e2647f r2742: - fixed a bug in talloc_unreference()
- made the LOCAL-TALLOC smbtorture test much stricter, checking that
  block counts for every pointer are correct after every operation
2007-10-10 12:59:29 -05:00
Andrew Tridgell
a87584c8e3 r2718: - added a talloc_unreference() function as requested by metze.
- added documentation for talloc_unreference()

- made the abandoned child logic in talloc_free() clearer and more consistent
2007-10-10 12:59:26 -05:00
Andrew Tridgell
91669ea830 r2711: added a simple talloc speed tester. I get the following on my laptop:
MEASURING TALLOC VS MALLOC SPEED
  talloc: 279154 ops/sec
  malloc: 318758 ops/sec

which I think is an acceptable overhead for the increased functionality
2007-10-10 12:59:25 -05:00
Andrew Tridgell
911a8d590c r2709: finally solved the talloc reference problem.
The problem was that the simple "uint_t ref_count;" in a talloc chunk
did not give enough information. It told us that a pointer was
referenced more than once, but it didn't say who it was referenced
by. This means that when the pointer was freed we had no sane way to
clean up the reference.

I have now replaced ref_count with a "refs" list, which means that
references point to the pointer, and the pointer has a linked list of
references. So now we can cleanup from either direction without losing track of anything.

I've also added a LOCAL-TALLOC smbtorture test that tests talloc
behaviour for some common uses.
2007-10-10 12:59:24 -05:00
Andrew Tridgell
5cf9333f60 r2170: if we don't have a native iconv library then we can't build this test 2007-10-10 12:58:28 -05:00
Andrew Tridgell
e754d0cbca r2165: generalise the charset torture test to add testing of CP850
potentially we can test any charset
2007-10-10 12:58:28 -05:00
Andrew Tridgell
756f28ac95 r2159: converted samba4 over to UTF-16.
I had previously thought this was unnecessary, as windows doesn't use
standards compliant UTF-16, and for filesystem operations treats bytes
as UCS-2, but Bjoern Jacke has pointed out to me that this means we
don't correctly store extended UTF-16 characters as UTF-8 on
disk. This can be seen with (for example) the gothic characters with
codepoints above 64k.

This commit also adds a LOCAL-ICONV torture test that tests the first
1 million codepoints against the system iconv library, and tests 5
million random UTF-16LE buffers for identical error handling to the
system iconv library.

the lib/iconv.c changes need backporting to samba3
2007-10-10 12:58:27 -05:00