1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-28 01:58:17 +03:00

netapi: add libnetapi_private_ctx and init function.

Guenther
(This used to be commit 45fff2d37ae21c76d100f66d9154f6add446f380)
This commit is contained in:
Günther Deschner 2008-07-01 20:14:36 +02:00
parent f09df9b186
commit 3f0da66d5c
3 changed files with 48 additions and 0 deletions

View 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;

View File

@ -191,6 +191,8 @@ struct libnetapi_ctx {
char *password;
char *krb5_cc_env;
int use_kerberos;
void *private_data;
};
/****************************************************************

View File

@ -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, ...);