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

1485 Commits

Author SHA1 Message Date
Swen Schillig
a75727f191 source3: Update all consumers of strtoul_err(), strtoull_err() to new API
Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
2019-06-30 11:32:18 +00:00
Noel Power
e2ee3f8943 s3/rpcclient: cppcheck: Fix shiftTooManyBitsSigned error
Fixes

source3/rpcclient/cmd_srvsvc.c:44: error: shiftTooManyBitsSigned: Shifting signed 32-bit value by 31 bits is undefined behaviour <--[cppcheck]

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-06-04 22:13:07 +00:00
Noel Power
5733f678c8 s3/rpcclient: Fix bad (and illegal) func cast
../../source3/rpcclient/cmd_samr.c: In function ‘cmd_samr_get_usrdom_pwinfo’:
../../librpc/ndr/libndr.h:219:76: error: cast between incompatible function types from ‘void (*)(struct ndr_print *, const char *, uint32_t)’ {aka ‘void (*)(struct ndr_print *, const char *, unsigned int)’} to ‘void (*)(struct ndr_print *, const char *, const void *)’ [-Werror=cast-function-type]
 #define NDR_PRINT_STRUCT_STRING(ctx, type, p) ndr_print_struct_string(ctx, (ndr_print_fn_t)ndr_print_ ##type, #p, p)
                                                                            ^
