1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
Commit Graph

66 Commits

Author SHA1 Message Date
Ralph Boehme
9471508391 s3: remove now unneeded call to cmdline_messaging_context()
This was only needed as dbwrap_open() had a bug where it asked for the ctdb
connection before initializing messaging. The previous commit fixed that so we
can now safely remove the calls to cmdline_messaging_context() from all tools
that don't use messaging.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13925

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Oct 24 09:33:47 UTC 2019 on sn-devel-184
2019-10-24 09:33:47 +00:00
Swen Schillig
968f720410 s3: free popt context in utils
If done with popt context it should be free'd.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
2019-08-22 00:21:50 +00:00
Andreas Schneider
f699cec7d5 s3:utils: Use C99 initializer for poptOption in smbget
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:15 +01:00
Christian Ambach
fce0d1b290 s3:utils/smbget fix recursive download with empty source directories
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13199
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Oct 26 09:58:07 CEST 2018 on sn-devel-144
2018-10-26 09:58:07 +02:00
Christian Ambach
b89732c31b s3:utils/smbget add error handling for mkdir() calls
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2018-10-26 06:59:09 +02:00
Christof Schmitt
20ed13923e s3:smbget: Use cmdline_messaging_context
Initialize the messaging context through cmdline_messaging_context to
allow access to config in clustered Samba.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-09-07 17:26:17 +02:00
Christof Schmitt
b7464fd89b s3:lib: Move popt_common_credentials to separate file
This is only used by command line utilities and has additional
dependencies. Move to a separate file to contain the dependencies to the
command line tools.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13465

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-09-07 17:26:14 +02:00
Andreas Schneider
4a3164e0be s3:smbget: Fix buffer truncation issues with gcc8
../source3/utils/smbget.c: In function ‘smb_download_file’:
../source3/utils/smbget.c:97:27: error: ‘b’ directive output may be truncated writing 1 byte into a region of size between 0 and 19 [-Werror=format-truncation=]
   snprintf(buffer, l, "%jdb", (intmax_t)s);
                           ^

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13437

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
2018-06-20 22:22:07 +02:00
Andreas Schneider
f5401ff314 s3-util: Fix asking for username and password in smbget.
If the user specified the username in the URI with with:

  smb://DOMAIN;user:secret@server/share

the tool should not prompt for the username nor the password.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12175

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Aug 26 04:22:27 CEST 2016 on sn-devel-144
2016-08-26 04:22:27 +02:00
Andreas Schneider
8b91178aa8 smbget: Fix a memory leak
Found by cppcheck.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
2016-06-24 02:01:19 +02:00
Christian Ambach
fcb56e0e11 s3:utils/smbget fix option parsing
* use proper values for val in poptOption
* popt does not support bool, so set them via the switch statement
* abort when option parsing reported errors

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-02-26 11:31:33 +01:00
Christian Ambach
dfc35044d8 s3:utils/smbget remove -P option
as agreed on samba-technical list.
It does not really provide a useful function but can cause confusion

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-02-26 11:31:32 +01:00
Christian Ambach
113f8dd3d9 s3:utils/smbget improve check of write() result
check that all bytes in the buffer have been written

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-02-26 11:31:32 +01:00
Christian Ambach
01ba35dca2 s3:utils/smbget abort recursive download on error
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-02-26 11:31:32 +01:00
Christian Ambach
c91dde9cae s3:utils/smbget another int -> bool conversion
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-02-26 11:31:32 +01:00
Christian Ambach
da2aae933e s3:utils/smbget set default blocksize
this got lost in the recent refactorings and causes problems
when smbget attempts to use a zero byte read buffer

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Feb  5 12:10:16 CET 2016 on sn-devel-144
2016-02-05 12:10:16 +01:00
Christian Ambach
64121471f9 s3:utils/smbget add a error message on allocation error
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
2016-02-05 09:00:20 +01:00
Christian Ambach
cac1086ae1 s3-utils/smbget: Fix user-/name password reading from rcfile
As the password option is gone, code needs to be able to read password
from user parameter when user%password syntax is used.

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-01-28 09:58:26 +01:00
Christian Ambach
bf1c1ad068 s3-utils/smbget: Fix reading the rcfile
shortName in POPT_AUTOHELP is null, so the loop always stopped at this
item.

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-01-28 09:58:26 +01:00
Andreas Schneider
e1548c5bf7 s3-utils/smbget: Fix option parsing and apply samba defaults
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Christian Ambach <ambi@samba.org>
2016-01-28 09:58:26 +01:00
Christian Ambach
b7da062cba s3:utils/smbget make use of bool for flags
convert flags stored as int to bool

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Jan 25 13:33:12 CET 2016 on sn-devel-144
2016-01-25 13:33:12 +01:00
Christian Ambach
76f16796cc s3:utils/smbget use C99 format identifiers
for ssize_t and off_t variables

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-01-25 10:24:24 +01:00
Christian Ambach
4d033bac76 s3:utils/smbget code format
adopt the code to latest README.Coding standards
e.g. curly braces everywhere, blanks before braces,
obey 80 character limit (except for the popt definitions)

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-01-25 10:24:23 +01:00
Christian Ambach
ec802d27ce s3:utils/smbget fix recursive download
get_auth_data is called multiple times (once for the directory listing and then
for every file to be downloaded). Save the obtained values across multiple calls
to make smbclient use the correct username for each download.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=6482
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2016-01-25 10:24:23 +01:00
Ralph Boehme
00e952e3c6 s3: fix encryption help messages
Encryption is a SMB3 feature and not tied to UNIX extensions, so fix the
help messages of various utilities.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Dec 22 02:22:50 CET 2015 on sn-devel-144
2015-12-22 02:22:50 +01:00
Volker Lendecke
c51300ad89 lib: load_case_tables() -> smb_init_locale()
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-24 00:00:20 +01:00
Andreas Schneider
c5e73bccd5 s3-utils: Fix a memory leak in smbget.
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-12-06 01:14:09 +01:00
Andreas Schneider
3a3baa442e smbget: Fix file descriptor leak.
Reviewed-by: Alexander Bokovoy <ab@samba.org>
2013-02-22 16:36:14 +01:00
Andreas Schneider
de1288e13e smbget: Use new samba_getpass() function.
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
2012-12-03 14:35:10 +01:00
Jeremy Allison
7d6ebe0de7 More const fixes. Remove CONST_DISCARD. 2011-05-06 01:44:07 +02:00
Günther Deschner
633dbabe91 s3-utils: Fix Bug #8106. Fix the build of smbget on HP NonStop.
Guenther

