samba.git
16 years agor2683: Fix a couple of compile warnings, depend on gtk+-2.4
Jelmer Vernooij [Mon, 27 Sep 2004 09:26:37 +0000 (09:26 +0000)]
r2683: Fix a couple of compile warnings, depend on gtk+-2.4

16 years agor2682: as sambdb holds all search data, don't double free the data
Stefan Metzmacher [Mon, 27 Sep 2004 09:21:52 +0000 (09:21 +0000)]
r2682: as sambdb holds all search data, don't double free the data

metze

16 years agor2681: commit the first semi working search implementation
Stefan Metzmacher [Mon, 27 Sep 2004 08:52:31 +0000 (08:52 +0000)]
r2681: commit the first semi working search implementation
which exports data from a ldb.

I commit this code, so that someone can help me to find a strange
bug

metze

16 years agor2680: switched the libcli/raw/ code over to use talloc_reference(), which simplifies...
Andrew Tridgell [Mon, 27 Sep 2004 08:41:39 +0000 (08:41 +0000)]
r2680: switched the libcli/raw/ code over to use talloc_reference(), which simplifies things quite a bit

16 years agor2679: fixed an uninitialised variable found with valgrind
Andrew Tridgell [Mon, 27 Sep 2004 08:39:51 +0000 (08:39 +0000)]
r2679: fixed an uninitialised variable found with valgrind

16 years agor2678: from_name and to_name aren't needed in smb_iconv_t
Andrew Tridgell [Mon, 27 Sep 2004 08:39:06 +0000 (08:39 +0000)]
r2678: from_name and to_name aren't needed in smb_iconv_t

16 years agor2677: - fixed a bug in the recursive logic talloc_free() when there are
Andrew Tridgell [Mon, 27 Sep 2004 08:38:13 +0000 (08:38 +0000)]
r2677: - fixed a bug in the recursive logic talloc_free() when there are
  circular references (circular references are allowed, they just need
  to be handled carefully inside talloc)

- mark talloc_reference() pointers nicely in the --leak-report-full
  code, so you see what has a reference to what in a useful manner

16 years agor2676: add a test of the reference counting logic in the SAMR server into the
Andrew Tridgell [Mon, 27 Sep 2004 05:15:14 +0000 (05:15 +0000)]
r2676: add a test of the reference counting logic in the SAMR server into the
RPC-SAMR torture test. This closes the samr connection before working
on a open domain handle. The server is supposed to know that the open
domain handle still holds a reference to the connection, so the
connection remains valid even though it has been closed.

16 years agor2675: added a convenience function
Andrew Tridgell [Mon, 27 Sep 2004 05:13:00 +0000 (05:13 +0000)]
r2675: added a convenience function

  void *talloc_reference(const void *context, const void *ptr);

this function makes a secondary reference to ptr, and hangs it off the
given context. This greatly simplifies some of the current reference
counting code in the samr server and I suspect it will be widely used
in other places too.

the way you use it is like this:

domain_state->connect_state = talloc_reference(domain_state, connect_state);

that makes the element connect_state of domain_state a secondary
reference to connect_state. The connect_state structure will then only
be freed when both domain_state and the original connect_state go
away, allowing you to free them independently and in any order.

you could do this alrady using a talloc destructor, and that is what
the samr server did previously, but that meant this construct was
being reinvented in several places. So this convenience function sets
up the destructor for you, giving a much more convenient and less
error prone API.

16 years agor2674: I have realised that talloc() should have its context marked const, as
Andrew Tridgell [Mon, 27 Sep 2004 04:20:18 +0000 (04:20 +0000)]
r2674: I have realised that talloc() should have its context marked const, as
a const pointer really means that "the data pointed to by this pointer
won't change", and that is certainly true of talloc(). The fact that
some behind-the-scenes meta-data can change doesn't matter from the
point of view of const.

this fixes a number of const warnings caused by const data structures
being passed as talloc contexts. That will no longer generate a
warning.

also changed the talloc leak reporting option from --leak-check to
--leak-report, as all it does is generate a report on exit. A new
--leak-report-full option has been added that shows the complete tree
of memory allocations, which is is quite useful in tracking things down.

