1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-27 07:42:04 +03:00
Commit Graph

101 Commits

Author SHA1 Message Date
4e0ac63c36 r6014: rather large change set....
pulling back all recent rpc changes from trunk into
3.0.  I've tested a compile and so don't think I've missed
any files.  But if so, just mail me and I'll clean backup
in a couple of hours.

Changes include \winreg, \eventlog, \svcctl, and
general parse_misc.c updates.

I am planning on bracketing the event code with an
#ifdef ENABLE_EVENTLOG until I finish merging Marcin's
changes (very soon).
2007-10-10 10:56:15 -05:00
25121547ca r5805: merging spoolss parsing changes from trunk and cleaning up resulting segvs 2007-10-10 10:56:01 -05:00
a348f9221a r4601: Removed any use of the MAX_XXX_STR style definitions. A little larger
change than I'd hoped for due to formating changes to tidy up code.
Jeremy.
2007-10-10 10:53:49 -05:00
620f2e608f r4088: Get medieval on our ass about malloc.... :-). Take control of all our allocation
functions so we can funnel through some well known functions. Should help greatly with
malloc checking.
HEAD patch to follow.
Jeremy.
2007-10-10 10:53:32 -05:00
36741d3cf5 r1492: Rework our random number generation system.
On systems with /dev/urandom, this avoids a change to secrets.tdb for every fork().

For other systems, we now only re-seed after a fork, and on startup.
No need to do it per-operation.  This removes the 'need_reseed'
parameter from generate_random_buffer().

Andrew Bartlett
2007-10-10 10:52:13 -05:00
af251f4ea6 r1202: This hopefully fixes our memory use when unmarshalling strings. The test case
was 'rpcclient -c "enumprinters 2"' with 4000 printers. At some point this
completely exploded in memory usage. For every string we talloc'ed memory up
to the end of the buffer. -> O(n^2).

This survives valgrind with this number of printers. It might also have
influence on winbind with a large number of users.

All those who dare to look at samba3 rpc code, could you please take a look? I
know this is a burden, but I would like comments ;-)))

Volker
2007-10-10 10:51:59 -05:00
a363e5d8c5 source/rpc_parse/parse_prs.c ZERO_STRUCTP(ps) not needed as it is done
in prs_init now

testsuite/printing/psec.c	cannot do a prs_mem_free() when tdb_prs_fetch fails
				as the prs structure has not been initialized
-
ebabf72a78 fix some warnings from the Sun compiler -
68945027b5 Fix some uninitialised variable warnings. -
3802f5895e commit sign only patch from Andrew; bug 167; tested using 2k & XP clientspreviously joined to the Samba domain -
398bd14fc6 get rid of more compiler warnings -
024d32f793 Fix comment -
59dae1da66 More printf portability fixes. Got caught out by some gcc'isms last
time.  )-:
-
ba4d334b82 More printf fixes - size_t is long on some architectures. -
5472ddc9ea Jeremy requested that I get my NTLMSSP patch into CVS. He didn't request
the schannel code, but I've included that anyway. :-)

This patch revives the client-side NTLMSSP support for RPC named pipes
in Samba, and cleans up the client and server schannel code.  The use of the
new code is enabled by the 'sign', 'seal' and 'schannel' commands in
rpcclient.

The aim was to prove that our separate NTLMSSP client library actually
implements NTLMSSP signing and sealing as per Microsoft's NTLMv1 implementation,
in the hope that knowing this will assist us in correctly implementing
NTLMSSP signing for SMB packets.  (Still not yet functional)

This patch replaces the NTLMSSP implementation in rpc_client/cli_pipe.c with
calls to libsmb/ntlmssp.c.  In the process, we have gained the ability to
use the more secure NT password, and the ability to sign-only, instead of
having to seal the pipe connection.  (Previously we were limited to sealing,
and could only use the LM-password derived key).

Our new client-side NTLMSSP code also needed alteration to cope with our
comparatively simple server-side implementation.  A future step is to replace
it with calls to the same NTLMSSP library.

Also included in this patch is the schannel 'sign only' patch I submitted to
the team earlier.  While not enabled (and not functional, at this stage) the
work in this patch makes the code paths *much* easier to follow.  I have also
included similar hooks in rpccleint to allow the use of schannel on *any* pipe.

rpcclient now defaults to not using schannel (or any other extra per-pipe
authenticiation) for any connection.  The 'schannel' command enables schannel
for all pipes until disabled.

This code is also much more secure than the previous code, as changes to our
cli_pipe routines ensure that the authentication footer cannot be removed
by an attacker, and more error states are correctly handled.

(The same needs to be done to our server)

Andrew Bartlett
-
285952fd62 This fixes net rpc vampire when talking to win2k (<sp3). win2k sends
back a different sized blob of encrypted password data then we were
expecting.  There's an extra 32 bytes of unknown stuff.
-
0ef69b586a parse_string is only used for the authentication negotiators.
It can itself determine the length of the string it has to
transfer. Andrew B., could you take a look at the length calculation?
Is that safe?

Thanks,

Volker
-
ff66d40970 Fixes to make SCHANNEL work in 3.0 against a W2K DC. Still need to fix
multi-PDU encode/decode with SCHANNEL. Also need to test against WNT DC.
Jeremy.
-
0f348a35d0 Put the core schannel functions to parse_prs.c. They are also used by
schannel clients.

Volker
-
50f0ca752e Merge from HEAD:
signed/unsigned (mostly i counters)

a little bit of const.

