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

20 Commits

Author SHA1 Message Date
Andrew Tridgell
ddc10d4d37 r4549: got rid of a lot more uses of plain talloc(), instead using
talloc_size() or talloc_array_p() where appropriate.

also fixed a memory leak in pvfs_copy_file() (failed to free a memory
context)
(This used to be commit 89b74b5354)
2007-10-10 13:08:25 -05:00
Stefan Metzmacher
3e7c0e10cf r4327: add usefull function if you don't want that the data will talloc_memdup()'ed
metze
(This used to be commit 1f01e370b1)
2007-10-10 13:07:35 -05:00
Andrew Tridgell
ed42a64901 r4263: added support for the trans2 RAW_SEARCH_EA_LIST information
level. This is quite a strange level that we've never seen before, but
is used by the os2 workplace shell.

note w2k screws up this level when unicode is negotiated, so it only
passes the RAW-SEARCH test when you force non-unicode
(This used to be commit 25189b8fbf)
2007-10-10 13:07:29 -05:00
Stefan Metzmacher
34b1367373 r4027: add a useful function for debugging
metze
(This used to be commit 41b1ba53fc)
2007-10-10 13:06:15 -05:00
Andrew Bartlett
4c06ac06a1 r3572: Thanks to tridge for his patience with my build breakage.
This concludes the proper fixes.

Andrew Bartlett
(This used to be commit c1d025793f)
2007-10-10 13:05:33 -05:00
Andrew Tridgell
e1f38d8138 r3571: rough guesses at what abartlet really wanted to do in his last commit
(which I suspect was missing some pieces)

this at least fixes the build so i can keep going on pvfs. Please review/fix Andrew.
(This used to be commit bffd18d09d)
2007-10-10 13:05:32 -05:00
Andrew Tridgell
351ca44e8b 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.
(This used to be commit c60ff99c31)
2007-10-10 12:59:20 -05:00
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
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
716e6c1efb r2043: data_blob() now returns a talloc'd pointer. If everyone has been
following the data_blob() API properly then this will cause no
problems. I'm expecting chaos.

this is part of the general move towards using talloc for everything
in samba4
(This used to be commit 3f6b3c21e4)
2007-10-10 12:58:20 -05:00
Andrew Tridgell
600144050c r2039: got rid of the free() ptr in DATA_BLOB
I plan on replacing the concept by adding a generic destructor in all talloc ptrs, so you can do:

  talloc_set_destructor(ptr, my_destructor);

to setup a function that will be called on free.
(This used to be commit 957b260621)
2007-10-10 12:58:19 -05:00
Andrew Tridgell
b83ba93eae r1983: a completely new implementation of talloc
This version does the following:

  1) talloc_free(), talloc_realloc() and talloc_steal() lose their
     (redundent) first arguments

  2) you can use _any_ talloc pointer as a talloc context to allocate
     more memory. This allows you to create complex data structures
     where the top level structure is the logical parent of the next
     level down, and those are the parents of the level below
     that. Then destroy either the lot with a single talloc_free() or
     destroy any sub-part with a talloc_free() of that part

  3) you can name any pointer. Use talloc_named() which is just like
     talloc() but takes the printf style name argument as well as the
     parent context and the size.

The whole thing ends up being a very simple piece of code, although
some of the pointer walking gets hairy.

So far, I'm just using the new talloc() like the old one. The next
step is to actually take advantage of the new interface
properly. Expect some new commits soon that simplify some common
coding styles in samba4 by using the new talloc().
(This used to be commit e35bb094c5)
2007-10-10 12:58:14 -05:00
Andrew Bartlett
02262db2ed r1452: Thanks to Volker for spotting that this code was certainly not tested...
(make sure to actually return the result).

Andrew Bartlett
(This used to be commit 8d449bbe2b)
2007-10-10 12:56:58 -05:00
Andrew Bartlett
30c15f37cc r1435: talloc_steal is very useful - add a function to do it with a DATA_BLOB
Andrew Bartlett
(This used to be commit 66d6e26110)
2007-10-10 12:56:55 -05:00
Andrew Bartlett
5dc73338d2 r607: When our code is looking for an 'empty' data blob
some of it tests the .length, other code checks the
.data.

Ensure that we always NULL the .data, so that talloc-based
blobs behave just like their direct malloc equivalents.

Andrew Bartlett
(This used to be commit 64121aa1a9)
2007-10-10 12:51:50 -05:00
Andrew Tridgell
340d9b71f9 added a basic dcerpc endpoint mapper to Samba4. Currently only
implements the epm_Lookup() call, I'll add the other important calls
soon. I was rather pleased to find that epm_Lookup() worked first
time, which is particularly surprising given its complexity.

This required quite a bit of new infrastructure:

  * a generic way of handling dcerpc policy handles in the rpc server

  * added type checked varients of talloc. These are much less error
    prone. I'd like to move to using these for nearly all uses of
    talloc.

  * added more dcerpc fault handling code, and translation from
    NTSTATUS to a dcerpc fault code

  * added data_blob_talloc_zero() for allocating an initially zero
    blob

  * added a endpoint enumeration hook in the dcerpc endpoint server
    operations
(This used to be commit 3f85f9b782)
2003-12-13 02:20:40 +00:00
Andrew Tridgell
16309de71d * the RPC-ECHO pipe now works in smbd, as long as the data sizes
don't cause fragmented pdus (I'll add fragments shortly)

 * change data_blob_talloc() to not zero memory when the 2nd argument
   is NULL. The zeroing just masks bugs, and can't even allow a DOS
   attack

 * modified pidl to ensure that [ref] arguments to the out side of
   functions are allocated when parsing the in side. This allows rpc
   backends to assume that [ref] variables are all setup. Doesn't work
   correctly for [ref] arrays yet

 * changed DLIST_ADD_END() to take the type instead of a tmp
   variable. This means you don't need to declare a silly tmp variable in
   the caller
(This used to be commit 46e0a35819)
2003-12-12 03:59:09 +00:00
Andrew Tridgell
c123c84541 fixed some memory leaks in the dcerpc use of ntlmssp signing
(This used to be commit abbc9993b8)
2003-11-26 02:08:41 +00:00
Andrew Tridgell
e0ac659917 signed DCERPC over TCP now works !
* moved ntlmssp code into libcli/auth/, and updated to latest ntlmssp
   code from samba3 (thanks Andrew! the new interface is great)

 * added signing/ntlmssp support in the dcerpc code

 * added a dcerpc_auth.c module for the various dcerpc auth mechanisms
(This used to be commit c18c9b5585)
2003-11-26 01:16:41 +00:00
Andrew Tridgell
ef2e26c91b first public release of samba4 code
(This used to be commit b0510b5428)
2003-08-13 01:53:07 +00:00