gd/samba/.git
2 years agowip setup logfile master-libnetapi-offlinejoin
Günther Deschner [Fri, 4 Jun 2021 17:56:58 +0000 (19:56 +0200)]
wip setup logfile

2 years agowip: add odj_ops
Günther Deschner [Fri, 4 Jun 2021 13:22:28 +0000 (15:22 +0200)]
wip: add odj_ops

2 years agofixup WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED handling
Günther Deschner [Wed, 14 Apr 2021 09:58:54 +0000 (11:58 +0200)]
fixup WKSSVC_JOIN_FLAGS_DOMAIN_JOIN_IF_JOINED handling

2 years agowip start collect_group_policies()
Günther Deschner [Fri, 5 Mar 2021 12:28:47 +0000 (13:28 +0100)]
wip start collect_group_policies()

2 years agofixup gpo_connect()
Günther Deschner [Fri, 5 Mar 2021 20:54:20 +0000 (21:54 +0100)]
fixup gpo_connect()

2 years agoRevert "libgpo: Remove unused code"
Günther Deschner [Fri, 5 Mar 2021 20:23:13 +0000 (21:23 +0100)]
Revert "libgpo: Remove unused code"

This reverts commit c40e354fe1fde2adcb16f5df7539d8ba41bb902b.

2 years agoRevert "s3-net: disable net_ads_gpo_apply() and net_ads_gpo_refresh()"
Günther Deschner [Fri, 5 Mar 2021 20:22:33 +0000 (21:22 +0100)]
Revert "s3-net: disable net_ads_gpo_apply() and net_ads_gpo_refresh()"

This reverts commit b2e418369b41dd1238d66a759545b0d8bc88bf74.

2 years agos3-libnetapi: add NetRequestProvisioningPackageInstall boilerplate
Günther Deschner [Mon, 1 Mar 2021 13:58:54 +0000 (14:58 +0100)]
s3-libnetapi: add NetRequestProvisioningPackageInstall boilerplate

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetRequestProvisioningPackageInstall to IDL
Günther Deschner [Mon, 1 Mar 2021 13:57:49 +0000 (14:57 +0100)]
s3-libnetapi: add NetRequestProvisioningPackageInstall to IDL

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: implement NetCreateProvisioningPackage_l
Günther Deschner [Mon, 22 Feb 2021 20:11:05 +0000 (21:11 +0100)]
s3-libnetapi: implement NetCreateProvisioningPackage_l

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agoRevert "s3-libnetapi: do request smbconf modification in NetRequestOfflineDomainJoin()"
Günther Deschner [Thu, 3 Jun 2021 14:42:55 +0000 (16:42 +0200)]
Revert "s3-libnetapi: do request smbconf modification in NetRequestOfflineDomainJoin()"

This reverts commit f1065601bc6122787bce6d310b9ab97c892cf674.

