summaryrefslogtreecommitdiff
path: root/source3/lib/netapi/netapi.c
AgeCommit message (Collapse)AuthorFilesLines
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:lib/netapi: add libnetapi_get_creds()Stefan Metzmacher1-0/+23
Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@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 Kalugin1-12/+17
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 Cabrero1-8/+11
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 Cabrero1-9/+11
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>
2021-07-14s3-libnetapi: add libnetapi_set_logfile()Günther Deschner1-0/+19
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-07-14s3-libnetapi: add libnetapi_get_use_kerberos()Günther Deschner1-0/+18
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
2021-06-29s3:libnetapi: Check return code of cli_credentials_guess()Andreas Schneider1-1/+2
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-04-28auth:creds: Add obtained arg to cli_credentials_set_gensec_features()Andreas Schneider1-1/+3
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-04-28auth:creds: Add obtained arg to cli_credentials_set_kerberos_state()Andreas Schneider1-1/+2
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2021-03-24s3:netapi: Add libnetapi_set_creds()Andreas Schneider1-0/+21
This will be used by the 'net' command in future! Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Wed Mar 24 02:07:20 UTC 2021 on sn-devel-184
2021-03-24s3:netapi: Remove use_ccache from 'struct libnetapi_ctx'Andreas Schneider1-2/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-03-24s3:netapi: Remove use_kerberos from struct libnetapi_ctxAndreas Schneider1-2/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-03-24s3:netapi: Remove workgroup from 'struct libnetapi_ctx'Andreas Schneider1-6/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-03-24s3:netapi: Remove password from 'struct libnetapi_ctx'Andreas Schneider1-6/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-03-24s3:netapi: Remove username from 'struct libnetapi_ctx'Andreas Schneider1-18/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-03-24s3:netapi: Get username/password from cli_credentials in netapi.cAndreas Schneider1-2/+2
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-03-24s3:netapi: Fill also cli_credentials with netapi settersAndreas Schneider1-0/+39
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-03-24s3:netapi: Add a cli_credentials pointer to struct libnetapi_ctxAndreas Schneider1-0/+17
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-03-24s3:netapi: Remove unused ctx->krb5_cc_envAndreas Schneider1-7/+0
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-03-24s3:netapi: Implement public libnetapi_get_(username|password) functionsAndreas Schneider1-0/+46
Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
2021-03-16lib: Remove init_names()Volker Lendecke1-2/+0
is_myname() looks at lp_* directly, nmbd maintains its own list: We don't need the baroque loadparm handler anymore. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2017-09-16s3: Avoid netlogon_creds_cli.h in includes.hVolker Lendecke1-0/+1
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-07-26s3: clients: Use netlogon_creds_cli_close_global_db() in all normal exit paths.Jeremy Allison1-0/+2
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>
2016-09-28werror: replace WERR_INVALID_PARAM with WERR_INVALID_PARAMETER in ↵Günther Deschner1-1/+1
source3/lib/netapi/ Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-28werror: replace WERR_GENERAL_FAILURE with WERR_GEN_FAILURE in ↵Günther Deschner1-2/+2
source3/lib/netapi/ Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2016-09-28werror: replace WERR_NOMEM with WERR_NOT_ENOUGH_MEMORY in source3/lib/netapi/Günther Deschner1-8/+8
Guenther Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2015-03-24lib: Remove load_case_tables_library()Volker Lendecke1-3/+0
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
2012-07-18source3/netapi: fix only caller which doesn't set up a talloc_stackframe()Rusty Russell1-0/+4
libnetapi_free() needs a stackframe too; looked like Andrew and Günther missed this in a37de9a95974c138d264d9cb0c7829bb426bb2d6. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2011-10-26s3-netapi: remove pointless use_memory_krb5_ccache.Günther Deschner1-14/+0
This breaks the ABI. Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Wed Oct 26 13:23:58 CEST 2011 on sn-devel-104
2011-09-21s3-netapi: allow to use default krb5 credential cache for libnetapi users.Günther Deschner1-8/+17
Guenther
2011-07-28s3:libnetapi: use lp_load_global()Michael Adam1-1/+1
2011-06-09s3-talloc Change TALLOC_ZERO_P() to talloc_zero()Andrew Bartlett1-1/+1
Using the standard macro makes it easier to move code into common, as TALLOC_ZERO_P isn't standard talloc.
2011-05-20s3: Fix Coverity ID 2573: UNUSED_VALUEVolker Lendecke1-2/+3
Andrew B., please check!
2011-05-13s3-netapi Initialise global variables in libnetapiAndrew Bartlett1-1/+1
It is important to initalise the global variables when loading this configuration for the potentially first time. Andrew Bartlett
2011-05-13s3-libnetapi Don't create a talloc_stackframe() in a global variableAndrew Bartlett1-13/+31
This also ensures that libnetapi_free() invalidates the global stat_ctx variable, and changes the API so that the behaviour of the error string routines is to consistently return a allocated string. Pair-Programmed-With: Günther Deschner <gd@samba.org> Andrew Bartlett
2011-04-13s3-lib Move isvalid83_w to mangle_hash.cAndrew Bartlett1-1/+0
This means that there is no need for the 'valid.dat' table to be loaded by anything other than smbd, so the unloader is also removed. The concept of a 'valid dos character' has been replaced by the hash2 mangle method. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
2011-02-18lib/util/charset Add back setlocale(), but only when called from binariesAndrew Bartlett1-1/+1
When called from a library, we don't want to call this, as we may overwrite some of our calling program's context. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Fri Feb 18 09:29:35 CET 2011 on sn-devel-104
2010-11-24s3-libnetapi Load case tables earlierAndrew Bartlett1-2/+3
If we don't load the case tables as the 'first' thing we do, we will segfault on the first case insensitive string comparison. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Nov 24 09:21:05 CET 2010 on sn-devel-104
2010-11-24s3-libnetapi Add function header commentsAndrew Bartlett1-0/+3
Andrew Bartlett
2010-11-24s3-netapi Add libnetapi_net_init(), don't double-init common Samba subsystemsAndrew Bartlett1-12/+34
The issue here is that libnet and net were both trying to load the smb.conf files, the case tables and set the debug levels. The set of the debug levels caused problems, because it would force the level to 0, not (say) 10 as requested on the command line. This regression was apparently introduced in cf4de8ec2c8df2ceabbe3d836d296b058e7b19fb when eliminating AllowDebugChange. Andrew Bartlett
2010-11-02s3-debug Remove 'AllowDebugChange' and use lp_set_cmdline() insteadAndrew Bartlett1-11/+2
By removing this global variable, the API between the two different debug systems is made more similar. Both s3 and s4 now have lp_set_cmdline() which ensures that the smb.conf cannot overwrite these the user-specified log level. Andrew Bartlett
2010-11-02s3-debug Impove setup_logging() to specify logging to stderrAndrew Bartlett1-4/+1
This change improves the setup_logging() API so that callers which wish to set up logging to stderr can simply ask for it, rather than directly modify the dbf global variable. Andrew Bartlett
2010-08-26s3-build: only include krb5 environment variables where required.Günther Deschner1-0/+1
Guenther
2010-08-05s3-secrets: only include secrets.h when needed.Günther Deschner1-0/+1
Guenther
2010-01-24s3: add libnetapi_set_use_ccache()Volker Lendecke1-0/+6
2009-07-15Remove gencache_init/shutdownVolker Lendecke1-1/+0
gencache_get/set/del/iterate call gencache_init() internally anyway. And we've been very lazy calling gencache_shutdown, so this seems not really required.
2009-06-29Fix bug 6514: net gives unhelpful "lp_load failed" when it's missing smb.confDavid Markey1-1/+1