1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-20 16:23:51 +03:00

Add basic credential functions for libnetapi.

Guenther
This commit is contained in:
Günther Deschner
2007-12-18 02:34:07 +01:00
parent 086c550059
commit 7c38f706b5
2 changed files with 36 additions and 0 deletions

View File

@@ -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);
}

View File

@@ -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"