Flags like -a, -d and -s have many overlap effects. This patch restricts
the effect of flags to a simple action.
New -u (user) flag replaces -a optional argument for running saned as a different user.
The code that retrieve the user info and drop privileges migrated to runas_user().
As a side effect, PID file can be created even if getting user info fails.
New -l (listen) flag sets run_mode to standalone.
New -D (daemonize) flag daemonizes saned after bind.
New -o (once) make saned exit after the first client disconnects.
Flag -s (syslog) is gone. Previous behavior can be reproduced with '-a -d level -o -f'.
New -e (stderr) flag for redirecting output to stderr, instead of syslog.
Flag -d (debug) now only sets the debug level and argument is required. Previous behavior
can be reproduced with '-a -d level -o -f -e'.
The run_mode SANED_RUN_DEBUG and SANED_RUN_ALONE shared most of its code
path. With the new flags dealing with their difference, SANED_RUN_DEBUG is gone.
Flag '-a' still works as before but it can be replaced by '-l -D -u user'.
Current uses of -d (debug) or -s (syslog) will break.
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
This should fix [-Wstrict-aliasing] compiler warnings on those systems
where the IN6_IS_ADDR_LOOPBACK and IN6_IS_ADDR_V4MAPPED macros exist.
POSIX.1-2001 states that they shall be defined in netinit/in.h so most
systems will probably have them.
using backend debugging using SANE_DEBUG_xxx to be used for saned controlled
scanning when using socket activation. When only the socket is received we
use the existing code path.
Network fds are of no use to the Avahi process and can cause the net
backend to hang when saned is run in debug mode.
This only happens if the net backend tries to connect to saned a second
time and manages to establish the connection before saned has completed
its shutdown.
There is some potential for this to also occur when saned is run in
standalone mode but it's far less probable as the window is a lot smaller.
Global replace of u_int??_t with C9x standard based uintxx_t
in order to remove some tricky and overlapping portability logic
from acinclude.m4 and leave it in only m4/stdint.m4.
* configure.in: Group all USB logic together and all SCSI
logic together to aid understanding of whats no longer
valid. Allow sharing enable/disable options between all
USB drivers on multiple platforms. Combined CAM_LIBS and
SCSI_LIBS since they are mutually exclusive.
Skip some USB/SCSI checks when previous tests show it will always fail.
* backend/Makefile.am, tools/Makefile.in: Combine CAM_LIBS and
SCSI_LIBS. Add missing SOCKET_LIBS to epson2. Add USB_LIB.
* saned.c: Add limits.h for PATH_MAX.
sanei/sanei_tcp.c, sanie/sanei_udp.c: Improve portablity by
removing usage of MSG_WAITALL since not all platforms support
that (cygwin). Default is to be blocking anyways. Changed
usage of MSG_NOTWAIT to use fcntl() function as needed as well.
* configure.in, lib/Makefile.in, lib/strcasestr.c: Add internal
strcasestr() for platforms missing it (cygwin).
* pixma_common.c: My source match header prototype for picky
compilers (cygwin).
* backend/umax_pp_mid.c: Allow BACKEND_NAME to be filename
yet debug to be SANE_DEBUG_UMAX_PP to match man page.