[SCM] Samba Shared Repository - branch v3-5-test updated
Jeremy Allison
jra at samba.org
Thu Nov 12 15:11:01 MST 2009
The branch, v3-5-test has been updated
via 5c81851... Remove unused variable warning. Jeremy. (cherry picked from commit d2a9f4a2729026da11780ae4b71e289982094bd7)
via 421ceb5... Remove erroneous 'presult = NULL' changes. Now presult only gets set if NTSTATUS == OK. Jeremy. (cherry picked from commit 03637130316099d4f3db4ce757af2f34ce46d881)
via ca13c8c... Revert "Ensure every return path initializes presult as NULL." Vl is correct, this is the wrong way to fix this.
via 3e0add7... Ensure all callers to the rpc_client/cli_pipe functions correctly initialize return variables. Jeremy. (cherry picked from commit 5363d6e62c2d4d3275e78d04c48835524c54f620)
from 8702bdb... Fix bug 6891 - using windows explorer to change ownership on a folder fails with Bad File Descriptor. Jeremy. (cherry picked from commit 6747a91ca0c350374c54bac5892cf96e5aed029f)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test
- Log -----------------------------------------------------------------
commit 5c81851109021cc5e0733b3d153d3e2f18a16a41
Author: Jeremy Allison <jra at samba.org>
Date: Thu Nov 12 14:09:25 2009 -0800
Remove unused variable warning.
Jeremy.
(cherry picked from commit d2a9f4a2729026da11780ae4b71e289982094bd7)
commit 421ceb5070007924341b108e1a578b43b39fa058
Author: Jeremy Allison <jra at samba.org>
Date: Thu Nov 12 13:59:25 2009 -0800
Remove erroneous 'presult = NULL' changes. Now presult only gets set
if NTSTATUS == OK.
Jeremy.
(cherry picked from commit 03637130316099d4f3db4ce757af2f34ce46d881)
commit ca13c8cef238285c09ef5850a91ca1771a2a9685
Author: Jeremy Allison <jra at samba.org>
Date: Thu Nov 12 13:57:13 2009 -0800
Revert "Ensure every return path initializes presult as NULL."
Vl is correct, this is the wrong way to fix this.
This reverts commit 83c2c177a5e86d04da37384f1f04230c8274e1e6.
(cherry picked from commit 496d147dc4d50650ef1e88877aa28719458089b8)
commit 3e0add7c118cff14c3ed8f619920f4938e4795c3
Author: Jeremy Allison <jra at samba.org>
Date: Thu Nov 12 13:56:33 2009 -0800
Ensure all callers to the rpc_client/cli_pipe functions correctly
initialize return variables.
Jeremy.
(cherry picked from commit 5363d6e62c2d4d3275e78d04c48835524c54f620)
-----------------------------------------------------------------------
Summary of changes:
source3/auth/auth_netlogond.c | 12 ++++----
source3/client/client.c | 2 +-
source3/include/proto.h | 13 ---------
source3/libads/authdata.c | 1 -
source3/libsmb/libsmb_dir.c | 2 +-
source3/libsmb/libsmb_server.c | 4 +-
source3/libsmb/passchange.c | 4 +-
source3/libsmb/trusts_util.c | 2 +-
source3/rpc_client/cli_pipe.c | 55 +++-------------------------------------
source3/utils/net_ads.c | 4 +-
source3/utils/net_rpc_shell.c | 2 +-
source3/utils/net_util.c | 2 +-
source3/utils/smbcacls.c | 2 +-
source3/utils/smbtree.c | 2 +-
14 files changed, 23 insertions(+), 84 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/auth/auth_netlogond.c b/source3/auth/auth_netlogond.c
index 8c930a5..ebfed83 100644
--- a/source3/auth/auth_netlogond.c
+++ b/source3/auth/auth_netlogond.c
@@ -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(
diff --git a/source3/client/client.c b/source3/client/client.c
index 6b273b4..2e875a4 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -3690,7 +3690,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;
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 27f80db..9120e24 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5286,23 +5286,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);
diff --git a/source3/libads/authdata.c b/source3/libads/authdata.c
index f287b16..2471cca 100644
--- a/source3/libads/authdata.c
+++ b/source3/libads/authdata.c
@@ -399,7 +399,6 @@ NTSTATUS kerberos_return_pac(TALLOC_CTX *mem_ctx,
const char *auth_princ = NULL;
const char *local_service = NULL;
const char *cc = "MEMORY:kerberos_return_pac";
- krb5_creds *creds = NULL;
ZERO_STRUCT(tkt);
ZERO_STRUCT(ap_rep);
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index 6a4613c..73bbf82 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -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;
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index db9d6de..a572acd 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -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;
diff --git a/source3/libsmb/passchange.c b/source3/libsmb/passchange.c
index 570a048..e8c412b 100644
--- a/source3/libsmb/passchange.c
+++ b/source3/libsmb/passchange.c
@@ -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;
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 5dda3c5..e127c9a 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -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;
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index deada5a..084bbef 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -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;
@@ -3093,7 +3091,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,
@@ -3104,8 +3102,6 @@ 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;
@@ -3213,7 +3207,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,
@@ -3223,8 +3217,6 @@ 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 @@ 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;
@@ -3480,18 +3469,13 @@ NTSTATUS rpc_pipe_open_tcp(TALLOC_CTX *mem_ctx, const char *host,
NTSTATUS status;
uint16_t port = 0;
- *presult = NULL;
-
status = rpc_pipe_get_tcp_port(host, abstract_syntax, &port);
if (!NT_STATUS_IS_OK(status)) {
- goto done;
+ return status;
}
- status = rpc_pipe_open_tcp_port(mem_ctx, host, port,
+ return rpc_pipe_open_tcp_port(mem_ctx, host, port,
abstract_syntax, presult);
-
-done:
- return status;
}
/********************************************************************
@@ -3506,8 +3490,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 +3576,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 +3629,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 +3688,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 +3712,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 +3778,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 +3800,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 +3849,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 +3874,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 +3949,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 +3986,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 +4040,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 +4079,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)) {
@@ -4160,8 +4118,6 @@ NTSTATUS cli_rpc_pipe_open_schannel(struct cli_state *cli,
struct rpc_pipe_client *result = NULL;
NTSTATUS status;
- *presult = NULL;
-
status = get_schannel_session_key(cli, domain, &neg_flags,
&netlogon_pipe);
if (!NT_STATUS_IS_OK(status)) {
@@ -4204,8 +4160,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 +4185,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
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 10873ca..031a338 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -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");
diff --git a/source3/utils/net_rpc_shell.c b/source3/utils/net_rpc_shell.c
index 5e0f150..39ef1ce 100644
--- a/source3/utils/net_rpc_shell.c
+++ b/source3/utils/net_rpc_shell.c
@@ -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);
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index d0d1fc0..eaa2125 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -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;
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index dfc2a92..eefe4fe 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -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();
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c
index 02001f0..717ce65 100644
--- a/source3/utils/smbtree.c
+++ b/source3/utils/smbtree.c
@@ -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;
--
Samba Shared Repository
More information about the samba-cvs
mailing list