2 years agos3-libnetapi: do request smbconf modification in NetRequestOfflineDomainJoin()
Günther Deschner [Thu, 18 Feb 2021 15:59:55 +0000 (16:59 +0100)]
s3-libnetapi: do request smbconf modification in NetRequestOfflineDomainJoin()

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetCreateProvisioningPackage example code
Günther Deschner [Mon, 15 Feb 2021 16:41:05 +0000 (17:41 +0100)]
s3-libnetapi: add NetCreateProvisioningPackage example code

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetCreateProvisioningPackage to api
Günther Deschner [Mon, 15 Feb 2021 16:34:26 +0000 (17:34 +0100)]
s3-libnetapi: add NetCreateProvisioningPackage to api

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetCreateProvisioningPackage boilerplate
Günther Deschner [Mon, 15 Feb 2021 13:27:27 +0000 (14:27 +0100)]
s3-libnetapi: add NetCreateProvisioningPackage boilerplate

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetCreateProvisioningPackage to IDL
Günther Deschner [Mon, 15 Feb 2021 13:24:35 +0000 (14:24 +0100)]
s3-libnetapi: add NetCreateProvisioningPackage to IDL

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos4-selftest: add net offlinejoin tests master-libnetapi-offlinejoin-ok
Günther Deschner [Fri, 4 Jun 2021 22:32:17 +0000 (00:32 +0200)]
s4-selftest: add net offlinejoin tests

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agodocs: document "net offlinejoin" set of commands
Günther Deschner [Tue, 13 Apr 2021 16:45:56 +0000 (18:45 +0200)]
docs: document "net offlinejoin" set of commands

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-net: add "net offlinejoin" command
Günther Deschner [Tue, 9 Mar 2021 12:52:51 +0000 (13:52 +0100)]
s3-net: add "net offlinejoin" command

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add djoin tool
Günther Deschner [Tue, 9 Feb 2021 16:16:04 +0000 (17:16 +0100)]
s3-libnetapi: add djoin tool

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: implement NetRequestOfflineDomainJoin_l
Günther Deschner [Tue, 9 Feb 2021 16:15:20 +0000 (17:15 +0100)]
s3-libnetapi: implement NetRequestOfflineDomainJoin_l

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetRequestOfflineDomainJoin example code
Günther Deschner [Mon, 8 Feb 2021 14:35:31 +0000 (15:35 +0100)]
s3-libnetapi: add NetRequestOfflineDomainJoin example code

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetRequestOfflineDomainJoin to api
Günther Deschner [Mon, 8 Feb 2021 14:50:21 +0000 (15:50 +0100)]
s3-libnetapi: add NetRequestOfflineDomainJoin to api

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetRequestOfflineDomainJoin() boilerplate.
Günther Deschner [Mon, 8 Feb 2021 12:59:40 +0000 (13:59 +0100)]
s3-libnetapi: add NetRequestOfflineDomainJoin() boilerplate.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetRequestOfflineDomainJoin to IDL
Günther Deschner [Mon, 8 Feb 2021 12:44:54 +0000 (13:44 +0100)]
s3-libnetapi: add NetRequestOfflineDomainJoin to IDL

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: implement NetProvisionComputerAccount_l
Günther Deschner [Fri, 5 Feb 2021 12:05:45 +0000 (13:05 +0100)]
s3-libnetapi: implement NetProvisionComputerAccount_l

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetProvisionComputerAccount example code
Günther Deschner [Thu, 4 Feb 2021 21:03:54 +0000 (22:03 +0100)]
s3-libnetapi: add NetProvisionComputerAccount example code

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetProvisionComputerAccount to api.
Günther Deschner [Thu, 4 Feb 2021 21:02:54 +0000 (22:02 +0100)]
s3-libnetapi: add NetProvisionComputerAccount to api.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetProvisionComputerAccount() boilerplate
Günther Deschner [Thu, 4 Feb 2021 20:41:27 +0000 (21:41 +0100)]
s3-libnetapi: add NetProvisionComputerAccount() boilerplate

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add NetProvisionComputerAccount() to IDL
Günther Deschner [Wed, 3 Feb 2021 14:28:13 +0000 (15:28 +0100)]
s3-libnetapi: add NetProvisionComputerAccount() to IDL

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add netapi_save_file_ucs2() to example code
Günther Deschner [Thu, 18 Feb 2021 15:10:01 +0000 (16:10 +0100)]
s3-libnetapi: add netapi_save_file_ucs2() to example code

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add netapi_read_file helper
Günther Deschner [Wed, 10 Feb 2021 11:21:31 +0000 (12:21 +0100)]
s3-libnetapi: add netapi_read_file helper

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add offline domain join related error codes (not WERRORs)
Günther Deschner [Mon, 8 Feb 2021 13:01:42 +0000 (14:01 +0100)]
s3-libnetapi: add offline domain join related error codes (not WERRORs)

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add missing NetJoinFlags for netapi
Günther Deschner [Wed, 3 Feb 2021 14:08:03 +0000 (15:08 +0100)]
s3-libnetapi: add missing NetJoinFlags for netapi

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add libnetapi_set_logfile()
Günther Deschner [Mon, 15 Feb 2021 16:33:46 +0000 (17:33 +0100)]
s3-libnetapi: add libnetapi_set_logfile()

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnetapi: add libnetapi_get_use_kerberos()
Günther Deschner [Thu, 8 Apr 2021 20:14:41 +0000 (22:14 +0200)]
s3-libnetapi: add libnetapi_get_use_kerberos()

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agore-run make libnetapi ....
Günther Deschner [Mon, 8 Feb 2021 14:59:32 +0000 (15:59 +0100)]
re-run make libnetapi ....

