1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

61 Commits

Author SHA1 Message Date
Volker Lendecke
7ef78bd7b5 Convert cli_trans to tevent_req 2009-04-06 21:32:06 +02:00
Volker Lendecke
ba408a2c82 Remove async_req dependency from cli_pull_trans 2009-04-05 16:07:41 +02:00
Volker Lendecke
62f12e2322 Fix an uninitialized variable valgrind error
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2009-03-31 21:19:15 +02:00
Stefan Metzmacher
6af15943c6 s3:libsmb: use new simplified smb_signing code for the client side
We store the seqnum/mid mapping in the cli_request structure
for async requests and in the cli_state structure for sync calls.

We skip the signing check for oplock requests while waiting
for async requests coming in.

metze
2009-03-23 12:21:14 +01:00
Stefan Metzmacher
88dd6af605 s3:libsmb: always create bytes array in cli_trans code
Otherwise we return NO_MEMORY without a reason for fragmented trans
requests, as talloc_append_blob() returns buf if we append a 0 length
blob. When we pass buf = NULL we'll get back NULL and then assume
NO_MEMORY...

metze
2009-03-19 13:57:21 +01:00
Stefan Metzmacher
880fbc4e8c s3:libsmb: fix smb signing for fragmented trans/trans2/nttrans requests
Before we send the secondary requests we need to remove the
old mid=>seqnum mapping and reset cli->mid and make the new
mid=>seqnum mapping "persistent".

The bug we had in cli_send_trans was this:
The first cli_send_smb() incremented cli->mid
and the secondary requests used the incremented mid,
but as cli->outbuf still had the correct mid,
we send the correct mid to the server. The real problem
was that the cli_send_smb() function stored the seqnum
under the wrong mid.

cli_send_nttrans() was totally broken and now follows the
same logic as cli_send_trans().

The good thing is that in practice the problem is unlikely to happen,
because max_xmit is large enough to avoid secondary requests.

metze
2009-03-19 13:54:22 +01:00
Volker Lendecke
c14b7e648b Split up async_req into a generic and a NTSTATUS specific part 2009-02-01 19:05:39 +01:00
Volker Lendecke
37da26a06e Add the strlen to push to smb_bytes_push_str, return the converted size
The pushed strlen replaces the STR_TERMINATE flag which I personally always
find very confusing.
2009-01-29 21:38:06 +01:00
Volker Lendecke
4abdd3981e Pass "bytes_alignment" up through cli_request_send
This parameter makes smb_spice_chain add padding before the bytes field
2008-12-19 14:53:29 +01:00
Volker Lendecke
7fbb64d726 Simplify async programming a bit with helper routines
Introduce async_req_is_error() and async_req_simple_recv()
2008-12-08 22:09:33 +01:00
Volker Lendecke
9a3be6f0f8 Move cli_trans_oob to lib/util.c
Rename it to trans_oob, it will be used in the server routines.
2008-11-28 08:24:37 +01:00
Volker Lendecke
40b93006c1 Fix some bogus compiler warnings
(This used to be commit 84ed752d9f)
2008-09-10 11:57:10 +02:00
Volker Lendecke
c81b5fd440 Add async trans/trans2/nttrans calls to libsmb
Logic stolen from Samba4, naturally the specific implementation differs a bit.
(This used to be commit 4b8bc5b03d)
2008-09-09 17:37:34 +02:00
Volker Lendecke
44b7f672b8 Fix signing problem in the client with transs requests
This is a different fix than Jeremy put into 3-0-test with 040db1ce85 and other
branches with different hashes. Jeremy, I think your fix led to bug 5436, so I
reverted your fix. This fixes the original problem I found with the transs
requests for large rpc queries in a different way. Please check!

Thanks,

