summaryrefslogtreecommitdiff
path: root/source3/client/clitar.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-5/+2
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-10r13535: Fix #2353 based on a patch by William Jojo.Jeremy Allison1-3/+4
Jeremy. (This used to be commit fe63a6ee06149195032320dd0fb9b6c7dfb460d3)
2007-10-10r12522: Try and fix bug #2926 by removing setlocale(LC_ALL, "C")Jeremy Allison1-1/+1
and replace calls to isupper/islower/toupper/tolower with ASCII equivalents (mapping into _w variants). Jeremy. (This used to be commit c2752347eb2deeb2798c580ec7fc751a847717e9)
2007-10-10r12045: More warning fixes... Just a few more to go.Jeremy Allison1-0/+2
Jeremy. (This used to be commit cd192ed79a531c6775cdbfb35f0eb2e0fa230ce9)
2007-10-10r11511: A classic "friday night check-in" :-). This moves muchJeremy Allison1-1/+1
of the Samba4 timezone handling code back into Samba3. Gets rid of "kludge-gmt" and removes the effectiveness of the parameter "time offset" (I can add this back in very easily if needed) - it's no longer being looked at. I'm hoping this will fix the problems people have been having with DST transitions. I'll start comprehensive testing tomorrow, but for now all modifications are done. Splits time get/set functions into srv_XXX and cli_XXX as they need to look at different timezone offsets. Get rid of much of the "efficiency" cruft that was added to Samba back in the day when the C library timezone handling functions were slow. Jeremy. (This used to be commit 414303bc0272f207046b471a0364fa296b67c1f8)
2007-10-10r6225: get rid of warnings from my compiler about nested externsHerb Lewis1-1/+1
(This used to be commit efea76ac71412f8622cd233912309e91b9ea52da)
2007-10-10r5968: derrell's large file fix for libsmbclient (BUG 2505)Gerald Carter1-1/+1
(This used to be commit 85be4c5df398faa6c5bfacd1f9d2f12c39d411e1)
2007-10-10r5687: Fix for bug #2398 from Kevin Dalley <kevin@kelphead.org>.Jeremy Allison1-5/+1
smbtar shouldn't assume /dev/null means dryrun. Jeremy. (This used to be commit 84e7b7db8992db7812b8e09b8633c257657fb91c)
2007-10-10r5295: fix compile issue with MIT 1.4 due to broken gssapi.hGerald Carter1-30/+0
(This used to be commit f88f5e12187ed87934ae2cafbf9e9599d4fd7f6c)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-11/+11
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-10r2835: Since we always have -I. and -I$(srcdir) in CFLAGS, we can get rid ofTim Potter1-1/+1
'..' from all #include preprocessor commands. This fixes bugzilla #1880 where OpenVMS gets confused about the '.' characters. (This used to be commit 7f161702fa4916979602cc0295919b541912acd6)
2007-10-10r2361: Fix the appalling toktocliplist() fn. Bug found by Luis Benvenutto.Jeremy Allison1-3/+5
Jeremy. (This used to be commit d434d8e2b47bc8553ee04bd7211f622e3fcbb7fb)
2007-10-10r1320: Return an error when the last command read from stdin fails in ↵Jelmer Vernooij1-3/+3
smbclient + prepare for better error checking in tar.. (This used to be commit 374f00b56b7e9bff08e70ee2d93538b2c7fde7b7)
2004-03-18Merge from HEAD for Amanda group.Jeremy Allison1-2/+2
Apply Craig Barratt's fixes to allow multiple exlusion files and patterns. Jeremy. (This used to be commit 0272fac8ca40b3d4ea4de8ac8a2e371d450d12e6)
2003-09-12Fix from Craig Barratt <cbarratt@users.sourceforge.net> to fix restoreJeremy Allison1-2/+4
with filenames > 100 chars. Jeremy. (This used to be commit aa40a86cbe797cba4e281cb8dc09b2ae67e93dc2)
2003-09-02Proposed patch for #308. Needs testing.Jeremy Allison1-7/+10
Jeremy (This used to be commit e2b73477e772ac2f527719df0d3d64c67649bb1c)
2003-08-27Print an error instead of crashing if no argument is specified forTim Potter1-0/+4
smbclient -T Fixes bug 345. (This used to be commit a46e58e2b6e3d9526012d6a2d903163a3373fa59)
2003-08-12Apply a little constVolker Lendecke1-1/+1
(This used to be commit e3b36906c53bd4a9231c2efb007cec234e52a78f)
2003-08-06Reversed replacement. Oops.Jeremy Allison1-2/+2
Jeremy. (This used to be commit 520bee397d946766cef8ab9f0d7d89064106f510)
2003-08-06Get rid of MAXPATHLEN, move to standard PATH_MAX.Jeremy Allison1-2/+2
Jeremy. (This used to be commit 455ed2d51d86f39ce0fa6e6abca31a5425d2ea17)
2003-08-01Fix the option processing for smbtar. Does no one check this !Jeremy Allison1-2/+15
Jeremy. (This used to be commit c4af1ec73584656fb9d2b372461da4748e1643f1)
2003-08-01Finish reformatting.Jeremy Allison1-516/+467
Jeremy. (This used to be commit 5ef75fa36620a87e8fd8567b854ea0770d8125ea)
2003-08-01Reformat lots of clitar code as I hate the style so much :-).Jeremy Allison1-563/+540
Jeremy. (This used to be commit 77f2a91549c8b61e74e2088faef2b61612803aed)
2003-08-01Reformat clitar option processing - getting ready to fix it for popt...Jeremy Allison1-183/+176
Jeremy. (This used to be commit 94b30e7b4a4f71d3aa2fefee60b9ea8ead2acccd)
2003-07-16Fix from Dragan Krnic for handling files in tar archives > 8GB.Tim Potter1-0/+10
Fixes bug 102. (This used to be commit b54183a7b23d1046faad0890de3fdda3df0fec88)
2003-07-03Removed strupper/strlower macros that automatically map to ↵Jeremy Allison1-1/+1
strupper_m/strlower_m. I really want people to think about when they're using multibyte strings. Jeremy. (This used to be commit ff222716a08af65d26ad842ce4c2841cc6540959)
2003-04-14Merge:Tim Potter1-1/+1
- "Fix lingering large offset problems in smbtar etc." (This used to be commit ba53df64cab5dc0ea9f2b7d82007bf655f85bc67)
2003-03-18Jeremy merged across my string parinoia fixes, but forgot to enable them! :-)Andrew Bartlett1-24/+24
This patch catches up on the rest of the work - as much string checking as is possible is done at compile time, and the rest at runtime. Lots of code converted to pstrcpy() etc, and other code reworked to correctly call sizeof(). Andrew Bartlett (This used to be commit c5b604e2ee67d74241ae2fa07ae904647d35a2be)
2003-03-03More janitorial duties, fixing the BIG_UINT changes for large offsets.Richard Sharpe1-5/+6
(This used to be commit 1af39523cc3b2313f3e8acd4f2e5338182ec0b13)
2003-01-03Merge from HEAD - make Samba compile with -Wwrite-strings without additionalAndrew Bartlett1-6/+6
warnings. (Adds a lot of const). Andrew Bartlett (This used to be commit 3a7458f9472432ef12c43008414925fd1ce8ea0c)
2002-12-19merge from 2.2 fix for smbclient large filesHerb Lewis1-18/+18
(This used to be commit 17f685fdbf5d36f82e3da0a09457f5e248b3f109)
2002-12-16merge smbtar fix from 2.2Herb Lewis1-6/+8
(This used to be commit 41188337c3fa8c716dc7a4721ee5c31e5ddd928d)
2002-08-17sync 3.0 branch with headJelmer Vernooij1-1/+1
(This used to be commit 3928578b52cfc949be5e0ef444fce1558d75f290)
2002-07-15updated the 3.0 branch from the head branch - ready for alpha18Andrew Tridgell1-13/+12
(This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce)
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)
2001-10-11first step in converting the head branch to use lang_tdb.c insteadAndrew Tridgell1-1/+1
of gettext for internationalisation support. There is more to do (This used to be commit ab7f67677a1ade4669e5c2750d0a38422ea616a9)
2001-10-09initial support to error report in smbclient, useful when using smbclient -c ↵Simo Sorce1-10/+17
in scripts. Thanks to Claudio Cicali aka FleXer for the initial patch (This used to be commit 53b95b3c0fd087b1cade95fd8de849547ac3bfcb)
2001-10-02Removed 'extern int DEBUGLEVEL' as it is now in the smb.h header.Tim Potter1-1/+0
(This used to be commit 2d0922b0eabfdc0aaf1d0797482fef47ed7fde8e)
2001-09-17move to SAFE_FREE()Simo Sorce1-12/+10
(This used to be commit 29db6ef7a7c4df51adf964c0aecb1164e4ab7dee)
2001-09-10declare dbf in one spotAndrew Tridgell1-1/+0
(This used to be commit f41c3bb80f1e498a9d27f6e236b0ff3a742764c9)
2001-09-10replaced stdio in many parts of samba with a XFILE. XFILE is a cut-downAndrew Tridgell1-6/+6
replacemnt of stdio that doesn't suffer from the 8-bit filedescriptor limit that we hit with nasty consequences on some systems I would eventually prefer us to have a configure test to see if we need to replace stdio, but for now this code needs to be tested widely so I'm enabling it by default. (This used to be commit 1af8bf34f1caa3e7ec312d8109c07d32a945a448)
2001-08-20a bunch of fixes from the sflight to seattleAndrew Tridgell1-1/+0
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)
2001-08-12this is a big global fix for the ptr = Realloc(ptr, size) bug.Simo Sorce1-2/+4
many possible mem leaks, and segfaults fixed. someone should port this fix to 2.2 also. (This used to be commit fa8e55b8b465114ce209344965c1ca0333b84db9)
2001-07-04strchr and strrchr are macros when compiling with optimisation in gcc, so we ↵Andrew Tridgell1-6/+6
can't redefine them. damn. (This used to be commit c41fc06376d1a2b83690612304e85010b5e5f3cf)
2001-07-04The big character set handling changeover!Andrew Tridgell1-62/+25
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)
2001-06-21next_token() was supposed to be a reentrant replacement for strtok(),Andrew Tridgell1-5/+5
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-03-26Fix for smbtar race condition from Glenn Burkhardt <glenn@aoi.ultranet.com>.Jeremy Allison1-1/+11
Jeremy. (This used to be commit 0c9a92a0557b2595e520cbaf2feaa587f9e7502d)
2000-11-22Tar fixes from Craig Barratt craig@arraycomm.com.Jeremy Allison1-2/+2
Jeremy. (This used to be commit cf05709ec394d6cac14577c033d658bdc4506208)
2000-04-30- removed all our old wildcard matching code and replaced it with aAndrew Tridgell1-2/+2
call to ms_fnmatch(). This also removes all the Win9X semantics stuff and a bunch of other associated cruft. - moved the stat cache code into statcache.c - fixed the uint16 alignment requirements of ascii_to_unistr() and unistr_to_ascii() - trans2 SMB_FIND_FILE_BOTH_DIRECTORY_INFO returns the short name as unicode always (at least thats what NT4 does) - fixed some errors in the in-memory tdb code. Still ugly, but doesn't crash as much (This used to be commit 03e9cea004bbba72161a5323cf3b4556c94aed8e)
2000-01-26Second set of inline optimisation fixes from Ying Chen <ying@almaden.ibm.com>.Jeremy Allison1-4/+4
Stop makeing function calls for every use of skip_multibyte_char. This function is called several *million* times during a NetBench run :-). Jeremy. (This used to be commit e5a3deba46ea2d4cb49a6c4b73edd766fe8b5a5c)