NOTE: I find it quite useful to insert talloc_report_full(ptr, stderr)
calls at strategic points in the code while debugging memory
allocation problems, particularly before freeing a major context (such
as the connection context). This allows you to see if that context has
been accumulating too much data, such as per-request data, which
should have been freed when the request finished.

16 years agor2673: in the rpc server, free up the old call when we decide to extend an
Andrew Tridgell [Mon, 27 Sep 2004 04:11:37 +0000 (04:11 +0000)]
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

16 years agor2672: don't call a variable "dup" as that conflicts with a standard system call...
Andrew Tridgell [Mon, 27 Sep 2004 04:00:23 +0000 (04:00 +0000)]
r2672: don't call a variable "dup" as that conflicts with a standard system call name

16 years agor2671: we're getting too many errors caused by the talloc_realloc() API not
Andrew Tridgell [Mon, 27 Sep 2004 01:36:19 +0000 (01:36 +0000)]
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.

16 years agor2670: use a destructor to auto-close the samr ldb when the last user
Andrew Tridgell [Mon, 27 Sep 2004 00:48:01 +0000 (00:48 +0000)]
r2670: use a destructor to auto-close the samr ldb when the last user
disconnects. Previously the ldb was always kept open.

16 years agor2669: convert make_user_info() and associated functions from malloc to talloc
Andrew Tridgell [Sun, 26 Sep 2004 23:39:18 +0000 (23:39 +0000)]
r2669: convert make_user_info() and associated functions from malloc to talloc

16 years agor2668: steal the cli pointer into the pipe context so a single free destroys the...
Andrew Tridgell [Sun, 26 Sep 2004 23:38:14 +0000 (23:38 +0000)]
r2668: steal the cli pointer into the pipe context so a single free destroys the cli context too

16 years agor2667: Remove forward declaration of static function from function. GCC 3.5 and 4...
Jelmer Vernooij [Sun, 26 Sep 2004 22:19:48 +0000 (22:19 +0000)]
r2667: Remove forward declaration of static function from function. GCC 3.5 and 4.0 don't accept declarations of static functions inside other
functions, see http://gcc.gnu.org/ml/gcc-patches/2004-08/msg02514.html

16 years agor2664: fixed the final server leak for normal operation. We now get a clean report...
Andrew Tridgell [Sun, 26 Sep 2004 12:51:49 +0000 (12:51 +0000)]
r2664: fixed the final server leak for normal operation. We now get a clean report from --leak-check

16 years agor2663: fix an epmapper server leak - another talloc_realloc(NULL, ) leak
Andrew Tridgell [Sun, 26 Sep 2004 12:50:36 +0000 (12:50 +0000)]
r2663: fix an epmapper server leak - another talloc_realloc(NULL, ) leak

16 years agor2662: make --leak-check completely silent if not blocks are allocated
Andrew Tridgell [Sun, 26 Sep 2004 12:48:06 +0000 (12:48 +0000)]
r2662: make --leak-check completely silent if not blocks are allocated

16 years agor2661: fixed a client side memory leak in the clilist code.
Andrew Tridgell [Sun, 26 Sep 2004 11:45:14 +0000 (11:45 +0000)]
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

16 years agor2660: - converted the libcli/raw/ library to use talloc_increase_ref_count()
Andrew Tridgell [Sun, 26 Sep 2004 11:30:20 +0000 (11:30 +0000)]
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

16 years agor2659: removed some extraneous debug msgs
Andrew Tridgell [Sun, 26 Sep 2004 11:27:01 +0000 (11:27 +0000)]
r2659: removed some extraneous debug msgs

16 years agor2658: fixed a couple of error codes found with RAW-CONTEXT
Andrew Tridgell [Sun, 26 Sep 2004 11:25:33 +0000 (11:25 +0000)]
r2658: fixed a couple of error codes found with RAW-CONTEXT

