The branch, master has been updated via 7938d94d12e s4-selftest: add net offlinejoin tests via a8ad0eb4ae7 docs: document "net offlinejoin" set of commands via 575407dc2fc s3-net: add "net offlinejoin" command via ec6fd45d7b5 s3-libnetapi: add djoin tool via 3e3269d34b2 s3-libnetapi: implement NetRequestOfflineDomainJoin_l via e7a8aeee449 s3-libnetapi: add NetRequestOfflineDomainJoin example code via c1f937bfb1d s3-libnetapi: add NetRequestOfflineDomainJoin to api via 0816a3d9e60 s3-libnetapi: add NetRequestOfflineDomainJoin() boilerplate. via c97dac6d1be s3-libnetapi: add NetRequestOfflineDomainJoin to IDL via 3c8254a2faf s3-libnetapi: implement NetProvisionComputerAccount_l via 962c803947c s3-libnetapi: add NetProvisionComputerAccount example code via 8bf2a3f9c0b s3-libnetapi: add NetProvisionComputerAccount to api. via 3f71d1fa1c0 s3-libnetapi: add NetProvisionComputerAccount() boilerplate via b19a145e8f0 s3-libnetapi: add NetProvisionComputerAccount() to IDL via fc51b38ed8b s3-libnetapi: add netapi_save_file_ucs2() to example code via 3cfe663651f s3-libnetapi: add netapi_read_file helper via 44bd5049e14 s3-libnetapi: add offline domain join related error codes (not WERRORs) via 4d65b263563 s3-libnetapi: add missing NetJoinFlags for netapi via 1c62cac7f27 s3-libnetapi: add libnetapi_set_logfile() via 927390bae58 s3-libnetapi: add libnetapi_get_use_kerberos() via adcdb696cfe re-run make libnetapi .... via eff9610e7b0 s3-libnet_join: always check config correctness while joining offline via 799384792a8 s3-libnet_join: check for netbios name correctness as well via 33ed555e9bd s3-libnet_join: set netbios name as well when modification is requested via 8f3b9944857 s3-libnet_join: use dsgetonedcname to validate given DC via 7a9972943a4 s3-dsgetdcname: add dsgetonedcname() via de329620391 s3-libnet_join: use joinprov3 struct in libnet_DomainOfflineJoin() via 1581d63bfe0 s3-libnet_join: add support for libnet_DomainOfflineJoin via 997fbcbc902 s3-dsgetdcname: return dcinfo also when delivering from the cache. via 22d500ec541 s3-dsgetdcname: the returned dcinfo unc should always be prefixed via 91dcc7c889a s3-libnet_join: add request_offline_join flag via 0d75503421c s3-libnet_join: fully implement libnet_odj_compose_OP_JOINPROV3_PART via beaab062891 s3-librpc: add ODJ_PROVISION_DATA pointer to libnet_JoinCtx via 36db8faea38 s3-libnet_join: return account rid in libnet_JoinCtx via 793277c0ddd s3-libnet_join: add libnet_odj_find_joinprov3() via 80b8bbe4851 s3-libnet_join: add libnet_odj_find_win7blob to libnet_offline_join via 402d9032cbf s3-libnet_join: add some libnet_JoinCtx-to-ODJ helpers via ada1ed29cfc s3-libnet_join: return the allocated netr_DsRGetDCNameInfo struct via 9a0db8c8ed1 s3-rpc_client: add copy_netr_DsRGetDCNameInfo() helper via f37d5ea243f s3-libnet_join: let libnetjoin return a netr_DsRGetDCNameInfo via 9d9a1132119 s3-libnet_join: add new provision_computer_account_only flag via bd5dce667d8 s4-torture: add odj ndr testsuite via 705f9954582 librpc: make sure the 4 byte _pad in ODJ_WIN7BLOB is never 0 via 9963da126be librpc: more work on ODJ IDL via 91ff058420b librpc: add custom odj_switch_level_from_guid() via 8ff687863dd librpc: compile ODJ idl via dc40f23acd9 librpc: add "Offline Domain Join" (ODJ) IDL via 9cc62b562c9 librpc/ndr: do not print strings when NDR_SECRET is used from e168a95c1bb s3: VFS: Update status of SMB_VFS_READ_DFS_PATHAT.
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 7938d94d12e5ed2790fdf3d5291c8d92e66f1b4a Author: Günther Deschner <g...@samba.org> Date: Sat Jun 5 00:32:17 2021 +0200 s4-selftest: add net offlinejoin tests Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> Autobuild-User(master): Günther Deschner <g...@samba.org> Autobuild-Date(master): Wed Jul 14 17:38:21 UTC 2021 on sn-devel-184 commit a8ad0eb4ae76a59e62e65570e8c1a808a8419a7b Author: Günther Deschner <g...@samba.org> Date: Tue Apr 13 18:45:56 2021 +0200 docs: document "net offlinejoin" set of commands Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 575407dc2fc9aa27a1301b74c827f3bb3fb5d0eb Author: Günther Deschner <g...@samba.org> Date: Tue Mar 9 13:52:51 2021 +0100 s3-net: add "net offlinejoin" command Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit ec6fd45d7b527a91ee4e2bc9fa03312e8cb65022 Author: Günther Deschner <g...@samba.org> Date: Tue Feb 9 17:16:04 2021 +0100 s3-libnetapi: add djoin tool Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 3e3269d34b28603dca50db75f6b079ff21d3e932 Author: Günther Deschner <g...@samba.org> Date: Tue Feb 9 17:15:20 2021 +0100 s3-libnetapi: implement NetRequestOfflineDomainJoin_l Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit e7a8aeee4490a0d9a3324e7c1bcff491ec88a3f0 Author: Günther Deschner <g...@samba.org> Date: Mon Feb 8 15:35:31 2021 +0100 s3-libnetapi: add NetRequestOfflineDomainJoin example code Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit c1f937bfb1d72872e19c425e46fafdee1fa9f137 Author: Günther Deschner <g...@samba.org> Date: Mon Feb 8 15:50:21 2021 +0100 s3-libnetapi: add NetRequestOfflineDomainJoin to api Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 0816a3d9e60d2ca923d77cc10cc0951f288622ac Author: Günther Deschner <g...@samba.org> Date: Mon Feb 8 13:59:40 2021 +0100 s3-libnetapi: add NetRequestOfflineDomainJoin() boilerplate. Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit c97dac6d1be1e9c93b2c7dfe615722f364def8de Author: Günther Deschner <g...@samba.org> Date: Mon Feb 8 13:44:54 2021 +0100 s3-libnetapi: add NetRequestOfflineDomainJoin to IDL Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 3c8254a2faf5c95fcdb08ad14ded38e284e5d6af Author: Günther Deschner <g...@samba.org> Date: Fri Feb 5 13:05:45 2021 +0100 s3-libnetapi: implement NetProvisionComputerAccount_l Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 962c803947ce52c8950677af1abc8920b1d1bb28 Author: Günther Deschner <g...@samba.org> Date: Thu Feb 4 22:03:54 2021 +0100 s3-libnetapi: add NetProvisionComputerAccount example code Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 8bf2a3f9c0b7798466b90aaa497082f794986584 Author: Günther Deschner <g...@samba.org> Date: Thu Feb 4 22:02:54 2021 +0100 s3-libnetapi: add NetProvisionComputerAccount to api. Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 3f71d1fa1c011d04636897852768c209793df4d9 Author: Günther Deschner <g...@samba.org> Date: Thu Feb 4 21:41:27 2021 +0100 s3-libnetapi: add NetProvisionComputerAccount() boilerplate Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit b19a145e8f0d25291a209436ce55b9f8d8a5fd80 Author: Günther Deschner <g...@samba.org> Date: Wed Feb 3 15:28:13 2021 +0100 s3-libnetapi: add NetProvisionComputerAccount() to IDL Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit fc51b38ed8b7ff239db82d4d2d52f6332910ca97 Author: Günther Deschner <g...@samba.org> Date: Thu Feb 18 16:10:01 2021 +0100 s3-libnetapi: add netapi_save_file_ucs2() to example code Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 3cfe663651f353f69833ffc46687d9602c3cc900 Author: Günther Deschner <g...@samba.org> Date: Wed Feb 10 12:21:31 2021 +0100 s3-libnetapi: add netapi_read_file helper Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 44bd5049e14556d3c9c803a50830a289c6ca2cdb Author: Günther Deschner <g...@samba.org> Date: Mon Feb 8 14:01:42 2021 +0100 s3-libnetapi: add offline domain join related error codes (not WERRORs) Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 4d65b263563c7261a2e58bd6162089703bb6eeed Author: Günther Deschner <g...@samba.org> Date: Wed Feb 3 15:08:03 2021 +0100 s3-libnetapi: add missing NetJoinFlags for netapi Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 1c62cac7f271c9a4c47449fd1d35f876af000b58 Author: Günther Deschner <g...@samba.org> Date: Mon Feb 15 17:33:46 2021 +0100 s3-libnetapi: add libnetapi_set_logfile() Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 927390bae58f10450100099aa150870b1f638deb Author: Günther Deschner <g...@samba.org> Date: Thu Apr 8 22:14:41 2021 +0200 s3-libnetapi: add libnetapi_get_use_kerberos() Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit adcdb696cfeb28a1611b69c6f03ea4e495ce7186 Author: Günther Deschner <g...@samba.org> Date: Mon Feb 8 15:59:32 2021 +0100 re-run make libnetapi .... Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit eff9610e7b02726d25ed952c5b1440f4d763b63c Author: Günther Deschner <g...@samba.org> Date: Fri Feb 19 15:00:24 2021 +0100 s3-libnet_join: always check config correctness while joining offline Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 799384792a8ef004a74ae3cf11fdf839eacfca2f Author: Günther Deschner <g...@samba.org> Date: Fri Feb 19 14:49:50 2021 +0100 s3-libnet_join: check for netbios name correctness as well Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 33ed555e9bd1a8d8fca0f403eeef7576e80241ba Author: Günther Deschner <g...@samba.org> Date: Thu Feb 18 16:58:42 2021 +0100 s3-libnet_join: set netbios name as well when modification is requested Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 8f3b994485797a98d1c8f3681eeb25b851c82119 Author: Günther Deschner <g...@samba.org> Date: Tue Feb 16 16:13:37 2021 +0100 s3-libnet_join: use dsgetonedcname to validate given DC Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 7a9972943a45a803950eb322449f8f88066cec16 Author: Günther Deschner <g...@samba.org> Date: Tue Feb 16 16:11:14 2021 +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 <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit de3296203914df6240e146aa114ef2e1ae3d6315 Author: Günther Deschner <g...@samba.org> Date: Tue May 11 15:22:55 2021 +0200 s3-libnet_join: use joinprov3 struct in libnet_DomainOfflineJoin() Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 1581d63bfe09dcd0fd9d7a2e07686a071e5dc3e3 Author: Günther Deschner <g...@samba.org> Date: Mon Feb 15 20:57:56 2021 +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 <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 997fbcbc902d945eb5261ddc6667f830fbcd5931 Author: Günther Deschner <g...@samba.org> Date: Sat Feb 13 22:11:52 2021 +0100 s3-dsgetdcname: return dcinfo also when delivering from the cache. Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 22d500ec5411c3e0e82711217b15e3a6e52e0224 Author: Günther Deschner <g...@samba.org> Date: Sat Feb 13 22:03:06 2021 +0100 s3-dsgetdcname: the returned dcinfo unc should always be prefixed Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 91dcc7c889a72915d05448150ae8f203738846fc Author: Günther Deschner <g...@samba.org> Date: Mon Feb 15 20:43:37 2021 +0100 s3-libnet_join: add request_offline_join flag Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 0d75503421c98b0996e0cc70a8a94f6130ccd9b7 Author: Günther Deschner <g...@samba.org> Date: Sat Feb 13 18:21:23 2021 +0100 s3-libnet_join: fully implement libnet_odj_compose_OP_JOINPROV3_PART Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit beaab062891670bde92c37be6afbf30dacaaec0c Author: Günther Deschner <g...@samba.org> Date: Mon Feb 15 17:34:55 2021 +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 <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 36db8faea38c5332a26c391e196e12e3de2ab9ba Author: Günther Deschner <g...@samba.org> Date: Sat Feb 13 18:20:53 2021 +0100 s3-libnet_join: return account rid in libnet_JoinCtx Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 793277c0dddba567f25c56f1982cb0c3d0888eba Author: Günther Deschner <g...@samba.org> Date: Tue May 11 15:22:12 2021 +0200 s3-libnet_join: add libnet_odj_find_joinprov3() Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 80b8bbe48511d764cac4334182c3fb7b47fd54f7 Author: Günther Deschner <g...@samba.org> Date: Mon Feb 15 20:57:04 2021 +0100 s3-libnet_join: add libnet_odj_find_win7blob to libnet_offline_join Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 402d9032cbf1ac495202bfd2aabad386ac3e454d Author: Günther Deschner <g...@samba.org> Date: Wed Feb 10 15:56:43 2021 +0100 s3-libnet_join: add some libnet_JoinCtx-to-ODJ helpers Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit ada1ed29cfccd588281b11bf480012707b48cba3 Author: Günther Deschner <g...@samba.org> Date: Tue Mar 2 17:45:46 2021 +0100 s3-libnet_join: return the allocated netr_DsRGetDCNameInfo struct Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 9a0db8c8ed11f990e14a7c72fa86b87a209e2713 Author: Günther Deschner <g...@samba.org> Date: Fri Feb 12 23:56:10 2021 +0100 s3-rpc_client: add copy_netr_DsRGetDCNameInfo() helper Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit f37d5ea243fbf42676640a4f036d13c3ef90ba09 Author: Günther Deschner <g...@samba.org> Date: Sat Feb 13 02:27:03 2021 +0100 s3-libnet_join: let libnetjoin return a netr_DsRGetDCNameInfo Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 9d9a11321195d6c5429eb6a773187157c816fe8b Author: Günther Deschner <g...@samba.org> Date: Fri Feb 5 13:23:50 2021 +0100 s3-libnet_join: add new provision_computer_account_only flag Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit bd5dce667d82edf6d1597516e3bd1c9a1082c697 Author: Günther Deschner <g...@samba.org> Date: Mon Feb 8 16:08:10 2021 +0100 s4-torture: add odj ndr testsuite Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 705f9954582cf314a8b0542d166868bf406d1843 Author: Günther Deschner <g...@samba.org> Date: Thu Feb 25 23:19:25 2021 +0100 librpc: make sure the 4 byte _pad in ODJ_WIN7BLOB is never 0 Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 9963da126becaf994fb86df911fb45085316fb99 Author: Günther Deschner <g...@samba.org> Date: Mon Feb 8 16:08:43 2021 +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 <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 91ff058420b2dc7ee55e0a0a5f4586ab2cd88387 Author: Günther Deschner <g...@samba.org> Date: Mon Feb 8 23:45:42 2021 +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 <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 8ff687863dd257d085cf6ac5d8ed0d91760c47c9 Author: Günther Deschner <g...@samba.org> Date: Fri Feb 5 19:19:36 2021 +0100 librpc: compile ODJ idl Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit dc40f23acd98ff55ca20824fc9ffe665c6b0c8aa Author: Günther Deschner <g...@samba.org> Date: Fri Feb 5 19:19:11 2021 +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 <g...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> commit 9cc62b562c978f664d0ccd91079975c264dd1573 Author: Günther Deschner <g...@samba.org> Date: Wed Feb 10 11:23:13 2021 +0100 librpc/ndr: do not print strings when NDR_SECRET is used Guenther Signed-off-by: Guenther Deschner <g...@samba.org> Reviewed-by: Stefan Metzmacher <me...@samba.org> Reviewed-by: Alexander Bokovoy <a...@samba.org> ----------------------------------------------------------------------- Summary of changes: docs-xml/manpages/net.8.xml | 68 ++++ librpc/idl/ODJ.idl | 268 +++++++++++++ librpc/idl/wscript_build | 1 + librpc/ndr/ndr_ODJ.c | 65 +++ librpc/ndr/{ndr_cab.h => ndr_ODJ.h} | 6 +- librpc/ndr/ndr_string.c | 4 + librpc/wscript_build | 5 + source3/lib/netapi/examples/common.c | 146 +++++++ source3/lib/netapi/examples/common.h | 3 + source3/lib/netapi/examples/join/djoin.c | 166 ++++++++ .../examples/join/provision_computer_account.c | 122 ++++++ ...ame_machine.c => request_offline_domain_join.c} | 66 ++-- source3/lib/netapi/examples/wscript_build | 3 + source3/lib/netapi/joindomain.c | 327 ++++++++++++++++ source3/lib/netapi/libnetapi.c | 231 ++++++++++- source3/lib/netapi/libnetapi.h | 28 +- source3/lib/netapi/netapi.c | 37 ++ source3/lib/netapi/netapi.h | 79 ++++ source3/lib/netapi/netapi_private.h | 3 + source3/libads/ldap.c | 1 + source3/libnet/libnet_join.c | 238 +++++++++-- source3/libnet/libnet_join_offline.c | 436 +++++++++++++++++++++ .../netapi_net.h => libnet/libnet_join_offline.h} | 16 +- source3/librpc/idl/libnet_join.idl | 9 +- source3/librpc/idl/libnetapi.idl | 58 ++- source3/librpc/wscript_build | 2 +- source3/libsmb/dsgetdcname.c | 61 ++- source3/libsmb/dsgetdcname.h | 6 + source3/rpc_client/util_netlogon.c | 60 +++ source3/rpc_client/util_netlogon.h | 3 + source3/utils/net.c | 7 + source3/utils/net_offlinejoin.c | 288 ++++++++++++++ source3/utils/net_proto.h | 9 + source3/utils/wscript_build | 1 + source3/wscript_build | 2 +- source4/librpc/wscript_build | 1 + source4/selftest/tests.py | 1 + source4/torture/ndr/ndr.c | 1 + source4/torture/ndr/odj.c | 210 ++++++++++ source4/torture/wscript_build | 1 + testprogs/blackbox/test_net_offline.sh | 69 ++++ 41 files changed, 3005 insertions(+), 103 deletions(-) create mode 100644 librpc/idl/ODJ.idl create mode 100644 librpc/ndr/ndr_ODJ.c copy librpc/ndr/{ndr_cab.h => ndr_ODJ.h} (80%) create mode 100644 source3/lib/netapi/examples/join/djoin.c create mode 100644 source3/lib/netapi/examples/join/provision_computer_account.c copy source3/lib/netapi/examples/join/{rename_machine.c => request_offline_domain_join.c} (54%) create mode 100644 source3/libnet/libnet_join_offline.c copy source3/{lib/netapi/netapi_net.h => libnet/libnet_join_offline.h} (61%) create mode 100644 source3/utils/net_offlinejoin.c create mode 100644 source4/torture/ndr/odj.c create mode 100755 testprogs/blackbox/test_net_offline.sh Changeset truncated at 500 lines: diff --git a/docs-xml/manpages/net.8.xml b/docs-xml/manpages/net.8.xml index f5b2b9157ef..aade21a5a5a 100644 --- a/docs-xml/manpages/net.8.xml +++ b/docs-xml/manpages/net.8.xml @@ -3013,6 +3013,74 @@ Dump the locking table of a certain global lock. </refsect2> +<refsect2> +<title>OFFLINEJOIN</title> + +<para>Starting with version 4.15 Samba has support for offline join APIs. Windows supports offline join capabilities since Windows 7 and Windows 2008 R2. +</para> + +<para>The following offline commands are implemented: +<simplelist> +<member>net offlinejoin provision - Provisions a machine account in AD.</member> +<member>net offlinejoin requestodj - Requests a domain offline join.</member> +</simplelist> +</para> + +<refsect3> + <title>OFFLINEJOIN PROVISION <replaceable>domain=DOMAIN</replaceable> <replaceable>machine_name=MACHINE_NAME</replaceable> <replaceable>machine_account_ou=MACHINE_ACCOUNT_OU</replaceable> <replaceable>dcname=DCNAME</replaceable> <replaceable>defpwd</replaceable> <replaceable>reuse</replaceable> <replaceable>savefile=FILENAME</replaceable> <replaceable>printblob</replaceable></title> + +<para> +Provisions a machine account in AD. This command needs network connectivity to the domain controller to succeed. This command supports the following additional parameters: +</para> + +<itemizedlist> + +<listitem><para><replaceable>DOMAIN</replaceable> can be a NetBIOS domain name (also known as short domain name) or a DNS domain name for Active Directory Domains. The <replaceable>DOMAIN</replaceable> parameter cannot be NULL.</para></listitem> + +<listitem><para><replaceable>MACHINE_NAME</replaceable> defines the machine account name that will be provisioned in AD. The <replaceable>MACHINE_NAME</replaceable> parameter cannot be NULL.</para></listitem> + +<listitem><para><replaceable>MACHINE_ACCOUNT_OU</replaceable> can be set to a RFC 1779 LDAP DN, like <emphasis>ou=mymachines,cn=Users,dc=example,dc=com</emphasis> in order to create the machine account in a non-default LDAP container. This optional parameter is only supported when joining Active Directory Domains.</para></listitem> + +<listitem><para><replaceable>DCNAME</replaceable> defines a specific domain controller for creating the machine account in AD.</para></listitem> + +<listitem><para><replaceable>DEFPWD</replaceable> is an optional parameter that can be set to enforce using the default machine account password. The use of this parameter is not recommended as the default machine account password can be easily guessed. </para></listitem> + +<listitem><para><replaceable>REUSE</replaceable> is an optional parameter that can be set to enforce reusing an exisiting machine account in AD.</para></listitem> + +<listitem><para><replaceable>SAVEFILE</replaceable> is an optional parameter to store the generated provisioning data on disk.</para></listitem> + +<listitem><para><replaceable>PRINTBLOB</replaceable> is an optional parameter to print the generated provisioning data on stdout.</para></listitem> + +</itemizedlist> + +<para> + Example: + net offlinejoin provision -U administrator%secret domain=MYDOM machine_name=MYHOST savefile=provisioning.txt +</para> +</refsect3> + +<refsect3> + <title>OFFLINEJOIN REQUESTODJ <replaceable>loadfile=FILENAME</replaceable></title> + +<para> +Requests an offline domain join by providing file-based provisioning data. This command supports the following additional parameters: +</para> + +<itemizedlist> + +<listitem><para><replaceable>LOADFILE</replaceable> is a required parameter to load the provisioning from a file.</para></listitem> + +</itemizedlist> + +<para> + Example: + net offlinejoin requestodj -U administrator%secret loadfile=provisioning.txt +</para> + +</refsect3> + +</refsect2> + <refsect2> <title>HELP [COMMAND]</title> diff --git a/librpc/idl/ODJ.idl b/librpc/idl/ODJ.idl new file mode 100644 index 00000000000..00c731b76a9 --- /dev/null +++ b/librpc/idl/ODJ.idl @@ -0,0 +1,268 @@ +/* + The MIT License (MIT) + Copyright (c) Microsoft Corporation + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or substantial + portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT + NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + The Offline Domain Join IDL has been derived from : + + https://github.com/MicrosoftDocs/win32/blob/docs/desktop-src/NetMgmt/odj-idl.md +*/ + +import "misc.idl", "lsa.idl", "netlogon.idl", "security.idl"; + +#include "idl_types.h" + +cpp_quote("#define OP_JP2_FLAG_PERSISTENTSITE 0x00000001") + +[ + uuid("11111111-3333-5555-7777-99999999"), + version(0.0), + pointer_default(unique), + helpstring("Offline Domain Join IDL"), + helper("../librpc/ndr/ndr_ODJ.h") +] +interface ODJ +{ + typedef struct { + uint32 cbBlob; + [size_is(cbBlob),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pBlob; + } OP_BLOB; + + /* Contains a serialized ODJ_WIN7_BLOB structure. */ + const string ODJ_GUID_JOIN_PROVIDER = "{631c7621-5289-4321-bc9e-80f843f868c3}"; + + /* Contains a serialized OP_JOIN_PROV2_PART structure. */ + const string ODJ_GUID_JOIN_PROVIDER2 = "{57BFC56B-52F9-480C-ADCB-91B3F8A82317}"; + + /* Contains a serialized OP_JOIN_PROV3_PART structure. */ + const string ODJ_GUID_JOIN_PROVIDER3 = "{FC0CCF25-7FFA-474A-8611-69FFE269645F}"; + + /* Contains a serialized OP_CERT_PART structure. */ + const string ODJ_GUID_CERT_PROVIDER = "{9c0971e9-832f-4873-8e87-ef1419d4781e}"; + + /* Contains a serialized OP_POLICY_PART structure. */ + const string ODJ_GUID_POLICY_PROVIDER = "{68fb602a-0c09-48ce-b75f-07b7bd58f7ec}"; + +#if 0 + typedef struct { + char Value[6]; + } SID_IDENTIFIER_AUTHORITY; + + typedef struct { + char Revision; + char SubAuthorityCount; + SID_IDENTIFIER_AUTHORITY IdentifierAuthority; + [size_is(SubAuthorityCount)] uint32 SubAuthority[*]; + } ODJ_SID; + + typedef struct { + USHORT Length; + USHORT MaximumLength; + [size_is(MaximumLength/2), length_is(Length/2)] PWSTR Buffer; + } ODJ_UNICODE_STRING; +#endif +#define ODJ_SID dom_sid2 +#define ODJ_UNICODE_STRING lsa_StringLarge + +#define ODJ_DECLARE_SERIALIZED_PTR(el_name) \ + typedef [public] struct { \ + el_name *p; \ + } el_name ##_ctr; \ + \ + typedef [public,gensize] struct { \ + [subcontext(0xFFFFFC01)] el_name ## _ctr s; \ + } el_name ## _serialized_ptr; + + typedef struct { + ODJ_UNICODE_STRING Name; + ODJ_UNICODE_STRING DnsDomainName; + ODJ_UNICODE_STRING DnsForestName; + GUID DomainGuid; + ODJ_SID *Sid; + } ODJ_POLICY_DNS_DOMAIN_INFO; + + typedef struct { + [string,charset(UTF16)] uint16 *lpDomain; + [string,charset(UTF16)] uint16 *lpMachineName; + [string,charset(UTF16)] [flag(NDR_SECRET)] uint16 *lpMachinePassword; + /* + * Not sure whether the following 4 bytes are padding or a + * pointer, at least it's value may not be 0 for Windows to accept our + * generated win7blobs - gd + */ +#if 0 + [flag(NDR_ALIGN8)] DATA_BLOB _pad; +#else + [value(0xffffffff)] uint32 _pad; +#endif + ODJ_POLICY_DNS_DOMAIN_INFO DnsDomainInfo; + netr_DsRGetDCNameInfo DcInfo; + DWORD Options; + } ODJ_WIN7BLOB; + + typedef ODJ_WIN7BLOB *PODJ_WIN7BLOB; + + typedef struct { + DWORD dwFlags; + [string,charset(UTF16)] uint16 *lpNetbiosName; + [string,charset(UTF16)] uint16 *lpSiteName; + [string,charset(UTF16)] uint16 *lpPrimaryDNSDomain; + DWORD dwReserved; + [string,charset(UTF16)] uint16 *lpReserved; + } OP_JOINPROV2_PART; + + typedef struct { + DWORD Rid; + [string,charset(UTF16)] uint16 *lpSid; + } OP_JOINPROV3_PART; + + typedef struct { + [string,charset(UTF16)] uint16 *pKeyPath; + [string,charset(UTF16)] uint16 *pValueName; + winreg_Type ulValueType; + uint32 cbValueData; + [size_is(cbValueData),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pValueData; + } OP_POLICY_ELEMENT; + + typedef struct { + [string,charset(UTF16)] uint16 *pSource; + uint32 ulRootKeyId; + uint32 cElements; + [size_is(cElements)] OP_POLICY_ELEMENT *pElements; + } OP_POLICY_ELEMENT_LIST; + + typedef struct { + uint32 cElementLists; + [size_is(cElementLists)] + OP_POLICY_ELEMENT_LIST *pElementLists; + OP_BLOB Extension; + } OP_POLICY_PART; + + typedef struct { + [string,charset(UTF16)] uint16 *pTemplateName; + uint32 ulPrivateKeyExportPolicy; + [string,charset(UTF16)] uint16 *pPolicyServerUrl; + uint32 ulPolicyServerUrlFlags; + [string,charset(UTF16)] uint16 *pPolicyServerId; + uint32 cbPfx; + [size_is(cbPfx)] uint8 *pPfx; + } OP_CERT_PFX_STORE; + + typedef struct { + uint32 StoreLocation; + [string,charset(UTF16)] uint16 *pStoreName; + uint32 cbSst; + [size_is(cbSst)] uint8 *pSst; + } OP_CERT_SST_STORE; + + typedef struct { + uint32 cPfxStores; + [size_is(cPfxStores)] OP_CERT_PFX_STORE *pPfxStores; + uint32 cSstStores; + [size_is(cSstStores)] OP_CERT_SST_STORE *pSstStores; + OP_BLOB Extension; + } OP_CERT_PART; + + ODJ_DECLARE_SERIALIZED_PTR(ODJ_WIN7BLOB) + ODJ_DECLARE_SERIALIZED_PTR(OP_JOINPROV2_PART) + ODJ_DECLARE_SERIALIZED_PTR(OP_JOINPROV3_PART) + ODJ_DECLARE_SERIALIZED_PTR(OP_POLICY_PART) + ODJ_DECLARE_SERIALIZED_PTR(OP_CERT_PART) + + typedef [public,nodiscriminant,gensize] union { + [case(1)] [subcontext(0xFFFFFC01)] ODJ_WIN7BLOB win7blob; + [case(2)] [subcontext(0xFFFFFC01)] OP_JOINPROV2_PART_ctr join_prov2; + [case(3)] [subcontext(0xFFFFFC01)] OP_JOINPROV3_PART_ctr join_prov3; + [case(4)] [subcontext(0xFFFFFC01)] OP_CERT_PART_ctr cert_part; + [case(5)] [subcontext(0xFFFFFC01)] OP_POLICY_PART_ctr policy_part; + [default]; + } OP_PACKAGE_PART_u; + + typedef [public,bitmap32bit] bitmap { + OPSPI_PACKAGE_PART_ESSENTIAL = 0x00000001 + } ODJ_PackageFlags; + + typedef struct { + GUID PartType; + uint32 ulFlags; +#if 1 + [value(ndr_size_OP_PACKAGE_PART_u(Part, odj_switch_level_from_guid(&PartType), 0))] uint32 part_len; + [subcontext(4),subcontext_size(part_len),switch_is(odj_switch_level_from_guid(&PartType))] OP_PACKAGE_PART_u *Part; +#else + OP_BLOB Part; +#endif + OP_BLOB Extension; + } OP_PACKAGE_PART; + + ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE_PART) + + typedef struct { + uint32 cParts; + [size_is(cParts)] OP_PACKAGE_PART *pParts; + OP_BLOB Extension; + } OP_PACKAGE_PART_COLLECTION; + + ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE_PART_COLLECTION) + + typedef struct { + [value(ndr_size_OP_PACKAGE_PART_COLLECTION_serialized_ptr(w, 0))] uint32 cbBlob; + [subcontext(4), subcontext_size(cbBlob)] OP_PACKAGE_PART_COLLECTION_serialized_ptr *w; + } OP_PACKAGE_PART_COLLECTION_blob; + + typedef struct { + GUID EncryptionType; + OP_BLOB EncryptionContext; +#if 1 + OP_PACKAGE_PART_COLLECTION_blob WrappedPartCollection; +#else + OP_BLOB WrappedPartCollection; +#endif + uint32 cbDecryptedPartCollection; + OP_BLOB Extension; + } OP_PACKAGE; + + ODJ_DECLARE_SERIALIZED_PTR(OP_PACKAGE) + + typedef [v1_enum,public] enum { + ODJ_WIN7_FORMAT = 0x00000001, /* blob is ODJ_WIN7BLOB */ + ODJ_WIN8_FORMAT = 0x00000002 /* blob is OP_PACKAGE */ + } ODJFormat; + + typedef [public,nodiscriminant,gensize] union { + [case(ODJ_WIN7_FORMAT)] [subcontext(0xFFFFFC01)] ODJ_WIN7BLOB odj_win7blob; + [case(ODJ_WIN8_FORMAT)] [subcontext(0xFFFFFC01)] OP_PACKAGE_ctr op_package; + [default] [subcontext(0xFFFFFC01)] [flag(LIBNDR_FLAG_REMAINING)] DATA_BLOB blob; + } ODJ_BLOB_u; + + typedef struct { + ODJFormat ulODJFormat; + [value(ndr_size_ODJ_BLOB_u(pBlob, ulODJFormat, 0))] uint32 cbBlob; +#if 1 + [switch_is(ulODJFormat), subcontext(4), subcontext_size(cbBlob)] ODJ_BLOB_u *pBlob; +#else + [size_is(cbBlob),flag(LIBNDR_PRINT_ARRAY_HEX)] uint8 *pBlob; +#endif + } ODJ_BLOB; + + typedef [public] struct { + [value(1)] uint32 ulVersion; + uint32 ulcBlobs; + [size_is(ulcBlobs)] ODJ_BLOB *pBlobs; + } ODJ_PROVISION_DATA; + + ODJ_DECLARE_SERIALIZED_PTR(ODJ_PROVISION_DATA) +} diff --git a/librpc/idl/wscript_build b/librpc/idl/wscript_build index 0cbd7f8fdfc..1e53eec7dc0 100644 --- a/librpc/idl/wscript_build +++ b/librpc/idl/wscript_build @@ -113,6 +113,7 @@ bld.SAMBA_PIDL_LIST('PIDL', negoex.idl notify.idl ntprinting.idl + ODJ.idl printcap.idl rap.idl schannel.idl diff --git a/librpc/ndr/ndr_ODJ.c b/librpc/ndr/ndr_ODJ.c new file mode 100644 index 00000000000..86630b88827 --- /dev/null +++ b/librpc/ndr/ndr_ODJ.c @@ -0,0 +1,65 @@ +/* + Unix SMB/CIFS implementation. + + routines for marshalling/unmarshalling special ODJ structures + + Copyright (C) Guenther Deschner 2021 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "includes.h" +#include "../librpc/gen_ndr/ndr_ODJ.h" +#include "../librpc/ndr/ndr_ODJ.h" + +uint32_t odj_switch_level_from_guid(const struct GUID *r) +{ + struct { + uint16_t level; + const char *guid; + } levels[] = { + { + .level = 1, + .guid = ODJ_GUID_JOIN_PROVIDER + },{ + .level = 2, + .guid = ODJ_GUID_JOIN_PROVIDER2 + },{ + .level = 3, + .guid = ODJ_GUID_JOIN_PROVIDER3 + },{ + .level = 4, + .guid = ODJ_GUID_CERT_PROVIDER + },{ + .level = 5, + .guid = ODJ_GUID_POLICY_PROVIDER + } + }; + int i; + + for (i = 0; i < ARRAY_SIZE(levels); i++) { + struct GUID guid; + NTSTATUS status; + + status = GUID_from_string(levels[i].guid, &guid); + if (!NT_STATUS_IS_OK(status)) { + return 0; + } + if (GUID_equal(&guid, r)) { + return levels[i].level; + } + } + + return 0; +} diff --git a/librpc/ndr/ndr_cab.h b/librpc/ndr/ndr_ODJ.h similarity index 80% copy from librpc/ndr/ndr_cab.h copy to librpc/ndr/ndr_ODJ.h index 39b6bc9b483..f57f2d77437 100644 --- a/librpc/ndr/ndr_cab.h +++ b/librpc/ndr/ndr_ODJ.h @@ -1,9 +1,9 @@ /* Unix SMB/CIFS implementation. - routines for marshalling/unmarshalling cab structures + routines for marshalling/unmarshalling special ODJ structures - Copyright (C) Guenther Deschner 2016 + Copyright (C) Guenther Deschner 2021 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,4 +19,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -uint32_t ndr_count_cfdata(const struct cab_file *r); +uint32_t odj_switch_level_from_guid(const struct GUID *r); diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c index 77efb3e9848..b5421e99ff5 100644 --- a/librpc/ndr/ndr_string.c +++ b/librpc/ndr/ndr_string.c @@ -334,6 +334,10 @@ _PUBLIC_ size_t ndr_string_array_size(struct ndr_push *ndr, const char *s) _PUBLIC_ void ndr_print_string(struct ndr_print *ndr, const char *name, const char *s) { + if (NDR_HIDE_SECRET(ndr)) { + ndr->print(ndr, "%-25s: <REDACTED SECRET VALUE>", name); + return; + } if (s) { ndr->print(ndr, "%-25s: '%s'", name, s); } else { diff --git a/librpc/wscript_build b/librpc/wscript_build index f6349e168fa..b82209b4299 100644 --- a/librpc/wscript_build +++ b/librpc/wscript_build @@ -361,6 +361,11 @@ bld.SAMBA_SUBSYSTEM('NDR_DRSBLOBS', header_path=[ ('gen_ndr*', 'gen_ndr'), ('ndr*', 'ndr')] ) +bld.SAMBA_SUBSYSTEM('NDR_ODJ', + source='gen_ndr/ndr_ODJ.c ndr/ndr_ODJ.c', + public_deps='NDR_LSA NDR_NETLOGON NDR_SECURITY', + deps='ndr') + bld.SAMBA_SUBSYSTEM('NDR_KRB5PAC', source='', deps='ndr-krb5pac') diff --git a/source3/lib/netapi/examples/common.c b/source3/lib/netapi/examples/common.c index 358e0edc4c7..a1a491e60c2 100644 --- a/source3/lib/netapi/examples/common.c +++ b/source3/lib/netapi/examples/common.c @@ -6,6 +6,16 @@ #include <popt.h> #include <netapi.h> -- Samba Shared Repository