2 years agos3-libnet_join: always check config correctness while joining offline
Günther Deschner [Fri, 19 Feb 2021 14:00:24 +0000 (15:00 +0100)]
s3-libnet_join: always check config correctness while joining offline

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: check for netbios name correctness as well
Günther Deschner [Fri, 19 Feb 2021 13:49:50 +0000 (14:49 +0100)]
s3-libnet_join: check for netbios name correctness as well

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: set netbios name as well when modification is requested
Günther Deschner [Thu, 18 Feb 2021 15:58:42 +0000 (16:58 +0100)]
s3-libnet_join: set netbios name as well when modification is requested

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: use dsgetonedcname to validate given DC
Günther Deschner [Tue, 16 Feb 2021 15:13:37 +0000 (16:13 +0100)]
s3-libnet_join: use dsgetonedcname to validate given DC

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-dsgetdcname: add dsgetonedcname()
Günther Deschner [Tue, 16 Feb 2021 15:11:14 +0000 (16:11 +0100)]
s3-dsgetdcname: add dsgetonedcname()

The idea is to run the same DC validation steps as for dsgetdcname()
just omit the query list of DCs via DNS/netbios step but instead
validate a given DC right away.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: use joinprov3 struct in libnet_DomainOfflineJoin()
Günther Deschner [Tue, 11 May 2021 13:22:55 +0000 (15:22 +0200)]
s3-libnet_join: use joinprov3 struct in libnet_DomainOfflineJoin()

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: add support for libnet_DomainOfflineJoin
Günther Deschner [Mon, 15 Feb 2021 19:57:56 +0000 (20:57 +0100)]
s3-libnet_join: add support for libnet_DomainOfflineJoin

libnet_DomainOfflineJoin will consume the provided offline domain join
blob and lay out libnet_Join information to properly store join metadata
in the local database.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-dsgetdcname: return dcinfo also when delivering from the cache.
Günther Deschner [Sat, 13 Feb 2021 21:11:52 +0000 (22:11 +0100)]
s3-dsgetdcname: return dcinfo also when delivering from the cache.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-dsgetdcname: the returned dcinfo unc should always be prefixed
Günther Deschner [Sat, 13 Feb 2021 21:03:06 +0000 (22:03 +0100)]
s3-dsgetdcname: the returned dcinfo unc should always be prefixed

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: add request_offline_join flag
Günther Deschner [Mon, 15 Feb 2021 19:43:37 +0000 (20:43 +0100)]
s3-libnet_join: add request_offline_join flag

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: fully implement libnet_odj_compose_OP_JOINPROV3_PART
Günther Deschner [Sat, 13 Feb 2021 17:21:23 +0000 (18:21 +0100)]
s3-libnet_join: fully implement libnet_odj_compose_OP_JOINPROV3_PART

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-librpc: add ODJ_PROVISION_DATA pointer to libnet_JoinCtx
Günther Deschner [Mon, 15 Feb 2021 16:34:55 +0000 (17:34 +0100)]
s3-librpc: add ODJ_PROVISION_DATA pointer to libnet_JoinCtx

