summaryrefslogtreecommitdiff
path: root/source3/lib/netapi
AgeCommit message (Collapse)AuthorFilesLines
2026-03-20s3:lib:netapi set talloc type for GROUP_INFO_xGary Lockyer1-0/+4
Call talloc_set_type setting the type name after copying the GROUP_INFO to the buffer. This will allow the client code to use talloc_get_type_abort, if needed to suppress any cast-align warnings Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-08-27s3:lib: Initialize pointer to NULLJennifer Sutton1-1/+1
../../source3/lib/netapi/tests/netdisplay.c: In function ‘test_netquerydisplayinformation’: ../../source3/lib/netapi/tests/netdisplay.c:87:45: error: ‘current_name’ may be used uninitialized [-Werror=maybe-uninitialized] 87 | if (name && strcasecmp(current_name, name) == 0) { | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../source3/lib/netapi/tests/netdisplay.c:37:21: note: ‘current_name’ was declared here 37 | const char *current_name; | ^~~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Jennifer Sutton <jennifersutton@catalyst.net.nz> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2025-07-29s3:lib: Fix CID 1497484 use-after-free.Vinit Agnihotri1-0/+1
p was not set to NULL after being free'd, this can cause a use-after-free situation. This fixes coverity issue#1497484 Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com> Reviewed-by: Guenther Deschner <gd@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Tue Jul 29 15:01:42 UTC 2025 on atb-devel-224
2025-06-16libsmb: Remove "source3/libsmb/libsmb.h"Volker Lendecke1-1/+2
libsmb.h added ads_status.h and cli_smb2_fnum.h. Only few users need either. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2025-04-18s3:libsmb: pass struct smb_transports to cli_cm_connect() and cli_cm_open()Stefan Metzmacher1-1/+4
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
2025-02-17s3:rpc_client: Use cli_rpc_pipe_reopen_np_noauth() for OpenPolicy fallbackStefan Metzmacher1-1/+1
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15680 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-11-06s3:headers: s/the the\b/the/ in commentsDouglas Bagnall1-1/+1
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-09-26s3:lib/netapi: make use of dcerpc_binding_get_abstract_syntax()Stefan Metzmacher1-3/+12
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-09-26s3:lib/netapi: make use of dcerpc_binding_handle_transport_session_key()Stefan Metzmacher2-6/+12
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
2024-06-04lib: Use cli_credentials_add_gensec_features in a few placesVolker Lendecke1-6/+2
Capture a common pattern Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2024-05-14s3:include: remove unused krb5_env.hStefan Metzmacher1-1/+0
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-05-14s3:libnet_join: pass down cli_credentials *admin_credentials to ↵Stefan Metzmacher1-41/+36
libnet_{Join,Unjoin}Ctx() Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-05-14s3:lib/netapi: make use of ads_simple_creds/libnetapi_get_creds in ↵Stefan Metzmacher1-36/+11
NetGetJoinableOUs_l Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2024-05-14s3:lib/netapi: add libnetapi_get_creds()Stefan Metzmacher2-0/+25
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
2023-11-21s3:libnetapi: Use dcerpc_lsa_open_policy_fallback() in localgroup.cAndreas Schneider1-7/+21
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
2023-09-14s3:netapi: Fix a leak in libnetapi_net_init()Pavel Kalugin1-1/+7
Allow libnetapi_net_init() to be called more than once without leaking libnetapi_ctx allocated on a previous call, which is currently the case in the `net rpc` code. Signed-off-by: Pavel Kalugin <pkalugin@inno.tech> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-14libnetapi: Use lpcfg_set_cmdline()Pavel Kalugin2-12/+18
Replace lp_set_cmdline() with lpcfg_set_cmdline() in netapi.c. For this purpose: 1. Add loadparm_context to the libnetapi_ctx because we need it in libnetapi_set_debuglevel() and libnetapi_set_logfile(). 2. Move loadparm_context creation from libnetapi_net_init() to libnetapi_init() and add the lp_ctx parameter to the former. Signed-off-by: Pavel Kalugin <pkalugin@inno.tech> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-11netapi: Pass net's cmdline credentials to libnetapi_net_init()Samuel Cabrero2-9/+13
Avoid unnecessary credentials allocation and initialization by passing the net's cmdline creds to libnetapi_net_init() directly. Fixes the problem of running cli_credentials_guess() (which runs password callbacks) twice, one for the net's cmdline creds and a second time for the creds initialized in libnetapi_net_init(), just to override them immediately after. Example: $ export PASSWD_FD=0 $ ./bin/net offlinejoin composeodj <...> foo bar Password is read from STDIN twice. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-11netapi: Pass loadparm_context to libnetapi_net_init()Samuel Cabrero2-10/+13
The net's tool cmdline lp_ctx can be reused, no need to init a new one except for external library users. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-11s3:lib: Fix code spellingJoseph Sutton1-1/+1
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-05s3:libnetapi: Implement NetComposeOfflineDomainJoin_l()Samuel Cabrero1-1/+179
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13577 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-05s3:libnetapi: Add NetComposeOfflineDomainJoin() to API.Samuel Cabrero1-0/+43
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13577 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-05s3:libnetapi: Add NetComposeOfflineDomainJoin() boilerplateSamuel Cabrero3-0/+102
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13577 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-05s3:libnetapi: Add some comments to document ODJ blob charset conversionsSamuel Cabrero1-0/+4
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13577 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-09-05s3:libnetapi: Return error from RequestOfflineJoinSamuel Cabrero1-2/+4
The error code must be returned to caller even if the error string is not set. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13577 Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2023-07-13s3:lib: Fix code spellingAndreas Schneider2-3/+3
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2023-02-06s3:netapi: Remove unused variablesAndreas Schneider1-7/+0
source3/lib/netapi/tests/netfile.c:40:22: error: variable 'i2' set but not used [-Werror,-Wunused-but-set-variable] struct FILE_INFO_2 *i2 = NULL; ^ source3/lib/netapi/tests/netfile.c:41:22: error: variable 'i3' set but not used [-Werror,-Wunused-but-set-variable] struct FILE_INFO_3 *i3 = NULL; ^ Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-12-16s3-librpc: add ads.idl and convert ads_struct to talloc.Günther Deschner1-2/+2
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-27s3:libads: Allocate ads->auth.user_name under ADS_STRUCT talloc contextSamuel Cabrero1-3/+11
Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-27s3:libads: Allocate ads->auth.password under ADS_STRUCT talloc contextSamuel Cabrero1-3/+11
Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-27s3:libads: Allocate ADS_STRUCT under a talloc contextSamuel Cabrero1-5/+2
The ads_destroy() function is now static and only called from the ADS_STRUCT destructor. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-06-27s3:netapi: Allocate a temporary talloc context for NetGetJoinableOUs_l()Samuel Cabrero1-6/+17
Prepare to allocate ADS_STRUCT under a talloc context. Signed-off-by: Samuel Cabrero <scabrero@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2022-05-23s3:lib: Fix use_after_free: Using freed pointer "p"Pavel Filipenský1-0/+1
Found by covscan. Signed-off-by: Pavel Filipenský <pfilipen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-12-15s3:lib: Do not close fd = -1 on fail in netapi exampleAndreas Schneider1-1/+3
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-12-15s3:lib: Fix memory leak in netapi examplesAndreas Schneider1-2/+6
Found by covscan. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-11-09CVE-2020-25717: Add FreeIPA domain controller roleAlexander Bokovoy1-0/+1
As we want to reduce use of 'classic domain controller' role but FreeIPA relies on it internally, add a separate role to mark FreeIPA domain controller role. It means that role won't result in ROLE_STANDALONE. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14801 BUG: https://bugzilla.samba.org/show_bug.cgi?id=14556 Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Alexander Bokovoy <ab@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-08-06libnetapi: Save lines with any_nt_status_not_ok()Volker Lendecke4-440/+90
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2021-07-14s3-libnetapi: add djoin toolGünther Deschner2-0/+167
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: implement NetRequestOfflineDomainJoin_lGünther Deschner1-1/+113
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add NetRequestOfflineDomainJoin example codeGünther Deschner2-0/+98
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add NetRequestOfflineDomainJoin to apiGünther Deschner1-0/+24
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add NetRequestOfflineDomainJoin() boilerplate.Günther Deschner3-0/+73
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: implement NetProvisionComputerAccount_lGünther Deschner1-2/+181
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add NetProvisionComputerAccount example codeGünther Deschner2-0/+123
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add NetProvisionComputerAccount to api.Günther Deschner1-0/+36
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add NetProvisionComputerAccount() boilerplateGünther Deschner3-0/+88
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add netapi_save_file_ucs2() to example codeGünther Deschner2-0/+59
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add netapi_read_file helperGünther Deschner2-0/+90
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add missing NetJoinFlags for netapiGünther Deschner1-0/+7
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add libnetapi_set_logfile()Günther Deschner3-0/+28
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>