[Samba] Using parameters in lpq command conflicts with background

Mac mac at nibsc.ac.uk
Tue Oct 5 10:06:09 GMT 2004

Hi Jerry, (and rest of list)

>I have an application than makes use of the "lpq command" and uses the 
>%U parameter in the command string.  The application returns a 
>personalized queue list based on the value of %U.  This technique worked 
>well in older versions of Samba (circa RedHat 8), but I have run into 
>some trouble with Samba 3.  The issue appears to be twofold.
>    1)  The lpq command is now run from the background lpq monitoring 
>process, which does not have a "user" (%U) per-se associated with it.
>    2)  The background lpq process maintains its cache(s) based on the 
>service name.  IIRC, the older caching system maintained a cache for 
>each unique "lpq command" line.

Indeed it did.  In fact the whole (tdb-based) lpq monitoring system has
a whole heap of changes from previous Samba versions (we jumped from
1.9.18p8 to 3.0.6) and all sorts of strange things happen now.

>I've temporarily solved the problem by running smbd from inetd - this 
>prevents the background lpq process from running and causes each user's 
>process to invoke their own lpq command (complete with %U substitution).

Fab!  Thanks for finding this workaround.  I'll give it a shot.

>Would it be possible to update the background lpq code to use the (fully 
>substituted) lpq command as the cache identifier instead of (or in 
>addition to) the service name?  My application aside, I think it would 
>be best if Samba's behavior was consistent in both daemon and non-daemon 
>modes.  I'd be willing to lend my mediocre programming skills to the 
>task if it would help.

I agree about the damon vs. non-daemon mode, very odd that the behaviour is

          Assistant Systems Adminstrator @nibsc.ac.uk
                        dmccann at nibsc.ac.uk
   Work: +44 1707 641565          Everything else: +44 7956 237670 (anytime)

More information about the samba mailing list