It will be used later to pass in offline domain join structs to serve
request offline domain join requests.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: return account rid in libnet_JoinCtx
Günther Deschner [Sat, 13 Feb 2021 17:20:53 +0000 (18:20 +0100)]
s3-libnet_join: return account rid in libnet_JoinCtx

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: add libnet_odj_find_joinprov3()
Günther Deschner [Tue, 11 May 2021 13:22:12 +0000 (15:22 +0200)]
s3-libnet_join: add libnet_odj_find_joinprov3()

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: add libnet_odj_find_win7blob to libnet_offline_join
Günther Deschner [Mon, 15 Feb 2021 19:57:04 +0000 (20:57 +0100)]
s3-libnet_join: add libnet_odj_find_win7blob to libnet_offline_join

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: add some libnet_JoinCtx-to-ODJ helpers
Günther Deschner [Wed, 10 Feb 2021 14:56:43 +0000 (15:56 +0100)]
s3-libnet_join: add some libnet_JoinCtx-to-ODJ helpers

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: return the allocated netr_DsRGetDCNameInfo struct
Günther Deschner [Tue, 2 Mar 2021 16:45:46 +0000 (17:45 +0100)]
s3-libnet_join: return the allocated netr_DsRGetDCNameInfo struct

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-rpc_client: add copy_netr_DsRGetDCNameInfo() helper
Günther Deschner [Fri, 12 Feb 2021 22:56:10 +0000 (23:56 +0100)]
s3-rpc_client: add copy_netr_DsRGetDCNameInfo() helper

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: let libnetjoin return a netr_DsRGetDCNameInfo
Günther Deschner [Sat, 13 Feb 2021 01:27:03 +0000 (02:27 +0100)]
s3-libnet_join: let libnetjoin return a netr_DsRGetDCNameInfo

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos3-libnet_join: add new provision_computer_account_only flag
Günther Deschner [Fri, 5 Feb 2021 12:23:50 +0000 (13:23 +0100)]
s3-libnet_join: add new provision_computer_account_only flag

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agos4-torture: add odj ndr testsuite
Günther Deschner [Mon, 8 Feb 2021 15:08:10 +0000 (16:08 +0100)]
s4-torture: add odj ndr testsuite

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agolibrpc: make sure the 4 byte _pad in ODJ_WIN7BLOB is never 0
Günther Deschner [Thu, 25 Feb 2021 22:19:25 +0000 (23:19 +0100)]
librpc: make sure the 4 byte _pad in ODJ_WIN7BLOB is never 0

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agolibrpc: more work on ODJ IDL
Günther Deschner [Mon, 8 Feb 2021 15:08:43 +0000 (16:08 +0100)]
librpc: more work on ODJ IDL

A lot of nested use of serialization stream pointers
([MS-RPCE] 2.2.6 Type Serialization Version 1).

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agolibrpc: add custom odj_switch_level_from_guid()
Günther Deschner [Mon, 8 Feb 2021 22:45:42 +0000 (23:45 +0100)]
librpc: add custom odj_switch_level_from_guid()

This function maintains an arbitrary mapping of GUID strings to
integers. This is required as only integers can be used as
discriminators for autogenerated ODJ unions.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agolibrpc: compile ODJ idl
Günther Deschner [Fri, 5 Feb 2021 18:19:36 +0000 (19:19 +0100)]
librpc: compile ODJ idl

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agolibrpc: add "Offline Domain Join" (ODJ) IDL
Günther Deschner [Fri, 5 Feb 2021 18:19:11 +0000 (19:19 +0100)]
librpc: add "Offline Domain Join" (ODJ) IDL

This IDL is based on

https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/NetMgmt/odj-idl.md

and has been licensed by Microsoft under the terms of the MIT License.

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
2 years agolibrpc/ndr: do not print strings when NDR_SECRET is used
Günther Deschner [Wed, 10 Feb 2021 10:23:13 +0000 (11:23 +0100)]
librpc/ndr: do not print strings when NDR_SECRET is used

Guenther

