summaryrefslogtreecommitdiff
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
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)
-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,