summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/netapi/netapi.c27
-rw-r--r--source3/lib/netapi/netapi.h10
2 files changed, 33 insertions, 4 deletions
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index 6d27b99d96..d5527dc4ff 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -130,7 +130,7 @@ NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx,
const char *debuglevel)
{
AllowDebugChange = true;
- ctx->debuglevel = debuglevel;
+ ctx->debuglevel = talloc_strdup(ctx, debuglevel);
if (!debug_parse_levels(debuglevel)) {
return W_ERROR_V(WERR_GENERAL_FAILURE);
}
@@ -141,7 +141,7 @@ NET_API_STATUS libnetapi_set_debuglevel(struct libnetapi_ctx *ctx,
****************************************************************/
NET_API_STATUS libnetapi_get_debuglevel(struct libnetapi_ctx *ctx,
- const char **debuglevel)
+ char **debuglevel)
{
*debuglevel = ctx->debuglevel;
return NET_API_STATUS_SUCCESS;
@@ -195,3 +195,26 @@ const char *libnetapi_errstr(struct libnetapi_ctx *ctx,
return get_friendly_werror_msg(W_ERROR(status));
}
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx,
+ const char *error_string)
+{
+ TALLOC_FREE(ctx->error_string);
+ ctx->error_string = talloc_strdup(ctx, error_string);
+ if (!ctx->error_string) {
+ return W_ERROR_V(WERR_NOMEM);
+ }
+ return NET_API_STATUS_SUCCESS;
+
+}
+
+/****************************************************************
+****************************************************************/
+
+const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx)
+{
+ return ctx->error_string;
+}
diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h
index 3c9d3b3853..46dd8e1a24 100644
--- a/source3/lib/netapi/netapi.h
+++ b/source3/lib/netapi/netapi.h
@@ -27,7 +27,8 @@
****************************************************************/
struct libnetapi_ctx {
- const char *debuglevel;
+ char *debuglevel;
+ char *error_string;
char *username;
char *workgroup;
char *password;
@@ -41,11 +42,16 @@ NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
NET_API_STATUS libnetapi_getctx(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_get_debuglevel(struct libnetapi_ctx *ctx, 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);
const char *libnetapi_errstr(struct libnetapi_ctx *ctx, NET_API_STATUS status);
+NET_API_STATUS libnetapi_set_error_string(struct libnetapi_ctx *ctx, const char *error_string);
+const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx);
+
+/****************************************************************
+****************************************************************/
/* wkssvc */
NET_API_STATUS NetJoinDomain(const char *server,