From 1c754022d6bb542075c44f3910dea12d94a3a072 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 May 2019 16:27:57 +0200 Subject: [PATCH 01/10] s4:auth: Fix debug statement in gensec_gssapi The 'role' is set to null, we should first set it to the correct value before printing anything. Found by GCC 9. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13937 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit bd29f3fcc023d00afde8e9cc2f9db22dcae49877) --- source4/auth/gensec/gensec_gssapi.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c index a61b2b2659c..4577c91c93a 100644 --- a/source4/auth/gensec/gensec_gssapi.c +++ b/source4/auth/gensec/gensec_gssapi.c @@ -703,11 +703,7 @@ init_sec_context_done: OM_uint32 lifetime = 0; gss_cred_usage_t usage; const char *role = NULL; - DEBUG(0, ("GSS %s Update(krb5)(%d) Update failed, credentials expired during GSSAPI handshake!\n", - role, - gensec_gssapi_state->gss_exchange_count)); - switch (gensec_security->gensec_role) { case GENSEC_CLIENT: creds = gensec_gssapi_state->client_cred->creds; @@ -719,6 +715,11 @@ init_sec_context_done: break; } + DBG_ERR("GSS %s Update(krb5)(%d) failed, credentials " + "expired during GSSAPI handshake!\n", + role, + gensec_gssapi_state->gss_exchange_count); + maj_stat = gss_inquire_cred(&min_stat, creds, &name, &lifetime, &usage, NULL); -- 2.21.0 From 0b8ffb9db3f723f12982fd550c9eb3aa3f78afc3 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 May 2019 16:31:10 +0200 Subject: [PATCH 02/10] s3:rpc_server: Do not free the tdbname before we printed it Found by GCC 9. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13937 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit 790d7e34cbe4e190d6acdd24696efe53944cd4a6) --- source3/rpc_server/eventlog/srv_eventlog_nt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/rpc_server/eventlog/srv_eventlog_nt.c b/source3/rpc_server/eventlog/srv_eventlog_nt.c index ce27dd530e1..5093125a6f6 100644 --- a/source3/rpc_server/eventlog/srv_eventlog_nt.c +++ b/source3/rpc_server/eventlog/srv_eventlog_nt.c @@ -95,13 +95,13 @@ static bool elog_check_access( EVENTLOG_INFO *info, const struct security_token tdbname, SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL, &sec_desc); - TALLOC_FREE( tdbname ); - if (!NT_STATUS_IS_OK(status)) { DEBUG(5,("elog_check_access: Unable to get NT ACL for %s: %s\n", tdbname, nt_errstr(status))); + TALLOC_FREE(tdbname); return False; } + TALLOC_FREE(tdbname); ace = talloc_zero(sec_desc, struct security_ace); if (ace == NULL) { -- 2.21.0 From a22dc6d259669139ae3fa2a1da9785f97dff95fa Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 May 2019 16:32:45 +0200 Subject: [PATCH 03/10] s4:ntvfs: Do not free eadb before we printed an error Found by GCC 9. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13937 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit 6da032df5450ef72f8608a19b3b5cc6e9185cd6e) --- source4/ntvfs/posix/vfs_posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c index 4133723c50a..20b5fba59a8 100644 --- a/source4/ntvfs/posix/vfs_posix.c +++ b/source4/ntvfs/posix/vfs_posix.c @@ -123,7 +123,6 @@ static void pvfs_setup_options(struct pvfs_state *pvfs) pvfs, eadb, 50000, lpcfg_tdb_flags(pvfs->ntvfs->ctx->lp_ctx, TDB_DEFAULT), O_RDWR|O_CREAT, 0600); - TALLOC_FREE(eadb); if (pvfs->ea_db != NULL) { pvfs->flags |= PVFS_FLAG_XATTR_ENABLE; } else { @@ -131,6 +130,7 @@ static void pvfs_setup_options(struct pvfs_state *pvfs) eadb, strerror(errno))); pvfs->flags &= ~PVFS_FLAG_XATTR_ENABLE; } + TALLOC_FREE(eadb); } if (pvfs->flags & PVFS_FLAG_XATTR_ENABLE) { -- 2.21.0 From 763d2ca4421680279ea2926e8cca7d7669e03906 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 May 2019 16:51:20 +0200 Subject: [PATCH 04/10] s4:torture: Do not print NULL strings we just checked before Found by GCC 9. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13937 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit be72dfbc8edc53ed191dc01668a53cafb5cd785d) --- source4/torture/rpc/drsuapi_cracknames.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c index c03f6bd1ca9..33917832069 100644 --- a/source4/torture/rpc/drsuapi_cracknames.c +++ b/source4/torture/rpc/drsuapi_cracknames.c @@ -213,13 +213,13 @@ static bool test_DsCrackNamesMatrix(struct torture_context *tctx, } else if (n_matrix[i][j] == NULL && formats[j] == DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL) { } else if (n_matrix[i][j] == NULL && n_from[j] != NULL) { err_msg = talloc_asprintf(mem_ctx, - "dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s", - formats[i], formats[j], n_matrix[i][j], n_from[j]); + "dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: should be %s", + formats[i], formats[j], n_from[j]); torture_fail(tctx, err_msg); } else if (n_matrix[i][j] != NULL && n_from[j] == NULL) { err_msg = talloc_asprintf(mem_ctx, - "dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s", - formats[i], formats[j], n_matrix[i][j], n_from[j]); + "dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: should be %s", + formats[i], formats[j], n_matrix[i][j]); torture_fail(tctx, err_msg); } else if (strcmp(n_matrix[i][j], n_from[j]) != 0) { err_msg = talloc_asprintf(mem_ctx, -- 2.21.0 From 6f1b8490ac32148e3c0d96a92f0f3c0810cc8571 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 May 2019 16:54:30 +0200 Subject: [PATCH 05/10] lib:torture: Fix string comparison macros where we directly pass NULL See e.g. lib/util/tests/strlist.c +177 Found by GCC 9. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13937 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit a8f773e326d6bdfc1c9eb87a74c00108f6620c56) --- lib/torture/torture.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/torture/torture.h b/lib/torture/torture.h index c0fbdb9081d..9af7e42d851 100644 --- a/lib/torture/torture.h +++ b/lib/torture/torture.h @@ -323,7 +323,9 @@ void torture_result(struct torture_context *test, #define torture_assert_casestr_equal(torture_ctx,got,expected,cmt) \ do { const char *__got = (got), *__expected = (expected); \ if (!strequal(__got, __expected)) { \ - torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", __got, __expected, cmt); \ + torture_result(torture_ctx, TORTURE_FAIL, \ + __location__": "#got" was %s, expected %s: %s", \ + __got, __expected == NULL ? "null" : __expected, cmt); \ return false; \ } \ } while(0) @@ -332,8 +334,8 @@ void torture_result(struct torture_context *test, do { const char *__got = (got), *__expected = (expected); \ if (strcmp_safe(__got, __expected) != 0) { \ torture_result(torture_ctx, TORTURE_FAIL, \ - __location__": "#got" was %s, expected %s: %s", \ - __got, __expected, cmt); \ + __location__": "#got" was %s, expected %s: %s", \ + __got, __expected == NULL ? "NULL" : __expected, cmt); \ return false; \ } \ } while(0) -- 2.21.0 From 60cb152e7c7ad06cae201391c17eca102a5a3126 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 May 2019 16:58:07 +0200 Subject: [PATCH 06/10] s4:torture: Do not free full_name before we printed it Found by GCC 9. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13937 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit 46f036d3231bc99cf37c7cabf82757d3c28c5cff) --- source4/torture/vfs/fruit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c index e460ce20336..e0ba935ff99 100644 --- a/source4/torture/vfs/fruit.c +++ b/source4/torture/vfs/fruit.c @@ -1163,11 +1163,11 @@ static bool check_stream(struct smb2_tree *tree, status = smb2_create(tree, mem_ctx, &create); if (!NT_STATUS_IS_OK(status)) { - TALLOC_FREE(full_name); if (value == NULL) { return true; } torture_comment(tctx, "Unable to open stream %s\n", full_name); + TALLOC_FREE(full_name); return false; } -- 2.21.0 From 97c5d1180cd0e91d60376a80515fc4feeea0aa3a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 May 2019 17:03:54 +0200 Subject: [PATCH 07/10] ctdb:common: Do not print NULL if we don't get a sockpath sock_socket_start_recv() might not fill sockpath if we return early. Found by GCC 9. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13937 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit 830cb7e67568de5f3ce359cb6af3be8ab545c824) --- ctdb/common/sock_daemon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ctdb/common/sock_daemon.c b/ctdb/common/sock_daemon.c index e5e16f8af12..6298653f4ec 100644 --- a/ctdb/common/sock_daemon.c +++ b/ctdb/common/sock_daemon.c @@ -893,7 +893,7 @@ static void sock_daemon_run_socket_fail(struct tevent_req *subreq) subreq, struct tevent_req); struct sock_daemon_run_state *state = tevent_req_data( req, struct sock_daemon_run_state); - const char *sockpath = NULL; + const char *sockpath = "INVALID"; int ret = 0; bool status; -- 2.21.0 From 18dc92e946765602a2c683029a6fdc73e168e96f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 May 2019 17:05:58 +0200 Subject: [PATCH 08/10] s3:winbindd: Do not free db_path in idmap_tdb2 before we printed it Found by GCC 9. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13937 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit e333425e0ff6be5691b74a920610b508e7d26892) --- source3/winbindd/idmap_tdb2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index 4d423907ae3..24654731a48 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -115,13 +115,13 @@ static NTSTATUS idmap_tdb2_open_db(struct idmap_domain *dom) /* Open idmap repository */ ctx->db = db_open(ctx, db_path, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644, DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE); - TALLOC_FREE(db_path); - if (ctx->db == NULL) { DEBUG(0, ("Unable to open idmap_tdb2 database '%s'\n", db_path)); + TALLOC_FREE(db_path); return NT_STATUS_UNSUCCESSFUL; } + TALLOC_FREE(db_path); return idmap_tdb2_init_hwm(dom); } -- 2.21.0 From 9b363e3deb856576eaf0074bb2ebc865da2dfbd0 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 May 2019 17:11:13 +0200 Subject: [PATCH 09/10] s3:utils: If share is NULL in smbcquotas, don't print it Found by GCC 9. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13937 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit 3653dc7013518d90e6deb08a1f21d7472dc86675) --- source3/utils/smbcquotas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c index a4b1b8111a5..ca8b192e75c 100644 --- a/source3/utils/smbcquotas.c +++ b/source3/utils/smbcquotas.c @@ -712,8 +712,8 @@ FSQFLAGS:QUOTA_ENABLED/DENY_DISK/LOG_SOFTLIMIT/LOG_HARD_LIMIT", "SETSTRING" }, exit(EXIT_PARSE_ERROR); } share = strchr_m(server,'\\'); - if (!share) { - printf("Invalid argument: %s\n", share); + if (share == NULL) { + printf("Invalid argument\n"); exit(EXIT_PARSE_ERROR); } -- 2.21.0 From 73086007a538f4d4584f24d676fe134ec173d9cf Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 8 May 2019 17:12:12 +0200 Subject: [PATCH 10/10] s3:utils: If share is NULL in smbcacls, don't print it Found by GCC 9. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13937 Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison (cherry picked from commit 2b957bde5a2f0f670ee0c8acde6edae1f4aaf253) --- source3/utils/smbcacls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index 33eb78c41ec..ac287ad6978 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -908,8 +908,8 @@ int main(int argc, char *argv[]) return -1; } share = strchr_m(server,'\\'); - if (!share) { - printf("Invalid argument: %s\n", share); + if (share == NULL) { + printf("Invalid argument\n"); return -1; } -- 2.21.0