summaryrefslogtreecommitdiff
path: root/source3/client/client.c
AgeCommit message (Collapse)AuthorFilesLines
2007-10-10r13915: Fixed a very interesting class of realloc() bugs found by Coverity.Jeremy Allison1-4/+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-10r13212: r12414@cabra: derrell | 2006-01-28 17:52:17 -0500Derrell Lipman1-1/+1
lp_load() could not be called multiple times to modify parameter settings based on reading from multiple configuration settings. Each time, it initialized all of the settings back to their defaults before reading the specified configuration file. This patch adds a parameter to lp_load() specifying whether the settings should be initialized. It does, however, still force the settings to be initialized the first time, even if the request was to not initialize them. (Not doing so could wreak havoc due to uninitialized values.) (This used to be commit f2a24de769d1b2266e576597c57a8e3b1e2a2b51)
2007-10-10r12555: Fix more load_case_table swegfaults. Arggg.Jeremy Allison1-0/+1
What I'd give for a global constructor... Jeremy. (This used to be commit c970d7d0a5ba225465dfb0980989b8817b17c643)
2007-10-10r11978: Volker's fix for #3292 (smbclient spins if server terminatesJeremy Allison1-1/+5
connection). Jeremy. (This used to be commit 9b8602e0551500916a9d79c317589cd82d3da111)
2007-10-10r11976: (Slightly modified) Volker fix for #3293. Use SMBecho instead ofJeremy Allison1-1/+6
chkpath to keep a connection alive. Jeremy. (This used to be commit f1c88de7a28942b6aaa634551dde7a8af91f4de3)
2007-10-10r11839: Info level 0x101 is really a protocol NT level.Jeremy Allison1-1/+1
Fix bug #3274 from Guenter Kukkukk <guenter.kukkukk@kukkukk.com> Jeremy. (This used to be commit e4b3b70ef1c0fea3252b73c55ea3e9cad7229afd)
2007-10-10r11770: BUG 2718: don't use qpathinfo_basic() call when remote server is ↵Gerald Carter1-2/+3
Win9x or the do_cd() call will fail (This used to be commit be31c2a105ae2b6e655530190c939caae1b41294)
2007-10-10r11511: A classic "friday night check-in" :-). This moves muchJeremy Allison1-2/+2
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-10r10964: BUG 1051: store the directory path so we can send the full name in ↵Gerald Carter1-2/+9
the unlink call (del tmp\foo) (This used to be commit 49b8d7d7f5ed93a2b9b21404194452f35bcf7b26)
2007-10-10r9545: (Hopefully the last) fixes for DIR -> SMB_STRUCT_DIR.Jeremy Allison1-5/+5
Jeremy. (This used to be commit b242f278601e1a23c9116009482e802326d418f7)
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-10r8478: remove unused printmode command from smbclient (noticed by ↵Gerald Carter1-40/+0
kalim@samba.org) (This used to be commit aa5de7d0b35b07dfb32aa43df00f73de80de9fdd)
2007-10-10r6685: smbclient fixesGerald Carter1-3/+16
* BUG 2680: copy files from an MSDFS win2k root share * BUG 2688: re-implement support for the -P (--port) option * support connecting to an 'msdfs proxy' share on a Samba server (This used to be commit 9e3e473632fee669eda477d8cbe309b7109552ea)
2007-10-10r6388: BUG 2626: ensure that the calling_name is set to something after ↵Gerald Carter1-0/+2
parsing smb.conf (if not set via -n) (This used to be commit 97c68ec1e86c1de44fa1ab6e5a9d7f58b2843a34)
2007-10-10r6348: Fix for bug #2605 reported by Daniel Patterson ↵Jeremy Allison1-6/+21
<Daniel_Patterson@national.com.au>. Ensure smbclient doesn't perform commands if the "chdir" fails in a scripted set. Jeremy. (This used to be commit 644608ea7db6d8d73a8c028a82cd0767ffe32af6)
2007-10-10r6291: BUG 2588: force smbclient messages to port 139 unless someone set the ↵Gerald Carter1-1/+6
-p option (This used to be commit 40f573e202096088957bfff8ca2eb49f5b4985bd)
2007-10-10r6225: get rid of warnings from my compiler about nested externsHerb Lewis1-3/+3
(This used to be commit efea76ac71412f8622cd233912309e91b9ea52da)
2007-10-10r6120: Added "volume" command to smbclient that prints out the volume name andJeremy Allison1-0/+20
serial number. Jeremy. (This used to be commit c69623072e4112a4719867ea4809f5145b3cb64c)
2007-10-10r5979: Don't crash when talking to a Win98 server (bugid #2530 - not a fixJeremy Allison1-0/+1
buy just prevent the crash). Jeremy. (This used to be commit 9d5ef800b6d3da54a5c733cff70306ac052ddd23)
2007-10-10r5968: derrell's large file fix for libsmbclient (BUG 2505)Gerald Carter1-2/+2
(This used to be commit 85be4c5df398faa6c5bfacd1f9d2f12c39d411e1)
2007-10-10r5835: Make smbclient obey the max protocol argument again.Jeremy Allison1-1/+1
Jeremy. (This used to be commit 7cb9618e5de8aae5e910e620e70ea130b76f6099)
2007-10-10r5578: get 'recurse; dir' working across multiple levels of dfs referralsGerald Carter1-16/+16
note that this does not handle the situation where the same \\server\share is mounted mutliple times in the dfs tree since I store a single mount path per struct cli_state * (This used to be commit 52c82b51ba9729cc53a049d8e9fbb7365d652c51)
2007-10-10r5577: get recurse; dir working across single level dfs referralsGerald Carter1-3/+5
(This used to be commit d4443807bc7a5a8615c69517365a92709db7ce29)
2007-10-10r5545: move cli_cm_XXX() connection handling code to clidfs and out of ↵Gerald Carter1-273/+27
client.c; client.c still maintains a pointer to the first connection so the change is fairly reansparent to other smbclient functions such as -L and -M (This used to be commit d6a05ffd664e2e304f6e481af34a4c5d640fc3f9)
2007-10-10r5542: fix a few more msdfs bugs in smbclient against both smbd and 2k dfs rootGerald Carter1-5/+29
shares. (This used to be commit 5d2624c453b0bc961302edd9f2421a7c3d504d1f)
2007-10-10r5527: Allow own netbios name to be set in smbclient's session setup.Günther Deschner1-2/+8
Guenther (This used to be commit 3660b7e64d9a17bcaa4f43c6d782b0b1d52ed6ab)
2007-10-10r5520: fix last remaining dfs issues with smbclient.Gerald Carter1-53/+146
* all the unix extension commands should work * send the correct TRANS2_FINDFIRST format to 2k to get a listing from a msdfs root share (tested against smbd as well). * mkdir, rmdir, etc... all seem ok. I'm sure bugs will pop up so keep testing. Last thing I plan on doing is to clean up the horrible mess with connection management in smbclient and global variables (so i can move the cli_cm_xx() routines to a separate file). (This used to be commit 53d6a5f9d16aef4afc60b4b37b296b256da00dfd)
2007-10-10r5519: fix msdfs support for [m]get and [m]putGerald Carter1-16/+32
(This used to be commit 6a9e4d6af1a4a4f426189e71aac5a4e7e217d6f7)
2007-10-10r5518: Add initial msdfs support to smbclient. Currently I can onlyGerald Carter1-104/+141
cd up and down the tree and get directory listings. Still have to figure out how to get a directory listing on a 2k dfs root. Also have to work out some issues with relative paths that cross dfs mount points. We're protected from the new code paths when connecting to a non-dfs root share ( the flag from the tcon&X is stored in the struct cli_state* ) (This used to be commit e57fd2c5f00de2b11a2b44374830e89a90bc0022)
2007-10-10r5495: * add in some code from Mike Nix <mnix@wanm.com.au> for the SMBsplopenGerald Carter1-129/+271
and SMBsplclose commands (BUG 2010) * clarify some debug messages in smbspool (also from Mike) my changes: * start adding msdfs client routines * enable smbclient to maintain multiple connections * set the CAP_DFS flag for our internal clienht routines. I actualy have a dfs referral working in do_cd() but that code is too ugly to live so I'm not checking it in just yet. Further work is to merge with vl's changes in trunk to support multiple TIDs per cli_state *. (This used to be commit 0449756309812d854037ba0af631abad678e670e)
2007-10-10r4697: Fix for bug #2231 inspired by brad.ellis@its.monash.edu.au.Jeremy Allison1-3/+3
Remove double "\\" from findfirst. Jeremy. (This used to be commit 88a89b31059ac21e09d283f8795cd6ea88c4315c)
2007-10-10r4088: Get medieval on our ass about malloc.... :-). Take control of all our ↵Jeremy Allison1-14/+14
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-10r3931: Fix all "may be used uninitialized" and "shadow" warnings.Jeremy Allison1-2/+4
Jeremy. (This used to be commit 8e979772a640bb4f00f4d72b6a9c837b8ef14333)
2007-10-10r3714: Getfacl now seems to work on files and directories. Next do setfaclJeremy Allison1-2/+132
and port to Samba4. Jeremy. (This used to be commit 4d52bf7c8b3147dd4f0d3081fbf9a1f5ebd246a1)
2007-10-10r3713: Implementation of get posix acls in UNIX extensions. Passes valgrind.Jeremy Allison1-0/+47
Need to add printout functions in client and set posix acl in server. SteveF - take a look at this for the cifsfs client ! Once this is working and tested the next step is to write this up for the UNIX extensions spec. documents. Jeremy. (This used to be commit 1bd3f133442a472b4718b94a636f2fec89a2e0dc)
2007-10-10r3292: A fix from Narayana Pattipati ↵Richard Sharpe1-2/+2
<narayana[dot]pattipati[at]wipro\dotty/com> for Solaris to ensure we distinguish properly between 5.1 and 5.10. (This used to be commit 96baa5bb6c908fa5e870d86d3f380fd368ada658)
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-10r2651: Added 'stat' command to smbclient to exercise the UNIX_FILE_BASICJeremy Allison1-0/+153
info level. Outputs data on the file in the same format the the stat command in Linux. Should be useful to people wanting to learn how to parse the UNIX extension output. Yes I will add the docs later :-). Jeremy. (This used to be commit b25cc596417d29815814c3968ac2627bf59ffc0b)
2007-10-10r1908: Bugzilla #1541. Fix recursive ls in smbclient. Fix by Josef Zlomek.Tim Potter1-1/+1
(This used to be commit e59af43f6b8f824447bd20efc08dd81f2774e99c)
2007-10-10r1320: Return an error when the last command read from stdin fails in ↵Jelmer Vernooij1-2/+4
smbclient + prepare for better error checking in tar.. (This used to be commit 374f00b56b7e9bff08e70ee2d93538b2c7fde7b7)
2007-10-10r1154: Change default setting for case sensitivity to "auto". If set to autoJeremy Allison1-0/+16
then is the client supports it (current clients supported are Samba and CIFSVFS - detected by the negprot strings "Samba", "POSIX 2" and a bare "NT LM 0.12" string) then the setting of the per packet flag smb_flag FLAG_CASELESS_PATHNAMES is taken into account per packet. This allows the linux CIFS client to use Samba in a case sensitive manner. Additional command in smbclient "case_sensitive", toggles the flag in subsequent packets. Docs to follow. Jeremy. (This used to be commit cf84c0fe1a061acc0313f7db124b8f947cdf623d)
2007-10-10r1085: Now it's had some proper user testing, merge in the deferred open ↵Jeremy Allison1-1/+1
fix. I'm still doing more testing, but it fixes a behaviour that we've been wrong on ever since the start of Samba. Jeremy. (This used to be commit 894cc6d16296b934c112786eec896846156aee5d)
2007-10-10r710: Fix smbclient symlink command when widelinks = no.Jeremy Allison1-2/+1
Jeremy. (This used to be commit ed699a73f899b3212185ecf52d1c4cd59cc8a7ea)
2007-10-10r96: Stupid f&%'n UNIX extensions.... SETPATHINFOJeremy Allison1-18/+18
normally takes as it's param entry the filename to be acted upon.... Unless it's UNIX extensions create hardlink, or UNIX extensions create symlink. Then it's param -> newfile name data -> oldfile name. This caused me to stuff them up in 3.0.2 (and the client commands link and symlink). Fixed them, everything is now called oldname and newname - thus specifying which name should already exist (hint - the old one...) and which will be created (newname). Jeremy. (This used to be commit 21cc6ab7e8a41160a3e2970623ade7445b5214d6)
2004-03-26source code fix for bug 1095 -- honor the '-l' optionGerald Carter1-2/+6
(This used to be commit ab48af6993b427f525c36aa0ffd57c612c100561)
2004-03-12Fix problems with very long filenames in both smbd and smbclient.Alexander Bokovoy1-37/+37
It appears that we pass filename through resolve_wildcards() as pstring and use fstring temporary buffer there. As result, a long filename in unix charset (UTF-8 by default) can easily expand over 255 bytes while Windows is able to send to us such names (e.g. Japanese name of ~190 mb chars) which we unable to process through this small fstring buffer. Tested with W2K and smbclient, Japanese and Cyrillics. (This used to be commit 83dac6571f99b854ac607d4313cc3f742c1fae2e)
2004-03-11BUG 1088: patch from SATOH Fumiyasu <fumiya@miraclinux.com> -- use ↵Gerald Carter1-29/+19
strchr_m() for query_host (smbclient -L) (This used to be commit bc6992c4bffed043dd8ad58d721202091cd14cd3)
2004-03-03Added client "hardlink" commant to test doing NT rename with hard links.Jeremy Allison1-12/+6
Added hardlink_internals() code - UNIX extensions now use this too. Jeremy. (This used to be commit aad6eb2240393931940c982e25a981ce32264f38)
2004-03-03Use a common function to parse all pathnames from the wire. This allowsJeremy Allison1-3/+43
much closer emulation of Win2k3 error return codes. Jeremy. (This used to be commit c9f31fafeda6ad79e590276f36e03ecd2e93f818)
2004-03-01BUG 692: patch from SATOH Fumiyasu <fumiya@miraclelinux.com> to correct ↵Gerald Carter1-4/+4
truncation of share names and workgroup names (This used to be commit 822e31d841e720d48f4feeec673b75575caa8fac)