../../source3/rpcclient/cmd_samr.c:2646:4: note: in expansion of macro ‘NDR_PRINT_STRUCT_STRING’
    NDR_PRINT_STRUCT_STRING(mem_ctx,

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri May 10 02:26:02 UTC 2019 on sn-devel-184
2019-05-10 02:26:02 +00:00
Swen Schillig
414bc3748b rpcclient: Use wrapper for string to integer conversion
In order to detect an value overflow error during
the string to integer conversion with strtoul/strtoull,
the errno variable must be set to zero before the execution and
checked after the conversion is performed. This is achieved by
using the wrapper function strtoul_err and strtoull_err.

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Ralph Böhme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-01 00:32:10 +00:00
Gary Lockyer
0e2acf6cfb winbind: Generate and pass logon ID
Generate a random logon_id and pass it in the SamLogon calls.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-02-20 06:03:09 +01:00
Andreas Schneider
0a6f78d736 s3:rpcclient: Use C99 initializer for cmd_set in cmd_shutdown
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:20 +01:00
Andreas Schneider
5701586d53 s3:rpcclient: Use C99 initializer for cmd_set in cmd_epmapper
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:20 +01:00
Andreas Schneider
328cb7aa9a s3:rpcclient: Use C99 initializer for cmd_set in cmd_test
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:19 +01:00
Andreas Schneider
eee66741f6 s3:rpcclient: Use C99 initializer for cmd_set in cmd_eventlog
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:19 +01:00
Andreas Schneider
f70dbe9f86 s3:rpcclient: Use C99 initializer for cmd_set in cmd_witness
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:19 +01:00
Andreas Schneider
05afe9624f s3:rpcclient: Use C99 initializer for cmd_set in rpcclient
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:19 +01:00
Andreas Schneider
bbc4d8c52a s3:rpcclient: Use C99 initializer for cmd_set in cmd_lsarpc
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:19 +01:00
Andreas Schneider
90b338e86d s3:rpcclient: Use C99 initializer for cmd_set in cmd_samr
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:19 +01:00
Andreas Schneider
d69fbf4150 s3:rpcclient: Use C99 initializer for cmd_set in cmd_clusapi
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:19 +01:00
Andreas Schneider
b7b7813422 s3:rpcclient: Use C99 initializer for cmd_set in cmd_ntsvcvs
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:19 +01:00
Andreas Schneider
2069372e1e s3:rpcclient: Use C99 initializer for cmd_set in cmd_iremotewinspool
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:18 +01:00
Andreas Schneider
a1765267ad s3:rpcclient: Use C99 initializer for cmd_set in cmd_winreg
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:18 +01:00
Andreas Schneider
711cb03507 s3:rpcclient: Use C99 initializer for cmd_set in cmd_fss
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:18 +01:00
Andreas Schneider
2bec9593ba s3:rpcclient: Use C99 initializer for cmd_set in cmd_wkssvc
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:18 +01:00
Andreas Schneider
8cb851ffb9 s3:rpcclient: Use C99 initializer for cmd_set in cmd_dssetup
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:18 +01:00
Andreas Schneider
17d166e6bd s3:rpcclient: Use C99 initializer for cmd_set in cmd_drsuapi
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:18 +01:00
Andreas Schneider
d1695761a1 s3:rpcclient: Use C99 initializer for cmd_set in cmd_echo
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:18 +01:00
Andreas Schneider
6087decf9f s3:rpcclient: Use C99 initializer for cmd_set in cmd_srvsvc
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:17 +01:00
Andreas Schneider
281c5107b0 s3:rpcclient: Use C99 initializer for cmd_set in cmd_netlogon
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:17 +01:00
Andreas Schneider
5b298d30c8 s3:rpcclient: Use C99 initializer for cmd_set in cmd_dfs
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:17 +01:00
Andreas Schneider
65729e3782 s3:rpcclient: Use C99 initializer for cmd_set in cmd_spoolss
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:17 +01:00
Andreas Schneider
3834ea867a s3:rpcclient: Use C99 initializer for poptOption in cmd_witness
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-01-28 10:29:13 +01:00
Tim Beale
e903d37ea4 s3:rpclient: rpclient help is not very helpful
The help was not telling me that there was a mandatory 'server' argument
that I needed to specify. After trying several different combinations
of parameters, I eventually had to run the tool in gdb to work out why
it was complaining.

This is the output I was getting:

bin/rpcclient -U$USERNAME%$PASSWORD -I $SERVER_IP
Usage: rpcclient [OPTION...]
  -c, --command=COMMANDS                 Execute semicolon separated
cmds
  -I, --dest-ip=IP                       Specify destination IP address
  -p, --port=PORT                        Specify port number
...

New help output is:

Usage: rpcclient [OPTION...] <server>
Options:
  -c, --command=COMMANDS                 Execute semicolon separated
cmds
...

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-01-25 13:20:23 +01:00
Volker Lendecke
918602e0f8 rpcclient: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-12-11 00:40:31 +01:00
Volker Lendecke
90de1431b9 rpcclient: Use dom_sid_str_buf
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Dec  8 02:43:48 CET 2018 on sn-devel-144
2018-12-08 02:43:48 +01:00
Andreas Schneider
56ac8944eb s3:rpcclient: Initialize domain_name
This could be passed uninitialized to dcerpc_netr_DsRGetDCName()

Found by cppcheck.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-11-14 05:07:15 +01:00
Günther Deschner
b8279f6525 s3-rpcclient: Use spoolss_init_spoolss_UserLevel1 in winspool cmds
Use spoolss initialization function to set client version information for
iremotewinspool printer operations

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2018-09-08 01:43:27 +02:00
Christof Schmitt
dd3ae2ffdc rpcclient: Use cmdline_messaging_context
Use cmdline_messaging_context with its error checking instead of open
coding the same steps.

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:15 +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
Joe Guo
6a6d14248d cmd_drsuapi: add dswriteaccountspn command
The dswriteaccountspn command is missing in drsuapi, add it so we can
use it in rpcclient.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2018-05-12 02:09:28 +02:00
Christof Schmitt
501819fa9e rpcclient: Print number of entries for NetSessEnum
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13407

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2018-04-25 19:59:13 +02:00
Andreas Schneider
d0c882434c s3:rpcclient: Fix size types
This fixes compilation with -Wstrict-overflow=2

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-03-20 23:16:16 +01:00
Andreas Schneider
3e2e4096cc s3:rpcclient: Add FALL_THROUGH statements in rpcclient.c
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2018-03-01 04:37:43 +01:00
Stefan Metzmacher
76868818e8 rpcclient: add lookupsids_level command
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13286

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2018-02-21 14:19:18 +01:00
Ralph Boehme
9ccc6eef14 rpcclient: fix variable initialisation and add parenthesis to if clauses
Just a few README.Coding fixes.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2018-02-21 14:19:18 +01:00
Ralph Boehme
489e942aa9 s3/rpc_client: return validation from rpccli_netlogon functions
Return the validation info instead of the already mapped info3. Higher
layers need info6 if available, this is the first step in passing the
unmapped info up to callers.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2018-01-13 08:24:08 +01:00
Volker Lendecke
3b2ba9c884 rpcclient: Avoid a ZERO_STRUCT, save a few bytes .text
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-11-13 23:54:46 +01:00
Volker Lendecke
82c17bc9fa rpcclient: Fix "capabilities" command
This used to not properly store the chained credentials back into the
netlogon_creds_cli tdb. This by the way is the bug that all the
routines for the NT4 style sam replication had that just disappeared.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Sep 25 13:42:19 CEST 2017 on sn-devel-144
2017-09-25 13:42:19 +02:00
Volker Lendecke
fe736f246b rpcclient: Remove sam_sync related commands
These three commands don't use the netlogon credential chain
correctly. They are missing the netlogon_creds_store after the dcerpc
call, so they destroy the correct use of the netlogon creds.

The only valid server for these calls that I know of would be NT4, and
that should be gone long ago.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2017-09-20 22:48:15 +02:00
Volker Lendecke
b62bba83ba cli_netlogon: Eliminate rpccli_setup_netlogon_creds_with_creds
Inlining the code from rpccli_setup_netlogon_creds

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-09-16 08:36:17 +02:00
Volker Lendecke
7a3d1b5a6f cli_netlogon: Rename rpccli_create_netlogon_creds_with_creds
This creates a context with access to a credentials, not credentials

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-09-16 08:36:17 +02:00
Volker Lendecke
43c104a8e2 s3: Avoid netlogon_creds_cli.h in includes.h
There's no point recompiling all of source3 if netlogon_creds_cli.h is changed

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-09-16 08:36:16 +02:00
Jeremy Allison
dbd3293246 s3: clients: Use netlogon_creds_cli_close_global_db() in all normal exit paths.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=12932

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-07-26 21:35:22 +02:00
Jeremy Allison
74b589799e s3: rpcclient: Use rpcclient_msg_ctx as the long-lived talloc context for rpcclient_netlogon_creds.
Guaranteed to stay around until the command exits.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-07-26 21:35:22 +02:00
Jeremy Allison
b1450af1c3 s3: rpcclient: Use event context as the talloc parent of the rpcclient_msg_ctx.
Give control over shutdown.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2017-07-26 21:35:22 +02:00