[PATCH] Fix a few CIDs
Jeremy Allison
jra at samba.org
Wed May 23 18:22:23 UTC 2018
On Wed, May 23, 2018 at 07:39:42AM +0200, Volker Lendecke via samba-technical wrote:
> Hi!
>
> Review appreciated!
LGTM. RB+ and pushed, thanks !
> --
> SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
> phone: +49-551-370000-0, fax: +49-551-370000-9
> AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
> http://www.sernet.de, mailto:kontakt at sernet.de
> From 1f940ba1d8016d6e104399f2e639d1b1a1ba2fc0 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 22 May 2018 13:17:25 +0200
> Subject: [PATCH 1/6] ctdb: Fix CID 1435740 Unchecked return value
>
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
> ctdb/tests/src/cluster_wait.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/ctdb/tests/src/cluster_wait.c b/ctdb/tests/src/cluster_wait.c
> index ecd2efdf314..8b0bb429e81 100644
> --- a/ctdb/tests/src/cluster_wait.c
> +++ b/ctdb/tests/src/cluster_wait.c
> @@ -58,6 +58,7 @@ struct tevent_req *cluster_wait_send(TALLOC_CTX *mem_ctx,
> {
> struct tevent_req *req, *subreq;
> struct cluster_wait_state *state;
> + bool ok;
>
> req = tevent_req_create(mem_ctx, &state, struct cluster_wait_state);
> if (req == NULL) {
> @@ -95,7 +96,13 @@ struct tevent_req *cluster_wait_send(TALLOC_CTX *mem_ctx,
> tevent_req_set_callback(subreq, cluster_wait_sync_registered, req);
>
> /* If cluster is not synchronized within 30 seconds, time out */
> - tevent_req_set_endtime(req, ev, tevent_timeval_current_ofs(30, 0));
> + ok = tevent_req_set_endtime(
> + req,
> + ev,
> + tevent_timeval_current_ofs(30, 0));
> + if (!ok) {
> + return tevent_req_post(req, ev);
> + }
>
> return req;
> }
> --
> 2.11.0
>
>
> From 519469b6515c93f7600f9345fd90a24c520ad081 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 22 May 2018 13:20:17 +0200
> Subject: [PATCH 2/6] audit_logging: Fix CID 1435739 Dereference null return
> value
>
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
> lib/audit_logging/tests/audit_logging_test.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/lib/audit_logging/tests/audit_logging_test.c b/lib/audit_logging/tests/audit_logging_test.c
> index 9ba71fb60d7..8385e9ce363 100644
> --- a/lib/audit_logging/tests/audit_logging_test.c
> +++ b/lib/audit_logging/tests/audit_logging_test.c
> @@ -519,6 +519,7 @@ static void test_audit_get_timestamp(void **state)
> struct tm tz;
> c = strptime(c, " %Z", &tz);
> }
> + assert_non_null(c);
> assert_int_equal(0, strlen(c));
>
> actual = mktime(&tm);
> --
> 2.11.0
>
>
> From aaf32ada100c3d3adc15484e2900785e4da68985 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 22 May 2018 13:23:33 +0200
> Subject: [PATCH 3/6] ctdbd: Fix CID 1435732 Argument cannot be negative
>
> setenv returns its error in "errno"
>
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
> ctdb/server/ctdbd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
> index 252309cceab..5290165a2a4 100644
> --- a/ctdb/server/ctdbd.c
> +++ b/ctdb/server/ctdbd.c
> @@ -307,7 +307,7 @@ int main(int argc, const char *argv[])
> 1);
> if (ret != 0) {
> D_ERR("Failed to set up lock debugging (%s)\n",
> - strerror(ret));
> + strerror(errno));
> goto fail;
> }
> }
> --
> 2.11.0
>
>
> From a0aaa680275922122c94ead5eeafb7f9576607cf Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 22 May 2018 13:25:41 +0200
> Subject: [PATCH 4/6] ldap_server: Fix CID 1435731 Unchecked return value
>
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
> source4/ldap_server/ldap_server.c | 14 +++++++++++---
> 1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
> index 80b8c193be4..49e03ef8c6f 100644
> --- a/source4/ldap_server/ldap_server.c
> +++ b/source4/ldap_server/ldap_server.c
> @@ -494,9 +494,17 @@ static bool ldapsrv_call_read_next(struct ldapsrv_connection *conn)
> return false;
> }
> if (!timeval_is_zero(&conn->limits.endtime)) {
> - tevent_req_set_endtime(subreq,
> - conn->connection->event.ctx,
> - conn->limits.endtime);
> + bool ok;
> + ok = tevent_req_set_endtime(subreq,
> + conn->connection->event.ctx,
> + conn->limits.endtime);
> + if (!ok) {
> + ldapsrv_terminate_connection(
> + conn,
> + "ldapsrv_call_read_next: "
> + "no memory for tevent_req_set_endtime");
> + return false;
> + }
> }
> tevent_req_set_callback(subreq, ldapsrv_call_read_done, conn);
> conn->sockets.read_req = subreq;
> --
> 2.11.0
>
>
> From 9fafdf490b3ca6f2adcd1d05466b6e558bc5ef68 Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 22 May 2018 17:08:43 +0200
> Subject: [PATCH 5/6] kdc: Fix CID 1435720 Unchecked return value
>
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
> source4/kdc/kdc-proxy.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/source4/kdc/kdc-proxy.c b/source4/kdc/kdc-proxy.c
> index 5072835fa19..0f84906338f 100644
> --- a/source4/kdc/kdc-proxy.c
> +++ b/source4/kdc/kdc-proxy.c
> @@ -184,6 +184,7 @@ static void kdc_udp_proxy_resolve_done(struct composite_context *csubreq)
> struct tevent_req *subreq;
> struct tsocket_address *local_addr, *proxy_addr;
> int ret;
> + bool ok;
>
> status = resolve_name_recv(csubreq, state, &state->proxy.ip);
> if (!NT_STATUS_IS_OK(status)) {
> @@ -234,8 +235,15 @@ static void kdc_udp_proxy_resolve_done(struct composite_context *csubreq)
> return;
> }
> tevent_req_set_callback(subreq, kdc_udp_proxy_recvfrom_done, req);
> - tevent_req_set_endtime(subreq, state->ev,
> - timeval_current_ofs(state->kdc->proxy_timeout, 0));
> +
> + ok = tevent_req_set_endtime(
> + subreq,
> + state->ev,
> + timeval_current_ofs(state->kdc->proxy_timeout, 0));
> + if (!ok) {
> + DBG_DEBUG("tevent_req_set_endtime failed\n");
> + return;
> + }
>
> DEBUG(4,("kdc_udp_proxy: proxying request to %s[%s]\n",
> state->proxy.name.name, state->proxy.ip));
> --
> 2.11.0
>
>
> From 775ec455ff5724326541a0949d142404bc99697f Mon Sep 17 00:00:00 2001
> From: Volker Lendecke <vl at samba.org>
> Date: Tue, 22 May 2018 17:10:07 +0200
> Subject: [PATCH 6/6] ldap_server: Fix CID 1435721 Unchecked return value
>
> Signed-off-by: Volker Lendecke <vl at samba.org>
> ---
> source4/ldap_server/ldap_server.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c
> index 49e03ef8c6f..b5251e3623e 100644
> --- a/source4/ldap_server/ldap_server.c
> +++ b/source4/ldap_server/ldap_server.c
> @@ -104,6 +104,7 @@ static void ldapsrv_terminate_connection_done(struct tevent_req *subreq)
> tevent_req_callback_data(subreq,
> struct ldapsrv_connection);
> int sys_errno;
> + bool ok;
>
> tstream_disconnect_recv(subreq, &sys_errno);
> TALLOC_FREE(subreq);
> @@ -130,9 +131,15 @@ static void ldapsrv_terminate_connection_done(struct tevent_req *subreq)
> conn->limits.reason);
> return;
> }
> - tevent_req_set_endtime(subreq,
> - conn->connection->event.ctx,
> - conn->limits.endtime);
> + ok = tevent_req_set_endtime(subreq,
> + conn->connection->event.ctx,
> + conn->limits.endtime);
> + if (!ok) {
> + TALLOC_FREE(conn->sockets.raw);
> + stream_terminate_connection(conn->connection,
> + conn->limits.reason);
> + return;
> + }
> tevent_req_set_callback(subreq, ldapsrv_terminate_connection_done, conn);
> }
>
> --
> 2.11.0
>
More information about the samba-technical
mailing list