From 751fc874bec2cbc93b4a84067f3e7102f39bd76c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 7 Jan 2008 20:06:41 +0100 Subject: Add libnetapi_set_error_string and libnetapi_get_error_string. Guenther (This used to be commit f8806bad8134d544229c426f58bee143ba752cf8) --- source3/lib/netapi/netapi.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'source3/lib/netapi/netapi.c') 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; +} -- cgit