[sane-devel] Re: saned problems with xinetd

Robert Kleemann robertk@oz.net
Thu, 19 Sep 2002 12:48:13 -0700


Thanks for the help.  I think I'm making progress.

The bash error was due to overly restrictive permissions that I had on
the /root directory. (700 instead of 755) I changed these and the
problem went away.  I also changed #!/bin/bash to #!/bin/sh although
I'm not sure what effect this will have since /bin/sh is just a
symbolic link to /bin/bash

After doing this saned works when called via root!  I'm not sure why
it didn't work before but it must be because I forgot to test some
configuration permutation.

I'd still prefer to run saned as non-root so there are some mysteries
that I have yet to uncover.  Here are some scenarios with their data:

All of the tcpdumps for the following scenarios can be found at:
http://www.kleemann.org/crap/tcpd.tgz

1) If I run saned via xinetd as root via the following shell
   script then everything works.

#!/bin/sh
export SANE_DEBUG_HP=128
export SANE_DEBUG_NET=128
cd /tmp
#exec /usr/sbin/saned 2> saned.$$.stderr | tee saned.$$.stdout
exec /usr/sbin/saned

2) If I try to get debug info by uncommenting the second to last line
   and comment the last line in the script then I get a "argument
   marshalling error (connection reset by peer)" error on the
   client. The /tmp/saned* files are zero length.

3) If I try to run as user saned with the nonredirected version of the
   above script then the client appears to succeed but no network
   scanners are found.  I thought this was a permission problem with a
   device so I added saned to every group that is found in /dev but it
   still didn't work scanner.  This gives saned access to 90% of the
   devices in /dev including: sg*, lp*, usb/scanner*, and usb/lp*

[robert@manny robert]$ scanimage -L
[sanei_debug] Setting debug level of net to 128.
[net] sane_init: authorize = 0x8049240, version_code = 0xbffff50c
[net] sane_init: SANE net backend version 1.0.6 from sane-backends-1.0.7
[net] sane_init: Client has little endian byte order
[net] sane_init: determining sane service port
[net] sane_init: found port 6566
[net] sane_init: searching for config file
[net] sane_init: trying to add localhost
[net] add_device: adding backend localhost
[net] add_device: backend localhost added
[net] sane_init: done reading config
[net] sane_init: evaluating environment variable SANE_NET_HOSTS
[net] sane_init: done
[net] sane_get_devices: local_only = 0
[net] connect_dev: trying to connect to localhost
[net] connect_dev: connection succeeded
[net] connect_dev: sanei_w_init
[net] connect_dev: net_init (user=robert, local version=1.0.3)
[net] connect_dev: freeing init reply (status=Success, remote version=1.0.3)
[net] connect_dev: done
[net] sane_get_devices: finished (0 devices)
device `hp:/dev/usb/scanner0' is a Hewlett-Packard MODELx flatbed scanner
[net] sane_exit: exiting
[net] sane_exit: closing dev 0x80629f8, ctl=3
[net] sane_exit: finished.

4) If I try to get some debugging info by using the "tee" line in the
   script then I get the same marshalling error as root.  So I can't
   get any debug info on why saned is failing.


Any ideas?  Is there some way that I can get more debug info from
saned?  I bet saned is having problems accessing some file due to
permissions but how can I find out what that is?

Robert.