[sane-devel] Forward: saned problems with xinetd

Robert Kleemann robertk at oz.net
Thu Sep 19 00:15:36 BST 2002


I've been banging my head on this all afternoon so it's time to seek
help.

Summary: saned runs fine as a standalone server (saned -d128) but
fails when run from xinetd.

I'm running the redhat 7.3 dist with all updates:
$ rpm -qa | grep sane
sane-frontends-1.0.7-2
xsane-0.84-2
sane-backends-1.0.7-6.1
xsane-gimp-0.84-2

Local scanning with the HP 5200C (usb) works fine.

I setup network scanning as follows:
- added a saned user and group
- added a scanner group and changed appropriate /dev/usb/scanner*
  perms
- added saned to group scanner
- modified /etc/security/console.perms so changes above changes won't
  get mucked on reboot
- added localhost, and the names of all LAN machines to
  /etc/sane.d/saned.conf
- added localhost to /etc/saned.conf/net.conf

- created /etc/xinetd.d/sane as follows:

# default: off
# description: The sane server accepts requests
# for network access to a local scanner via the
# network.
service sane
{
	disable	= no
	socket_type = stream
	wait        = no
	user        = saned
	group       = saned
	server      = /usr/local/sbin/saned2
	port        = 6566
}

Note: /usr/local/sbin/saned2 is just a wrapper that calls
/usr/sbin/saned which allows me to verify that xinetd is calling it,
add debug options etc.

- added "sane 6566/tcp # SANE network scanner daemon" to /etc/services
- verified that /etc/hosts.allow /etc/hosts.deny allow access

Results:

- "telnet localhost 6566" connects with no problem
- "scanimage -L" only shows the local scanner (not the net scanner)
- adding debugging info to /usr/local/sbin/saned shows that it is in
  fact being called.  Adding debug stuff to this
  (e.g. SANE_DEBUG_NET=128) does nothing.

- If I stop xinetd, log in as the saned user, and run "/usr/sbin/saned
  -d128" Then scanimage -L lists the net printer.  Rerunning saned
  allows me to successfully scan an image.

The exact same behavior is seen if I use a different machine as a
client.

I ran the clients with SANE_DEBUG_NET=128 and notice the following
differences:

(when saned is run from xinetd)
$ export SANE_DEBUG_NET=128 ; scanimage -L
[sanei_debug] Setting debug level of net to 128.
[net] sane_init: authorize = 0x8049240, version_code = 0xbffff4fc
[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=Unknown SANE status code 794978670, remote version=47.98.24947)
[net] connect_dev: access to localhost denied
[net] connect_dev: closing connection to localhost
[net] sane_get_devices: ignoring failure to connect to localhost
[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=-1
[net] sane_exit: finished.

(when saned is run as user saned via "saned -d128")
$ export SANE_DEBUG_NET=128 ; scanimage -L
[sanei_debug] Setting debug level of net to 128.
[net] sane_init: authorize = 0x8049240, version_code = 0xbffff4fc
[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: got localhost:hp:/dev/usb/scanner0
[net] sane_get_devices: finished (1 devices)
device `hp:/dev/usb/scanner0' is a Hewlett-Packard MODELx flatbed scanner
device `net:localhost: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.

The key difference are the two lines:
from xinetd:
[net] connect_dev: freeing init reply (status=Unknown SANE status code 794978670, remote version=47.98.24947)
from debug daemon: 
[net] connect_dev: freeing init reply (status=Success, remote version=1.0.3)

Does anyone have any idea what might be causing this?  Obviously, the
"saned -d128" solution doesn't work since I have to re-run it after
each request.  I'm willing to debug if someone can give me a place to
start.

Robert.



More information about the sane-devel mailing list