Signed-off-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoWHATSNEW: samba-tool without ad-dc
David Mulder [Wed, 7 Jul 2021 14:00:36 +0000 (08:00 -0600)]
WHATSNEW: samba-tool without ad-dc

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): David Mulder <dmulder@samba.org>
Autobuild-Date(master): Thu Jul  8 14:43:11 UTC 2021 on sn-devel-184

2 years agoselftest: Print dns_update_cache path into the logs
Andrew Bartlett [Mon, 23 Nov 2020 07:54:29 +0000 (20:54 +1300)]
selftest: Print dns_update_cache path into the logs

This sometimes get stuck in a loop and this may help debug it.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jul  8 12:44:49 UTC 2021 on sn-devel-184

2 years agolib/tsocket: Free subreq as soon as possible
Samuel Cabrero [Fri, 31 Jul 2020 09:13:27 +0000 (11:13 +0200)]
lib/tsocket: Free subreq as soon as possible

This is not a memory leak as it is freed when the parent req's state is
freed, but will help in low memory situations.

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jul  8 10:21:25 UTC 2021 on sn-devel-184

2 years agowitness.idl: fix length calculation for witness_IPaddrInfoList
Stefan Metzmacher [Fri, 31 Jul 2020 09:27:25 +0000 (11:27 +0200)]
witness.idl: fix length calculation for witness_IPaddrInfoList

If r->num is 0, we should not dereference r->addr.

Using ndr_size_witness_IPaddrInfoList() also make this much simpler
and avoids the magic 12.

Credit Oss-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22175
REF: https://oss-fuzz.com/testcase-detail/5686294157197312

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2 years agotorture/ndr: reproduce a problem with witness_AsyncNotify
Stefan Metzmacher [Fri, 31 Jul 2020 09:27:10 +0000 (11:27 +0200)]
torture/ndr: reproduce a problem with witness_AsyncNotify

Credit Oss-Fuzz

REF: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=22175
REF: https://oss-fuzz.com/testcase-detail/5686294157197312

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2 years agotorture/ndr: add more details to the test names
Stefan Metzmacher [Fri, 31 Jul 2020 11:23:19 +0000 (13:23 +0200)]
torture/ndr: add more details to the test names

We can have more than one blob for a given idl function
and we should avoid using the same name for all of them.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2 years agotorture/ndr: make check functions typesafe
Stefan Metzmacher [Fri, 31 Jul 2020 11:20:09 +0000 (13:20 +0200)]
torture/ndr: make check functions typesafe

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
2 years agolibcli: Move map_errno_from_nt_status from s3 lib to common libcli
Samuel Cabrero [Fri, 22 Jan 2021 13:04:35 +0000 (14:04 +0100)]
libcli: Move map_errno_from_nt_status from s3 lib to common libcli

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agos3:lib: Map ECANCELED to NT_STATUS_CANCELLED
Samuel Cabrero [Thu, 30 Jul 2020 10:07:57 +0000 (12:07 +0200)]
s3:lib: Map ECANCELED to NT_STATUS_CANCELLED

Now map_nt_error_from_unix() returns the same value as
map_nt_error_from_unix_common().

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoauth:creds: Remove unused simple.c file
Andreas Schneider [Tue, 22 Jun 2021 07:31:29 +0000 (09:31 +0200)]
auth:creds: Remove unused simple.c file

This code is tested by the cmocka unit test:
auth/credentials/tests/test_creds.c

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agolib:tdb: Fix a memory leak on error
Andreas Schneider [Wed, 7 Jul 2021 09:12:37 +0000 (11:12 +0200)]
lib:tdb: Fix a memory leak on error

Found by covscan.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agoselftest: Add test for one-way trust wbinfo auth
Isaac Boukris [Thu, 8 Oct 2020 12:00:44 +0000 (14:00 +0200)]
selftest: Add test for one-way trust wbinfo auth

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Jul  7 15:01:22 UTC 2021 on sn-devel-184