Autobuild-User: Günther Deschner <gd@samba.org>
Autobuild-Date: Tue Apr 26 16:41:17 CEST 2011 on sn-devel-104
2011-04-26 16:41:17 +02:00
Volker Lendecke
53f50c2268 s3: Fix bug 8066, wrong output in smbget
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Fri Apr 15 09:32:55 CEST 2011 on sn-devel-104
2011-04-15 09:32:55 +02:00
Andreas Schneider
de4ef101c1 s3-utils: Fixed possible resource leak in smbget.
s3-utils: Fixed possible resource leak in smbget.
2011-01-26 14:20:37 -08:00
Jeremy Allison
e850958928 Check all SMB_MALLOC returns correctly. Found by Andreas Moroder <andreas.moroder@gmx.net>.
Jeremy
2010-09-10 11:56:26 -07:00
Günther Deschner
f1aa9ebb08 s3-utils: remove unused variable in smbget.
Guenther
2010-09-09 11:11:04 +02:00
Björn Jacke
b4b453a287 s3: use time_mono throughout in smbget 2010-09-08 22:33:32 +02:00
Björn Jacke
b4ae2efa96 s3: use monotonic clock for time deltas in smbget 2010-08-31 13:10:45 +02:00
Andreas Schneider
ce2a086119 s3-popt: Only include popt-common.h when needed. 2010-08-05 12:08:31 +02:00
Volker Lendecke
9e3fc22c60 s3: Fix bug 7338, smbget skips leading slash when using a custom outputfile 2010-07-04 11:44:20 +02:00
Volker Lendecke
285176cbc9 s3: Fix some nonempty blank lines 2010-07-04 11:44:20 +02:00
Jeremy Allison
f387ed88e8 Fix bug #7069 - smbget does not return an error status after some errors
A combination patch from Johannes Poehlmann <johannes@lst.de> and
Jeremy. Fix the return codes from smb_download_file() and smb_download_dir().

Jeremy.
2010-01-28 10:38:24 -08:00
Volker Lendecke
6aef5e591f Fix bug 6546: Avoid accessing buf[-1] if NUL byte comes from fgets 2009-11-30 21:48:59 +01:00
Volker Lendecke
7d85bf2a42 Fix bug 6361: Make --rcfile work in smbget
Thanks to j scott <gl@arlut.utexas.edu> for reporting!
2009-05-15 21:05:31 +02:00
Jeremy Allison
faa1100d22 More warning fixes for Solaris.
Jeremy.
2009-02-23 16:22:43 -08:00
Jeremy Allison
669f2a02e2 Fix printf warnings found on systems where time_t <> long int.
Jeremy.
2009-02-19 13:36:20 -08:00
Jeremy Allison
07e0094365 Fix all warnings in source3 with gcc4.3.
Jeremy.
2008-12-31 18:06:57 -08:00
Marc VanHeyningen
e06aa46b9f Coverity fixes
(This used to be commit 3fc85d2259)
2008-03-17 20:52:25 +01:00
Charles
3634d98784 The attached patch removes some global variables, and make them local to main().
(This used to be commit 50cab87d3e)
2008-03-11 19:49:08 +01:00
Charles
ad7c3455ff Fix return code.
(This used to be commit 98b6433660)
2008-03-09 19:52:29 +01:00
Charles
5b8823e49a smbget: Make global variables static.
(This used to be commit c430b7831d)
2008-03-09 13:50:56 +01:00