summaryrefslogtreecommitdiff
path: root/source3/libsmb/clireadwrite.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r15162: Patch for bug #3668. Windows has a bug with LARGE_READXJeremy Allison1-1/+5
where if you ask for exactly 64k bytes it returns 0. Jeremy. (This used to be commit dcef65acb5bc08ea4b61ef490a518b7e668ff2ee)
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-1/+6
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)
2007-10-10r13119: Fix for #1779 from William Jojo <jojowil@hvcc.edu>Jeremy Allison1-4/+6
Jeremy. (This used to be commit 103cac7dd314117b15e27fd263a64beeb36ed6e6)
2007-10-10r10656: BIG merge from trunk. Features not copied overGerald Carter1-6/+6
* \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)
2007-10-10r8572: Remove crufty #define NO_SYSLOG as it's not used at all anymore.Tim Potter1-2/+0
(This used to be commit 985dbb47d925e79c1195ca219f7ab5d6648b22b8)
2007-10-10r4212: Ensure we only look at the bottom bit of large_readx.Jeremy Allison1-5/+6
Set the 14 word version of write if size > 0xffff as well as 64-bit offset. Jeremy. (This used to be commit 94779ccb39560bf5eecab77d70f1fa04bfcf1456)
2007-10-10r4188: Ensure we add in the upper length in the right place !Jeremy Allison1-1/+1
Jeremy. (This used to be commit 9d4e57f06c4f75f42036e91401b0d0392647752b)
2007-10-10r4186: Fix client & server to allow 127k READX calls.Jeremy Allison1-1/+7
Jeremy. (This used to be commit 831cb21a874601e4536c2cf76c5351e1d0defcb5)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-2/+2
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)
2007-10-10r2959: If we want to support writes >= 65536 with cli_write, then it had betterRichard Sharpe1-4/+4
return a size_t, not an ssize_t, and we had better left shift the upper part of the write count, not right shift it. (This used to be commit 3eb33fbc64415600d62ff7b1f2edd67d2dac05b4)
2007-10-10r2373: Fix typo.Jeremy Allison1-3/+3
Jeremy. (This used to be commit b1033fc77c97f0d9b5613a0b9f7d45dcf58e6b56)
2007-10-10r2371: Fix for talking to OS/2 clients (max_mux ignored) by Guenter Kukkukk ↵Jeremy Allison1-1/+7
<guenter.kukkukk@kukkukk.com>. Bugid #1590. Jeremy. (This used to be commit 330025d1a669de927a3879a9c3a9fc20e1be464f)
2003-08-08RPC fix from Ronan Waide <waider@waider.ie>. Tested with rpcecho.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 68590b9e2266cf76b46a68cca0acaa47733811fe)
2003-01-15*lots of small merges form HEADGerald Carter1-2/+5
*sync up configure.in *don't build torture tools in make all *make sure to remove torture tools as part of make clean (This used to be commit 0fb724b3216eeeb97e61ff12755ca3a31bcad6ef)
2003-01-03Merge from HEAD - make Samba compile with -Wwrite-strings without additionalAndrew Bartlett1-2/+3
warnings. (Adds a lot of const). Andrew Bartlett (This used to be commit 3a7458f9472432ef12c43008414925fd1ce8ea0c)
2002-12-30Merge Richard's write > 4Gb fix.Jeremy Allison1-2/+12
Jeremy. (This used to be commit 5431bae8944496f44d8cc6d2c4de86e9feb60f32)
2002-12-19merge from 2.2 fix for smbclient large filesHerb Lewis1-1/+9
(This used to be commit 17f685fdbf5d36f82e3da0a09457f5e248b3f109)
2002-11-27Test was reversed for ERRmoredata in cli_read.Jeremy Allison1-0/+10
Jeremy. (This used to be commit fff7f3cbe248982bcd70abb1da6624186bab42d2)
2002-09-25sync'ing up for 3.0alpha20 releaseGerald Carter1-1/+1
(This used to be commit 65e7b5273bb58802bf0c389b77f7fcae0a1f6139)
2002-07-15updated the 3.0 branch from the head branch - ready for alpha18Andrew Tridgell1-26/+38
(This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce)
2002-03-20Correctly increment offset in cli_smbwrite.Jeremy Allison1-0/+2
Jeremy. (This used to be commit 5b04b5f1df3ee509e7314064966be09e2202b0ef)
2002-03-20Test against W2K that we're doing large read/writes correctly (we are).Jeremy Allison1-0/+9
At least with 14 word writes. Jeremy. (This used to be commit 24ef6258a16e6b4673f1088d64b79bddcd268df5)
2002-01-30Removed version number from file header.Tim Potter1-2/+1
Changed "SMB/Netbios" to "SMB/CIFS" in file header. (This used to be commit 6a58c9bd06d0d7502a24bf5ce5a2faf0a146edfa)
2002-01-11Same fix as went into 2.2 (I'm waiting for jerry to finish some code).Jeremy Allison1-6/+6
Jeremy. (This used to be commit 01ff6ce4963e1daff019f2b936cef218e1c93f67)
2001-09-05use cli_is_error() instead of looking in smb_rcls, otherwise NT statusAndrew Tridgell1-2/+2
codes don't work correctly (This used to be commit 55d5828e608671f070a9e96938be0d16d50aeb26)
2001-08-27started converting NTSTATUS to be a structure on systems with gcc in order ↵Andrew Tridgell1-4/+5
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)
2001-08-24Re-added readbraw call to test with smbtorture. This code not yetJeremy Allison1-1/+88
tested... Jeremy. (This used to be commit fe85a19b4b9db5910ad8259890f94c9496e1aebf)
2001-08-10A rewrite of the error handling in the libsmb client code. I've separatedTim Potter1-10/+14
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)
2001-07-01cli_read() was reading too many bytes.Andrew Tridgell1-2/+1
(This used to be commit ba79d2a030b9ae087f0cc4248baa6cf6bee112fb)
2001-06-29Use a logical cli_read(), removed the cli_read_one() hack.Jeremy Allison1-124/+61
Jeremy. (This used to be commit 2999eab5abe86bf08e693800c01ad544f04e4d6c)
2001-06-22Merged cli_read_one() function for reading DCE/RPC reply fragments.Tim Potter1-0/+46
(This used to be commit 9e074bc2bf2df34048b67457623bb8219fb1e4d6)
2001-06-22added some comments to make the cli read code clearerAndrew Tridgell1-4/+14
(This used to be commit bbfbe03cc6166c23c42a704b5acaa19cbdbc39ce)
2001-06-21next_token() was supposed to be a reentrant replacement for strtok(),Andrew Tridgell1-5/+8
but the code suffered from bitrot and is not now reentrant. That means we can get bizarre behaviour i've fixed this by making next_token() reentrant and creating a next_token_nr() that is a small non-reentrant wrapper for those lumps of code (mostly smbclient) that have come to rely on the non-reentrant behaviour (This used to be commit 674ee2f1d12b0afc164a9e9072758fd1c5e54df7)
2001-06-05Set correct reply word in large writeX (greater than 64k) replies.Jeremy Allison1-1/+5
Also added smbtorture test for this. Jeremy. (This used to be commit 6d65556ae8bea45a203defaded8436cbb56965e1)
2000-08-01Tidyup removing many of the 0xC0000000 | NT_STATUS_XXX stuff (only need ↵Jeremy Allison1-2/+2
NT_STATUS_XXX). Removed IS_BITS_xxx macros as they were just reproducing "C" syntax in a more obscure way. Jeremy. (This used to be commit c55bcec817f47d6162466b193d533c877194124a)
2000-04-25split clientgen.c into several partsAndrew Tridgell1-0/+273
the next step is splitting out the auth code, to make adding lukes NTLMSSP support easier (This used to be commit 10c5470835b43116ed48b3137c3b9cc867a20989)