[SCM] Samba Shared Repository - branch master updated
Gary Lockyer
gary at samba.org
Wed Jul 24 05:50:03 UTC 2019
The branch, master has been updated
via 54af94ff21a s4/source4/common: clang: Fix 'Dereference of undefined pointer value'
via c7c40e205d4 s4/dsdb/common: clang: Fix 'Value stored to 'cps_stdin' is never read'
via 55f18757aae s4/dsdb/common: clang: Fix 'Access results in a deref of a null pointer'
via bd86df913b1 s4/dsdb/common: clang: Fix 'The left operand of '&' is a garbage value'
via 79d585689e2 s4/dsdb/common: clang: Fix 'function call argument is an uninitialized value'
via 6f733b5891d s4/auth/kerberos: clang: Fix Value stored to 'code' is never read
via 765fc314e4a s4/auth/kerberos: clang: Fix 'value stored to 'ret' is never read '
from 256684c7a86 join: Use a specific attribute order for the DsAddEntry nTDSDSA object
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 54af94ff21a7f395133bcc13458cc2e1f52183be
Author: Noel Power <noel.power at suse.com>
Date: Fri Jul 5 11:34:25 2019 +0000
s4/source4/common: clang: Fix 'Dereference of undefined pointer value'
Fixes:
source4/dsdb/common/util.c:3131:6: warning: Dereference of undefined pointer value <--[clang]
if (res->count < 1) {
^
/source4/dsdb/common/util.c:3207:6: warning: Dereference of undefined pointer value <--[clang]
if (res->count < 1) {
^~~~~~~~~~
source4/dsdb/common/util.c:4004:39: warning: Dereference of undefined pointer value <--[clang]
(*wkguid_dn) = talloc_steal(mem_ctx, res->msgs[0]->dn);
^
source4/dsdb/common/util.c:4191:35: warning: Dereference of undefined pointer value <--[clang]
ouv_value = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector");
source4/dsdb/common/util.c:5757:13: warning: 1st function call argument is an uninitialized value <--[clang]
same_nc = (ldb_dn_compare(source_nc, target_nc) == 0);
^
This fix also fixes the associated 'Access to field 'xyx' results in a
dereference of a null pointer' warnings that also will happen when this
is fixed
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
Autobuild-User(master): Gary Lockyer <gary at samba.org>
Autobuild-Date(master): Wed Jul 24 05:49:14 UTC 2019 on sn-devel-184
commit c7c40e205d432342457b20312f3ebf94e15b9ff6
Author: Noel Power <noel.power at suse.com>
Date: Fri Jul 5 11:16:45 2019 +0000
s4/dsdb/common: clang: Fix 'Value stored to 'cps_stdin' is never read'
Fixes:
source4/dsdb/common/util.c:2125:4: warning: Value stored to 'cps_stdin' is never read <--[clang]
cps_stdin = -1;
^ ~~
source4/dsdb/common/util.c:2132:3: warning: Value stored to 'cps_stdin' is never read <--[clang]
cps_stdin = -1;
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
commit 55f18757aae0f7fb137217e42ced6e2e08bfbfa2
Author: Noel Power <noel.power at suse.com>
Date: Fri Jul 5 11:07:07 2019 +0000
s4/dsdb/common: clang: Fix 'Access results in a deref of a null pointer'
Fixes:
source4/dsdb/common/util.c:2000:6: warning: Access to field 'count' results in a dereference of a null pointer (loaded from variable 'res') <--[clang]
if (res->count != 1) {
^~~
source4/dsdb/common/util.c:3281:28: warning: Access to field 'msgs' results in a dereference of a null pointer (loaded from variable 'res') <--[clang]
el = ldb_msg_find_element(res->msgs[0], attr);
^~~
source4/dsdb/common/util.c:3568:6: warning: Access to field 'count' results in a dereference of a null pointer (loaded from variable 'res') <--[clang]
if (res->count != 1 || ret != LDB_SUCCESS) {
^~~
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
commit bd86df913b14070e157b6a9178438f71321c8872
Author: Noel Power <noel.power at suse.com>
Date: Fri Jul 5 11:04:10 2019 +0000
s4/dsdb/common: clang: Fix 'The left operand of '&' is a garbage value'
Fixes:
source4/dsdb/common/util.c:1964:18: warning: The left operand of '&' is a garbage value <--[clang]
return (options & DS_NTDSDSA_OPT_IS_GC) != 0;
~~~~~~~ ^
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
commit 79d585689e206dc0e04a4d30f75a38dc4490d96b
Author: Noel Power <noel.power at suse.com>
Date: Fri Jul 5 10:42:54 2019 +0000
s4/dsdb/common: clang: Fix 'function call argument is an uninitialized value'
Fixes:
source4/dsdb/common/util.c:1804:8: warning: 3rd function call argument is an uninitialized value <--[clang]
ret = samdb_reference_dn(ldb, mem_ctx, server_ref_dn, "rIDSetReferences", dn);
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
commit 6f733b5891db344ec9f3f996322213d8ac2075e5
Author: Noel Power <noel.power at suse.com>
Date: Fri Jul 5 10:41:19 2019 +0000
s4/auth/kerberos: clang: Fix Value stored to 'code' is never read
Fixes:
source4/auth/kerberos/kerberos_util.c:645:3: warning: Value stored to 'code' is never read <--[clang]
code = 0;
^ ~
1 warning generated.
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
commit 765fc314e4aee455bae0f391a7d388584b48bb4a
Author: Noel Power <noel.power at suse.com>
Date: Fri Jul 5 10:24:53 2019 +0000
s4/auth/kerberos: clang: Fix 'value stored to 'ret' is never read '
Fixes:
source4/auth/kerberos/kerberos_pac.c:116:2: warning: Value stored to 'ret' is never read <--[clang]
ret = smb_krb5_make_pac_checksum(mem_ctx,
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
Signed-off-by: Noel Power <noel.power at suse.com>
Reviewed-by: Gary Lockyer <gary at catalyst.net.nz>
-----------------------------------------------------------------------
Summary of changes:
source4/auth/kerberos/kerberos_pac.c | 11 ++++--
source4/auth/kerberos/kerberos_util.c | 1 -
source4/dsdb/common/util.c | 64 ++++++++++++++++++++++++++++-------
3 files changed, 60 insertions(+), 16 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source4/auth/kerberos/kerberos_pac.c b/source4/auth/kerberos/kerberos_pac.c
index e45a846cd88..54ef4d61b02 100644
--- a/source4/auth/kerberos/kerberos_pac.c
+++ b/source4/auth/kerberos/kerberos_pac.c
@@ -120,6 +120,13 @@
&srv_checksum->type,
&srv_checksum->signature);
+ if (ret) {
+ DBG_WARNING("making krbtgt PAC srv_checksum failed: %s\n",
+ smb_get_krb5_error_message(context, ret, mem_ctx));
+ talloc_free(pac_data);
+ return ret;
+ }
+
/* Then sign Server checksum */
ret = smb_krb5_make_pac_checksum(mem_ctx,
&srv_checksum->signature,
@@ -128,8 +135,8 @@
&kdc_checksum->type,
&kdc_checksum->signature);
if (ret) {
- DEBUG(2, ("making krbtgt PAC checksum failed: %s\n",
- smb_get_krb5_error_message(context, ret, mem_ctx)));
+ DBG_WARNING("making krbtgt PAC kdc_checksum failed: %s\n",
+ smb_get_krb5_error_message(context, ret, mem_ctx));
talloc_free(pac_data);
return ret;
}
diff --git a/source4/auth/kerberos/kerberos_util.c b/source4/auth/kerberos/kerberos_util.c
index 50bf8feec96..bbb5c8791ca 100644
--- a/source4/auth/kerberos/kerberos_util.c
+++ b/source4/auth/kerberos/kerberos_util.c
@@ -642,7 +642,6 @@ krb5_error_code smb_krb5_remove_obsolete_keytab_entries(TALLOC_CTX *mem_ctx,
break;
case ENOENT:
case KRB5_KT_END:
- code = 0;
break;
default:
*error_string = talloc_asprintf(mem_ctx,
diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c
index e521ed09999..51d6b243347 100644
--- a/source4/dsdb/common/util.c
+++ b/source4/dsdb/common/util.c
@@ -1794,7 +1794,7 @@ int samdb_rid_manager_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, struct ld
*/
int samdb_rid_set_dn(struct ldb_context *ldb, TALLOC_CTX *mem_ctx, struct ldb_dn **dn)
{
- struct ldb_dn *server_ref_dn;
+ struct ldb_dn *server_ref_dn = NULL;
int ret;
ret = samdb_server_reference_dn(ldb, mem_ctx, &server_ref_dn);
@@ -1957,7 +1957,7 @@ bool samdb_is_pdc(struct ldb_context *ldb)
*/
bool samdb_is_gc(struct ldb_context *ldb)
{
- uint32_t options;
+ uint32_t options = 0;
if (samdb_ntds_options(ldb, &options) != LDB_SUCCESS) {
return false;
}
@@ -1997,6 +1997,11 @@ int samdb_search_for_parent_domain(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
talloc_free(local_ctx);
return ret;
}
+ /* should never be true with 'ret=LDB_SUCCESS', here to satisfy clang */
+ if (res == NULL) {
+ talloc_free(local_ctx);
+ return LDB_ERR_OTHER;
+ }
if (res->count != 1) {
*errstring = talloc_asprintf(mem_ctx, "Invalid dn (%s), not child of a domain object",
ldb_dn_get_linearized(dn));
@@ -2122,14 +2127,12 @@ enum samr_ValidationStatus samdb_check_password(TALLOC_CTX *mem_ctx,
if (write(cps_stdin, utf8_pw, utf8_len) != utf8_len) {
close(cps_stdin);
- cps_stdin = -1;
TALLOC_FREE(password_script);
TALLOC_FREE(event_ctx);
return SAMR_VALIDATION_STATUS_PASSWORD_FILTER_ERROR;
}
close(cps_stdin);
- cps_stdin = -1;
if (!tevent_req_poll(req, event_ctx)) {
TALLOC_FREE(password_script);
@@ -2847,7 +2850,7 @@ NTSTATUS samdb_create_foreign_security_principal(struct ldb_context *sam_ctx, TA
struct dom_sid *sid, struct ldb_dn **ret_dn)
{
struct ldb_message *msg;
- struct ldb_dn *basedn;
+ struct ldb_dn *basedn = NULL;
char *sidstr;
int ret;
@@ -3114,7 +3117,7 @@ int dsdb_find_guid_attr_by_dn(struct ldb_context *ldb,
struct GUID *guid)
{
int ret;
- struct ldb_result *res;
+ struct ldb_result *res = NULL;
const char *attrs[2];
TALLOC_CTX *tmp_ctx = talloc_new(ldb);
@@ -3128,6 +3131,11 @@ int dsdb_find_guid_attr_by_dn(struct ldb_context *ldb,
talloc_free(tmp_ctx);
return ret;
}
+ /* satisfy clang */
+ if (res == NULL) {
+ talloc_free(tmp_ctx);
+ return LDB_ERR_OTHER;
+ }
if (res->count < 1) {
talloc_free(tmp_ctx);
return ldb_error(ldb, LDB_ERR_NO_SUCH_OBJECT, __func__);
@@ -3190,7 +3198,7 @@ int dsdb_find_sid_by_dn(struct ldb_context *ldb,
struct ldb_dn *dn, struct dom_sid *sid)
{
int ret;
- struct ldb_result *res;
+ struct ldb_result *res = NULL;
const char *attrs[] = { "objectSid", NULL };
TALLOC_CTX *tmp_ctx = talloc_new(ldb);
struct dom_sid *s;
@@ -3204,6 +3212,10 @@ int dsdb_find_sid_by_dn(struct ldb_context *ldb,
talloc_free(tmp_ctx);
return ret;
}
+ if (res == NULL) {
+ talloc_free(tmp_ctx);
+ return LDB_ERR_OTHER;
+ }
if (res->count < 1) {
talloc_free(tmp_ctx);
return ldb_error(ldb, LDB_ERR_NO_SUCH_OBJECT, __func__);
@@ -3278,6 +3290,11 @@ WERROR dsdb_loadreps(struct ldb_context *sam_ctx, TALLOC_CTX *mem_ctx, struct ld
return WERR_DS_DRA_INTERNAL_ERROR;
}
+ /* satisfy clang */
+ if (res == NULL) {
+ talloc_free(tmp_ctx);
+ return WERR_DS_DRA_INTERNAL_ERROR;
+ }
el = ldb_msg_find_element(res->msgs[0], attr);
if (el == NULL) {
/* it's OK to be empty */
@@ -3571,6 +3588,11 @@ int samdb_dns_host_name(struct ldb_context *sam_ctx, const char **host_name)
TALLOC_FREE(tmp_ctx);
return ret;
}
+ /* satisfy clang */
+ if (res == NULL) {
+ TALLOC_FREE(tmp_ctx);
+ return LDB_ERR_OTHER;
+ }
_host_name = ldb_msg_find_attr_as_string(res->msgs[0],
@@ -3983,7 +4005,7 @@ int dsdb_wellknown_dn(struct ldb_context *samdb, TALLOC_CTX *mem_ctx,
const char *attrs[] = { NULL };
int ret;
struct ldb_dn *dn;
- struct ldb_result *res;
+ struct ldb_result *res = NULL;
/* construct the magic WKGUID DN */
dn = ldb_dn_new_fmt(tmp_ctx, samdb, "<WKGUID=%s,%s>",
@@ -4000,6 +4022,11 @@ int dsdb_wellknown_dn(struct ldb_context *samdb, TALLOC_CTX *mem_ctx,
talloc_free(tmp_ctx);
return ret;
}
+ /* fix clang warning */
+ if (res == NULL){
+ talloc_free(tmp_ctx);
+ return LDB_ERR_OTHER;
+ }
(*wkguid_dn) = talloc_steal(mem_ctx, res->msgs[0]->dn);
talloc_free(tmp_ctx);
@@ -4174,7 +4201,7 @@ int dsdb_load_udv_v2(struct ldb_context *samdb, struct ldb_dn *dn, TALLOC_CTX *m
struct drsuapi_DsReplicaCursor2 **cursors, uint32_t *count)
{
static const char *attrs[] = { "replUpToDateVector", NULL };
- struct ldb_result *r;
+ struct ldb_result *r = NULL;
const struct ldb_val *ouv_value;
unsigned int i;
int ret;
@@ -4187,7 +4214,10 @@ int dsdb_load_udv_v2(struct ldb_context *samdb, struct ldb_dn *dn, TALLOC_CTX *m
if (ret != LDB_SUCCESS) {
return ret;
}
-
+ /* fix clang warning */
+ if (r == NULL) {
+ return LDB_ERR_OTHER;
+ }
ouv_value = ldb_msg_find_ldb_val(r->msgs[0], "replUpToDateVector");
if (ouv_value) {
enum ndr_err_code ndr_err;
@@ -4260,7 +4290,7 @@ int dsdb_load_udv_v2(struct ldb_context *samdb, struct ldb_dn *dn, TALLOC_CTX *m
int dsdb_load_udv_v1(struct ldb_context *samdb, struct ldb_dn *dn, TALLOC_CTX *mem_ctx,
struct drsuapi_DsReplicaCursor **cursors, uint32_t *count)
{
- struct drsuapi_DsReplicaCursor2 *v2;
+ struct drsuapi_DsReplicaCursor2 *v2 = NULL;
uint32_t i;
int ret;
@@ -5731,14 +5761,18 @@ bool dsdb_objects_have_same_nc(struct ldb_context *ldb,
struct ldb_dn *target_dn)
{
TALLOC_CTX *tmp_ctx;
- struct ldb_dn *source_nc;
- struct ldb_dn *target_nc;
+ struct ldb_dn *source_nc = NULL;
+ struct ldb_dn *target_nc = NULL;
int ret;
bool same_nc = true;
tmp_ctx = talloc_new(mem_ctx);
ret = dsdb_find_nc_root(ldb, tmp_ctx, source_dn, &source_nc);
+ /* fix clang warning */
+ if (source_nc == NULL) {
+ ret = LDB_ERR_OTHER;
+ }
if (ret != LDB_SUCCESS) {
DBG_ERR("Failed to find base DN for source %s\n",
ldb_dn_get_linearized(source_dn));
@@ -5747,6 +5781,10 @@ bool dsdb_objects_have_same_nc(struct ldb_context *ldb,
}
ret = dsdb_find_nc_root(ldb, tmp_ctx, target_dn, &target_nc);
+ /* fix clang warning */
+ if (target_nc == NULL) {
+ ret = LDB_ERR_OTHER;
+ }
if (ret != LDB_SUCCESS) {
DBG_ERR("Failed to find base DN for target %s\n",
ldb_dn_get_linearized(target_dn));
--
Samba Shared Repository
More information about the samba-cvs
mailing list