summaryrefslogtreecommitdiff
path: root/source3/lib/netapi/netapi.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-01-07 20:06:41 +0100
committerGünther Deschner <gd@samba.org>2008-01-07 20:13:18 +0100
commit751fc874bec2cbc93b4a84067f3e7102f39bd76c (patch)
tree635b420bb7432483e8cefe5c81f58ab7f46e5203 /source3/lib/netapi/netapi.c
parent1b3520db8836437b9d4d48fab4df69126c1d9b5d (diff)
downloadsamba-751fc874bec2cbc93b4a84067f3e7102f39bd76c.tar.gz
samba-751fc874bec2cbc93b4a84067f3e7102f39bd76c.tar.bz2
samba-751fc874bec2cbc93b4a84067f3e7102f39bd76c.zip
Add libnetapi_set_error_string and libnetapi_get_error_string.
Guenther (This used to be commit f8806bad8134d544229c426f58bee143ba752cf8)
Diffstat (limited to 'source3/lib/netapi/netapi.c')
-rw-r--r--source3/lib/netapi/netapi.c27
1 files changed, 25 insertions, 2 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;
+}