I will quote from The Matrix...
I keep on thinking the same thing... Oh why didn't I take the Blue Pill?
> From [EMAIL PROTECTED] Mon Mar 4 22:58:00 2002
> Date: Mon, 4 Mar 2002 22:05:06 -0800
> From: Luca Filipozzi <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> Subject: Re: LPRng: lpd_printcap_path=|/some/filter
>
> On Mon, Mar 04, 2002 at 05:00:26PM -0800, Patrick Powell wrote:
> > PGPPASS=IlikeCarTalk
>
> Time to change that, I guess. :) Maybe something like IHatePrintenv.
Strange.... but that did not work. I changed the key a while
ago but did not update the shell script. Wonder why this was left
in. Oh, yes, testing PGP authentication for server stuff.
>
> > e) cat /tmp/lookup -
> >
> > DBSERVER 91398 /var/tmp/LPD/dbserver /var/tmp/LPD/printcap
> > USER=papowell
> > LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
> > HOME=/home/papowell
> > LOGNAME=papowell
> > PATH=/bin:/usr/bin
> > SHELL=/bin/sh
> > LOGDIR=/home/papowell
> > PGPPASS=IlikeCarTalk
> > IFS=
> > all
> >
> > ^^^^ this 'all' should cause lpd to get an 'all' printcap entry
Yup.
>
> Yup. I understand the way it recursively retrieves each printcap entry,
> be it for a printer or a tc.
>
> root@silicate# ll /tmp/lookup
> -rw-rw-rw- 1 root root 213 Mar 4 19:52 /tmp/lookup
>
> root@silicate# cat /tmp/lookup
> DBSERVER 26608 /etc/lprng/dblookup
> PWD=/
> LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
> LOGDIR=/root
> USER=root
> LANG=en_US
> LOGNAME=root
> SHLVL=1
> SHELL=/bin/sh
> IFS=
>
> HOME=/root
> PATH=/bin:/usr/bin
> _=/usr/bin/printenv
> ---EOF--- ... blocked on read (cat) here.
>
> root@silicate# ps ax # snipped
> 26605 pts/1 S 0:00 lpd MAIN
> 26606 ? S 0:00 lpd Waiting
> 26607 ? S 0:00 lpd SERVICEALL
> 26608 ? S 0:00 /bin/sh /etc/lprng/dblookup
> 26610 ? S 0:00 /bin/cat
>
> The cat in your test script is blocked on read(), waiting for lpd
> SERVICEALL to write 'all' into the pipe, which it never does.
>
> I can't figure it out... the code is the same for lpq and lpd,
> Get_all_printcap_entries(), except lpq works and lpd does not.
>
> The only difference is the IFS. Yours is [space][tab] and mine is
> [space][tab][newline].
>
> More debugging:
>
> 27577 pts/1 S 0:00 strace -ofoo -f lpd
> 27579 ? S 0:00 lpd Waiting
> 27580 ? S 0:00 lpd SERVICEALL
> 27581 ? T 0:00 /bin/sh /etc/lprng/dblookup
> 27583 ? S 0:00 /bin/cat
>
> Running lpd under strace -f, I see:
> 27580 open("/tmp/temp00QSDQJd", O_RDWR|O_CREAT|O_EXCL, 0600) = 5
> 27580 fchmod(5, 0600) = 0
> 27580 stat64("/tmp/temp00QSDQJd", {st_mode=S_IFREG|0600, st_size=0,
> ...}) = 0
> 27580 stat64("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=20480, ...})
> = 0
> 27580 gettimeofday({1015303034, 65798}, NULL) = 0
> 27580 getpid() = 27580
> 27580 open("/tmp/temp01amNlyj", O_RDWR|O_CREAT|O_EXCL, 0600) = 6
> 27580 fchmod(6, 0600) = 0
> 27580 stat64("/tmp/temp01amNlyj", {st_mode=S_IFREG|0600, st_size=0,
> ...}) = 0
> 27580 write(5, "all", 3) = 3
> 27580 write(5, "\n", 1) = 1
> 27580 lseek(5, 0, SEEK_SET) = 0
>
> Why lpd SERVICEALL is writing to a temporary file rather than a pipe, I
> don't know.
This is tricky. It turns out that sometimes when you write to a script
it never reads the input. Then the LPD server will block and nothing happens.
By writing the stuff to a file and then attaching the file to the filter
STDIN you avoid this problem.
This caused me a couple of days INTENSE pain.
>
> More debugging....
>
> Ok, I have found the problem, I think. There's some ugly interaction
> between LPRng's lpd and LDAP, specifically libnss-ldap. This is
> interesting...
>
> With nsswitch.conf like this, lpd doesn't write() into the pipe.
>
> passwd: files ldap
> shadow: files ldap
> group: files ldap
>
> Removing ldap from the above lines causes lpd to work correctly.
>
> Argggh!!!!
>
> Any ideas?
>
> Luca
>
> --
> Luca Filipozzi, ECE Dept. IT Manager, University of British Columbia
> [dpkg] We are the apt. You will be packaged. Resistance is futile.
> gpg key 5A827A2D - A149 97BD 188C 7F29 779E 09C1 3573 32C4 5A82 7A2D
This is totally insane...
OK, try the following in the script.
#...
tee /tmp/out | ldap_stuff
The 'tee' will make a copy of the input and THEN send it to the lpad
script.
This will at least let you see what is being sent, if anything.
-----------------------------------------------------------------------------
YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST
The address you post from MUST be your subscription address
If you need help, send email to [EMAIL PROTECTED] (or lprng-requests
or lprng-digest-requests) with the word 'help' in the body. For the impatient,
to subscribe to a list with name LIST, send mail to [EMAIL PROTECTED]
with: | example:
subscribe LIST <mailaddr> | subscribe lprng-digest [EMAIL PROTECTED]
unsubscribe LIST <mailaddr> | unsubscribe lprng [EMAIL PROTECTED]
If you have major problems, send email to [EMAIL PROTECTED] with the word
LPRNGLIST in the SUBJECT line.
-----------------------------------------------------------------------------