summaryrefslogtreecommitdiffstats
path: root/source3/lib/netapi/netapi.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-12-18 02:47:01 +0100
committerGünther Deschner <gd@samba.org>2007-12-21 15:29:10 +0100
commitfb2c13fe191212f5e782b398fa4dffa42bfba129 (patch)
tree361567d3fe073b2a79a68d3238e044e5c0954ab2 /source3/lib/netapi/netapi.c
parentd14ee1dc08c5c765b07bd472e47e34152db2f9d3 (diff)
downloadsamba-fb2c13fe191212f5e782b398fa4dffa42bfba129.tar.gz
samba-fb2c13fe191212f5e782b398fa4dffa42bfba129.tar.xz
samba-fb2c13fe191212f5e782b398fa4dffa42bfba129.zip
Add static libnetapi_ctx.
Guenther (This used to be commit 97449ea341539a709953a57869570cf13be0f44e)
Diffstat (limited to 'source3/lib/netapi/netapi.c')
-rw-r--r--source3/lib/netapi/netapi.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index 454d766ae94..853ac55f8a9 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -22,14 +22,16 @@
extern bool AllowDebugChange;
+struct libnetapi_ctx *stat_ctx = NULL;
+TALLOC_CTX *frame = NULL;
static bool libnetapi_initialized = false;
NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context)
{
struct libnetapi_ctx *ctx = NULL;
- TALLOC_CTX *frame = NULL;
- if (libnetapi_initialized) {
+ if (stat_ctx && libnetapi_initialized) {
+ *context = stat_ctx;
return W_ERROR_V(WERR_OK);
}
@@ -65,14 +67,34 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context)
libnetapi_initialized = true;
- *context = ctx;
+ *context = stat_ctx = ctx;
return W_ERROR_V(WERR_OK);
}
+NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx)
+{
+ if (stat_ctx) {
+ *ctx = stat_ctx;
+ return W_ERROR_V(WERR_OK);
+ }
+
+ return libnetapi_init(ctx);
+}
+
NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
{
+ gfree_names();
+ gfree_loadparm();
+ gfree_case_tables();
+ gfree_charcnv();
+ gfree_interfaces();
+
TALLOC_FREE(ctx);
+ TALLOC_FREE(frame);
+
+ gfree_debugsyms();
+
return W_ERROR_V(WERR_OK);
}