summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-12-18 02:43:22 +0100
committerGünther Deschner <gd@samba.org>2007-12-21 15:29:10 +0100
commitd14ee1dc08c5c765b07bd472e47e34152db2f9d3 (patch)
treecb9d4176c0b456b33a1f829b6b66fa47c0d73230
parentc9b44e0fc3750afb6e001baceffad8fa2f33ac4e (diff)
downloadsamba-d14ee1dc08c5c765b07bd472e47e34152db2f9d3.tar.gz
samba-d14ee1dc08c5c765b07bd472e47e34152db2f9d3.tar.bz2
samba-d14ee1dc08c5c765b07bd472e47e34152db2f9d3.zip
Use full string based debug_parse_levels in libnetapi.
Guenther (This used to be commit 78d8f0e41aa3db0060596a7b345c2f04261986e0)
-rw-r--r--source3/lib/netapi/netapi.c25
-rw-r--r--source3/lib/netapi/netapi.h4
2 files changed, 25 insertions, 4 deletions
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index 38b44c769d..454d766ae9 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -42,20 +42,21 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **context)
}
DEBUGLEVEL = 0;
- DEBUGLEVEL_CLASS[DBGC_ALL] = 0;
+ setup_logging("libnetapi", true);
+
dbf = x_stderr;
x_setbuf(x_stderr, NULL);
AllowDebugChange = false;
load_case_tables();
- setup_logging("libnetapi", true);
-
if (!lp_load(get_dyn_CONFIGFILE(), true, false, false, false)) {
TALLOC_FREE(frame);
return W_ERROR_V(WERR_GENERAL_FAILURE);
}
+ AllowDebugChange = true;
+
init_names();
load_interfaces();
reopen_logs();
@@ -75,6 +76,24 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
return W_ERROR_V(WERR_OK);
}
+NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx,
+ const char *debuglevel)
+{
+ AllowDebugChange = true;
+ ctx->debuglevel = debuglevel;
+ if (!debug_parse_levels(debuglevel)) {
+ return W_ERROR_V(WERR_GENERAL_FAILURE);
+ }
+ return W_ERROR_V(WERR_OK);
+}
+
+NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx,
+ const char **debuglevel)
+{
+ *debuglevel = ctx->debuglevel;
+ return W_ERROR_V(WERR_OK);
+}
+
NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx,
const char *username)
{
diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h
index d75299601f..278922224d 100644
--- a/source3/lib/netapi/netapi.h
+++ b/source3/lib/netapi/netapi.h
@@ -23,7 +23,7 @@
#define NET_API_STATUS uint32_t
struct libnetapi_ctx {
- int debuglevel;
+ const char *debuglevel;
char *username;
char *workgroup;
char *password;
@@ -31,6 +31,8 @@ struct libnetapi_ctx {
NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx);
+NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx, const char *debuglevel);
+NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx, const char **debuglevel);
NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx, const char *username);
NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx, const char *password);
NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx, const char *workgroup);