diff options
author | Günther Deschner <gd@samba.org> | 2008-07-01 20:14:36 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-07-18 16:51:48 +0200 |
commit | 3f0da66d5cae7efb600080c054ab52ed5b5a650f (patch) | |
tree | a468607fe188920818968852190e13d27cf69f91 /source3/lib/netapi | |
parent | f09df9b1869b7d95d7399b13b79ecf1f14b02f07 (diff) | |
download | samba-3f0da66d5cae7efb600080c054ab52ed5b5a650f.tar.gz samba-3f0da66d5cae7efb600080c054ab52ed5b5a650f.tar.bz2 samba-3f0da66d5cae7efb600080c054ab52ed5b5a650f.zip |
netapi: add libnetapi_private_ctx and init function.
Guenther
(This used to be commit 45fff2d37ae21c76d100f66d9154f6add446f380)
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r-- | source3/lib/netapi/netapi.c | 28 | ||||
-rw-r--r-- | source3/lib/netapi/netapi.h | 2 | ||||
-rw-r--r-- | source3/lib/netapi/netapi_private.h | 18 |
3 files changed, 48 insertions, 0 deletions
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c index cf1be00849..2cc636ffb7 100644 --- a/source3/lib/netapi/netapi.c +++ b/source3/lib/netapi/netapi.c @@ -30,8 +30,30 @@ static bool libnetapi_initialized = false; /**************************************************************** ****************************************************************/ +static NET_API_STATUS libnetapi_init_private_context(struct libnetapi_ctx *ctx) +{ + struct libnetapi_private_ctx *priv; + + if (!ctx) { + return W_ERROR_V(WERR_INVALID_PARAM); + } + + priv = TALLOC_ZERO_P(ctx, struct libnetapi_private_ctx); + if (!priv) { + return W_ERROR_V(WERR_NOMEM); + } + + ctx->private_data = priv; + + return NET_API_STATUS_SUCCESS; +} + +/**************************************************************** +****************************************************************/ + NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) { + NET_API_STATUS status; struct libnetapi_ctx *ctx = NULL; char *krb5_cc_env = NULL; @@ -96,6 +118,12 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context) return W_ERROR_V(WERR_NOMEM); } + status = libnetapi_init_private_context(ctx); + if (status != 0) { + TALLOC_FREE(frame); + return status; + } + libnetapi_initialized = true; *context = stat_ctx = ctx; diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h index f6345afe67..3612fa8240 100644 --- a/source3/lib/netapi/netapi.h +++ b/source3/lib/netapi/netapi.h @@ -191,6 +191,8 @@ struct libnetapi_ctx { char *password; char *krb5_cc_env; int use_kerberos; + + void *private_data; }; /**************************************************************** diff --git a/source3/lib/netapi/netapi_private.h b/source3/lib/netapi/netapi_private.h index 3ce078c2b6..c913fe789d 100644 --- a/source3/lib/netapi/netapi_private.h +++ b/source3/lib/netapi/netapi_private.h @@ -20,6 +20,24 @@ #ifndef __LIB_NETAPI_PRIVATE_H__ #define __LIB_NETAPI_PRIVATE_H__ +struct libnetapi_private_ctx { + struct { + const char *domain_name; + struct dom_sid *domain_sid; + struct rpc_pipe_client *cli; + + uint32_t connect_mask; + struct policy_handle connect_handle; + + uint32_t domain_mask; + struct policy_handle domain_handle; + + uint32_t builtin_mask; + struct policy_handle builtin_handle; + } samr; + +}; + NET_API_STATUS libnetapi_get_password(struct libnetapi_ctx *ctx, char **password); NET_API_STATUS libnetapi_get_username(struct libnetapi_ctx *ctx, char **username); NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *format, ...); |