summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorNadezhda Ivanova <nadezhda.ivanova@postpath.com>2009-09-21 14:26:15 -0700
committerNadezhda Ivanova <nadezhda.ivanova@postpath.com>2009-09-21 14:26:15 -0700
commit13b979b03d86f3ae43dc5fd539fa5d3f22f579a0 (patch)
tree40e15be25f6b975e7c5b91f00fdf6030726e25e7 /source3
parent025590e7a4758e86e7942642971b92fc6bab7a8e (diff)
parent1afc7c453c1d5f7e761e46cdc69900305a149820 (diff)
downloadsamba-13b979b03d86f3ae43dc5fd539fa5d3f22f579a0.tar.gz
samba-13b979b03d86f3ae43dc5fd539fa5d3f22f579a0.tar.bz2
samba-13b979b03d86f3ae43dc5fd539fa5d3f22f579a0.zip
Merge branch 'master' of git://git.samba.org/samba
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/select.c4
-rw-r--r--source3/passdb/secrets.c12
-rw-r--r--source3/winbindd/winbindd.c25
3 files changed, 26 insertions, 15 deletions
diff --git a/source3/lib/select.c b/source3/lib/select.c
index a58530af8d..b5443ff20c 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;
}
/*******************************************************************
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 0e66e3cf01..36f401bc92 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -1135,8 +1135,8 @@ void secrets_fetch_ipc_userpass(char **username, char **domain, char **password)
*******************************************************************************/
#define SCHANNEL_STORE_VERSION_1 1
-#define SCHANNEL_STORE_VERSION_2 2
-#define SCHANNEL_STORE_VERSION_CURRENT SCHANNEL_STORE_VERSION_2
+#define SCHANNEL_STORE_VERSION_2 2 /* should not be used */
+#define SCHANNEL_STORE_VERSION_CURRENT SCHANNEL_STORE_VERSION_1
TDB_CONTEXT *open_schannel_session_store(TALLOC_CTX *mem_ctx)
{
@@ -1168,12 +1168,18 @@ TDB_CONTEXT *open_schannel_session_store(TALLOC_CTX *mem_ctx)
vers.dptr = NULL;
} else if (vers.dsize == 4) {
ver = IVAL(vers.dptr,0);
- if (ver != SCHANNEL_STORE_VERSION_CURRENT) {
+ if (ver == SCHANNEL_STORE_VERSION_2) {
DEBUG(0,("open_schannel_session_store: wrong version number %d in %s\n",
(int)ver, fname ));
tdb_wipe_all(tdb_sc);
goto again;
}
+ if (ver != SCHANNEL_STORE_VERSION_CURRENT) {
+ DEBUG(0,("open_schannel_session_store: wrong version number %d in %s\n",
+ (int)ver, fname ));
+ tdb_close(tdb_sc);
+ tdb_sc = NULL;
+ }
} else {
tdb_close(tdb_sc);
tdb_sc = NULL;
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 9d4676f9b5..f0160fcb78 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -692,6 +692,8 @@ static void winbind_client_response_written(struct tevent_req *req)
ret = wb_resp_write_recv(req, &err);
TALLOC_FREE(req);
if (ret == -1) {
+ close(state->sock);
+ state->sock = -1;
DEBUG(2, ("Could not write response to client: %s\n",
strerror(err)));
remove_client(state);
@@ -792,6 +794,8 @@ static void winbind_client_request_read(struct tevent_req *req)
ret = wb_req_read_recv(req, state, &state->request, &err);
TALLOC_FREE(req);
if (ret == -1) {
+ close(state->sock);
+ state->sock = -1;
DEBUG(2, ("Could not read client request: %s\n",
strerror(err)));
remove_client(state);
@@ -813,22 +817,19 @@ 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) {
- /*
- * ignore EPIPE error here, because the other end might
- * have already closed the socket.
- */
- if (errno != EPIPE) {
+ if (state->sock != -1) {
+ /* 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)));
+ strerror(errno)));
}
- }
- /* Close socket */
+ /* Close socket */
- close(state->sock);
+ close(state->sock);
+ state->sock = -1;
+ }
/* Free any getent state */