16 years agor2657: if we are already fully authenticated in session setup then the vuid is ignored
Andrew Tridgell [Sun, 26 Sep 2004 11:24:39 +0000 (11:24 +0000)]
r2657: if we are already fully authenticated in session setup then the vuid is ignored

16 years agor2656: moved the seteuid configure tests into the posix backend (these tests
Andrew Tridgell [Sun, 26 Sep 2004 07:44:15 +0000 (07:44 +0000)]
r2656: moved the seteuid configure tests into the posix backend (these tests
don't actually work yet, that will come later)

16 years agor2655: fixed an error in the shutdown of the sock->transport->session->tree
Andrew Tridgell [Sun, 26 Sep 2004 07:04:35 +0000 (07:04 +0000)]
r2655: fixed an error in the shutdown of the sock->transport->session->tree
smbcli raw context handling

16 years agor2654: fixed some more server memory leaks. We are now down to a single leak
Andrew Tridgell [Sun, 26 Sep 2004 06:44:08 +0000 (06:44 +0000)]
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.

16 years agor2653: - data_blob() and data_blob_talloc() now get automatic names
Andrew Tridgell [Sun, 26 Sep 2004 06:41:59 +0000 (06:41 +0000)]
r2653: - data_blob() and data_blob_talloc() now get automatic names

- talloc_strdup() and related functions get automatic names

16 years agor2650: fixed a memory leak in make_server_info()
Andrew Tridgell [Sun, 26 Sep 2004 05:38:45 +0000 (05:38 +0000)]
r2650: fixed a memory leak in make_server_info()

16 years agor2649: - used some cpp tricks to make users of talloc() and talloc_realloc()
Andrew Tridgell [Sun, 26 Sep 2004 04:59:03 +0000 (04:59 +0000)]
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

16 years agor2648: - use a destructor on struct server_connection to simplify the
Andrew Tridgell [Sun, 26 Sep 2004 03:50:24 +0000 (03:50 +0000)]
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.

16 years agor2646: - use a talloc destructor to ensure that sockets from the new socket
Andrew Tridgell [Sun, 26 Sep 2004 03:05:04 +0000 (03:05 +0000)]
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

16 years agor2645: converted the NTLMSSP code to the new style of talloc
Andrew Tridgell [Sun, 26 Sep 2004 02:16:25 +0000 (02:16 +0000)]
r2645: converted the NTLMSSP code to the new style of talloc

16 years agor2644: removed an unused function
Andrew Tridgell [Sun, 26 Sep 2004 02:14:25 +0000 (02:14 +0000)]
r2644: removed an unused function

16 years agor2643: convert more of the auth subsyystem to the new talloc methods. This
Andrew Tridgell [Sun, 26 Sep 2004 01:43:05 +0000 (01:43 +0000)]
r2643: convert more of the auth subsyystem to the new talloc methods. This
also fixes a memory leak found with --leak-check.

16 years agor2642: smb_iconv_t is a pointer, so checks against -1 errors should use a cast
Andrew Tridgell [Sun, 26 Sep 2004 01:41:55 +0000 (01:41 +0000)]
r2642: smb_iconv_t is a pointer, so checks against -1 errors should use a cast

16 years agor2641: talloc_p() now produces a named talloc pointer, with the name
Andrew Tridgell [Sun, 26 Sep 2004 01:41:04 +0000 (01:41 +0000)]
r2641: talloc_p() now produces a named talloc pointer, with the name
auto-derived from the type you are allocating. This is done with
basically zero overhead by relying on the stringify operator in cpp
producing string constants.

the result is that --leak-check nicely names all pointers that come
from talloc_p()

16 years agor2640: valgrind does a great job on some types of memory leaks, but is slow
Andrew Tridgell [Sun, 26 Sep 2004 01:14:26 +0000 (01:14 +0000)]
r2640: valgrind does a great job on some types of memory leaks, but is slow
and can't properly handle leaks of doubly linked lists which we use a
lot (as the memory is always reachable). Even with --show-reachable
its hard to track leaks down sometimes.

I realised that talloc does have the necessary information to track
these, and by using the cascading property of the new talloc it can
report on leaks in a much more succinct fashion than valgrind can.

I have added a new samba option --leak-check that applies to all Samba
tools. When enabled it prints a leak report summarising all top level
contexts that are present when the program exits. A typical report
looks like this:

talloc report on 'null_context' (total 1071 bytes in 52 blocks)
        iconv(CP850,UTF8)              contains     43 bytes in   3 blocks
        UNNAMED                        contains     24 bytes in   1 blocks
        UNNAMED                        contains     24 bytes in   1 blocks
        dcesrv_init                    contains    604 bytes in  26 blocks
        server_service                 contains    120 bytes in   6 blocks
        UNNAMED                        contains     24 bytes in   1 blocks
        UNNAMED                        contains     24 bytes in   1 blocks
        server_service                 contains    104 bytes in   4 blocks
        server_context                 contains     12 bytes in   2 blocks
        iconv(UTF8,UTF-16LE)           contains     46 bytes in   3 blocks
        iconv(UTF-16LE,UTF8)           contains     46 bytes in   3 blocks

the numbers are recursive summaries for all the memory hanging off each context.

this option is not thread safe when used, but the code is thread safe
if the option is not given, so I don't think thats a problem.

16 years agor2639: we doon't need the valid_table code, so get rid of it
Andrew Tridgell [Sun, 26 Sep 2004 01:09:04 +0000 (01:09 +0000)]
r2639: we doon't need the valid_table code, so get rid of it

16 years agor2638: do lazy initialisation of iconv handles, so we don't initialise a
Andrew Tridgell [Sun, 26 Sep 2004 01:08:29 +0000 (01:08 +0000)]
r2638: do lazy initialisation of iconv handles, so we don't initialise a
handle unless we use it. This saves quite a bit of memory (libc chews
a lot loading a handle). Typically smbd now loads 3 handles, instead
of 36.

16 years agor2635: mem_ctx cleanups on the lsa and netlogon pipes in the rpc server
Andrew Tridgell [Sat, 25 Sep 2004 13:28:38 +0000 (13:28 +0000)]
r2635: mem_ctx cleanups on the lsa and netlogon pipes in the rpc server

16 years agor2634: use discard_const_p() in a few places
Andrew Tridgell [Sat, 25 Sep 2004 12:48:56 +0000 (12:48 +0000)]
r2634: use discard_const_p() in a few places

16 years agor2633: fixed some function types in the (unused) print backend
Andrew Tridgell [Sat, 25 Sep 2004 12:48:09 +0000 (12:48 +0000)]
r2633: fixed some function types in the (unused) print backend

16 years agor2632: a new approach to handling const errors. We have had huge numbers of
Andrew Tridgell [Sat, 25 Sep 2004 12:36:36 +0000 (12:36 +0000)]
r2632: a new approach to handling const errors. We have had huge numbers of
const warnings for a long time, and no real way to approach a
solution. Some of them are unavoidable due to the way the C standard
works (for example, any function that provides strchr() like
functionality _must_ produce a const warning)

I will be converting a bunch of places that currently produce const
warnings to use the discard_const_p(). Some of these will be
unavoidable const problems, some of them will be ones we will fix up
over time. At least this change means we will no longer be swamped
with const warnings, and we will easily be able to see when new
problems emerge.

16 years agor2631: the strchr family of functions should not return const strings.
Andrew Tridgell [Sat, 25 Sep 2004 12:31:49 +0000 (12:31 +0000)]
r2631: the strchr family of functions should not return const strings.

16 years agor2630: I missed a couple of places in the gensec talloc conversion
Andrew Tridgell [Sat, 25 Sep 2004 12:30:10 +0000 (12:30 +0000)]
r2630: I missed a couple of places in the gensec talloc conversion

16 years agor2629: convert gensec to the new talloc model
Andrew Tridgell [Sat, 25 Sep 2004 12:08:57 +0000 (12:08 +0000)]
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.

16 years agor2628: got rid of some warnings and converted a few more places to use hierarchical...
Andrew Tridgell [Sat, 25 Sep 2004 11:48:30 +0000 (11:48 +0000)]
r2628: got rid of some warnings and converted a few more places to use hierarchical memory allocation

16 years agor2627: use the new talloc capabilities in a bunch more places in the rpc
Andrew Tridgell [Sat, 25 Sep 2004 11:24:10 +0000 (11:24 +0000)]
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.

16 years agor2626: the symbol gai_error is defined in /usr/include, so don't use that name in...
Andrew Tridgell [Sat, 25 Sep 2004 11:19:29 +0000 (11:19 +0000)]
r2626: the symbol gai_error is defined in /usr/include, so don't use that name in our code

16 years agor2625: use talloc_p, not talloc when possible (when allocating a structure in particu...
Andrew Tridgell [Sat, 25 Sep 2004 11:18:50 +0000 (11:18 +0000)]
r2625: use talloc_p, not talloc when possible (when allocating a structure in particular), as it gives us type checking.

16 years agor2624: - save some system calls by only trying read/write operations that select...
Andrew Tridgell [Sat, 25 Sep 2004 11:18:04 +0000 (11:18 +0000)]
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

16 years agor2623: don't do pointer arithmetic on void*, as it doesn't work with non-GNU compilers
Andrew Tridgell [Sat, 25 Sep 2004 11:17:09 +0000 (11:17 +0000)]
r2623: don't do pointer arithmetic on void*, as it doesn't work with non-GNU compilers

16 years agor2622: to implement the SOCKET_FLAG_BLOCK option in the socket library we
Andrew Tridgell [Sat, 25 Sep 2004 11:16:30 +0000 (11:16 +0000)]
r2622: to implement the SOCKET_FLAG_BLOCK option in the socket library we
need to add MSG_WAITALL to the recv() flags. This is needed by the
current server code or sometimes it will fail with a receive error.

16 years agor2621: - now that the client code is non-blocking, we no longer need
Andrew Tridgell [Sat, 25 Sep 2004 11:15:18 +0000 (11:15 +0000)]
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

16 years agor2618: before we had refererence counts in talloc I added a hack in the
Andrew Tridgell [Sat, 25 Sep 2004 08:16:16 +0000 (08:16 +0000)]
r2618: before we had refererence counts in talloc I added a hack in the
server side request structure to prevent a structing being freed in
some circumstances. This change replaces this with the much more
robust mechanism of talloc_increase_ref_count().

16 years agor2617: add connect testing to the rpc test suite
Andrew Tridgell [Sat, 25 Sep 2004 08:14:05 +0000 (08:14 +0000)]
r2617: add connect testing to the rpc test suite

16 years agor2616: the cascading nature of talloc_free() can lead to some surprises. In
Andrew Tridgell [Sat, 25 Sep 2004 08:08:12 +0000 (08:08 +0000)]
r2616: the cascading nature of talloc_free() can lead to some surprises. In
this case the bug was that server_terminate_connection() destroys the
server context, which in turn cascades down to destroy all current
request contexts, so we musn't then try to destroy the request
structure a second time.

16 years agor2615: fixed a bug in the server side support for CONNECT level security
Andrew Tridgell [Sat, 25 Sep 2004 08:04:54 +0000 (08:04 +0000)]
r2615: fixed a bug in the server side support for CONNECT level security

16 years agor2614: support CONNECT level DCE/RPC security in both client and
Andrew Tridgell [Sat, 25 Sep 2004 07:25:51 +0000 (07:25 +0000)]
r2614: support CONNECT level DCE/RPC security in both client and
server. CONNECT security uses NTLMSSP, but does not do any signing or
sealing (or equivalently, its like signing, but with a zero filled
checksum).

16 years agor2613: use a talloc destructor to ensure that file descriptors are not leaked
Andrew Tridgell [Sat, 25 Sep 2004 04:45:52 +0000 (04:45 +0000)]
r2613: use a talloc destructor to ensure that file descriptors are not leaked
on abnormal termination of a connection. As long as the top level
connection structure is freed then that should cascade down to the
file structure, and call this destructor which will close the open file descriptor.

In general I'd like to use this technique in any place in Samba4 where
we hold operating system resources that we need to make sure are
released on abnormal termination.

16 years agor2612: Ensure ntlm_auth always logs to stderr.
Andrew Bartlett [Sat, 25 Sep 2004 03:39:35 +0000 (03:39 +0000)]
r2612: Ensure ntlm_auth always logs to stderr.

Add missing break;

Andrew Bartlett

16 years agor2611: Try to make Samba4's ntlm_auth more consistant with Samba 3.0.
Andrew Bartlett [Sat, 25 Sep 2004 02:54:56 +0000 (02:54 +0000)]
r2611: Try to make Samba4's ntlm_auth more consistant with Samba 3.0.

Andrew Bartlett

16 years agor2601: avoid free()ing unallocated memory by mistake
Simo Sorce [Fri, 24 Sep 2004 17:42:46 +0000 (17:42 +0000)]
r2601: avoid free()ing unallocated memory by mistake

16 years agor2597: A small program that takes SID strings on stdin and produces a marshalled
Tim Potter [Fri, 24 Sep 2004 12:41:00 +0000 (12:41 +0000)]
r2597: A small program that takes SID strings on stdin and produces a marshalled
lsa_SidArray on stdout.

16 years agor2594: Remove call to Gtk+ 2.4 specific code
Jelmer Vernooij [Fri, 24 Sep 2004 09:00:56 +0000 (09:00 +0000)]
r2594: Remove call to Gtk+ 2.4 specific code

16 years agor2593: don't crash if the server doesn't know that 0 count searches mean 1
Andrew Tridgell [Fri, 24 Sep 2004 07:32:52 +0000 (07:32 +0000)]
r2593: don't crash if the server doesn't know that 0 count searches mean 1

16 years agor2592: this fixes one of the security memory leaks in the server
Andrew Tridgell [Fri, 24 Sep 2004 07:28:50 +0000 (07:28 +0000)]
r2592: this fixes one of the security memory leaks in the server

16 years agor2591: fixed two errors in simple backend found with valgrind
Andrew Tridgell [Fri, 24 Sep 2004 07:28:16 +0000 (07:28 +0000)]
r2591: fixed two errors in simple backend found with valgrind

16 years agor2590: fixed one of the server security memory leaks. There are more :(
Andrew Tridgell [Fri, 24 Sep 2004 07:08:02 +0000 (07:08 +0000)]
r2590: fixed one of the server security memory leaks. There are more :(

16 years agor2589: a simple test to help find security related memory leaks. Run valgrind on...
Andrew Tridgell [Fri, 24 Sep 2004 06:56:11 +0000 (06:56 +0000)]
r2589: a simple test to help find security related memory leaks. Run valgrind on smbd with
--show-leak=yes and --show-reachable=yes to track them down.

16 years agor2588: connect/disconnect is common enough that I don't think a level 0 DEBUG
Andrew Tridgell [Fri, 24 Sep 2004 06:52:19 +0000 (06:52 +0000)]
r2588: connect/disconnect is common enough that I don't think a level 0 DEBUG
is warranted to warn that it has happened :)

16 years agor2587: fixed a couple of authentication memory leaks. There are more to be
Andrew Tridgell [Fri, 24 Sep 2004 06:51:14 +0000 (06:51 +0000)]
r2587: fixed a couple of authentication memory leaks. There are more to be
fixed - I'll commit a little test suite soon.

16 years agor2586: updated the nbench example in the README to reflect the new chaining syntax
Andrew Tridgell [Fri, 24 Sep 2004 06:49:10 +0000 (06:49 +0000)]
r2586: updated the nbench example in the README to reflect the new chaining syntax

16 years agor2583: mkproto.pl now treats "int main" as a special case and avoids it.
Andrew Tridgell [Fri, 24 Sep 2004 05:51:29 +0000 (05:51 +0000)]
r2583: mkproto.pl now treats "int main" as a special case and avoids it.

16 years agor2582: Merge checks for xattr and acl libraries from Samba3 so the {get,set}ntacl
Tim Potter [Fri, 24 Sep 2004 04:49:45 +0000 (04:49 +0000)]
r2582: Merge checks for xattr and acl libraries from Samba3 so the {get,set}ntacl
programs can build on non-xattr machines.

16 years agor2581: added "hosts allow" and "hosts deny" checking in smbd. I needed this
Andrew Tridgell [Fri, 24 Sep 2004 03:34:55 +0000 (03:34 +0000)]
r2581: added "hosts allow" and "hosts deny" checking in smbd. I needed this
as my box keeps getting hit by viruses spreading on my companies
internal network, which screws up my debug log badly (sigh).

metze, I'm not sure if you think access.c should go in the socket
library or not. It is closely tied to the socket functions, but you
may prefer it separate.

The access.c code is a port from Samba3, but with some cleanups to
make it (slighly) less ugly.

16 years agor2580: fixed an uninitialised byte found by valgrind
Andrew Tridgell [Fri, 24 Sep 2004 03:31:43 +0000 (03:31 +0000)]
r2580: fixed an uninitialised byte found by valgrind

16 years agor2577: - I recently found out that charaters below 0x3F are guaranteed not to
Andrew Tridgell [Fri, 24 Sep 2004 01:21:21 +0000 (01:21 +0000)]
r2577: - I recently found out that charaters below 0x3F are guaranteed not to
  occur as secondary bytes in any multi-byte character set. This
  allows for a very simple optimisation in strchr_m() and
  strrchr_m(). It might be a good idea to pick this up for Samba3.

- the horrible toktocliplist() is only used in clitar.c, so move it
  there, to prevent anyone else from being tempted to use it.

16 years agor2576: Some userspace tools for getting and setting ntacls via the 'security.ntacl'
Tim Potter [Fri, 24 Sep 2004 01:20:30 +0000 (01:20 +0000)]
r2576: Some userspace tools for getting and setting ntacls via the 'security.ntacl'
extended attribute.

16 years agor2573: - added a configure test for nanosecond time resolution in struct stat
Andrew Tridgell [Fri, 24 Sep 2004 00:44:42 +0000 (00:44 +0000)]
r2573: - added a configure test for nanosecond time resolution in struct stat
  (recently Linux systems support this, allowing us to support the
  full resolution in NTTIME)

- use nanosecond resolution in the posix backend if available

- moved the configure tests and list of object files for the posix
  backend into ntvfs/posix/ to keep them more neatlly separated.

16 years agor2572: fixed two places where status is not initialised in the nbench backend
Andrew Tridgell [Fri, 24 Sep 2004 00:42:20 +0000 (00:42 +0000)]
r2572: fixed two places where status is not initialised in the nbench backend

16 years agor2562: got rid of the "reference" backend that never happened - the code is
Andrew Tridgell [Thu, 23 Sep 2004 07:55:43 +0000 (07:55 +0000)]
r2562: got rid of the "reference" backend that never happened - the code is
too stale to be of any use as a reference.

16 years agor2561: completely redid the ntvfs module chaining code, You can now do something...
Andrew Tridgell [Thu, 23 Sep 2004 07:44:42 +0000 (07:44 +0000)]
r2561: completely redid the ntvfs module chaining code, You can now do something like:

  ntvfs handler = nbench posix

and the nbench pass-thru module will be called before the posix
module. The chaining logic is now much saner, and less racy, with each
level in the chain getting its own private pointer rather than relying
on save/restore logic in the pass-thru module.

The only pass-thru module we have at the moment is the nbench one
(which records all traffic in a nbench compatibe format), but I plan
on soon writing a "unixuid" pass-thru module that will implement the
setegid()/setgroups()/seteuid() logic for standard posix uid
handling. This separation of the posix backend from the uid handling
should simplify the code, and make development easier.

I also modified the nbench module so it can do multiple chaining, so
if you want to you can do:

   ntvfs module = nbench nbench posix

and it will save 2 copies of the log file in /tmp. This is really only
useful for testing at the moment until we have more than one pass-thru
module.

16 years agor2560: Don't require structure fields that have the pidl value() property
Tim Potter [Thu, 23 Sep 2004 03:32:46 +0000 (03:32 +0000)]
r2560: Don't require structure fields that have the pidl value() property
to be set.  They can be if you want, but will be overwritten by the
pidl push code.

16 years agor2559: Python ints can't hold the full range of uint32 values so store them
Tim Potter [Thu, 23 Sep 2004 03:26:14 +0000 (03:26 +0000)]
r2559: Python ints can't hold the full range of uint32 values so store them
as Python longs.

Also allow shorter width integer types to be initialised from long values.
Their values are truncated if they are too long.

16 years agor2556: fixed the -s one bug that jelmer pointed out
Andrew Tridgell [Thu, 23 Sep 2004 02:21:51 +0000 (02:21 +0000)]
r2556: fixed the -s one bug that jelmer pointed out

16 years agor2555: Start of a rpcclient type program.
Tim Potter [Thu, 23 Sep 2004 02:21:11 +0000 (02:21 +0000)]
r2555: Start of a rpcclient type program.

16 years agor2554: added a test for a bug that jelmer pointed out (handling of -s one)
Andrew Tridgell [Thu, 23 Sep 2004 02:15:10 +0000 (02:15 +0000)]
r2554: added a test for a bug that jelmer pointed out (handling of -s one)

16 years agor2553: fixed ldbtest so it passes the ldap schema restrictions and thus can be used...
Andrew Tridgell [Thu, 23 Sep 2004 02:14:43 +0000 (02:14 +0000)]
r2553: fixed ldbtest so it passes the ldap schema restrictions and thus can be used on the ldap backend

16 years agor2552: Character set conversion and string handling updates.
Andrew Bartlett [Thu, 23 Sep 2004 00:51:45 +0000 (00:51 +0000)]
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).

16 years agor2551: Add const.
Andrew Bartlett [Thu, 23 Sep 2004 00:47:38 +0000 (00:47 +0000)]
r2551: Add const.

Andrew Bartlett

16 years agor2550: survive our own BASE-NEGNOWAIT torture test.
Andrew Bartlett [Thu, 23 Sep 2004 00:27:21 +0000 (00:27 +0000)]
r2550: survive our own BASE-NEGNOWAIT torture test.

Andrew Bartlett

16 years agor2547: Another place to use convert_string_talloc().
Andrew Bartlett [Thu, 23 Sep 2004 00:10:40 +0000 (00:10 +0000)]
r2547: Another place to use convert_string_talloc().

Andrew Bartlett

16 years agor2546: Remove another strupper_m() that we don't need.
Andrew Bartlett [Thu, 23 Sep 2004 00:01:16 +0000 (00:01 +0000)]
r2546: Remove another strupper_m() that we don't need.

Andrew Bartlett

16 years agor2545: str_charnum -> strlen_m.
Andrew Bartlett [Wed, 22 Sep 2004 23:56:22 +0000 (23:56 +0000)]
r2545: str_charnum -> strlen_m.

These two functions do exactly the same thing, I'll be removing
str_charnum shortly.

Andrew Bartlett

16 years agor2544: (missed from the last commit)
Andrew Bartlett [Wed, 22 Sep 2004 23:53:41 +0000 (23:53 +0000)]
r2544: (missed from the last commit)

smb_conn->socket has gone away, and the packet count is now in the
main structure.

Andrew Bartlett

16 years agor2543: Catch one more use of sub_get_remote_machine().
Andrew Bartlett [Wed, 22 Sep 2004 23:51:17 +0000 (23:51 +0000)]
r2543: Catch one more use of sub_get_remote_machine().

Andrew Bartlett

16 years agor2542: I really don't like the 'substitute' code, and I particularly don't
Andrew Bartlett [Wed, 22 Sep 2004 23:50:28 +0000 (23:50 +0000)]
r2542: I really don't like the 'substitute' code, and I particularly don't
like it in the mainline code (outside the smb.conf magic).

We will need to have a more useful 'helper' routine for this, but for
now we at least get a reliable IP address.

Also remove the unused 'socket' structure in the smb server - it seems
to have been replaced by the socket library.

Andrew Bartlett