diff options
author | Günther Deschner <gd@samba.org> | 2007-12-18 02:34:07 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2007-12-21 15:29:10 +0100 |
commit | c9b44e0fc3750afb6e001baceffad8fa2f33ac4e (patch) | |
tree | 070b048da7ac4fe6e53a4cf6cc30e7ec03e98e57 | |
parent | 3d853b8e7e975a3e1c07a125e775e3a597112912 (diff) | |
download | samba-c9b44e0fc3750afb6e001baceffad8fa2f33ac4e.tar.gz samba-c9b44e0fc3750afb6e001baceffad8fa2f33ac4e.tar.bz2 samba-c9b44e0fc3750afb6e001baceffad8fa2f33ac4e.zip |
Add basic credential functions for libnetapi.
Guenther
(This used to be commit 7c38f706b5dc17f15708ac932c84d863a0cc713e)
-rw-r--r-- | source3/lib/netapi/netapi.c | 33 | ||||
-rw-r--r-- | source3/lib/netapi/netapi.h | 3 |
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" |