Add basic credential functions for libnetapi.
authorGünther Deschner <gd@samba.org>
Tue, 18 Dec 2007 01:34:07 +0000 (02:34 +0100)
committerGünther Deschner <gd@samba.org>
Fri, 21 Dec 2007 14:29:10 +0000 (15:29 +0100)
Guenther

source/lib/netapi/netapi.c
source/lib/netapi/netapi.h

index 898e62d6a5e1d722545545d49a7512cb271d659b..38b44c769dbccb146b396782ca1ce117dea35721 100644 (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);
+}
index 3dfbc0cffb8f01a0b4b7ae2f14b1372a82b7c9c9..d75299601f86ce66c00cbafc9cc02911492d7c92 100644 (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"