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

45 Commits

Author SHA1 Message Date
Jeremy Allison
0fdf60f051 Finish adding strings to all talloc_init() calls.
Jeremy.
(This used to be commit 784d15761c)
2002-12-23 23:53:56 +00:00
Jeremy Allison
7f23546730 Forward port the change to talloc_init() to make all talloc contexts
named. Ensure we can query them.
Jeremy.
(This used to be commit 842e08e52a)
2002-12-20 20:23:06 +00:00
Jeremy Allison
a030b19767 The name pointer in the talloc context must not be a talloced entry as
calling talloc_destroy_pool(as we do sometimes) will destroy it.
Jeremy.
(This used to be commit 63f344e27b)
2002-12-14 00:57:01 +00:00
Andrew Tridgell
9930b0b065 used findstatic.pl to make some variables static and remove some dead
code
(This used to be commit 91ad9041e9)
2002-07-01 09:12:41 +00:00
Andrew Tridgell
0bb6053946 put the ifdef for HAVE_VA_COPY in one place rather than in lots of
functions
(This used to be commit 1cf3228fdc)
2002-06-03 03:07:24 +00:00
Jim McDonough
276e1928c4 Add __va_copy to talloc functions. talloc_asprintf was causing all kinds
of problems on Linux/390 systems...
(This used to be commit 2605e483b3)
2002-05-16 20:06:00 +00:00
Andrew Bartlett
07e6ff5fcf Partly based on the work by mimir (Rafal Szczesniak
<mimir@diament.ists.pwr.wroc.pl>) this patch allows samba to correctly
enumerate its trusted domains - by exaimining the keys in the secrets.tdb file.

This patch has been tested with both NT4 and rpcclient/wbinfo, and adds
some extra functionality to talloc and rpc_parse to allow it to deal with
already unicode strings.

Finally, this cleans up some const warnings that were in net_rpc.c by pushing
another dash of const into the rpc client code.

Andrew Bartlett
(This used to be commit 0bdd94cb99)
2002-04-14 09:44:16 +00:00
Simo Sorce
32334bc655 more verbose checking in talloc and util_pw
fixed tdbsam memory corruption (and segfault)
reducing calls to pdb_uid_to_user_rid and countrary to 0 to move to a non alghoritmic rid allocation with some passdb modules.
(This used to be commit 9836af7cd6)
2002-03-18 23:57:14 +00:00
Tim Potter
57bd576445 getpid() -> sys_getpid()
(This used to be commit a3cea5e9ae)
2002-03-14 01:53:04 +00:00
Martin Pool
a984db9723 Fix typo.
(This used to be commit 58c1b11439)
2002-03-10 03:14:00 +00:00
Tim Potter
cd68afe312 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
(This used to be commit 6a58c9bd06)
2002-01-30 06:08:46 +00:00
Jean-François Micouleau
b387638d48 picky about realloc
J.F.
(This used to be commit 873dba59cf)
2002-01-25 17:02:54 +00:00
Martin Pool
3353223b47 FIXME We should turn the global list off when using Insure++,
otherwise all the memory will be seen as still reachable.
(This used to be commit 682e7cd394)
2002-01-14 06:51:34 +00:00
Martin Pool
cfec6d4498 Cope nicely with pools with no name.
(This used to be commit 86abefc172)
2002-01-03 05:52:27 +00:00
Martin Pool
e28cdc0931 talloc accounting now includes number of chunks and bytes allocated.
(This used to be commit cd25d01e42)
2002-01-03 05:34:33 +00:00
Martin Pool
3c2b7777ed Add talloc_asprintf_append, which grows an existing string buffer to
contain new print-formatted information.  (Also
talloc_vasprintf_append.)  Idea borrowed from glib.
(This used to be commit 53723e8748)
2002-01-03 05:25:30 +00:00
Martin Pool
cc0846f967 Add --enable-dmalloc to link against the dmalloc malloc debugger.
It's not as strong as Insure, but it's free, reasonably efficient and
works on every platform.
(This used to be commit e76d27fcdb)
2001-12-20 04:01:44 +00:00
Martin Pool
7110a867a1 Make TALLOC_CTX and talloc_chunk private to talloc.c.
Add a global singly-linked list of all active talloc pools, so that we
can eventually show how much memory is used for different purposes.
This also gives a check that pools are not being doubly freed.

