mirror of
https://github.com/samba-team/samba.git
synced 2025-12-21 20:23:50 +03:00
Add basic credential functions for libnetapi.
Guenther
This commit is contained in:
@@ -74,3 +74,36 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
|
|||||||
TALLOC_FREE(ctx);
|
TALLOC_FREE(ctx);
|
||||||
return W_ERROR_V(WERR_OK);
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ struct libnetapi_ctx {
|
|||||||
|
|
||||||
NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
|
NET_API_STATUS libnetapi_init(struct libnetapi_ctx **ctx);
|
||||||
NET_API_STATUS libnetapi_free(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"
|
#include "joindomain.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user