diff options
author | Andreas Schneider <asn@samba.org> | 2021-03-18 13:34:15 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2021-03-24 02:07:20 +0000 |
commit | c871c224611296ee922a508129913aca93a38a16 (patch) | |
tree | f1eafdafc9e3604a5b4fc1f237ca13dab6a83515 /source3/lib/netapi | |
parent | 6968a325d9d5c9d68634b10d9ee080004865bcd8 (diff) | |
download | samba-c871c224611296ee922a508129913aca93a38a16.tar.gz |
s3:netapi: Add libnetapi_set_creds()
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
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r-- | source3/lib/netapi/netapi.c | 21 | ||||
-rw-r--r-- | source3/lib/netapi/netapi.h | 6 |
2 files changed, 27 insertions, 0 deletions
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index dfb11fdc951..a56651d100f 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -315,6 +315,27 @@ NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, return NET_API_STATUS_SUCCESS; } +/** + * @brief Set the cli_credentials to be used in the netapi context + * + * @param[in] ctx The netapi context + * + * @param[in] creds The cli_credentials which should be used by netapi. + * + * @return 0 on success, an werror code otherwise. + */ +NET_API_STATUS libnetapi_set_creds(struct libnetapi_ctx *ctx, + struct cli_credentials *creds) +{ + if (ctx == NULL || creds == NULL) { + return W_ERROR_V(WERR_INVALID_PARAMETER); + } + + ctx->creds = creds; + + return NET_API_STATUS_SUCCESS; +} + /**************************************************************** ****************************************************************/ diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index b0560e1af1d..af2e4aaf961 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -24,6 +24,8 @@ extern "C" { #endif /* __cplusplus */ +struct cli_credentials; + /**************************************************************** NET_API_STATUS ****************************************************************/ @@ -1394,6 +1396,10 @@ NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, /**************************************************************** ****************************************************************/ +NET_API_STATUS libnetapi_set_creds(struct libnetapi_ctx *ctx, + struct cli_credentials *creds); + + NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username); |