From 0dc10be592ceb9bb91f2e082fba83d9a6b6e3b6a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 24 Jan 2009 12:24:17 +0100 Subject: [PATCH] Fix bug 5976 A reproducer for this bug goes as follows: Add a system("/bin/sleep 9999") to the cups printcap fetcher child. Add smb_msleep calls to the loop sending the princap info to the parent. Add them before all individual steps. Send a SIGHUP to the parent smbd, triggering it to fork. (and have the child wait in sleep) Connect with smbclient. send -STOP to the parent kill the sleep process. Now parts of the printcap info will end up in the child smbd handling the smbclient process. send -CONT to the parent smbd, send -STOP to the child handling smbclient. Now the parent will retrieve garbage, as the child has eaten part of the stuff. Later in the reload_printers() the parent will unlink the printq tdbs in print/*. Child wants to recreate them. Different inode. Bang. Phew. This is fixed (and needs verifying!!!) in current v3-2-test. Volker --- source/smbd/server.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/source/smbd/server.c b/source/smbd/server.c index d4435b5..266e280 100644 --- a/source/smbd/server.c +++ b/source/smbd/server.c @@ -335,6 +335,10 @@ static bool allowable_number_of_smbd_processes(void) Open the socket communication. ****************************************************************************/ +#ifdef HAVE_CUPS +extern struct fd_event *cache_fd_event; +#endif + static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ports) { int num_interfaces = iface_count(); @@ -745,6 +749,9 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ smb_panic("reinit_after_fork() failed"); } +#ifdef HAVE_CUPS + TALLOC_FREE(cache_fd_event); +#endif return True; } /* The parent doesn't need this socket */ -- 1.6.0.1