Andrew Bartlett
-
a823fee5b4 Ensure that only parse_prs.c access internal members of the prs_struct.
Needed to move to disk based i/o later.
Jeremy.
-
7a4c874842 merging some rpcclient and net functionality from HEAD -
3a7458f947 Merge from HEAD - make Samba compile with -Wwrite-strings without additional
warnings.  (Adds a lot of const).

Andrew Bartlett
-
5d5762d178 Lots of fixes for error paths where tdb_fetch() data need freeing.
Found via a post from Arcady Chernyak <Arcady.Chernyak@efi.com>.
Jeremy.
-
65e7b5273b sync'ing up for 3.0alpha20 release -
3928578b52 sync 3.0 branch with head -
03ac082dcb updated the 3.0 branch from the head branch - ready for alpha18 -
ddb5753e36 Added dos_errstr() function. Not all errors in list yet. -
1f007d3ed4 Renamed get_nt_error_msg() to nt_errstr(). -
6a58c9bd06 Removed version number from file header.
Changed "SMB/Netbios" to "SMB/CIFS" in file header.
-
9a969069f1 Added prs_mem_clear(). Clear memory on buffer reallocation. That way
we're not returning what the client gave us.
Jeremy.
-
6deb4caca5 Always clear malloced memory for parse structs.
Jeremy.
-
92a3ab274e Add prs_dump_before to dump everything from the start of the prs
buffer up to the current position, and use this to dump pipe buffers
just before parsing.
-
bfbe7f377e samr_querydom_info level 1: found the meaning of the unknow fields. And
discovered that our reply is short by 4 bytes since day 1 of this code.

Added a decode function to rpcclient too.

splitted the STRING2 fields filling while trying to understand the win9x
userlist bug. (didn't fix the bug, but the reply looks closer to NT).

        J.F.
-
5c892badbc Doxygen demo for Tim. -
2d0922b0ea Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header. -
94b0fde8a8 move to SAFE_FREE() -
3245714243 Merge prs_hash1() function from tng. -
dcd6e735f7 the next stage in the NTSTATUS/WERROR change. smbd and nmbd now compile, but the client code still needs some work -
94747b4639 Got "medieval on our ass" about adding the -1 to slprintf.
Jeremy.
-
13765eca71 configure configure.in include/config.h.in lib/replace.c: Added test and replacement
for setlinebuf which apparantly doesn't exist on HPUX 11.
include/byteorder.h:
rpc_parse/parse_prs.c:
Ding Dong the witch is dead ! :-). Ok, I'm happy 'cos I've finally deleted
all the *HORRIBLE* DBG_RW_XXX and RW_XXX macros from include/byteorder.h.
They were macros that included macros that had conditional macros included.
No one understood them (they were the cause of most of the bigendian issue
bugs). Finally, I went into parse_prs.c and inlined all of that stuff with
regular function calls. They're understandable, they're easy to edit and
they don't include macros !
JF - please look at the one comment I added (JF PLEASE CHECK). I have
tested this partly with IRIX (a bigendian system) running with AS/U on
a Solaris box in SGI's lab, and I've also confirmed these new changes
work with W2K (vmware) but there may be the odd bug lurking. Herb, if
you could re-checkout and test again with this code that would help.

Extra.  Fixed bug spotted by the sharp eyes of JF - big endian unicode
packet would cause a early truncate of string parsing as we were checking for a char *
0, not a uint16 * 0.

Jeremy.
-
0cd37c831d Serious (and I *mean* serious) attempt to fix little/bigendian RPC issues.
We were reading the endainness in the RPC header and then never propagating
it to the internal parse_structs used to parse the data.
Also removed the "align" argument to prs_init as it was *always* set to
4, and if needed can be set differently on a case by case basis.
Now ready for AS/U testing when Herb gets it set up :-).
Jeremy.
-
c3a1904564 Merged JF's fixes into HEAD. These are for string parsing and SAMR fixes.
Jeremy.
-
94fdffb355 As prs_alloc_mem now zeros memory, remove superfluous memsets after it.
Jeremy.
-
c9a6a17025 Separated dfs pipe into implementation and interface modules.
rpc_parse/parse_dfs.c: Had to add buffer overrun checking ! HOW DID THIS GET IN HERE !
rpc_parse/parse_prs.c: Ensure prs_alloc_mem does a memset of zero before returning.
Jeremy.
-
69fe739303 lib/util_unistr.c:
rewrote unistr2_to_ascii() to correct a bug seen on SGI boxes.

rpc_parse/parse_misc.c:
rpc_parse/parse_prs.c:
        rewrote of BUFFER5 handling to NOT byteswap when it was already in
        network byte order.

rpc_parse/parse_samr.c:
        cleanup of samr_io_q_lookup_domain(), remove the over-parsing by 2
        bytes.

rpc_server/srv_lsa.c:
        UNISTR2 strings need to be NULL terminated to pleased W2K.

rpc_server/srv_spoolss_nt.c:
        use snprintf instead of safe_strcpy as we want the string
        truncated at 32 chars.


That should fix SUN and SGI box not able to act as printserver and the
problem with joining from a W2K wks.

        J.F.
-
71e5e802b7 return NULL instead of return False in char *prs_mem_get(); -
d8bf81553c last part of W2K support.
the trust domain list reply on netlogon pipe was wrong, interim hack until
we have full trust relationships.

changed some unistr2 to parse the ending NULL char.

added a prs_align_needed() function. much like a prs_align but with a
condition. needed for the unistr2 parsing.

	J.F.
-
83bfe94771 fixing prs_unistr2(). For the special case of an empty (but existing)
string.

	J.F.
-
d131ad1ce3 Adding Herb's compile warning fixes to HEAD.
Jeremy.
-