1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-18 17:57:55 +03:00

310 Commits

Author SHA1 Message Date
Volker Lendecke
d3d388180d r15098: Make smbclient -L use RPC to list shares, fall back to RAP. This should list
long share names.

Volker
2007-10-10 11:16:23 -05:00
Jeremy Allison
a3b8bee3ff r14359: Try and fix Coverity #176 by making the pointer
aliasing clearer. This isn't a bug but a code
clarification.
Jeremy.
2007-10-10 11:15:26 -05:00
Jeremy Allison
d793e1550c r14351: Ensure we use the minimum of PATH_MAX and sizeof(pstring).
Fix Coverity #59.
Jeremy.
2007-10-10 11:15:26 -05:00
Jeremy Allison
1d710d06a2 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.
2007-10-10 11:10:59 -05:00
Derrell Lipman
f2a24de769 r13212: r12414@cabra: derrell | 2006-01-28 17:52:17 -0500
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.)
2007-10-10 11:06:18 -05:00
Jeremy Allison
c970d7d0a5 r12555: Fix more load_case_table swegfaults. Arggg.
What I'd give for a global constructor...
Jeremy.
2007-10-10 11:05:59 -05:00
Jeremy Allison
9b8602e055 r11978: Volker's fix for #3292 (smbclient spins if server terminates
connection).
Jeremy.
2007-10-10 11:05:41 -05:00
Jeremy Allison
f1c88de7a2 r11976: (Slightly modified) Volker fix for #3293. Use SMBecho instead of
chkpath to keep a connection alive.
Jeremy.
2007-10-10 11:05:40 -05:00
Jeremy Allison
e4b3b70ef1 r11839: Info level 0x101 is really a protocol NT level.
Fix bug #3274 from Guenter Kukkukk <guenter.kukkukk@kukkukk.com>
Jeremy.
2007-10-10 11:05:29 -05:00
Gerald Carter
be31c2a105 r11770: BUG 2718: don't use qpathinfo_basic() call when remote server is Win9x or the do_cd() call will fail 2007-10-10 11:05:28 -05:00
Jeremy Allison
414303bc02 r11511: A classic "friday night check-in" :-). This moves much
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.
2007-10-10 11:05:19 -05:00
Gerald Carter
49b8d7d7f5 r10964: BUG 1051: store the directory path so we can send the full name in the unlink call (del tmp\foo) 2007-10-10 11:04:58 -05:00
Jeremy Allison
b242f27860 r9545: (Hopefully the last) fixes for DIR -> SMB_STRUCT_DIR.
Jeremy.
2007-10-10 11:01:12 -05:00
Tim Potter
985dbb47d9 r8572: Remove crufty #define NO_SYSLOG as it's not used at all anymore. 2007-10-10 11:00:11 -05:00
Gerald Carter
aa5de7d0b3 r8478: remove unused printmode command from smbclient (noticed by kalim@samba.org) 2007-10-10 11:00:06 -05:00
Gerald Carter
9e3e473632 r6685: smbclient fixes
* 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
2007-10-10 10:56:51 -05:00
Gerald Carter
97c68ec1e8 r6388: BUG 2626: ensure that the calling_name is set to something after parsing smb.conf (if not set via -n) 2007-10-10 10:56:39 -05:00
Jeremy Allison
644608ea7d r6348: Fix for bug #2605 reported by Daniel Patterson <Daniel_Patterson@national.com.au>.
Ensure smbclient doesn't perform commands if the "chdir" fails in a scripted set.
Jeremy.
2007-10-10 10:56:37 -05:00
Gerald Carter
40f573e202 r6291: BUG 2588: force smbclient messages to port 139 unless someone set the -p option 2007-10-10 10:56:35 -05:00
Herb Lewis
efea76ac71 r6225: get rid of warnings from my compiler about nested externs 2007-10-10 10:56:30 -05:00
Jeremy Allison
c69623072e r6120: Added "volume" command to smbclient that prints out the volume name and
serial number.
Jeremy.
2007-10-10 10:56:23 -05:00
Jeremy Allison
9d5ef800b6 r5979: Don't crash when talking to a Win98 server (bugid #2530 - not a fix
buy just prevent the crash).
Jeremy.
2007-10-10 10:56:14 -05:00
Gerald Carter
85be4c5df3 r5968: derrell's large file fix for libsmbclient (BUG 2505) 2007-10-10 10:56:13 -05:00
Jeremy Allison
7cb9618e5d r5835: Make smbclient obey the max protocol argument again.
Jeremy.
2007-10-10 10:56:04 -05:00
Gerald Carter
52c82b51ba r5578: get 'recurse; dir' working across multiple levels of dfs referrals
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 *
2007-10-10 10:55:48 -05:00
Gerald Carter
d4443807bc r5577: get recurse; dir working across single level dfs referrals 2007-10-10 10:55:48 -05:00
Gerald Carter
d6a05ffd66 r5545: move cli_cm_XXX() connection handling code to clidfs and out of 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 2007-10-10 10:55:46 -05:00
Gerald Carter
5d2624c453 r5542: fix a few more msdfs bugs in smbclient against both smbd and 2k dfs root
shares.
2007-10-10 10:55:46 -05:00
Günther Deschner
3660b7e64d r5527: Allow own netbios name to be set in smbclient's session setup.
Guenther
2007-10-10 10:55:45 -05:00
Gerald Carter
53d6a5f9d1 r5520: fix last remaining dfs issues with smbclient.
* 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).
2007-10-10 10:55:44 -05:00
Gerald Carter
6a9e4d6af1 r5519: fix msdfs support for [m]get and [m]put 2007-10-10 10:55:44 -05:00
Gerald Carter
e57fd2c5f0 r5518: Add initial msdfs support to smbclient. Currently I can only
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* )
2007-10-10 10:55:44 -05:00
Gerald Carter
0449756309 r5495: * add in some code from Mike Nix <mnix@wanm.com.au> for the SMBsplopen
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 *.
2007-10-10 10:55:43 -05:00
Jeremy Allison
88a89b3105 r4697: Fix for bug #2231 inspired by brad.ellis@its.monash.edu.au.
Remove double "\\" from findfirst.
Jeremy.
2007-10-10 10:53:51 -05:00
Jeremy Allison
620f2e608f 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.
2007-10-10 10:53:32 -05:00
Jeremy Allison
8e979772a6 r3931: Fix all "may be used uninitialized" and "shadow" warnings.
Jeremy.
2007-10-10 10:53:25 -05:00
Jeremy Allison
4d52bf7c8b r3714: Getfacl now seems to work on files and directories. Next do setfacl
and port to Samba4.
Jeremy.
2007-10-10 10:53:16 -05:00
Jeremy Allison
1bd3f13344 r3713: Implementation of get posix acls in UNIX extensions. Passes valgrind.
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.
2007-10-10 10:53:16 -05:00
Richard Sharpe
96baa5bb6c r3292: A fix from Narayana Pattipati <narayana[dot]pattipati[at]wipro\dotty/com> for
Solaris to ensure we distinguish properly between 5.1 and 5.10.
2007-10-10 10:53:04 -05:00
Tim Potter
7f161702fa r2835: Since we always have -I. and -I$(srcdir) in CFLAGS, we can get rid of
'..' from all #include preprocessor commands.   This fixes bugzilla #1880
where OpenVMS gets confused about the '.' characters.
2007-10-10 10:52:55 -05:00
Jeremy Allison
b25cc59641 r2651: Added 'stat' command to smbclient to exercise the UNIX_FILE_BASIC
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.
2007-10-10 10:52:48 -05:00
Tim Potter
e59af43f6b r1908: Bugzilla #1541. Fix recursive ls in smbclient. Fix by Josef Zlomek. 2007-10-10 10:52:23 -05:00
Jelmer Vernooij
374f00b56b r1320: Return an error when the last command read from stdin fails in smbclient +
prepare for better error checking in tar..
2007-10-10 10:52:06 -05:00
Jeremy Allison
cf84c0fe1a r1154: Change default setting for case sensitivity to "auto". If set to auto
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.
2007-10-10 10:51:57 -05:00
Jeremy Allison
894cc6d162 r1085: Now it's had some proper user testing, merge in the deferred open 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.
2007-10-10 10:51:54 -05:00
Jeremy Allison
ed699a73f8 r710: Fix smbclient symlink command when widelinks = no.
Jeremy.
2007-10-10 10:51:35 -05:00
Jeremy Allison
21cc6ab7e8 r96: Stupid f&%'n UNIX extensions.... SETPATHINFO
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.
2007-10-10 10:51:08 -05:00
Gerald Carter
ab48af6993 source code fix for bug 1095 -- honor the '-l' option -
Alexander Bokovoy
83dac6571f Fix problems with very long filenames in both smbd and smbclient.
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.
-
Gerald Carter
bc6992c4bf BUG 1088: patch from SATOH Fumiyasu <fumiya@miraclinux.com> -- use strchr_m() for query_host (smbclient -L) -