On Tue, Jan 20, 2009 at 04:45:46PM +0100, Remy Zandwijk wrote:
> Our Samba/CUPS based printserver loses the info of which driver belongs to 
> a certain printer. The server is running Samba 3.2.7 on Solaris 9.
> 
> 
> Out of the blue, users complain they cannot print. Looking at 'printers and 
> faxes' from a Windows machine shows no info in the 'Model' field. In normal 
> situations this field lists the driver/model name.
> 
> Weird thing is: nobody is touching the printserver configuration at the 
> time Samba loses the information, although the ntprinters.tdb file's change 
> time is the time the problem occurs.
> 
> Stopping Samba and replacing the ntprinters.tdb file by a backup file works 
> and we can see the drivers again.
> 
> 
> What is going on here, but more important: what is the best way to debug 
> this one?

Attached find a patch that should solve this for 3.2.7.
3.2.8 will have a different fix for this. See also bug 5976
in bugzilla.samba.org for more info.

Thanks for your patience, sorry for the bug.

Volker
From 0dc10be592ceb9bb91f2e082fba83d9a6b6e3b6a Mon Sep 17 00:00:00 2001
From: Volker Lendecke <[email protected]>
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

Attachment: pgpsoDo81dq8a.pgp
Description: PGP signature

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/listinfo/samba

Reply via email to