Ensure all callers to the rpc_client/cli_pipe functions correctly
authorJeremy Allison <jra@samba.org>
Thu, 12 Nov 2009 21:56:33 +0000 (13:56 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 12 Nov 2009 21:56:33 +0000 (13:56 -0800)
initialize return variables.
Jeremy.

13 files changed:
source3/auth/auth_netlogond.c
source3/client/client.c
source3/include/proto.h
source3/libsmb/libsmb_dir.c
source3/libsmb/libsmb_server.c
source3/libsmb/passchange.c
source3/libsmb/trusts_util.c
source3/rpc_client/cli_pipe.c
source3/utils/net_ads.c
source3/utils/net_rpc_shell.c
source3/utils/net_util.c
source3/utils/smbcacls.c
source3/utils/smbtree.c

index 8c930a552a95919c022e8f3e7782c7e778ddf9df..ebfed83d41ec3fb10d0b9fb156848039b99fa9c9 100644 (file)
@@ -31,8 +31,8 @@ static NTSTATUS netlogond_validate(TALLOC_CTX *mem_ctx,
                                   struct netr_SamInfo3 **pinfo3,
                                   NTSTATUS *schannel_bind_result)
 {
-       struct rpc_pipe_client *p;
-       struct cli_pipe_auth_data *auth;
+       struct rpc_pipe_client *p = NULL;
+       struct cli_pipe_auth_data *auth = NULL;
        struct netr_SamInfo3 *info3 = NULL;
        NTSTATUS status;
 
@@ -158,14 +158,14 @@ static NTSTATUS check_netlogond_security(const struct auth_context *auth_context
 {
        TALLOC_CTX *frame = talloc_stackframe();
        struct netr_SamInfo3 *info3 = NULL;
-       struct rpc_pipe_client *p;
-       struct cli_pipe_auth_data *auth;
+       struct rpc_pipe_client *p = NULL;
+       struct cli_pipe_auth_data *auth = NULL;
        uint32_t neg_flags = NETLOGON_NEG_AUTH2_ADS_FLAGS;
-       char *plaintext_machinepw;
+       char *plaintext_machinepw = NULL;
        uint8_t machine_password[16];
        uint8_t schannel_key[16];
        NTSTATUS schannel_bind_result, status;
-       struct named_mutex *mutex;
+       struct named_mutex *mutex = NULL;
        const char *ncalrpcsock;
 
        ncalrpcsock = lp_parm_const_string(
index 435ede904edaaf84371632fdbb29ade6cdcfd9b7..6a3e73c710ea01beb5a657599d6c27630d8c4b55 100644 (file)
@@ -3668,7 +3668,7 @@ static void browse_fn(const char *name, uint32 m,
 static bool browse_host_rpc(bool sort)
 {
        NTSTATUS status;
-       struct rpc_pipe_client *pipe_hnd;
+       struct rpc_pipe_client *pipe_hnd = NULL;
        TALLOC_CTX *frame = talloc_stackframe();
        WERROR werr;
        struct srvsvc_NetShareInfoCtr info_ctr;
index 2dc0c83e022f8ce1edae7dd457605730b589993e..0eb5815f64190529597f0c793b9d0ddfd0f8316e 100644 (file)
@@ -5287,23 +5287,10 @@ unsigned int rpccli_set_timeout(struct rpc_pipe_client *cli,
 bool rpccli_get_pwd_hash(struct rpc_pipe_client *cli, uint8_t nt_hash[16]);
 NTSTATUS rpccli_anon_bind_data(TALLOC_CTX *mem_ctx,
                               struct cli_pipe_auth_data **presult);
-NTSTATUS rpccli_ntlmssp_bind_data(TALLOC_CTX *mem_ctx,
-                                 enum pipe_auth_type auth_type,
-                                 enum dcerpc_AuthLevel auth_level,
-                                 const char *domain,
-                                 const char *username,
-                                 const char *password,
-                                 struct cli_pipe_auth_data **presult);
 NTSTATUS rpccli_schannel_bind_data(TALLOC_CTX *mem_ctx, const char *domain,
                                   enum dcerpc_AuthLevel auth_level,
                                   struct netlogon_creds_CredentialState *creds,
                                   struct cli_pipe_auth_data **presult);
-NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx,
-                                  enum dcerpc_AuthLevel auth_level,
-                                  const char *service_princ,
-                                  const char *username,
-                                  const char *password,
-                                  struct cli_pipe_auth_data **presult);
 NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
                           const struct ndr_syntax_id *abstract_syntax,
                           struct rpc_pipe_client **presult);
index 6a4613c3c3d772f697a3f20c5031c820cbc76385..73bbf82861e342692a930c478d99807dc845ee08 100644 (file)
@@ -267,7 +267,7 @@ net_share_enum_rpc(struct cli_state *cli,
        struct srvsvc_NetShareCtr1 ctr1;
        fstring name = "";
         fstring comment = "";
-       struct rpc_pipe_client *pipe_hnd;
+       struct rpc_pipe_client *pipe_hnd = NULL;
         NTSTATUS nt_status;
        uint32_t resume_handle = 0;
        uint32_t total_entries = 0;
index db9d6de40f1a198f402cdc59b2c9d5baaa2dbb17..a572acde96000e2c5a744c604bca80afe9a4c4c0 100644 (file)
@@ -713,8 +713,8 @@ SMBC_attr_server(TALLOC_CTX *ctx,
 {
         int flags;
         struct sockaddr_storage ss;
-       struct cli_state *ipc_cli;
-       struct rpc_pipe_client *pipe_hnd;
+       struct cli_state *ipc_cli = NULL;
+       struct rpc_pipe_client *pipe_hnd = NULL;
         NTSTATUS nt_status;
        SMBCSRV *srv=NULL;
        SMBCSRV *ipc_srv=NULL;
index 570a048502c0ca5fb12083859a8b67d961156fc2..e8c412be46b4d5fc25195519ce3a384ad0d148aa 100644 (file)
@@ -28,8 +28,8 @@ NTSTATUS remote_password_change(const char *remote_machine, const char *user_nam
                                char **err_str)
 {
        struct nmb_name calling, called;
-       struct cli_state *cli;
-       struct rpc_pipe_client *pipe_hnd;
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_hnd = NULL;
        struct sockaddr_storage ss;
        char *user, *domain, *p;
 
index 5dda3c52dde8abfcd7fca4023cd8a5d8b355c518..e127c9a67be4f613d7573d8ec8701668eab6b434 100644 (file)
@@ -142,7 +142,7 @@ bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
        struct sockaddr_storage dc_ss;
        uint32          enum_ctx = 0;
        struct cli_state *cli = NULL;
-       struct rpc_pipe_client *lsa_pipe;
+       struct rpc_pipe_client *lsa_pipe = NULL;
        bool            retry;
        struct lsa_DomainList dom_list;
        int i;
index deada5acb2764d82aed57e167dd682b6311daba7..da54fca85d3c2c7609e7b1b14813a4f416a5cc4b 100644 (file)
@@ -3093,7 +3093,7 @@ static int cli_auth_ntlmssp_data_destructor(struct cli_pipe_auth_data *auth)
        return 0;
 }
 
-NTSTATUS rpccli_ntlmssp_bind_data(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpccli_ntlmssp_bind_data(TALLOC_CTX *mem_ctx,
                                  enum pipe_auth_type auth_type,
                                  enum dcerpc_AuthLevel auth_level,
                                  const char *domain,
@@ -3213,7 +3213,7 @@ static int cli_auth_kerberos_data_destructor(struct kerberos_auth_struct *auth)
 }
 #endif
 
-NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx,
+static NTSTATUS rpccli_kerberos_bind_data(TALLOC_CTX *mem_ctx,
                                   enum dcerpc_AuthLevel auth_level,
                                   const char *service_princ,
                                   const char *username,
index 10873cacbd8aece6dab102f70bd09544ee1d5fb9..031a338835d6a4d065dba12a17a50219ef7cd578 100644 (file)
@@ -1626,8 +1626,8 @@ static int net_ads_printer_publish(struct net_context *c, int argc, const char *
         ADS_STRUCT *ads;
         ADS_STATUS rc;
        const char *servername, *printername;
-       struct cli_state *cli;
-       struct rpc_pipe_client *pipe_hnd;
+       struct cli_state *cli = NULL;
+       struct rpc_pipe_client *pipe_hnd = NULL;
        struct sockaddr_storage server_ss;
        NTSTATUS nt_status;
        TALLOC_CTX *mem_ctx = talloc_init("net_ads_printer_publish");
index 5e0f1503712f6a4660ef8f57932b376a216a559b..39ef1cedcd0a51cfd20adcc8f1a37654bd04c4eb 100644 (file)
@@ -69,7 +69,7 @@ static NTSTATUS net_sh_run(struct net_context *c,
                           int argc, const char **argv)
 {
        TALLOC_CTX *mem_ctx;
-       struct rpc_pipe_client *pipe_hnd;
+       struct rpc_pipe_client *pipe_hnd = NULL;
        NTSTATUS status;
 
        mem_ctx = talloc_new(ctx);
index d0d1fc042144bf3c1a5e497aeb156b456fcc4788..eaa2125e34f7a58242828d9861d1b9d6dfa70936 100644 (file)
@@ -28,7 +28,7 @@ NTSTATUS net_rpc_lookup_name(struct net_context *c,
                             const char **ret_name, DOM_SID *ret_sid,
                             enum lsa_SidType *ret_type)
 {
-       struct rpc_pipe_client *lsa_pipe;
+       struct rpc_pipe_client *lsa_pipe = NULL;
        struct policy_handle pol;
        NTSTATUS result = NT_STATUS_OK;
        const char **dom_names;
index dfc2a92031da0763b441d81e6665dd62b10b4106..eefe4fe77cef1aab800ef793836ed5ea0d1cb036 100644 (file)
@@ -70,7 +70,7 @@ static NTSTATUS cli_lsa_lookup_sid(struct cli_state *cli,
                                   char **domain, char **name)
 {
        uint16 orig_cnum = cli->cnum;
-       struct rpc_pipe_client *p;
+       struct rpc_pipe_client *p = NULL;
        struct policy_handle handle;
        NTSTATUS status;
        TALLOC_CTX *frame = talloc_stackframe();
index 02001f0abbdfce1dddfbce21346bd97dc3b214b2..717ce650068d0e1737e302432a35da8d6df1afb3 100644 (file)
@@ -148,7 +148,7 @@ static bool get_rpc_shares(struct cli_state *cli,
                           void *state)
 {
        NTSTATUS status;
-       struct rpc_pipe_client *pipe_hnd;
+       struct rpc_pipe_client *pipe_hnd = NULL;
        TALLOC_CTX *mem_ctx;
        WERROR werr;
        struct srvsvc_NetShareInfoCtr info_ctr;