[SCM] Samba Shared Repository - branch master updated
Günther Deschner
gd at samba.org
Fri Dec 21 07:39:03 MST 2012
The branch, master has been updated
via b1548fd s3-prefork: Directly fail if tevent_req_is_unix_error() fails.
via 93d2847 s3-libsmb: Remove check if array is NULL.
via 56eb4ab s3-rpc_server: Fix username and remote check.
via bc3edaa s4-libcli: Use a do-while loop.
via 9c273d5 s3-lib: Cleanup transfer_file_internal() a bit.
via e4649da libgpo: Make it clear that we want to fall trough here.
via 53f5443 s4-dsdb: Make it clear that we want to fall trough here.
via ce25c48 s3-rpc_server: Make it clear we want to fall trough here.
via 3f899da s3-lib: Make it clear that we want to fall trough here.
via 96de3e7 s3-netapi: Add missing break in NetUserSetInfo_r().
via f7d8aa7 s3-libsmb: Fix a possible null pointer dereference.
via fd6041a2 s3-rpc_server: Fix null pointer derefs in rpc_pipe_open_interface().
via 6168d95 s3-winbind: Fix null pointer dereference in store_memory_creds().
via 9631e5b s3-vfs: Fix a null pointer deferference in vfs_media_harmony.
via 72e02c7 s3-rpc_server: Fix a possible null pointer dereference.
via f0454ff s3-vfs: Fix typo in readonly_connect().
via 3bf3ab4 libcli: Fix smb2cli_ioctl_send() if clause.
via f8a5abf libwbclient: Fix null check in process_domain_info_string().
via b26a9ea s3-rpc_server: Fix useless check if we still have a valid string.
via d0e2099 s3-libads: Fix copy&paste error in ads_keytab_add_entry().
via 3bd8c7d s3-lib: Fix push_ucs2() for-loop.
via 7f8c8d8 s3-tldap: Fix dead code in tldap_sasl_bind_send().
via 7937a6a s4-librpc: Remove dead code in smb_send_request().
via 568bade krb5_wrap: Remove dead code in smb_krb5_renew_ticket().
via 24a897f nsswitch: Fix wbclient BAIL macros.
via 9981b85 libcli: Check schannel state return value of tdb_transaction_commit().
via e41f0cc s3-utils: Check return value of secrets_init().
via 15c0594 s3-net: Check return values of push_reg_sz().
via 5b1d950 param: Correctly create directory and create common function.
via 426bcdb librpc: Check return codes of ndr functions.
via 4d02e86 ndr: Check return code of ndr_pull_advance().
via e3eaeb9 s4-libnet: Checkr return codes in samsync_ldb_handle_domain().
via 3000fc2 s3-nmbd: Check if we created the directories correctly.
via 6fd4724 s3-eventlog: Make sure the eventlog directory exists.
via ae6947c s4-regsitry: Check return value of ldb_msg_add_empty().
via a3bbf1b s3-winbind: Check if we created the directories correctly.
via e136b95 s4-lib: Use directory_create_or_exist() to create messaging dir.
via 3dda917 s3-smbd: Check return code of SMB_VFS_{L}STAT.
via 8631a90 s4-client: Check return codes in do_connect().
from a444bb9 tdb: Add a comment explaining the "check"
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit b1548fd944578d845c5aaf88a528cf5a60df0c62
Author: Andreas Schneider <asn at samba.org>
Date: Thu Dec 13 14:18:02 2012 +0100
s3-prefork: Directly fail if tevent_req_is_unix_error() fails.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
Autobuild-User(master): Günther Deschner <gd at samba.org>
Autobuild-Date(master): Fri Dec 21 15:38:19 CET 2012 on sn-devel-104
commit 93d2847bf4cc5d2fcdc95677d1cb1c515adc621c
Author: Andreas Schneider <asn at samba.org>
Date: Wed Dec 19 14:10:05 2012 +0100
s3-libsmb: Remove check if array is NULL.
rdata is an array with data. rdlength defines how big rdata is. So if
rdlength is not set we have a big problem.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 56eb4ab5f6280aa40c0e0edefad7f965b3f02a4a
Author: Andreas Schneider <asn at samba.org>
Date: Wed Dec 19 11:20:50 2012 +0100
s3-rpc_server: Fix username and remote check.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit bc3edaa6ad1a511075a97eab0bbb19a26b2288d2
Author: Andreas Schneider <asn at samba.org>
Date: Wed Dec 19 10:37:08 2012 +0100
s4-libcli: Use a do-while loop.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 9c273d5ca1810da8cf03a2af78b3fa5cbaaf2df7
Author: Andreas Schneider <asn at samba.org>
Date: Tue Dec 18 17:21:14 2012 +0100
s3-lib: Cleanup transfer_file_internal() a bit.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit e4649da0c72c3ec37c8a6a3920308f3ebcb1473e
Author: Andreas Schneider <asn at samba.org>
Date: Tue Dec 18 16:41:37 2012 +0100
libgpo: Make it clear that we want to fall trough here.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 53f54432831ba1c369beaed7d4ca95749eb2ee39
Author: Andreas Schneider <asn at samba.org>
Date: Tue Dec 18 16:39:40 2012 +0100
s4-dsdb: Make it clear that we want to fall trough here.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit ce25c484c12ce295820d64da0069ddcf45190825
Author: Andreas Schneider <asn at samba.org>
Date: Tue Dec 18 16:36:07 2012 +0100
s3-rpc_server: Make it clear we want to fall trough here.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 3f899daa9e32372daaed7729633a3325576f174a
Author: Andreas Schneider <asn at samba.org>
Date: Tue Dec 18 16:33:14 2012 +0100
s3-lib: Make it clear that we want to fall trough here.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 96de3e7364c6ca3c9184a1f920cf210565f4e78f
Author: Andreas Schneider <asn at samba.org>
Date: Tue Dec 18 16:31:36 2012 +0100
s3-netapi: Add missing break in NetUserSetInfo_r().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit f7d8aa79ff508dec519c493fcdcaa908cdc86670
Author: Andreas Schneider <asn at samba.org>
Date: Tue Dec 18 16:06:19 2012 +0100
s3-libsmb: Fix a possible null pointer dereference.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit fd6041a22065613de6746d0058ac1ae42b84b3b7
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 17:46:34 2012 +0100
s3-rpc_server: Fix null pointer derefs in rpc_pipe_open_interface().
Found by Coverity and asn ;)
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 6168d95817ebcde746f6cf8fa4da937fff7d80b3
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 17:18:14 2012 +0100
s3-winbind: Fix null pointer dereference in store_memory_creds().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 9631e5b1e490349dd59f0772ecba11be9f2ba963
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 15:36:32 2012 +0100
s3-vfs: Fix a null pointer deferference in vfs_media_harmony.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 72e02c73b64f1ff56b2d53ec63d68486a4f1ff90
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 15:31:21 2012 +0100
s3-rpc_server: Fix a possible null pointer dereference.
This variable can be set to NULL in an earlier function call.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit f0454ffb69d93daafd350e6021f953586c5374bd
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 15:21:10 2012 +0100
s3-vfs: Fix typo in readonly_connect().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 3bf3ab4f648f48c703d491ba2a883a1895960dbd
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 15:17:45 2012 +0100
libcli: Fix smb2cli_ioctl_send() if clause.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit f8a5abf960f40673a5113cc6820a68eb01662d3e
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 14:17:59 2012 +0100
libwbclient: Fix null check in process_domain_info_string().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit b26a9eae1648ecfa9912aa8ce81e0f0ea674ca53
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 14:40:17 2012 +0100
s3-rpc_server: Fix useless check if we still have a valid string.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit d0e20998a232b793d3e5db7dff70c84d11d2c527
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 14:33:45 2012 +0100
s3-libads: Fix copy&paste error in ads_keytab_add_entry().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 3bd8c7dec60a26743e889df61c862516eb5bdcc3
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 14:25:31 2012 +0100
s3-lib: Fix push_ucs2() for-loop.
ret is a bool and size is what we are looking for here, else the
statement can never be true.
Jeremy please check!
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 7f8c8d80ef6553dc28f0bf6d9aa7a2c46ab55529
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 14:21:01 2012 +0100
s3-tldap: Fix dead code in tldap_sasl_bind_send().
dn can't be NULL cause it is set to "" in that case.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 7937a6afcbe38af271894364a44abd55207ba83b
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 14:08:59 2012 +0100
s4-librpc: Remove dead code in smb_send_request().
If trigger_read we return earlier.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 568bade612f1969ed92e9fe4d04088b08545ad8b
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 14:03:50 2012 +0100
krb5_wrap: Remove dead code in smb_krb5_renew_ticket().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 24a897f029dd92a6341ef29e99291c01be928650
Author: Andreas Schneider <asn at samba.org>
Date: Mon Dec 17 10:39:10 2012 +0100
nsswitch: Fix wbclient BAIL macros.
In the code you normally use:
BAIL_ON_WBC_ERROR;
but the last ; is statement never reached, so dead code.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 9981b857a5cfba3d55e25541afcfe1fda1bc4338
Author: Andreas Schneider <asn at samba.org>
Date: Fri Dec 14 18:21:26 2012 +0100
libcli: Check schannel state return value of tdb_transaction_commit().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit e41f0ccdd280f18e3b4f72f1f20cd768c4572427
Author: Andreas Schneider <asn at samba.org>
Date: Fri Dec 14 18:14:34 2012 +0100
s3-utils: Check return value of secrets_init().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 15c0594feeed89b66d869bbfaf75f9af38269c33
Author: Andreas Schneider <asn at samba.org>
Date: Fri Dec 14 18:07:10 2012 +0100
s3-net: Check return values of push_reg_sz().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 5b1d95046c8ea624419d94dd7d9e2785ba86f556
Author: Andreas Schneider <asn at samba.org>
Date: Fri Dec 14 17:54:13 2012 +0100
param: Correctly create directory and create common function.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 426bcdb37c05bd5b6ceae34a03b9dbabbf6e9727
Author: Andreas Schneider <asn at samba.org>
Date: Fri Dec 14 17:43:36 2012 +0100
librpc: Check return codes of ndr functions.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 4d02e868f6ad35a408d011e888fba5618bd0c6d9
Author: Andreas Schneider <asn at samba.org>
Date: Fri Dec 14 17:09:34 2012 +0100
ndr: Check return code of ndr_pull_advance().
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit e3eaeb942b0a0eaee810c1d5f719854745e0dc4c
Author: Andreas Schneider <asn at samba.org>
Date: Fri Dec 14 17:02:48 2012 +0100
s4-libnet: Checkr return codes in samsync_ldb_handle_domain().
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 3000fc29c373f7fcc59f4de443f209f377dbd4f6
Author: Andreas Schneider <asn at samba.org>
Date: Thu Dec 13 18:16:34 2012 +0100
s3-nmbd: Check if we created the directories correctly.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 6fd4724fb95cda3adfee37b6bde7e526e423083d
Author: Andreas Schneider <asn at samba.org>
Date: Thu Dec 13 17:50:55 2012 +0100
s3-eventlog: Make sure the eventlog directory exists.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit ae6947cc48d032ad8af76f8a9e3dbae6a074d10e
Author: Andreas Schneider <asn at samba.org>
Date: Thu Dec 13 17:48:45 2012 +0100
s4-regsitry: Check return value of ldb_msg_add_empty().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit a3bbf1bf3460034028516c1c0fced01db0cecd0c
Author: Andreas Schneider <asn at samba.org>
Date: Thu Dec 13 17:29:39 2012 +0100
s3-winbind: Check if we created the directories correctly.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit e136b95af82e200dfc28dd3e48e05c210862f906
Author: Andreas Schneider <asn at samba.org>
Date: Thu Dec 13 16:10:38 2012 +0100
s4-lib: Use directory_create_or_exist() to create messaging dir.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 3dda9177708df4d3f2451d23a186b03a856aba87
Author: Andreas Schneider <asn at samba.org>
Date: Thu Dec 13 14:26:40 2012 +0100
s3-smbd: Check return code of SMB_VFS_{L}STAT.
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
commit 8631a9090bd22f5ce3036dd596a213dd9d8a67c4
Author: Andreas Schneider <asn at samba.org>
Date: Thu Dec 13 14:11:29 2012 +0100
s4-client: Check return codes in do_connect().
Found by Coverity.
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Günther Deschner <gd at samba.org>
-----------------------------------------------------------------------
Summary of changes:
lib/krb5_wrap/krb5_samba.c | 9 +--
lib/param/util.c | 96 +++++++++++---------------
libcli/auth/schannel_state_tdb.c | 6 ++-
libcli/smb/smb2cli_ioctl.c | 2 +-
libgpo/gpo_sec.c | 2 +
librpc/ndr/ndr_string.c | 2 +-
librpc/rpc/binding.c | 11 +++-
nsswitch/libwbclient/wbc_err_internal.h | 4 +-
nsswitch/libwbclient/wbc_util.c | 5 --
source3/lib/charcnv.c | 4 +-
source3/lib/eventlog/eventlog.c | 7 ++-
source3/lib/netapi/user.c | 1 +
source3/lib/server_prefork.c | 4 +-
source3/lib/sysacls.c | 2 +
source3/lib/tldap.c | 2 +-
source3/lib/util_transfer_file.c | 8 ++-
source3/libads/kerberos_keytab.c | 2 +-
source3/libsmb/libsmb_server.c | 2 +-
source3/libsmb/nmblib.c | 3 +-
source3/modules/vfs_media_harmony.c | 4 +-
source3/modules/vfs_readonly.c | 2 +-
source3/nmbd/nmbd.c | 15 +++-
source3/rpc_server/rpc_ncacn_np.c | 12 ++--
source3/rpc_server/rpc_server.c | 1 +
source3/rpc_server/spoolss/srv_spoolss_nt.c | 3 +-
source3/rpc_server/svcctl/srv_svcctl_reg.c | 6 +-
source3/rpc_server/wkssvc/srv_wkssvc_nt.c | 4 +-
source3/smbd/reply.c | 9 ++-
source3/utils/net_rpc_printer.c | 26 ++++++-
source3/utils/smbpasswd.c | 7 ++-
source3/winbindd/winbindd.c | 15 +++-
source3/winbindd/winbindd_cred_cache.c | 8 +-
source4/client/client.c | 20 +++++-
source4/dsdb/samdb/cracknames.c | 1 +
source4/lib/messaging/messaging.c | 7 ++-
source4/lib/registry/ldb.c | 8 ++-
source4/libcli/clireadwrite.c | 6 +-
source4/libnet/libnet_samsync_ldb.c | 18 ++++-
source4/librpc/rpc/dcerpc_smb.c | 4 -
39 files changed, 217 insertions(+), 131 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/krb5_wrap/krb5_samba.c b/lib/krb5_wrap/krb5_samba.c
index f04f6e1..ffb3f8d 100644
--- a/lib/krb5_wrap/krb5_samba.c
+++ b/lib/krb5_wrap/krb5_samba.c
@@ -816,7 +816,7 @@ done:
krb5_context context = NULL;
krb5_ccache ccache = NULL;
krb5_principal client = NULL;
- krb5_creds creds, creds_in, *creds_out = NULL;
+ krb5_creds creds, creds_in;
ZERO_STRUCT(creds);
ZERO_STRUCT(creds_in);
@@ -876,12 +876,7 @@ done:
done:
krb5_free_cred_contents(context, &creds_in);
-
- if (creds_out) {
- krb5_free_creds(context, creds_out);
- } else {
- krb5_free_cred_contents(context, &creds);
- }
+ krb5_free_cred_contents(context, &creds);
if (client) {
krb5_free_principal(context, client);
diff --git a/lib/param/util.c b/lib/param/util.c
index 98894fc..2569e7b 100644
--- a/lib/param/util.c
+++ b/lib/param/util.c
@@ -71,14 +71,13 @@ bool lpcfg_is_myname(struct loadparm_context *lp_ctx, const char *name)
return false;
}
-
-/**
- A useful function for returning a path in the Samba lock directory.
-**/
-char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
- const char *name)
+static char *lpcfg_common_path(TALLOC_CTX* mem_ctx,
+ struct loadparm_context *lp_ctx,
+ const char *name)
{
char *fname, *dname;
+ bool ok;
+
if (name == NULL) {
return NULL;
}
@@ -87,47 +86,44 @@ char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
}
dname = talloc_strdup(mem_ctx, lpcfg_lockdir(lp_ctx));
+ if (dname == NULL) {
+ return NULL;
+ }
trim_string(dname,"","/");
-
- if (!directory_exist(dname)) {
- if (!mkdir(dname,0755))
- DEBUG(1, ("Unable to create directory %s for file %s. "
- "Error was %s\n", dname, name, strerror(errno)));
+
+ ok = directory_create_or_exist(dname, geteuid(), 0755);
+ if (!ok) {
+ DEBUG(1, ("Unable to create directory %s for file %s. "
+ "Error was %s\n", dname, name, strerror(errno)));
+ return NULL;
}
-
- fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name);
+ fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name);
+ if (fname == NULL) {
+ return dname;
+ }
talloc_free(dname);
return fname;
}
+
+/**
+ A useful function for returning a path in the Samba lock directory.
+**/
+char *lpcfg_lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
+ const char *name)
+{
+ return lpcfg_common_path(mem_ctx, lp_ctx, name);
+}
+
/**
A useful function for returning a path in the Samba state directory.
**/
char *lpcfg_state_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
const char *name)
{
- char *fname, *dname;
- if (name == NULL) {
- return NULL;
- }
- if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) {
- return talloc_strdup(mem_ctx, name);
- }
-
- dname = talloc_strdup(mem_ctx, lpcfg_statedir(lp_ctx));
- trim_string(dname,"","/");
-
- if (!directory_exist(dname)) {
- mkdir(dname,0755);
- }
-
- fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name);
-
- talloc_free(dname);
-
- return fname;
+ return lpcfg_common_path(mem_ctx, lp_ctx, name);
}
/**
@@ -136,26 +132,7 @@ char *lpcfg_state_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
char *lpcfg_cache_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
const char *name)
{
- char *fname, *dname;
- if (name == NULL) {
- return NULL;
- }
- if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) {
- return talloc_strdup(mem_ctx, name);
- }
-
- dname = talloc_strdup(mem_ctx, lpcfg_cachedir(lp_ctx));
- trim_string(dname,"","/");
-
- if (!directory_exist(dname)) {
- mkdir(dname,0755);
- }
-
- fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name);
-
- talloc_free(dname);
-
- return fname;
+ return lpcfg_common_path(mem_ctx, lp_ctx, name);
}
/**
@@ -222,10 +199,16 @@ char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
const char *name)
{
char *fname, *dname;
+ bool ok;
dname = lpcfg_private_path(mem_ctx, lp_ctx, "smbd.tmp");
- if (!directory_exist(dname)) {
- mkdir(dname,0755);
+ if (dname == NULL) {
+ return NULL;
+ }
+
+ ok = directory_create_or_exist(dname, geteuid(), 0755);
+ if (!ok) {
+ return NULL;
}
if (name == NULL) {
@@ -233,6 +216,9 @@ char *smbd_tmp_path(TALLOC_CTX *mem_ctx,
}
fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name);
+ if (fname == NULL) {
+ return dname;
+ }
talloc_free(dname);
return fname;
diff --git a/libcli/auth/schannel_state_tdb.c b/libcli/auth/schannel_state_tdb.c
index 6abb69b..bc91104 100644
--- a/libcli/auth/schannel_state_tdb.c
+++ b/libcli/auth/schannel_state_tdb.c
@@ -328,7 +328,11 @@ NTSTATUS schannel_check_creds_state(TALLOC_CTX *mem_ctx,
goto done;
}
- tdb_transaction_commit(tdb_sc->tdb);
+ ret = tdb_transaction_commit(tdb_sc->tdb);
+ if (ret != 0) {
+ status = NT_STATUS_INTERNAL_DB_CORRUPTION;
+ goto done;
+ }
if (creds_out) {
*creds_out = talloc_steal(mem_ctx, creds);
diff --git a/libcli/smb/smb2cli_ioctl.c b/libcli/smb/smb2cli_ioctl.c
index dd1788f..ced9ee6 100644
--- a/libcli/smb/smb2cli_ioctl.c
+++ b/libcli/smb/smb2cli_ioctl.c
@@ -77,6 +77,7 @@ struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
if (in_output_buffer) {
output_buffer_offset = SMB2_HDR_BODY+0x38;
+ output_buffer_length = in_output_buffer->length;
if (input_buffer_length > 0 && output_buffer_length > 0) {
uint32_t tmp;
output_buffer_offset += input_buffer_length;
@@ -84,7 +85,6 @@ struct tevent_req *smb2cli_ioctl_send(TALLOC_CTX *mem_ctx,
output_buffer_offset = NDR_ROUND(output_buffer_offset, 8);
pad_length = output_buffer_offset - tmp;
}
- output_buffer_length = in_output_buffer->length;
}
fixed = state->fixed;
diff --git a/libgpo/gpo_sec.c b/libgpo/gpo_sec.c
index 456a218..af73697 100644
--- a/libgpo/gpo_sec.c
+++ b/libgpo/gpo_sec.c
@@ -47,11 +47,13 @@ static bool gpo_sd_check_agp_object_guid(const struct security_ace_object *objec
&ext_right_apg_guid)) {
return true;
}
+ /* FALL TROUGH */
case SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT:
if (GUID_equal(&object->inherited_type.inherited_type,
&ext_right_apg_guid)) {
return true;
}
+ /* FALL TROUGH */
default:
break;
}
diff --git a/librpc/ndr/ndr_string.c b/librpc/ndr/ndr_string.c
index 94a18c3..2229b2e 100644
--- a/librpc/ndr/ndr_string.c
+++ b/librpc/ndr/ndr_string.c
@@ -559,7 +559,7 @@ _PUBLIC_ enum ndr_err_code ndr_check_string_terminator(struct ndr_pull *ndr, uin
uint32_t save_offset;
save_offset = ndr->offset;
- ndr_pull_advance(ndr, (count - 1) * element_size);
+ NDR_CHECK(ndr_pull_advance(ndr, (count - 1) * element_size));
NDR_PULL_NEED_BYTES(ndr, element_size);
for (i = 0; i < element_size; i++) {
diff --git a/librpc/rpc/binding.c b/librpc/rpc/binding.c
index f7fbbbc..ce59349 100644
--- a/librpc/rpc/binding.c
+++ b/librpc/rpc/binding.c
@@ -424,12 +424,19 @@ _PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(const struct epm_floor *epm_floor,
static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax)
{
DATA_BLOB blob;
+ enum ndr_err_code ndr_err;
struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx);
ndr->flags |= LIBNDR_FLAG_NOALIGN;
- ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
- ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
+ ndr_err = ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return data_blob_null;
+ }
+ ndr_err = ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ return data_blob_null;
+ }
blob = ndr_push_blob(ndr);
talloc_steal(mem_ctx, blob.data);
diff --git a/nsswitch/libwbclient/wbc_err_internal.h b/nsswitch/libwbclient/wbc_err_internal.h
index 83364b8..dd8e7f2 100644
--- a/nsswitch/libwbclient/wbc_err_internal.h
+++ b/nsswitch/libwbclient/wbc_err_internal.h
@@ -29,7 +29,7 @@
if (!WBC_ERROR_IS_OK(x)) { \
goto done; \
} \
- } while(0);
+ } while(0)
#define BAIL_ON_PTR_ERROR(x, status) \
do { \
@@ -39,7 +39,7 @@
} else { \
status = WBC_ERR_SUCCESS; \
} \
- } while (0);
+ } while (0)
#endif /* _WBC_ERR_INTERNAL_H */
diff --git a/nsswitch/libwbclient/wbc_util.c b/nsswitch/libwbclient/wbc_util.c
index af134ba..4060e25 100644
--- a/nsswitch/libwbclient/wbc_util.c
+++ b/nsswitch/libwbclient/wbc_util.c
@@ -466,12 +466,7 @@ static wbcErr process_domain_info_string(struct wbcDomainInfo *info,
}
/* Online/Offline status */
-
r = s;
- if (r == NULL) {
- wbc_status = WBC_ERR_INVALID_RESPONSE;
- BAIL_ON_WBC_ERROR(wbc_status);
- }
if ( strcmp(r, "Offline") == 0) {
info->domain_flags |= WBC_DOMINFO_DOMAIN_OFFLINE;
}
diff --git a/source3/lib/charcnv.c b/source3/lib/charcnv.c
index 1fa2c5c..407a209 100644
--- a/source3/lib/charcnv.c
+++ b/source3/lib/charcnv.c
@@ -286,10 +286,10 @@ static size_t push_ucs2(const void *base_ptr, void *dest, const char *src, size_
smb_ucs2_t *dest_ucs2 = (smb_ucs2_t *)dest;
size_t i;
- /* We check for i < (ret / 2) below as the dest string isn't null
+ /* We check for i < (size / 2) below as the dest string isn't null
terminated if STR_TERMINATE isn't set. */
- for (i = 0; i < (ret / 2) && i < (dest_len / 2) && dest_ucs2[i]; i++) {
+ for (i = 0; i < (size / 2) && i < (dest_len / 2) && dest_ucs2[i]; i++) {
smb_ucs2_t v = toupper_w(dest_ucs2[i]);
if (v != dest_ucs2[i]) {
dest_ucs2[i] = v;
diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c
index 67583b8..0cc0240 100644
--- a/source3/lib/eventlog/eventlog.c
+++ b/source3/lib/eventlog/eventlog.c
@@ -340,6 +340,7 @@ ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only )
ELOG_TDB *tdb_node = NULL;
char *eventlogdir;
TALLOC_CTX *ctx = talloc_tos();
+ bool ok;
/* check for invalid options */
@@ -372,8 +373,10 @@ ELOG_TDB *elog_open_tdb( const char *logname, bool force_clear, bool read_only )
/* make sure that the eventlog dir exists */
eventlogdir = state_path( "eventlog" );
- if ( !directory_exist( eventlogdir ) )
- mkdir( eventlogdir, 0755 );
+ ok = directory_create_or_exist(eventlogdir, geteuid(), 0755);
+ if (!ok) {
+ return NULL;
+ }
/* get the path on disk */
diff --git a/source3/lib/netapi/user.c b/source3/lib/netapi/user.c
index dfcbb09..df3914c 100644
--- a/source3/lib/netapi/user.c
+++ b/source3/lib/netapi/user.c
@@ -1888,6 +1888,7 @@ WERROR NetUserSetInfo_r(struct libnetapi_ctx *ctx,
case 1012:
case 1024:
user_mask = SAMR_USER_ACCESS_SET_LOC_COM;
+ break;
case 1051:
user_mask = SAMR_USER_ACCESS_SET_ATTRIBUTES |
SAMR_USER_ACCESS_GET_GROUPS;
diff --git a/source3/lib/server_prefork.c b/source3/lib/server_prefork.c
index 3d35e1c..49d1778 100644
--- a/source3/lib/server_prefork.c
+++ b/source3/lib/server_prefork.c
@@ -666,7 +666,9 @@ int prefork_listen_recv(struct tevent_req *req,
if (state->error) {
ret = state->error;
} else {
- tevent_req_is_unix_error(req, &ret);
+ if (!tevent_req_is_unix_error(req, &ret)) {
+ ret = 0;
+ }
}
if (ret) {
diff --git a/source3/lib/sysacls.c b/source3/lib/sysacls.c
index b63e682..6e1ac21 100644
--- a/source3/lib/sysacls.c
+++ b/source3/lib/sysacls.c
@@ -186,6 +186,7 @@ char *sys_acl_to_text(const struct smb_acl_t *acl_d, ssize_t *len_p)
case SMB_ACL_USER:
id = uidtoname(ap->info.user.uid);
+ /* FALL TROUGH */
case SMB_ACL_USER_OBJ:
tag = "user";
break;
@@ -198,6 +199,7 @@ char *sys_acl_to_text(const struct smb_acl_t *acl_d, ssize_t *len_p)
} else {
id = gr->gr_name;
}
+ /* FALL TROUGH */
case SMB_ACL_GROUP_OBJ:
tag = "group";
break;
diff --git a/source3/lib/tldap.c b/source3/lib/tldap.c
index 8b04d00..765580f 100644
--- a/source3/lib/tldap.c
+++ b/source3/lib/tldap.c
@@ -817,7 +817,7 @@ struct tevent_req *tldap_sasl_bind_send(TALLOC_CTX *mem_ctx,
asn1_push_tag(state->out, TLDAP_REQ_BIND);
asn1_write_Integer(state->out, ld->ld_version);
- asn1_write_OctetString(state->out, dn, (dn != NULL) ? strlen(dn) : 0);
+ asn1_write_OctetString(state->out, dn, strlen(dn));
if (mechanism == NULL) {
asn1_push_tag(state->out, ASN1_CONTEXT_SIMPLE(0));
diff --git a/source3/lib/util_transfer_file.c b/source3/lib/util_transfer_file.c
index 37a7d6e..00a2c9d 100644
--- a/source3/lib/util_transfer_file.c
+++ b/source3/lib/util_transfer_file.c
@@ -45,11 +45,15 @@ ssize_t transfer_file_internal(void *in_file,
size_t num_to_read_thistime;
size_t num_written = 0;
+ if (n == 0) {
+ return 0;
+ }
+
if ((buf = SMB_MALLOC_ARRAY(char, TRANSFER_BUF_SIZE)) == NULL) {
return -1;
}
- while (total < n) {
+ do {
num_to_read_thistime = MIN((n - total), TRANSFER_BUF_SIZE);
read_ret = (*read_fn)(in_file, buf, num_to_read_thistime);
@@ -84,7 +88,7 @@ ssize_t transfer_file_internal(void *in_file,
}
total += (size_t)read_ret;
- }
+ } while (total < n);
SAFE_FREE(buf);
return (ssize_t)total;
diff --git a/source3/libads/kerberos_keytab.c b/source3/libads/kerberos_keytab.c
index b7df50d..83df088 100644
--- a/source3/libads/kerberos_keytab.c
+++ b/source3/libads/kerberos_keytab.c
@@ -370,7 +370,7 @@ int ads_keytab_add_entry(ADS_STRUCT *ads, const char *srvPrinc)
short_princ_s = talloc_asprintf(tmpctx, "%s/%s@%s",
srvPrinc, machine_name,
lp_realm());
- if (!princ_s) {
+ if (short_princ_s == NULL) {
ret = -1;
goto out;
}
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 99aa74c..858622f 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -273,7 +273,7 @@ SMBC_server_internal(TALLOC_CTX *ctx,
* server...
*/
if (srv &&
- *share != '\0' &&
+ share != NULL && *share != '\0' &&
smbc_getOptionOneSharePerServer(context)) {
/*
diff --git a/source3/libsmb/nmblib.c b/source3/libsmb/nmblib.c
index a6816db..4adc3da 100644
--- a/source3/libsmb/nmblib.c
+++ b/source3/libsmb/nmblib.c
@@ -68,8 +68,9 @@ static void debug_nmb_res_rec(struct res_rec *res, const char *hdr)
res->rr_class,
res->ttl ) );
- if( res->rdlength == 0 || res->rdata == NULL )
+ if (res->rdlength == 0) {
return;
+ }
for (i = 0; i < res->rdlength; i+= MAX_NETBIOSNAME_LEN) {
DEBUGADD(4, (" %s %3x char ", hdr, i));
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index bdbb750..79b165c 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -1490,7 +1490,9 @@ static int mh_fstat(vfs_handle_struct *handle,
out:
DEBUG(MH_INFO_DEBUG, ("Leaving with fsp->fsp_name->st.st_ex_mtime "
"%s",
- ctime(&(fsp->fsp_name->st.st_ex_mtime.tv_sec))));
+ fsp->fsp_name != NULL ?
+ ctime(&(fsp->fsp_name->st.st_ex_mtime.tv_sec)) :
+ "0"));
return status;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list