2013年5月7日 星期二

Samba issue with getaddrinfo

Issue:
Samba has the under log. Can’t get ip address from interface, for example eth0.
This may cause some unexpect wrong issue. like printer in samba can’t work add driver in WinXP. (But Win7 is workable)
   1: [xxxxxxxxxx] ../lib/util/util_net.c:70(interpret_string_addr_internal) interpret_string_addr_internal: getaddrinfo failed for name eth0 [Unknown host]
   2: [xxxxxxxxxx] lib/interface.c:390(interpret_interface) interpret_interface: Can't find address for eth0
   3: [xxxxxxxxxx] lib/interface.c:543(load_interfaces) WARNING: no network interfaces found
Enviroment:
Linux Kernel: V2.6.32.5
Samba3: V3.6.3
gcc: V3.4

Cause:
Because gcc 3.4 don’t have getaddrinfo library function. And default in samba always return –1 when gcc don’t support this function.

Solution:
Using getaddrinfo by samba.
Add line 3 to samba.3.6.3/source3/include/config.h And make again.
   1: /* Whether iface ifconf is available */
   2: /* #undef HAVE_IFACE_IFCONF */
   3: #define HAVE_IFACE_IFCONF 1

2013年5月3日 星期五

busybox V1.19.4 lpd can’t start

busybox v1.19.4 lpd help messages show as under
   1: nas1203> lpd --help
   2: BusyBox v1.19.4 (2013-03-28 18:28:43 CST) multi-call binary.   3:  
   4: Usage: lpd SPOOLDIR [HELPER [ARGS]]   5:  
   6: SPOOLDIR must contain (symlinks to) device nodes or directories
   7: with names matching print queue names. In the first case, jobs are
   8: sent directly to the device. Otherwise each job is stored in queue
   9: directory and HELPER program is called. Name of file to print
  10: is passed in $DATAFILE variable.
  11: Example:
  12:         tcpsvd -E 0 515 softlimit -m 999999 lpd /var/spool ./print
it told us to use
tcpsvd -E 0 515 softlimit -m 999999 lpd /var/spool ./print
However the command is not correct.
Because tcpsvd command don’t have softlimit and –m parameter.

Change to :
tcpsvd -E 0 515 lpd /var/spool ./print
And make a director named with printer queue name like lp0 in /var/spool
mkdir /var/spool/lp0
chmod 1777 /var/spool/lp0
And don’t forget to add shell file to /var/spool/lp0 named print
   1: #!/bin/sh
   2: cat ./"$DATAFILE" >/dev/lp0
   3: rm -f ./"$DATAFILE"
chmod 555 /var/spool/lp0/print