summaryrefslogtreecommitdiffstats
path: root/source3/libsmb/clitrans.c
Commit message (Collapse)AuthorAgeFilesLines
* s3:libsmb: always create bytes array in cli_trans codeStefan Metzmacher2009-04-151-5/+14
| | | | | | | | | | | 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 (cherry picked from commit 88dd6af605dc5754b7e146a068272d37651da710) (cherry picked from commit 5bbf96dd63227a19fe1f95ff8d8f2b3c75a5a497)
* s3:libsmb: fix smb signing for fragmented trans/trans2/nttrans requestsStefan Metzmacher2009-04-151-23/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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 (cherry picked from commit 880fbc4e8cd67de73c4bcda94489eb1e1422a04b) (cherry picked from commit 70466990b4b7c68ae95dbbcf741cd3f41f2dd0b3)
* Split up async_req into a generic and a NTSTATUS specific partVolker Lendecke2009-02-011-7/+7
|
* Add the strlen to push to smb_bytes_push_str, return the converted sizeVolker Lendecke2009-01-291-3/+3
| | | | | The pushed strlen replaces the STR_TERMINATE flag which I personally always find very confusing.
* Pass "bytes_alignment" up through cli_request_sendVolker Lendecke2008-12-191-3/+3
| | | | This parameter makes smb_spice_chain add padding before the bytes field
* Simplify async programming a bit with helper routinesVolker Lendecke2008-12-081-3/+3
| | | | Introduce async_req_is_error() and async_req_simple_recv()
* Move cli_trans_oob to lib/util.cVolker Lendecke2008-11-281-17/+4
| | | | Rename it to trans_oob, it will be used in the server routines.
* Fix some bogus compiler warningsVolker Lendecke2008-09-101-5/+10
| | | | (This used to be commit 84ed752d9f17b2279bd60f534ce7c02b267a40b2)
* Add async trans/trans2/nttrans calls to libsmbVolker Lendecke2008-09-091-0/+701
| | | | | Logic stolen from Samba4, naturally the specific implementation differs a bit. (This used to be commit 4b8bc5b03d35d563104791c0d8317d9886e4f032)
* Fix signing problem in the client with transs requestsVolker Lendecke2008-05-131-0/+3
| | | | | | | | | | | | 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 c572d537e088a3fffb057181cad9a3692e40b815)
* Revert "Fix signing bug found by Volker. That one was *subtle*."Volker Lendecke2008-05-131-0/+14
| | | | | This reverts commit 816aea6c1a426eb2450061b847729e22bdac33a0. (This used to be commit e402e6508ca0806deef4c4044cfa6461b682850a)
* Add SMB encryption. Still fixing client decrypt butJeremy Allison2007-12-261-4/+4
| | | | | | negotiation works. Jeremy. (This used to be commit d78045601af787731f0737b8627450018902b104)
* Fix signing bug found by Volker. That one was *subtle*.Jeremy Allison2007-12-041-14/+0
| | | | | Jeremy (This used to be commit 816aea6c1a426eb2450061b847729e22bdac33a0)
* Ensure we have 2 bytes of zeros as a pad-buffer at theJeremy Allison2007-11-301-40/+85
| | | | | | | end of all returned trans/trans2/nttrans client replies. Not included in a count - for safety purposes. Jeremy. (This used to be commit 3e65fa5bcf5d1af3983f2e576698eccaad79fcda)
* RIP BOOL. Convert BOOL -> bool. I found a few interestingJeremy Allison2007-10-181-6/+6
| | | | | | | | 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 f35a266b3cbb3e5fa6a86be60f34fe340a3ca71f)
* [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.Gerald (Jerry) Carter2007-10-101-4/+4
| | | | (This used to be commit 5c6c8e1fe93f340005110a7833946191659d88ab)
* r23784: use the GPLv3 boilerplate as recommended by the FSF and the license textAndrew Tridgell2007-10-101-2/+1
| | | | (This used to be commit b0132e94fc5fef936aa766fb99a306b3628e9f07)
* r23779: Change from v2 or later to v3 or later.Jeremy Allison2007-10-101-1/+1
| | | | | Jeremy. (This used to be commit 407e6e695b8366369b7c76af1ff76869b45347b3)
* r22732: - Testing of libsmbclient against Vista revealed what is likely a bug inDerrell Lipman2007-10-101-1/+8
| | | | | | | | | | | | | | | | 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 cc0cd3a12f76b8cd711e3165d4cfe920552f256d)
* r22391: Looks bigger than it is. Make "inbuf" availableJeremy Allison2007-10-101-4/+4
| | | | | | | | 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 2d80a96120a5fe2fe726f00746d36d85044c4bdb)
* r21899: At least we're getting to stage 2 of the blobJeremy Allison2007-10-101-4/+10
| | | | | | exchange. Still not working but closer. Jeremy. (This used to be commit 2fde5c703d2390bc6685f34713dc996e69732f1a)
* r17333: Some C++ warningsVolker Lendecke2007-10-101-4/+4
| | | | (This used to be commit be9aaffdaccae06c8c035eaf31862e34b7cfbe38)
* r17292: Try and fix bug #3967 - signing problems on transJeremy Allison2007-10-101-40/+61
| | | | | | | | calls introduced by signing code simplification. Please test if you've seen signing problems with 3.0.23a. Jeremy. (This used to be commit f462daf02c12cfba634f92e681eb23a09e7d0acf)
* r15018: Merge Volker's ipc/trans2/nttrans changes overJeremy Allison2007-10-101-36/+2
| | | | | | | | | 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 08e52ead03304ff04229e1bfe544ff40e2564fc7)
* r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison2007-10-101-20/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 1d710d06a214f3f1740e80e0bffd6aab44aac2b0)
* r10656: BIG merge from trunk. Features not copied overGerald Carter2007-10-101-4/+15
| | | | | | | | * \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 939c3cb5d78e3a2236209b296aa8aba8bdce32d3)
* r8572: Remove crufty #define NO_SYSLOG as it's not used at all anymore.Tim Potter2007-10-101-2/+0
| | | | (This used to be commit 985dbb47d925e79c1195ca219f7ab5d6648b22b8)
* r7415: * big change -- volker's new async winbindd from trunkGerald Carter2007-10-101-2/+2
| | | | (This used to be commit a0ac9a8ffd4af31a0ebc423b4acbb2f043d865b8)
* r5840: Fix findfirst/findnext with protocol level < NT1.Jeremy Allison2007-10-101-2/+3
| | | | | Jeremy. (This used to be commit d53b5891a7d372b3ed2488bac06939d29388f709)
* r4570: Replace cli->nt_pipe_fnum with an array of NT file numbers, one for eachVolker Lendecke2007-10-101-2/+2
| | | | | | | | | | | | | 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 dc294c52e0216424236057ca6cd35e1ebf51d0da)
* r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison2007-10-101-4/+4
| | | | | | | | | | 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 620f2e608f70ba92f032720c031283d295c5c06a)
* Ensure we use the same mid for the secondary trans requests, W2K3Jeremy Allison2003-12-011-0/+6
| | | | | | does this. Jeremy. (This used to be commit 8adf0cd27a23b1bc6e0da08789a8b1e9eefb54a7)
* Better fix for client signing bug. Ensure we don't malloc/free trans signingJeremy Allison2003-12-011-30/+26
| | | | | | state info each packet. Jeremy. (This used to be commit 818cf32d6330f7e7855ce662326003e75d4a1d46)
* Fix signing bug with secondary client trans requests. Turns out the lastJeremy Allison2003-11-301-0/+20
| | | | | | | | 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 6750dc33b46c422582176b704592d9b2f1fb04d7)
* We are doing NT error codes now.... If we have an NT error, report thatVolker Lendecke2003-10-201-0/+11
| | | | | | | | | | 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 169f4dfee08e8de05e729fd48209df91cf8ba255)
* More fixes for client and server side signing. Ensure sequence numbersJeremy Allison2003-08-021-17/+61
| | | | | | | 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 3a789cb7f01115c37404e5a696de363287cb0e5f)
* Correct fix (removed the earlier band-aid) for what I thought was a signingJeremy Allison2003-08-021-0/+18
| | | | | | | | | | | | | 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 2093a3130d4087d0659b497eebd580e7a66e5aa3)
* Merge from HEAD:Andrew Bartlett2003-03-171-3/+3
| | | | | | | | | signed/unsigned (mostly i counters) a little bit of const. Andrew Bartlett (This used to be commit 50f0ca752e5058c4051f42a9337361373ba1f727)
* Change size parameters from signed to unsigned to fix up warnings.Jeremy Allison2003-03-131-69/+164
| | | | | Jeremy. (This used to be commit 33b11d5eb53bdeb9d279d221fd5c01579253e1c7)
* Removed version number from file header.Tim Potter2002-01-301-2/+1
| | | | | Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa)
* Same fix as went into 2.2 (I'm waiting for jerry to finish some code).Jeremy Allison2002-01-111-4/+4
| | | | | Jeremy. (This used to be commit 01ff6ce4963e1daff019f2b936cef218e1c93f67)
* use cli_is_error() instead of looking in smb_rcls, otherwise NT statusAndrew Tridgell2001-09-051-2/+2
| | | | | codes don't work correctly (This used to be commit 55d5828e608671f070a9e96938be0d16d50aeb26)
* started converting NTSTATUS to be a structure on systems with gcc in order ↵Andrew Tridgell2001-08-271-20/+6
| | | | | | 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 1b778bc7d22efff3f90dc450eb12baa1241cf68f)
* converted smbd to use NTSTATUS by defaultAndrew Tridgell2001-08-271-12/+17
| | | | | | | | | | | | | | | | | 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 83d9896c1ea8be796192b51a4678c2a3b87f7518)
* a bunch of fixes from the sflight to seattleAndrew Tridgell2001-08-201-7/+10
| | | | | | | in particular: - fixed NT status code for a bunch of ops - fixed handling of protocol levels in ms_fnmatch (This used to be commit 3eba9606f71f90bfd9820af26f8676277ed22390)
* Use tparam not tdata when reallocing params to make clearer.Jeremy Allison2001-08-171-12/+15
| | | | | Jeremy. (This used to be commit 31804cb7a89f280cec4c047cad643c7f593f9b03)
* more useful debug messages and check if the size are non null.Jean-François Micouleau2001-08-171-10/+17
| | | | | | | that fix the notification backend channel for spoolss. J.F. (This used to be commit 5e9a36bd9c1aa1a28f042ec9016a097215e4539e)
* this is a big global fix for the ptr = Realloc(ptr, size) bug.Simo Sorce2001-08-121-4/+26
| | | | | | | many possible mem leaks, and segfaults fixed. someone should port this fix to 2.2 also. (This used to be commit fa8e55b8b465114ce209344965c1ca0333b84db9)
* A rewrite of the error handling in the libsmb client code. I've separatedTim Potter2001-08-101-9/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | out the error handling into a bunch of separate functions rather than all being handled in one big function. Fetch error codes from the last received packet: void cli_dos_error(struct cli_state *cli, uint8 *eclass, uint32 *num); uint32 cli_nt_error(struct cli_state *); Convert errors to UNIX errno values: int cli_errno_from_dos(uint8 eclass, uint32 num); int cli_errno_from_nt(uint32 status); int cli_errno(struct cli_state *cli); Detect different kinds of errors: BOOL cli_is_dos_error(struct cli_state *cli); BOOL cli_is_nt_error(struct cli_state *cli); BOOL cli_is_error(struct cli_state *cli); This also means we now support CAP_STATUS32 as we can decode and understand NT errors instead of just DOS errors. Yay! Ported a whole bunch of files in libsmb to use this new API instead of the just the DOS error. (This used to be commit 6dbdb0d813f3c7ab20b38baa1223b0b479aadec9)
* The big character set handling changeover!Andrew Tridgell2001-07-041-1/+1
| | | | | | | | This commit gets rid of all our old codepage handling and replaces it with iconv. All internal strings in Samba are now in "unix" charset, which may be multi-byte. See internals.doc and my posting to samba-technical for a more complete explanation. (This used to be commit debb471267960e56005a741817ebd227ecfc512a)