summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/netapi/netapi.c33
-rw-r--r--source3/lib/netapi/netapi.h3
2 files changed, 36 insertions, 0 deletions
diff --git a/source3/lib/netapi/netapi.c b/source3/lib/netapi/netapi.c
index 898e62d6a5..38b44c769d 100644
--- a/source3/lib/netapi/netapi.c
+++ b/source3/lib/netapi/netapi.c
@@ -74,3 +74,36 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
TALLOC_FREE(ctx);
return W_ERROR_V(WERR_OK);
}
+
+NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx,
+ const char *username)
+{
+ TALLOC_FREE(ctx->username);
+ ctx->username = talloc_strdup(ctx, username);
+ if (!ctx->username) {
+ return W_ERROR_V(WERR_NOMEM);
+ }
+ return W_ERROR_V(WERR_OK);
+}
+
+NET_API_STATUS libnetapi_set_password(struct libnetapi_ctx *ctx,
+ const char *password)
+{
+ TALLOC_FREE(ctx->password);
+ ctx->password = talloc_strdup(ctx, password);
+ if (!ctx->password) {
+ return W_ERROR_V(WERR_NOMEM);
+ }
+ return W_ERROR_V(WERR_OK);
+}
+
+NET_API_STATUS libnetapi_set_workgroup(struct libnetapi_ctx *ctx,
+ const char *workgroup)
+{
+ TALLOC_FREE(ctx->workgroup);
+ ctx->workgroup = talloc_strdup(ctx, workgroup);
+ if (!ctx->workgroup) {
+ return W_ERROR_V(WERR_NOMEM);
+ }
+ return W_ERROR_V(WERR_OK);
+}
diff --git a/source3/lib/netapi/netapi.h b/source3/lib/netapi/netapi.h
index 3dfbc0cffb..d75299601f 100644
--- a/source3/lib/netapi/netapi.h
+++ b/source3/lib/netapi/netapi.h
@@ -31,6 +31,9 @@ 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_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);
#include "joindomain.h"