netapi: add libnetapi_private_ctx and init function.
authorGünther Deschner <gd@samba.org>
Tue, 1 Jul 2008 18:14:36 +0000 (20:14 +0200)
committerGünther Deschner <gd@samba.org>
Fri, 18 Jul 2008 14:51:48 +0000 (16:51 +0200)
Guenther
(This used to be commit 45fff2d37ae21c76d100f66d9154f6add446f380)

source3/lib/netapi/netapi.c
source3/lib/netapi/netapi.h
source3/lib/netapi/netapi_private.h

index cf1be00849865c21daecf53ae79e7e6c3ec4ac2e..2cc636ffb7f570b94ec2859ac3559db1e1073b48 100644 (file)
@@ -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;
index f6345afe67c637db06aad0db52d8b121c431bb4b..3612fa82406911bb437202f3f13cf9e1a6096c6d 100644 (file)
@@ -191,6 +191,8 @@ struct libnetapi_ctx {
        char *password;
        char *krb5_cc_env;
        int use_kerberos;
+
+       void *private_data;
 };
 
 /****************************************************************
index 3ce078c2b64bff456bc57dcc69aa9ba080c79c82..c913fe789de565fb242ad0e5cfa2a0aa02fca219 100644 (file)
 #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, ...);