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

1969 Commits

Author SHA1 Message Date
Andrew Tridgell
dbc2346de8 r2653: - data_blob() and data_blob_talloc() now get automatic names
- talloc_strdup() and related functions get automatic names
(This used to be commit 0cf427d14f)
2007-10-10 12:59:17 -05:00
Andrew Tridgell
df6dce1065 r2650: fixed a memory leak in make_server_info()
(This used to be commit 4aba6e7101)
2007-10-10 12:59:16 -05:00
Andrew Tridgell
ec0128ef01 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
(This used to be commit 6e721393d0)
2007-10-10 12:59:16 -05:00
Andrew Tridgell
9a62dce0ac 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.
(This used to be commit 230e1cd777)
2007-10-10 12:59:16 -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
4b1050a6cf r2645: converted the NTLMSSP code to the new style of talloc
(This used to be commit b378aae95d)
2007-10-10 12:59:16 -05:00
Andrew Tridgell
525a993469 r2644: removed an unused function
(This used to be commit bc779cb2ce)
2007-10-10 12:59:16 -05:00
Andrew Tridgell
6bea5bea4c r2643: convert more of the auth subsyystem to the new talloc methods. This
also fixes a memory leak found with --leak-check.
(This used to be commit f19201ea27)
2007-10-10 12:59:15 -05:00
Andrew Tridgell
9cafc0d07e r2642: smb_iconv_t is a pointer, so checks against -1 errors should use a cast
(This used to be commit 28dcd22029)
2007-10-10 12:59:15 -05:00
Andrew Tridgell
38aa974457 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()
(This used to be commit bd86ebe297)
2007-10-10 12:59:15 -05:00
Andrew Tridgell
b295256ea2 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.
(This used to be commit 96d33d36a5)
2007-10-10 12:59:15 -05:00
Andrew Tridgell
17cb5517f8 r2639: we doon't need the valid_table code, so get rid of it
(This used to be commit 480636ebbc)
2007-10-10 12:59:15 -05:00
Andrew Tridgell
4a1d53a07a 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.
(This used to be commit 60e8d154fd)
2007-10-10 12:59:15 -05:00
Andrew Tridgell
159f81ee32 r2635: mem_ctx cleanups on the lsa and netlogon pipes in the rpc server
(This used to be commit 1ee5ed4197)
2007-10-10 12:59:15 -05:00
Andrew Tridgell
6310f40448 r2634: use discard_const_p() in a few places
(This used to be commit 56ecda2178)
2007-10-10 12:59:14 -05:00
Andrew Tridgell
18104c5679 r2633: fixed some function types in the (unused) print backend
(This used to be commit e9803058ec)
2007-10-10 12:59:14 -05:00
Andrew Tridgell
797d80879c 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.
(This used to be commit fec3288ad6)
2007-10-10 12:59:14 -05:00
Andrew Tridgell
48c97988ca r2631: the strchr family of functions should not return const strings.
(This used to be commit 2a7e5f0708)
2007-10-10 12:59:14 -05:00
Andrew Tridgell
a2f3527d96 r2630: I missed a couple of places in the gensec talloc conversion
(This used to be commit 7124949140)
2007-10-10 12:59:14 -05:00
Andrew Tridgell
c5f4378361 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.
(This used to be commit f12ee2f241)
2007-10-10 12:59:14 -05:00
Andrew Tridgell
223e78990a r2628: got rid of some warnings and converted a few more places to use hierarchical memory allocation
(This used to be commit 26da45a801)
2007-10-10 12:59:14 -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
Andrew Tridgell
998e8022b6 r2626: the symbol gai_error is defined in /usr/include, so don't use that name in our code
(This used to be commit 458f853288)
2007-10-10 12:59:13 -05:00
Andrew Tridgell
bdfc5db41d r2625: use talloc_p, not talloc when possible (when allocating a structure in particular), as it gives us type checking.
(This used to be commit dabc7ddd9f)
2007-10-10 12:59:13 -05:00
Andrew Tridgell
daa66ec96c 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
(This used to be commit e95e5c591f)
2007-10-10 12:59:13 -05:00
Andrew Tridgell
368802bc86 r2623: don't do pointer arithmetic on void*, as it doesn't work with non-GNU compilers
(This used to be commit c2be7b696c)
2007-10-10 12:59:13 -05:00
Andrew Tridgell
5abd7f8f5f 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.
(This used to be commit 4cb11fb77a)
2007-10-10 12:59:13 -05:00
Andrew Tridgell
30381686c4 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
(This used to be commit e73b4ae4e5)
2007-10-10 12:59:12 -05:00
Andrew Tridgell
045543b661 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().
(This used to be commit 3f7741f178)
2007-10-10 12:59:12 -05:00
Andrew Tridgell
20fb9ab6cd r2617: add connect testing to the rpc test suite
(This used to be commit 01a759b627)
2007-10-10 12:59:12 -05:00
Andrew Tridgell
69d170e723 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.
(This used to be commit 28a647f681)
2007-10-10 12:59:12 -05:00
Andrew Tridgell
e3e3e4577b r2615: fixed a bug in the server side support for CONNECT level security
(This used to be commit fee98137ad)
2007-10-10 12:59:12 -05:00
Andrew Tridgell
642ba4bfee 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).
(This used to be commit f4660857bc)
2007-10-10 12:59:12 -05:00
Andrew Tridgell
4fa2904290 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.
(This used to be commit ed87b7fcbd)
2007-10-10 12:59:12 -05:00
Andrew Bartlett
cf938f14a2 r2612: Ensure ntlm_auth always logs to stderr.
Add missing break;