talloc_init_named now handle a NULL name properly (ie does nothing)

Add accessor talloc_pool_name().
(This used to be commit 4c6c03c8c7)
2001-12-19 07:36:32 +00:00
Martin Pool
fc00418dfc Doc
(This used to be commit 7da982e926)
2001-12-19 06:22:23 +00:00
Martin Pool
0b73aad2bf Doc
(This used to be commit 5dc2827b6e)
2001-12-19 06:00:19 +00:00
Martin Pool
d3abe277ef Put PRINTF_ATTRIBUTE on talloc_init_named, talloc_asprintf,
talloc_vasprintf.
(This used to be commit e6be48671d)
2001-12-19 05:02:42 +00:00
Martin Pool
55f6eefe12 Doc.
(This used to be commit 5b6c22a209)
2001-12-19 04:55:58 +00:00
Martin Pool
4f74ff9450 Start adding some debugging features to talloc based on Samba's
ancient mem_man.c:

Each TALLOC_CTX now has a field to store its purpose, to aid in
tracking down memory bloat.  A new call talloc_init_named() should be
used instead of talloc_init() so that this is set.

Added talloc_vasprintf to be called by varargs functions.
(This used to be commit 25b97a7435)
2001-12-19 04:50:10 +00:00
Andrew Tridgell
24449a9b0b fixed an off by 1 bug in talloc_asprintf()
(This used to be commit 2b2155beae)
2001-12-05 04:43:53 +00:00
Andrew Tridgell
aa1e690ba5 const religion in talloc calls
(This used to be commit ea5d285721)
2001-12-04 06:14:42 +00:00
Andrew Tridgell
245d28e447 return of vsnprintf doesn't include termination
thanks to simo for spotting this
(This used to be commit acd84ed762)
2001-10-14 12:40:26 +00:00
Andrew Tridgell
47a0b69029 bit neater talloc_asprintf() implementation
(This used to be commit 8ca8875cd9)
2001-10-14 09:32:14 +00:00
Simo Sorce
b7bd7ea153 introduce mangle backward compatibility functions
add talloc_asprintf()
(This used to be commit 7264d611ef)
2001-10-13 12:47:59 +00:00
Simo Sorce
484a7c0341 move to SAFE_FREE()
(This used to be commit 60e907b7e8)
2001-09-17 02:19:44 +00:00
Simo Sorce
2f844bf447 Change all realloc() statements to Realloc() (ecxept for tdb.c)
changed some code to exploit the fact that Realloc(NULL, size) == malloc(size)
fixed some possible mem leaks, or seg faults.

thanks to andreas moroder (mallocs not checked in client/client.c, client/smbumount.c)
(This used to be commit 7f33c01688)
2001-08-08 16:54:16 +00:00
Jeremy Allison
d6d9375efd Made talloc_realloc() semantics match realloc(). JF was complaining :-).
realloc(NULL) == malloc. realloc(p,0) == free() - a no-op in talloc.
Jeremy.
(This used to be commit 1ab31e5db5)
2001-07-02 22:17:58 +00:00
Tim Potter
147af5f318 Spelling fix.
(This used to be commit 5f4889beb9)
2001-06-22 01:58:19 +00:00
Andrew Tridgell
1cce779d77 the BAD_PTR idea in talloc.h is actually a bad idea - it means callers have no way of telling if the call really failed
(This used to be commit 7a96ca313e)
2001-06-22 01:56:16 +00:00
Tim Potter
c61e75e3e5 Added talloc_strdup() funcion.
(This used to be commit eea43a5a91)
2001-05-11 07:03:13 +00:00
Jeremy Allison
194a87bf76 Added Gerald's fixes.
Jeremy.
(This used to be commit be825b0746)
2001-03-23 21:54:30 +00:00
Andrew Tridgell
038d3977e2 a much simpler talloc() implementation. This version has the following
advantages:

