From dcb38e53549bc311e343f4217b7f3cffe5aa831a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 21 Sep 2009 03:16:18 +0200 Subject: [PATCH] tevent: make sure we don't set errno within the signal handler function. metze (cherry picked from commit d13dfbeb6c6ab5b20277439da5b95f1a7f2850eb) --- lib/tevent/tevent_signal.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/lib/tevent/tevent_signal.c b/lib/tevent/tevent_signal.c index ef9c0cf..0ca2a27 100644 --- a/lib/tevent/tevent_signal.c +++ b/lib/tevent/tevent_signal.c @@ -85,6 +85,7 @@ static void tevent_common_signal_handler(int signum) ssize_t res; struct tevent_common_signal_list *sl; struct tevent_context *ev = NULL; + int saved_errno = errno; SIG_INCREMENT(sig_state->signal_count[signum]); SIG_INCREMENT(sig_state->got_signal); @@ -103,6 +104,8 @@ static void tevent_common_signal_handler(int signum) ev = sl->se->event_ctx; } } + + errno = saved_errno; } #ifdef SA_SIGINFO -- 1.5.4.3 From 0820d65b59f8ab783a657a53b17b46371cdb808f Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 20 Sep 2009 23:29:34 +0200 Subject: [PATCH] s3:lib/select: don't overwrite errno in the signal handler metze (cherry picked from commit 00e378f17c39c52689601bc622b9cd78a0cdce12) --- source3/lib/select.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/source3/lib/select.c b/source3/lib/select.c index a58530a..b5443ff 100644 --- a/source3/lib/select.c +++ b/source3/lib/select.c @@ -39,11 +39,15 @@ static volatile unsigned pipe_written, pipe_read; void sys_select_signal(char c) { + int saved_errno = errno; + if (!initialised) return; if (pipe_written > pipe_read+256) return; if (write(select_pipe[1], &c, 1) == 1) pipe_written++; + + errno = saved_errno; } /******************************************************************* -- 1.5.4.3 From 7fef8d090d425cb6e18aa4e55de414cf5655dd00 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 20 Sep 2009 23:29:11 +0200 Subject: [PATCH] s3:rpc_client: don't randomly fragment rpc pdu's in developer mode This is really confusing and also breaks against windows, as it doesn't accept fragmented bind requests. metze (cherry picked from commit 68b8149d1fb26b2fe1138c99d971754b0a30378b) --- source3/rpc_client/cli_pipe.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 9990f1b..0d1d5e8 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -1280,7 +1280,7 @@ static struct async_req *rpc_api_pipe_send(TALLOC_CTX *mem_ctx, max_recv_frag = cli->max_recv_frag; -#ifdef DEVELOPER +#if 0 max_recv_frag = RPC_HEADER_LEN + 10 + (sys_random() % 32); #endif @@ -1966,7 +1966,7 @@ static uint32 calculate_data_len_tosend(struct rpc_pipe_client *cli, { uint32 data_space, data_len; -#ifdef DEVELOPER +#if 0 if ((data_left > 0) && (sys_random() % 2)) { data_left = MAX(data_left/2, 1); } -- 1.5.4.3 From 3a27560d7a11c067566dfd5c9eaf183cd08fb0d6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 24 Sep 2009 21:35:38 +0200 Subject: [PATCH] s3:winbindd_cm: don't invalidate the whole connection when just samr gave ACCCESS_DENIED metze (cherry picked from commit bfd3a6f13aa935950142a24bf331feb98f987bde) --- source3/winbindd/winbindd_cm.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 3162362..32afe40 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -2155,7 +2155,18 @@ NTSTATUS cm_connect_sam(struct winbindd_domain *domain, TALLOC_CTX *mem_ctx, done: - if (!NT_STATUS_IS_OK(result)) { + if (NT_STATUS_EQUAL(result, NT_STATUS_ACCESS_DENIED)) { + /* + * if we got access denied, we might just have no access rights + * to talk to the remote samr server server (e.g. when we are a + * PDC and we are connecting a w2k8 pdc via an interdomain + * trust). In that case do not invalidate the whole connection + * stack + */ + TALLOC_FREE(conn->samr_pipe); + ZERO_STRUCT(conn->sam_domain_handle); + return result; + } else if (!NT_STATUS_IS_OK(result)) { invalidate_cm_connection(conn); return result; } -- 1.5.4.3 From 57fbac4426cc64596eec0dd24e255785c70fb553 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 25 Sep 2009 06:20:33 +0200 Subject: [PATCH] s3:winbindd: only notify the client when we exist, if the connection isn't dead already This is similar to commit 83edf3e43e86781872a07d8eb53084f59ad7384c. metze --- source3/winbindd/winbindd.c | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 33b35e0..7d89940 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -871,11 +871,13 @@ static void remove_client(struct winbindd_cli_state *state) return; } - /* tell client, we are closing ... */ - nwritten = write(state->sock, &c, sizeof(c)); - if (nwritten == -1) { - DEBUG(2, ("final write to client failed: %s\n", - strerror(errno))); + if (!state->finished) { + /* tell client, we are closing ... */ + nwritten = write(state->sock, &c, sizeof(c)); + if (nwritten == -1) { + DEBUG(2, ("final write to client failed: %s\n", + strerror(errno))); + } } /* Close socket */ -- 1.5.4.3