Volker
(This used to be commit c572d537e0)
2008-05-13 16:29:47 +02:00
Volker Lendecke
8ef2ada0ef Revert "Fix signing bug found by Volker. That one was *subtle*."
This reverts commit 816aea6c1a.
(This used to be commit e402e6508c)
2008-05-13 16:29:47 +02:00
Jeremy Allison
afc93255d1 Add SMB encryption. Still fixing client decrypt but
negotiation works.
Jeremy.
(This used to be commit d78045601a)
2007-12-26 17:12:36 -08:00
Jeremy Allison
774a30989a Fix signing bug found by Volker. That one was *subtle*.
Jeremy
(This used to be commit 816aea6c1a)
2007-12-04 13:30:22 -08:00
Jeremy Allison
d19861e29d Ensure we have 2 bytes of zeros as a pad-buffer at the
end of all returned trans/trans2/nttrans client replies.
Not included in a count - for safety purposes.
Jeremy.
(This used to be commit 3e65fa5bcf)
2007-11-30 18:02:19 -08:00
Jeremy Allison
30191d1a57 RIP BOOL. Convert BOOL -> bool. I found a few interesting
bugs in various places whilst doing this (places that assumed
BOOL == int). I also need to fix the Samba4 pidl generation
(next checkin).
Jeremy.
(This used to be commit f35a266b3c)
2007-10-18 17:40:25 -07:00
Gerald (Jerry) Carter
e5a951325a [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.
(This used to be commit 5c6c8e1fe9)
2007-10-10 15:34:30 -05:00
Andrew Tridgell
5e54558c6d r23784: use the GPLv3 boilerplate as recommended by the FSF and the license text
(This used to be commit b0132e94fc)
2007-10-10 12:28:22 -05:00
Jeremy Allison
d824b98f80 r23779: Change from v2 or later to v3 or later.
Jeremy.
(This used to be commit 407e6e695b)
2007-10-10 12:28:20 -05:00
Derrell Lipman
d1153fc790 r22732: - Testing of libsmbclient against Vista revealed what is likely a bug in
Vista.  Vista provides a plethora of kludges to simulate older versions of
  Windows.  The kludges are in the form of shortcuts (or more likely symbolic
  links, but I don't know enough about Vista to determine that definitively)
  and in most cases, attempts to access them get back an "access denied"
  error.  On one particular folder, however, "<share>/Users/All Users", it
  returns an unknown (to ethereal and the Samba3 code) NT status code:
  0x8000002d.  Although this code does not have a high byte of 0xc0 indicating
  that it is an error, it appears to be an alternate form of "access denied".

  Without this patch, libsmbclient times out on an attempt to enumerate that
  folder rather than returning an error to the caller.  This patch corrects
  that problem.
(This used to be commit cc0cd3a12f)
2007-10-10 12:21:52 -05:00
Jeremy Allison
0829e1ad1c r22391: Looks bigger than it is. Make "inbuf" available
to all callers of smb_setlen (via set_message()
calls). This will allow the server to reflect back
the correct encryption context.
Jeremy.
(This used to be commit 2d80a96120)
2007-10-10 12:19:30 -05:00
Jeremy Allison
7e55a6e6c7 r21899: At least we're getting to stage 2 of the blob
exchange. Still not working but closer.
Jeremy.
(This used to be commit 2fde5c703d)
2007-10-10 12:18:47 -05:00
Volker Lendecke
02eea79624 r17333: Some C++ warnings
(This used to be commit be9aaffdac)
2007-10-10 11:38:26 -05:00
Jeremy Allison
321b0a3a63 r17292: Try and fix bug #3967 - signing problems on trans
calls introduced by signing code simplification.
Please test if you've seen signing problems with
3.0.23a.
Jeremy.
(This used to be commit f462daf02c)
2007-10-10 11:38:23 -05:00
Jeremy Allison
22dbd67708 r15018: Merge Volker's ipc/trans2/nttrans changes over
into 3.0. Also merge the new POSIX lock code - this
is not enabled unless -DDEVELOPER is defined.
This doesn't yet map onto underlying system POSIX
locks. Updates vfs to allow lock queries.
Jeremy.
(This used to be commit 08e52ead03)
2007-10-10 11:15:57 -05:00
Jeremy Allison
894358a8f3 r13915: Fixed a very interesting class of realloc() bugs found by Coverity.
realloc can return NULL in one of two cases - (1) the realloc failed,
(2) realloc succeeded but the new size requested was zero, in which
case this is identical to a free() call.

The error paths dealing with these two cases should be different,
but mostly weren't. Secondly the standard idiom for dealing with
realloc when you know the new size is non-zero is the following :

 tmp = realloc(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

However, there were *many* *many* places in Samba where we were
using the old (broken) idiom of :

 p = realloc(p, size)
 if (!p) {
    return error;
 }

which will leak the memory pointed to by p on realloc fail.

This commit (hopefully) fixes all these cases by moving to
a standard idiom of :

 p = SMB_REALLOC(p, size)
 if (!p) {
    return error;
 }

Where if the realloc returns null due to the realloc failing
or size == 0 we *guarentee* that the storage pointed to by p
has been freed. This allows me to remove a lot of code that
was dealing with the standard (more verbose) method that required
a tmp pointer. This is almost always what you want. When a
realloc fails you never usually want the old memory, you
want to free it and get into your error processing asap.

For the 11 remaining cases where we really do need to keep the
old pointer I have invented the new macro SMB_REALLOC_KEEP_OLD_ON_ERROR,
which can be used as follows :

 tmp = SMB_REALLOC_KEEP_OLD_ON_ERROR(p, size);
 if (!tmp) {
    SAFE_FREE(p);
    return error;
 } else {
    p = tmp;
 }

SMB_REALLOC_KEEP_OLD_ON_ERROR guarentees never to free the
pointer p, even on size == 0 or realloc fail. All this is
done by a hidden extra argument to Realloc(), BOOL free_old_on_error
which is set appropriately by the SMB_REALLOC and SMB_REALLOC_KEEP_OLD_ON_ERROR
macros (and their array counterparts).

It remains to be seen what this will do to our Coverity bug count :-).

Jeremy.
(This used to be commit 1d710d06a2)
2007-10-10 11:10:59 -05:00
Gerald Carter
54abd2aa66 r10656: BIG merge from trunk. Features not copied over
* \PIPE\unixinfo
* winbindd's {group,alias}membership new functions
* winbindd's lookupsids() functionality
* swat (trunk changes to be reverted as per discussion with Deryck)
(This used to be commit 939c3cb5d7)
2007-10-10 11:04:48 -05:00
Tim Potter
ab398643a4 r8572: Remove crufty #define NO_SYSLOG as it's not used at all anymore.
(This used to be commit 985dbb47d9)
2007-10-10 11:00:11 -05:00
Gerald Carter
fed660877c r7415: * big change -- volker's new async winbindd from trunk
(This used to be commit a0ac9a8ffd)
2007-10-10 10:57:08 -05:00
Jeremy Allison
3fc141baac r5840: Fix findfirst/findnext with protocol level < NT1.
Jeremy.
(This used to be commit d53b5891a7)
2007-10-10 10:56:04 -05:00
Volker Lendecke
c85d9e735c r4570: Replace cli->nt_pipe_fnum with an array of NT file numbers, one for each
supported pipe. Netlogon is still special, as we open that twice, one to do
the auth2, the other one with schannel.

The client interface is completely unchanged for those who only use a single
pie. cli->pipe_idx is used as the index for everything except the "real"
client rpc calls, which have been explicitly converted in my last commit. Next
step is to get winbind to just use a single smb connection for multiple pipes.

Volker
(This used to be commit dc294c52e0)
2007-10-10 10:53:47 -05:00
Jeremy Allison
acf9d61421 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.
(This used to be commit 620f2e608f)
2007-10-10 10:53:32 -05:00
Jeremy Allison
b4fa65d0ad Ensure we use the same mid for the secondary trans requests, W2K3
does this.
Jeremy.
(This used to be commit 8adf0cd27a)
2003-12-01 03:24:50 +00:00
Jeremy Allison
12d3246a6c Better fix for client signing bug. Ensure we don't malloc/free trans signing
state info each packet.
Jeremy.
(This used to be commit 818cf32d63)
2003-12-01 01:04:04 +00:00
Jeremy Allison
2ad1159990 Fix signing bug with secondary client trans requests. Turns out the last
packet is the one that matters for checking the signing replies. Need to
check the server code does this correctly too....
Bug #832 reported by Volker.
Jeremy.
(This used to be commit 6750dc33b4)
2003-11-30 19:40:57 +00:00
Volker Lendecke
df81637076 We are doing NT error codes now.... If we have an NT error, report that
back the same way we handle the DOS error. Although I don't see why
BUFFER_TOO_SMALL should not be handled as an error, simply copy the logic.

This is only called from smbcacls and smbcquotas.

Volker
(This used to be commit 169f4dfee0)
2003-10-20 08:41:32 +00:00
Jeremy Allison
099bd33a99 More fixes for client and server side signing. Ensure sequence numbers
are updated correctly on returning an error for server trans streams.
Ensure we turn off client trans streams on error.
Jeremy.
(This used to be commit 3a789cb7f0)
2003-08-02 07:07:38 +00:00
Jeremy Allison
2443f7ffa2 Correct fix (removed the earlier band-aid) for what I thought was a signing
bug with w2k. Turns out that when we're doing a trans/trans2/nttrans call
the MID and send_sequence_number and reply_sequence_number must remain constant.
This was something we got very wrong in earlier versions of Samba. I can now
get a directory listing from WINNT\SYSTEM32 with the older earlier parameters
for clilist.c
This still needs to be fixed for the server side of Samba, client appears to
be working happily now (I'm doing a signed smbtar download of an entire W2K3
image to test this :-).
Jeremy.
(This used to be commit 2093a3130d)
2003-08-02 00:29:45 +00:00
Andrew Bartlett
e88eab35bc Merge from HEAD:
signed/unsigned (mostly i counters)

a little bit of const.

Andrew Bartlett
(This used to be commit 50f0ca752e)
2003-03-17 23:04:03 +00:00
Jeremy Allison
dbe2858b86 Change size parameters from signed to unsigned to fix up warnings.
Jeremy.
(This used to be commit 33b11d5eb5)
2003-03-13 00:51:05 +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
Jeremy Allison
d6823366b8 Same fix as went into 2.2 (I'm waiting for jerry to finish some code).
Jeremy.
(This used to be commit 01ff6ce496)
2002-01-11 19:10:25 +00:00
Andrew Tridgell
d53d5beeb2 use cli_is_error() instead of looking in smb_rcls, otherwise NT status
codes don't work correctly
(This used to be commit 55d5828e60)
2001-09-05 11:32:59 +00:00
Andrew Tridgell
ee5f7237de started converting NTSTATUS to be a structure on systems with gcc in order to make it type incompatible with BOOL so we catch errors sooner. This has already found a number of bugs
(This used to be commit 1b778bc7d2)
2001-08-27 17:52:23 +00:00
Andrew Tridgell
e8e98c9ea0 converted smbd to use NTSTATUS by default
major changes include:

- added NSTATUS type
- added automatic mapping between dos and nt error codes
- changed all ERROR() calls to ERROR_DOS() and many to ERROR_NT()
  these calls auto-translate to the client error code system
- got rid of the cached error code and the writebmpx code

We eventually will need to also:
- get rid of BOOL, so we don't lose error info
- replace all ERROR_DOS() calls with ERROR_NT() calls

but that is too much for one night
(This used to be commit 83d9896c1e)
2001-08-27 08:19:43 +00:00
Andrew Tridgell
11ce0f4d2d a bunch of fixes from the sflight to seattle
in particular:
 - fixed NT status code for a bunch of ops
 - fixed handling of protocol levels in ms_fnmatch
(This used to be commit 3eba9606f7)
2001-08-20 05:15:26 +00:00
Jeremy Allison
556c8f3fbf Use tparam not tdata when reallocing params to make clearer.
Jeremy.
(This used to be commit 31804cb7a8)
2001-08-17 18:16:42 +00:00