2 years agoselftest: fl2000dc: Add outgoing trust from fl2000dc to ad_dc
Andreas Schneider [Fri, 9 Jun 2017 13:03:29 +0000 (15:03 +0200)]
selftest: fl2000dc: Add outgoing trust from fl2000dc to ad_dc

Pair-Programmed-With: Andreas Schneider <asn@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Fix "outgoing" test in kinit_trust heimdal
Isaac Boukris [Tue, 6 Oct 2020 20:33:45 +0000 (22:33 +0200)]
selftest: Fix "outgoing" test in kinit_trust heimdal

Found by the test not failing in one-way trust.

Signed-off-by: Isaac Boukris <iboukris@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotestprogs: Show that DOM\user and REALM\user work for auth
Andreas Schneider [Wed, 23 Jun 2021 08:55:04 +0000 (10:55 +0200)]
testprogs: Show that DOM\user and REALM\user work for auth

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agotestprogs: Rename TRUST_CREDS variables in test_trust_utils.sh
Andreas Schneider [Wed, 23 Jun 2021 08:50:23 +0000 (10:50 +0200)]
testprogs: Rename TRUST_CREDS variables in test_trust_utils.sh

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoselftest: Add the trusted domain realms to krb5.conf
Andreas Schneider [Fri, 18 Jun 2021 11:40:59 +0000 (13:40 +0200)]
selftest: Add the trusted domain realms to krb5.conf

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agos3:tests: Fix wbinfo_lookuprids_cache test with system tdb-tools
Andreas Schneider [Mon, 14 Jun 2021 09:38:44 +0000 (11:38 +0200)]
s3:tests: Fix wbinfo_lookuprids_cache test with system tdb-tools

If libtdb is used from the system, we should use those tools by default.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoAdd editorconfig config file
Andreas Schneider [Sun, 4 Jul 2021 18:06:04 +0000 (20:06 +0200)]
Add editorconfig config file

See https://editorconfig.org/ for details.

(neo)vim: https://github.com/editorconfig/editorconfig-vim
emacs:    https://github.com/editorconfig/editorconfig-emacs

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Jul  7 05:54:16 UTC 2021 on sn-devel-184

2 years agotevent: bump the version number to 0.11.0
Pavel Březina [Mon, 31 May 2021 12:58:19 +0000 (14:58 +0200)]
tevent: bump the version number to 0.11.0

* Other minor build fixes.
* Add custom tag to events
* Add event trace api

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Pavel Březina <pbrezina@redhat.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agotevent: add event trace api
Pavel Březina [Tue, 1 Jun 2021 12:10:05 +0000 (14:10 +0200)]
tevent: add event trace api

Adds new tracing API to trace fd, timer, signal and immediate events
on specific trace points: attach, before handler and dettach.

This can be used in combination with the event tag to keep track
of the currently executed event for purpose of debugging.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Pavel Březina <pbrezina@redhat.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agotevent: add custom tag to events
Pavel Březina [Tue, 1 Jun 2021 11:57:45 +0000 (13:57 +0200)]
tevent: add custom tag to events

Adds a new API to set and get an uint64_t tag on fd, timer, signal and
immediate events. This can be used to assign a unique and known id to
the event to allow easy tracking of such event.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Pavel Březina <pbrezina@redhat.com>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agotevent: add support for cmocka unit tests
Pavel Březina [Thu, 3 Jun 2021 11:05:46 +0000 (13:05 +0200)]
tevent: add support for cmocka unit tests

This adds a placeholder for new cmocka tests for tevent. Tests
are added in individual commits.

Signed-off-by: Pavel Březina <pbrezina@redhat.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2 years agothird_party:cmocka: Fix build when used in lib/tevent
Andreas Schneider [Tue, 8 Jun 2021 12:29:06 +0000 (14:29 +0200)]
third_party:cmocka: Fix build when used in lib/tevent

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2 years agosmbXsrv_{open,session,tcon}: protect smbXsrv_{open,session,tcon}_global_traverse_fn...
Stefan Metzmacher [Mon, 5 Jul 2021 15:17:30 +0000 (17:17 +0200)]
smbXsrv_{open,session,tcon}: protect smbXsrv_{open,session,tcon}_global_traverse_fn against invalid records