Andrew Bartlett
(This used to be commit cdb8261775)
2007-10-10 12:59:11 -05:00
Andrew Bartlett
bfd924725e r2611: Try to make Samba4's ntlm_auth more consistant with Samba 3.0.
Andrew Bartlett
(This used to be commit 8f4dab5d44)
2007-10-10 12:59:11 -05:00
Simo Sorce
567ed4e718 r2601: avoid free()ing unallocated memory by mistake
(This used to be commit e502b276ae)
2007-10-10 12:59:11 -05:00
Tim Potter
df99e4bb37 r2597: A small program that takes SID strings on stdin and produces a marshalled
lsa_SidArray on stdout.
(This used to be commit d7d8a7ffc6)
2007-10-10 12:59:11 -05:00
Jelmer Vernooij
9dd6674a6c r2594: Remove call to Gtk+ 2.4 specific code
(This used to be commit fa29cecb12)
2007-10-10 12:59:11 -05:00
Andrew Tridgell
82b61938ac r2593: don't crash if the server doesn't know that 0 count searches mean 1
(This used to be commit 640ced4530)
2007-10-10 12:59:11 -05:00
Andrew Tridgell
1954070a7e r2592: this fixes one of the security memory leaks in the server
(This used to be commit efb2b88edd)
2007-10-10 12:59:10 -05:00
Andrew Tridgell
4f2058175e r2591: fixed two errors in simple backend found with valgrind
(This used to be commit 1730882b9d)
2007-10-10 12:59:10 -05:00
Andrew Tridgell
7358fb62b8 r2590: fixed one of the server security memory leaks. There are more :(
(This used to be commit 9e1eb58e4b)
2007-10-10 12:59:10 -05:00
Andrew Tridgell
8e5acb6df0 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.
(This used to be commit 7b23624a0f)
2007-10-10 12:59:09 -05:00
Andrew Tridgell
3e54089bc1 r2588: connect/disconnect is common enough that I don't think a level 0 DEBUG
is warranted to warn that it has happened :)
(This used to be commit ee51eefe17)
2007-10-10 12:59:08 -05:00
Andrew Tridgell
f5db8edc97 r2587: fixed a couple of authentication memory leaks. There are more to be
fixed - I'll commit a little test suite soon.
(This used to be commit 5b967c1cbb)
2007-10-10 12:59:08 -05:00
Andrew Tridgell
a1ed65e8ed r2586: updated the nbench example in the README to reflect the new chaining syntax
(This used to be commit be20b3164c)
2007-10-10 12:59:07 -05:00
Andrew Tridgell
78d9f3f8a7 r2583: mkproto.pl now treats "int main" as a special case and avoids it.
(This used to be commit 01288e82bc)
2007-10-10 12:59:07 -05:00
Tim Potter
00e05a0b8b r2582: Merge checks for xattr and acl libraries from Samba3 so the {get,set}ntacl
programs can build on non-xattr machines.
(This used to be commit daad76207d)
2007-10-10 12:59:07 -05:00
Andrew Tridgell
fe45888e22 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.
(This used to be commit 058b2fd99e)
2007-10-10 12:59:07 -05:00