From b7a141f8a72512302bd118ad5d4b9cf8c4c57564 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 15 Apr 2008 01:50:13 +0200 Subject: smbd: merge "smbd:backgroundqueue=no" option from the v3-0-ctdb tree metze (This used to be commit 16d295d466eb18e3bccce6fb26d53012d5f2c3e8) --- source3/smbd/server.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/server.c b/source3/smbd/server.c index b71d6271f2..108a55033c 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1344,8 +1344,10 @@ extern void build_options(bool screen); smbd is launched via inetd and we fork a copy of ourselves here */ - if ( is_daemon && !interactive ) - start_background_queue(); + if (is_daemon && !interactive + && lp_parm_bool(-1, "smbd", "backgroundqueue", true)) { + start_background_queue(); + } if (!open_sockets_smbd(is_daemon, interactive, ports)) exit(1); -- cgit From f2067658df3c272c2e8c6f2d00bcc5687050ee1d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 15 Apr 2008 01:01:59 +0200 Subject: smbd: call reinit_after_fork() in the needed places metze (This used to be commit 425b3513a45cf98b53235470a3536be86d56d1c2) --- source3/smbd/server.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 108a55033c..337026a8ca 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -741,17 +741,9 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ sizeof(remaddr)), false); - /* Reset the state of the random - * number generation system, so - * children do not get the same random - * numbers as each other */ - - set_need_random_reseed(); - /* tdb needs special fork handling - remove - * CLEAR_IF_FIRST flags */ - if (tdb_reopen_all(1) == -1) { - DEBUG(0,("tdb_reopen_all failed.\n")); - smb_panic("tdb_reopen_all failed"); + if (!reinit_after_fork(smbd_messaging_context())) { + DEBUG(0,("reinit_after_fork() failed\n")); + smb_panic("reinit_after_fork() failed"); } return True; @@ -1384,12 +1376,10 @@ extern void build_options(bool screen); /* Setup aio signal handler. */ initialize_async_io_handler(); - /* - * For clustering, we need to re-init our ctdbd connection after the - * fork - */ - if (!NT_STATUS_IS_OK(messaging_reinit(smbd_messaging_context()))) + if (!reinit_after_fork(smbd_messaging_context())) { + DEBUG(0,("reinit_after_fork() failed\n")); exit(1); + } /* register our message handlers */ messaging_register(smbd_messaging_context(), NULL, -- cgit From 2df0ade13afc1690c2e6d80e087aa281c815e678 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 15 Apr 2008 10:57:45 +0200 Subject: smbd: create the messaging conntext earlier metze (This used to be commit 658d8475336c4397e0dad341f216baf9e1eb6aaf) --- source3/smbd/server.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 337026a8ca..59bbfdbc17 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -575,8 +575,6 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ MSG_SMB_INJECT_FAULT, msg_inject_fault); #endif - db_tdb2_setup_messaging(smbd_messaging_context(), true); - /* now accept incoming connections - forking a new process for each incoming connection */ DEBUG(2,("waiting for a connection\n")); @@ -1095,6 +1093,8 @@ extern void build_options(bool screen); TimeInit(); + db_tdb2_setup_messaging(NULL, false); + #ifdef HAVE_SET_AUTH_PARAMETERS set_auth_parameters(argc,argv); #endif @@ -1218,10 +1218,18 @@ extern void build_options(bool screen); exit(1); } + if (!lp_load_initial_only(get_dyn_CONFIGFILE())) { + DEBUG(0, ("error opening config file\n")); + exit(1); + } + + if (smbd_messaging_context() == NULL) + exit(1); + /* * Do this before reload_services. */ - db_tdb2_setup_messaging(NULL, false); + db_tdb2_setup_messaging(smbd_messaging_context(), true); if (!reload_services(False)) return(-1); @@ -1277,10 +1285,12 @@ extern void build_options(bool screen); if (is_daemon) pidfile_create("smbd"); - /* Setup all the TDB's - including CLEAR_IF_FIRST tdb's. */ - - if (smbd_messaging_context() == NULL) + if (!reinit_after_fork(smbd_messaging_context())) { + DEBUG(0,("reinit_after_fork() failed\n")); exit(1); + } + + /* Setup all the TDB's - including CLEAR_IF_FIRST tdb's. */ if (smbd_memcache() == NULL) { exit(1); @@ -1376,11 +1386,6 @@ extern void build_options(bool screen); /* Setup aio signal handler. */ initialize_async_io_handler(); - if (!reinit_after_fork(smbd_messaging_context())) { - DEBUG(0,("reinit_after_fork() failed\n")); - exit(1); - } - /* register our message handlers */ messaging_register(smbd_messaging_context(), NULL, MSG_SMB_FORCE_TDIS, msg_force_tdis); -- cgit From c071b941e6090a2b107a8a42835e6da772161425 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Apr 2008 13:08:14 +0200 Subject: Fix bug 5398 Thanks to Jason Mader for sending the compiler output :-) Volker (This used to be commit 7a57c2da1a6cc0fcea0b4d949c696219f1822694) --- source3/smbd/chgpasswd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c index b2b082363f..2596e73380 100644 --- a/source3/smbd/chgpasswd.c +++ b/source3/smbd/chgpasswd.c @@ -249,6 +249,7 @@ static int expect(int master, char *issue, char *expected) bool match = False; for (attempts = 0; attempts < 2; attempts++) { + NTSTATUS status; if (!strequal(issue, ".")) { if (lp_passwd_chat_debug()) DEBUG(100, ("expect: sending [%s]\n", issue)); @@ -269,7 +270,6 @@ static int expect(int master, char *issue, char *expected) buffer[nread] = 0; while (True) { - NTSTATUS status; status = read_socket_with_timeout( master, buffer + nread, 1, sizeof(buffer) - nread - 1, @@ -305,8 +305,8 @@ static int expect(int master, char *issue, char *expected) if (match) break; - if (len < 0) { - DEBUG(2, ("expect: %s\n", strerror(errno))); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(2, ("expect: %s\n", nt_errstr(status))); return False; } } -- cgit From b46d340fd5d7e88684ac77000e17c1899ff608b2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 19 Apr 2008 18:17:13 +0200 Subject: Refactoring: Make struct rpc_pipe_client its own talloc parent (This used to be commit a6d74a5a562b54f0b36934965f545fdeb1e8b34a) --- source3/smbd/change_trust_pw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/smbd') diff --git a/source3/smbd/change_trust_pw.c b/source3/smbd/change_trust_pw.c index 4773eeff86..227b2d6899 100644 --- a/source3/smbd/change_trust_pw.c +++ b/source3/smbd/change_trust_pw.c @@ -82,7 +82,8 @@ NTSTATUS change_trust_account_password( const char *domain, const char *remote_m goto failed; } - nt_status = trust_pw_find_change_and_store_it(netlogon_pipe, netlogon_pipe->mem_ctx, domain); + nt_status = trust_pw_find_change_and_store_it( + netlogon_pipe, netlogon_pipe, domain); cli_shutdown(cli); cli = NULL; -- cgit From 3756467db6a661be91f4aeb484000e993e4a9a4c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 12:18:33 +0100 Subject: Move the posix pending close functionality down into the VFS layer. This hides the pending close fds from the outside. Call order of SMB_VFS_CLOSE is reversed. Originally, it was: fd_close -> fd_close_posix -> SMB_VFS_CLOSE -> close And now it is: fd_close -> SMB_VFS_CLOSE -> fd_close_posix -> close This is in preparation of removing the fd parameter from the SMB_VFS_CLOSE function. But it is also the right place for the pending close calls anyways. Michael (This used to be commit 3cf56b124a2886c6260455bba4bf77d08e9a4f77) --- source3/smbd/open.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source3/smbd') diff --git a/source3/smbd/open.c b/source3/smbd/open.c index f3ed234c87..7a13b3ae38 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -72,13 +72,21 @@ static NTSTATUS fd_open(struct connection_struct *conn, NTSTATUS fd_close(files_struct *fsp) { + int ret; + if (fsp->fh->fd == -1) { return NT_STATUS_OK; /* What we used to call a stat open. */ } if (fsp->fh->ref_count > 1) { return NT_STATUS_OK; /* Shared handle. Only close last reference. */ } - return fd_close_posix(fsp); + + ret = SMB_VFS_CLOSE(fsp, fsp->fh->fd); + fsp->fh->fd = -1; + if (ret == -1) { + return map_nt_error_from_unix(errno); + } + return NT_STATUS_OK; } /**************************************************************************** -- cgit From 0db7aba8af80a01150d1061a4192ab814e4234b7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Fri, 11 Jan 2008 14:19:28 +0100 Subject: Remove redundant parameter fd from SMB_VFS_CLOSE(). Now all those redundant fd's have vanished from the VFS API. Michael (This used to be commit 14294535512a7f191c5008e622b6708e417854ae) --- source3/smbd/open.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/smbd') diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 7a13b3ae38..0d1dd31cd6 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -81,7 +81,7 @@ NTSTATUS fd_close(files_struct *fsp) return NT_STATUS_OK; /* Shared handle. Only close last reference. */ } - ret = SMB_VFS_CLOSE(fsp, fsp->fh->fd); + ret = SMB_VFS_CLOSE(fsp); fsp->fh->fd = -1; if (ret == -1) { return map_nt_error_from_unix(errno); -- cgit