I saw systems with locking.tdb records being part of:
  ctdb catdb smbXsrv_tcon_global.tdb

It's yet unknown how that happened, but we should not panic in srvsvc_*
calls because the info0 pointer was NULL.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jul  6 11:08:43 UTC 2021 on sn-devel-184

2 years agotestprogs: Consistantly use kinit -c $KRB5CCNAME
Stefan Metzmacher [Fri, 3 Apr 2020 14:29:36 +0000 (16:29 +0200)]
testprogs: Consistantly use kinit -c $KRB5CCNAME

We want to be really clear which credentials cache we use.

The kerberos_kinit() shell function uses this internally.

-c is the common option between MIT and Heimdal, and is
equivilant to --cache

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jul  5 23:51:43 UTC 2021 on sn-devel-184

2 years agogensec_krb5: restore ipv6 support for kpasswd
Stefan Metzmacher [Fri, 2 Jul 2021 07:37:25 +0000 (09:37 +0200)]
gensec_krb5: restore ipv6 support for kpasswd

We need to offer as much space we have in order to
get the address out of tsocket_address_bsd_sockaddr().

This fixes a regression in commit
43c808f2ff907497dfff0988ff90a48fdcfc16ef.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoprinting: avoid crash in LPRng_time
Douglas Bagnall [Wed, 5 May 2021 14:55:47 +0000 (14:55 +0000)]
printing: avoid crash in LPRng_time

If the string is too shhort we don't want to atoi() whatever is beyond
the end of it.

Found using Honggfuzz and the fuzz_parse_lpq_entry fuzzer.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jul  5 05:07:13 UTC 2021 on sn-devel-184

2 years agofuzz: add fuzz_parse_lpq_entry
Douglas Bagnall [Tue, 6 Apr 2021 11:11:32 +0000 (23:11 +1200)]
fuzz: add fuzz_parse_lpq_entry

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agofuzz: fix multiple comment headers
Douglas Bagnall [Fri, 14 May 2021 03:05:05 +0000 (15:05 +1200)]
fuzz: fix multiple comment headers

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agodns update: zero flags and reserved
Douglas Bagnall [Wed, 26 May 2021 03:01:36 +0000 (15:01 +1200)]
dns update: zero flags and reserved

This is the observed behaviour on Windows.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agodns_common_replace: do not leak
Douglas Bagnall [Thu, 15 Apr 2021 04:07:58 +0000 (16:07 +1200)]
dns_common_replace: do not leak

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agosamba-tool: dns update rejects malformed addresses
Douglas Bagnall [Sun, 20 Jun 2021 02:52:48 +0000 (14:52 +1200)]
samba-tool: dns update rejects malformed addresses

Because neither filling out the struct will not necessarily tell you
you got it wrong, and the RPC could succeed in setting an arbitrary
wrong address (typically, an IPv6 address would set an A record to
"255.255.255.255").

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agopydns: fix a comment in replace_by_dn()
Douglas Bagnall [Sun, 20 Jun 2021 10:03:35 +0000 (22:03 +1200)]
pydns: fix a comment in replace_by_dn()

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agoldb-samba: dns tombstone matching: constrict value length
Douglas Bagnall [Mon, 29 Mar 2021 00:03:45 +0000 (13:03 +1300)]
ldb-samba: dns tombstone matching: constrict value length

We know the only values we want to see are uint32, ie < ~4 billion
(and real values will be 7 digits for hundreds of years).

We also know the caller (we have just checked) is a trusted system
session which won't be padding the thing with spaces. But if they do,
let's call them out.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2 years agodns_server: free old zones when reloading
Douglas Bagnall [Tue, 30 Mar 2021 21:47:05 +0000 (10:47 +1300)]
dns_server: free old zones when reloading

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>