- memory is trackable by insure
- a very simple talloc_realloc() is possible (I've added it)

It is slower than the previous talloc code, but I don't think that
is going to be a problem. If it is a problem then there are
some ways we can make it faster but I'd like to leave those
until we have tested this a bit and can see what performance
problems might show up in profiling
(This used to be commit 1ab63cf3a6)
2001-03-23 21:37:30 +00:00
Jeremy Allison
0f2799aaf1 Move to talloc control of SPOOL_XXX structs. Move to talloc control of
security descriptors and pointers. Syncup with 2.2 tree.
Jeremy.
(This used to be commit 14d5997dc8)
2001-02-28 00:51:02 +00:00
Jeremy Allison
5265ce7837 Added total memory allocated counter to talloc, so we can tell if a talloc
pool is getting bloated. Also added a talloc_zero function to return zeroed memory.
Added debug in rpc_server/srv_pipe_hnd.c so we know when a talloc pool is being
freed. Syncup with srv_pipe_hnd.c from 2.2 so we are freeing memory at the same time.
Jeremy.
(This used to be commit d3a56c6042)
2001-02-27 19:22:02 +00:00
Jeremy Allison
369f5fd1d7 Fixed memory leaks in lsa_XX calls. Fixed memory leaks in smbcacls. Merged
in fixes from appliance-head and 2.2. Fixed multiple connection.tdb open
problem.
Jeremy.
(This used to be commit 0a40bc83e1)
2000-12-15 01:02:11 +00:00
Gerald Carter
95496b974a reworked talloc() to in order to help track down invalid
memory access.

Tridge, I don't think using 0xdeadbeef for size allocations
of 0 is going to work.  I ended up having to use NULL
as much code that works on UNISTR checks to see if the buffer ptr
is NULL.  So valid code ends up with a seg fault.

Rather than rewriting it all, I added a DEBUG_TALLOC
#ifdef in talloc.h that sets a macro BAD_PTR.
This is the value assigned to ptr for an allocation of 0 bytes.



jerry
(This used to be commit 233b9cffa2)
2000-08-12 14:14:40 +00:00
Gerald Carter
0a86b83a86 talloc returns 0xdeadbeef when asked to allocate 0 bytes
jerry
(This used to be commit df51dc32f6)
2000-08-10 13:58:15 +00:00
Jeremy Allison
5ec1642809 Ok - this is a *BIG* change - but it fixes the problems with static strings
in the RPC code. This change was prompted by trying to save a long (>256)
character comment in the printer properties page.

The new system associates a TALLOC_CTX with the pipe struct, and frees
the pool on return of a complete PDU.

A global TALLOC_CTX is used for the odd buffer allocated in the BUFFERxx
code, and is freed in the main loop.

This code works with insure, and seems to be free of memory leaks and
crashes (so far) but there are probably the occasional problem with
code that uses UNISTRxx structs on the stack and expects them to contain
storage without doing a init_unistrXX().

This means that rpcclient will probably be horribly broken.
A TALLOC_CTX also needed associating with the struct cli_state also,
to make the prs_xx code there work.

The main interface change is the addition of a TALLOC_CTX to the
prs_init calls - used for dynamic allocation in the prs_XXX calls.

Now this is in place it should make dynamic allocation of all RPC
memory on unmarshall *much* easier to fix.

Jeremy.
(This used to be commit 0ff2ce543e)
2000-07-27 00:47:19 +00:00
Andrew Tridgell
bdb98d93f2 fixed size alignment in talloc
(This used to be commit 064cdb7ee6)
2000-06-26 08:18:42 +00:00
Jeremy Allison
8f4e672094 Fixed pointer arithmetic found by IRIX compiler.
Jeremy.
(This used to be commit 20d72e8959)
2000-01-11 20:12:46 +00:00
Andrew Tridgell
5e9f559187 implemented talloc() as described on samba-technical. This fixes the
lp_string() bug properly.

we still need to add lp_talloc_free() calls in all the main event
loops, I've only put it in smbd and nmbd thus far.
(This used to be commit aa7f815525)
2000-01-05 06:36:36 +00:00