[comp.protocols.appletalk] Can lwsrv talk back to a mac?

KSpagnol@massey.ac.nz (Ken Spagnolo) (05/22/89)

Hello,
Below is email that I sent to cck@columbia.edu.  Since I got no response,
I'm trying here.  Any info is appreciated.  Please send email to the
address below.  Thanx.
---------------------------------------------------------------------------

We are using lwsrv and papif to send print jobs thru a Pyramid to our
laser printer.  We would like to limit who can use this printer and toss
unauthorized jobs.  This part is not a problem.  However, we would like
to let the user know that nothing is going to come out the other end, and
here we have encountered difficulty.

It seems that the place in which lwsrv discovers who the user is occurs
at 'case TOK_FOR:' in getjob() in simple.c.  At this point I tried using
NewStatus() to get some appropriate message to the users screen (in this
case a Mac), but no go.  I also tried p_write(pf,"",0,TRUE), which is the
same thing sent if an invalid token is received, just to see if I could
get anything at all, but again nothing happened.  It seems that the Mac
is just not listening at this time.  When we print from the Mac directly
to the laser printer, all sorts of status messages appear on the Mac's
screen, for instance 'no paper tray'.  Thru lwsrv, we get no responses of
any kind.  The question then is, Can lwsrv talk back to the Mac and what
mechanism is used to do so?

==============================================================================
Ken Spagnolo, Systems Programmer, Comp.Ctr., Massey Univ, Palmerston Nth, N.Z.
CSnet/ACSnet/Internet: K.Spagnolo@massey.ac.nz       Phone: +64-63-69099 x8587
From North America: K.Spagnolo%massey.ac.nz@relay.cs.net  New Zealand = GMT+12
==============================================================================

inei@cs.glasgow.ac.UK (Nick Nei) (05/26/89)

Ken Spagnolo writes:

>We are using lwsrv and papif to send print jobs thru a Pyramid to our
>laser printer.  We would like to limit who can use this printer and toss
>unauthorized jobs.
>However, we would like to let the user know that nothing is going to come
>the other end, and here we have encountered difficulty.

I have implemented a user-name and password scheme which modifies
lwsrv to check user-name and password.

To return a status message to the Macintosh (eg, "Wrong password"),
lwsrv must be running single-fork.  There is a bug in lwsrv.c.
The status and user-name strings are not null'd/cleared after
each time round the big loop.  Null it yourself otherwise the
next lwsrv job gets the status message of the previous one!

In fact passing diagnostics back to the Macintosh is not a good
idea, as I soon discovered.  This is because with small print jobs,
the user does not see the message at all: lwsrv receives the whole
file, disconnects from the Macintosh, discovers password/user-name
is wrong, writes to status, but the Mac is no longer listening.
Another disadvantage (even if you manage to get the message back
to the Mac), the message may not stay on screen long enough.
Your user may miss it and end up scratching his/her head.

In the end I decided that the best solution is to print a page
on the LaserWriter with the diagnostic message (with the name
of the document).  This seemed the best idea because the user
is likely to be hovering over the LaserWriter and not the
Macintosh.

Mail:	Nick Nei, Computing Science Dept., 
	Glasgow Univ., 17 Lilybank Gardens,
      	Glasgow G12 8QQ, UK.  Tel: (041) 339 8855 x 5457
ARPA:	inei%cs.glasgow.ac.uk@nsfnet-relay.ac.uk USENET: inei@cs.glasgow.uucp