diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/netapi/netapi_private.h | 4 | ||||
-rw-r--r-- | source3/lib/netapi/samr.c | 48 |
2 files changed, 52 insertions, 0 deletions
diff --git a/source3/lib/netapi/netapi_private.h b/source3/lib/netapi/netapi_private.h index c913fe789d..cb08ed0394 100644 --- a/source3/lib/netapi/netapi_private.h +++ b/source3/lib/netapi/netapi_private.h @@ -64,5 +64,9 @@ WERROR libnetapi_samr_open_builtin_domain(TALLOC_CTX *mem_ctx, uint32_t builtin_mask, struct policy_handle *connect_handle, struct policy_handle *builtin_handle); +void libnetapi_samr_close_domain_handle(struct libnetapi_ctx *ctx, + struct policy_handle *handle); +void libnetapi_samr_close_connect_handle(struct libnetapi_ctx *ctx, + struct policy_handle *handle); #endif diff --git a/source3/lib/netapi/samr.c b/source3/lib/netapi/samr.c index 2346f7f956..5df50fe85b 100644 --- a/source3/lib/netapi/samr.c +++ b/source3/lib/netapi/samr.c @@ -143,3 +143,51 @@ WERROR libnetapi_samr_open_builtin_domain(TALLOC_CTX *mem_ctx, done: return werr; } + +/**************************************************************** +****************************************************************/ + +void libnetapi_samr_close_domain_handle(struct libnetapi_ctx *ctx, + struct policy_handle *handle) +{ + struct libnetapi_private_ctx *priv; + + if (!is_valid_policy_hnd(handle)) { + return; + } + + priv = talloc_get_type_abort(ctx->private_data, + struct libnetapi_private_ctx); + + if (!policy_hnd_equal(handle, &priv->samr.domain_handle)) { + return; + } + + rpccli_samr_Close(priv->samr.cli, ctx, handle); + + ZERO_STRUCT(priv->samr.domain_handle); +} + +/**************************************************************** +****************************************************************/ + +void libnetapi_samr_close_connect_handle(struct libnetapi_ctx *ctx, + struct policy_handle *handle) +{ + struct libnetapi_private_ctx *priv; + + if (!is_valid_policy_hnd(handle)) { + return; + } + + priv = talloc_get_type_abort(ctx->private_data, + struct libnetapi_private_ctx); + + if (!policy_hnd_equal(handle, &priv->samr.connect_handle)) { + return; + } + + rpccli_samr_Close(priv->samr.cli, ctx, handle); + + ZERO_STRUCT(priv->samr.connect_handle); +} |