Revert "Ensure every return path initializes presult as NULL."
authorJeremy Allison <jra@samba.org>
Thu, 12 Nov 2009 21:57:13 +0000 (13:57 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 12 Nov 2009 21:57:13 +0000 (13:57 -0800)
Vl is correct, this is the wrong way to fix this.

This reverts commit 83c2c177a5e86d04da37384f1f04230c8274e1e6.

source3/rpc_client/cli_pipe.c

index da54fca85d3c2c7609e7b1b14813a4f416a5cc4b..0e658a2da8de63dba7a1bcbc5de7cf7b0735116b 100644 (file)
@@ -3066,8 +3066,6 @@ NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
 {
        struct cli_pipe_auth_data *result;
 
-       *presult = NULL;
-
        result = talloc(mem_ctx, struct cli_pipe_auth_data);
        if (result == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -3104,8 +3102,6 @@ static NTSTATUS rpccli_ntlmssp_bind_data(TALLOC_CTX *mem_ctx,
        struct cli_pipe_auth_data *result;
        NTSTATUS status;
 
-       *presult = NULL;
-
        result = talloc(mem_ctx, struct cli_pipe_auth_data);
        if (result == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -3171,8 +3167,6 @@ NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
 {
        struct cli_pipe_auth_data *result;
 
-       *presult = NULL;
-
        result = talloc(mem_ctx, struct cli_pipe_auth_data);
        if (result == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -3223,8 +3217,6 @@ static NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx,
 #ifdef HAVE_KRB5
        struct cli_pipe_auth_data *result;
 
-       *presult = NULL;
-
        if ((username != NULL) && (password != NULL)) {
                int ret = kerberos_kinit_password(username, password, 0, NULL);
                if (ret != 0) {
@@ -3270,7 +3262,6 @@ static NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx,
        TALLOC_FREE(result);
        return NT_STATUS_NO_MEMORY;
 #else
-       *presult = NULL;
        return NT_STATUS_NOT_SUPPORTED;
 #endif
 }
@@ -3288,8 +3279,6 @@ static NTSTATUS rpc_pipe_open_tcp_port(TALLOC_CTX *mem_ctx, const char *host,
        NTSTATUS status;
        int fd;
 
-       *presult = NULL;
-
        result = TALLOC_ZERO_P(mem_ctx, struct rpc_pipe_client);
        if (result == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -3506,8 +3495,6 @@ NTSTATUS rpc_pipe_open_ncalrpc(TALLOC_CTX *mem_ctx, const char *socket_path,
        NTSTATUS status;
        int fd;
 
-       *presult = NULL;
-
        result = talloc_zero(mem_ctx, struct rpc_pipe_client);
        if (result == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -3594,8 +3581,6 @@ static NTSTATUS rpc_pipe_open_np(struct cli_state *cli,
        struct rpc_pipe_client *result;
        NTSTATUS status;
 
-       *presult = NULL;
-
        /* sanity check to protect against crashes */
 
        if ( !cli ) {
@@ -3649,8 +3634,6 @@ NTSTATUS rpc_pipe_open_local(TALLOC_CTX *mem_ctx,
        struct cli_pipe_auth_data *auth;
        NTSTATUS status;
 
-       *presult = NULL;
-
        result = talloc(mem_ctx, struct rpc_pipe_client);
        if (result == NULL) {
                return NT_STATUS_NO_MEMORY;
@@ -3710,8 +3693,6 @@ static NTSTATUS cli_rpc_pipe_open(struct cli_state *cli,
                                  const struct ndr_syntax_id *interface,
                                  struct rpc_pipe_client **presult)
 {
-       *presult = NULL;
-
        switch (transport) {
        case NCACN_IP_TCP:
                return rpc_pipe_open_tcp(NULL, cli->desthost, interface,
@@ -3736,8 +3717,6 @@ NTSTATUS cli_rpc_pipe_open_noauth_transport(struct cli_state *cli,
        struct cli_pipe_auth_data *auth;
        NTSTATUS status;
 
-       *presult = NULL;
-
        status = cli_rpc_pipe_open(cli, transport, interface, &result);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
@@ -3804,8 +3783,6 @@ NTSTATUS cli_rpc_pipe_open_noauth(struct cli_state *cli,
                                  const struct ndr_syntax_id *interface,
                                  struct rpc_pipe_client **presult)
 {
-       *presult = NULL;
-
        return cli_rpc_pipe_open_noauth_transport(cli, NCACN_NP,
                                                  interface, presult);
 }
@@ -3828,8 +3805,6 @@ static NTSTATUS cli_rpc_pipe_open_ntlmssp_internal(struct cli_state *cli,
        struct cli_pipe_auth_data *auth;
        NTSTATUS status;
 
-       *presult = NULL;
-
        status = cli_rpc_pipe_open(cli, transport, interface, &result);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
@@ -3879,8 +3854,6 @@ NTSTATUS cli_rpc_pipe_open_ntlmssp(struct cli_state *cli,
                                   const char *password,
                                   struct rpc_pipe_client **presult)
 {
-       *presult = NULL;
-
        return cli_rpc_pipe_open_ntlmssp_internal(cli,
                                                interface,
                                                transport,
@@ -3906,8 +3879,6 @@ NTSTATUS cli_rpc_pipe_open_spnego_ntlmssp(struct cli_state *cli,
                                          const char *password,
                                          struct rpc_pipe_client **presult)
 {
-       *presult = NULL;
-
        return cli_rpc_pipe_open_ntlmssp_internal(cli,
                                                interface,
                                                transport,
@@ -3983,8 +3954,6 @@ NTSTATUS get_schannel_session_key(struct cli_state *cli,
        struct rpc_pipe_client *netlogon_pipe = NULL;
        NTSTATUS status;
 
-       *presult = NULL;
-
        status = cli_rpc_pipe_open_noauth(cli, &ndr_table_netlogon.syntax_id,
                                          &netlogon_pipe);
        if (!NT_STATUS_IS_OK(status)) {
@@ -4022,8 +3991,6 @@ NTSTATUS cli_rpc_pipe_open_schannel_with_key(struct cli_state *cli,
        struct cli_pipe_auth_data *auth;
        NTSTATUS status;
 
-       *presult = NULL;
-
        status = cli_rpc_pipe_open(cli, transport, interface, &result);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
@@ -4078,8 +4045,6 @@ static NTSTATUS get_schannel_session_key_auth_ntlmssp(struct cli_state *cli,
        struct rpc_pipe_client *netlogon_pipe = NULL;
        NTSTATUS status;
 
-       *presult = NULL;
-
        status = cli_rpc_pipe_open_spnego_ntlmssp(
                cli, &ndr_table_netlogon.syntax_id, NCACN_NP,
                DCERPC_AUTH_LEVEL_PRIVACY,
@@ -4119,8 +4084,6 @@ NTSTATUS cli_rpc_pipe_open_ntlmssp_auth_schannel(struct cli_state *cli,
        struct rpc_pipe_client *result = NULL;
        NTSTATUS status;
 
-       *presult = NULL;
-
        status = get_schannel_session_key_auth_ntlmssp(
                cli, domain, username, password, &neg_flags, &netlogon_pipe);
        if (!NT_STATUS_IS_OK(status)) {
@@ -4204,8 +4167,6 @@ NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
        struct cli_pipe_auth_data *auth;
        NTSTATUS status;
 
-       *presult = NULL;
-
        status = cli_rpc_pipe_open(cli, NCACN_NP, interface, &result);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
@@ -4231,7 +4192,6 @@ NTSTATUS cli_rpc_pipe_open_krb5(struct cli_state *cli,
        *presult = result;
        return NT_STATUS_OK;
 #else
-       *presult = NULL;
        DEBUG(0,("cli_rpc_pipe_open_krb5: kerberos not found at compile time.\n"));
        return NT_STATUS_NOT_IMPLEMENTED;
 #endif