]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:netapi: Remove username from 'struct libnetapi_ctx'
authorAndreas Schneider <asn@samba.org>
Thu, 18 Mar 2021 10:36:37 +0000 (11:36 +0100)
committerGünther Deschner <gd@samba.org>
Wed, 24 Mar 2021 00:55:32 +0000 (00:55 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
source3/lib/netapi/netapi.c
source3/lib/netapi/netapi_private.h

index 21890ecfabc43a937fdb0748c760757568f72c28..8d5c8c85f5aff3f7254d8245bf5a1b57ad55c91b 100644 (file)
@@ -131,17 +131,6 @@ NET_API_STATUS libnetapi_net_init(struct libnetapi_ctx **context)
 
        cli_credentials_guess(ctx->creds, lp_ctx);
 
-       if (getenv("USER")) {
-               ctx->username = talloc_strdup(ctx, getenv("USER"));
-       } else {
-               ctx->username = talloc_strdup(ctx, "");
-       }
-       if (!ctx->username) {
-               TALLOC_FREE(frame);
-               fprintf(stderr, "libnetapi_init: out of memory\n");
-               return W_ERROR_V(WERR_NOT_ENOUGH_MEMORY);
-       }
-
        status = libnetapi_init_private_context(ctx);
        if (status != 0) {
                TALLOC_FREE(frame);
@@ -291,13 +280,6 @@ NET_API_STATUS libnetapi_set_username(struct libnetapi_ctx *ctx,
                return W_ERROR_V(WERR_INVALID_PARAMETER);
        }
 
-       TALLOC_FREE(ctx->username);
-       ctx->username = talloc_strdup(ctx, username ? username : "");
-
-       if (!ctx->username) {
-               return W_ERROR_V(WERR_NOT_ENOUGH_MEMORY);
-       }
-
        cli_credentials_parse_string(ctx->creds, username, CRED_SPECIFIED);
 
        return NET_API_STATUS_SUCCESS;
index ba2f8bb26510d4dc22dffb9a7894bed2d308452c..3a1f8c488469b7ed2b83c26a37068009a12601bc 100644 (file)
@@ -57,7 +57,6 @@ struct libnetapi_private_ctx {
 struct libnetapi_ctx {
        char *debuglevel;
        char *error_string;
-       char *username;
        char *workgroup;
        char *password;
        int use_kerberos;