We have seen this from buggy backends that present NULL for constraint
string_lists. This is probably illegal behaviour from backends but we
don't want to crash.
h5400 now checks validity of -l, -t, -x and -y and auto selects a supported resolution.
scanimage now shows the full range for -x and -y despite other selections.
This creates temporary strings that correspond to the colon-delimited
username and password that are read from file in `auth_callback()`.
The null-terminated strings are used directly to determine lengths.
The AX_CXX_COMPILE_STDCXX* macros that were embedded in aclocal.m4
have been replaced with the versions found in the autoconf-archive
package from Debian 9.
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>
The fileno() is only available if its feature test macro passes. The
various symbols are defined appropriately in ../include/sane/config.h
during configuration of the build.
If the ICC profile added does not match the colour format of the
image, libpng will abort. This can leave the scanner motors in an
incorrect state and possibly cause permanent damage.
This cuts out some duplicate code, and enables us to reuse this
logic for PNG, JPEG, and any other future output format.
sanei_load_icc_profile also allows us to know that an ICC profile
file is not long enough before we start to write it to the output;
this should prevent poorly-written software from overflowing into
image data when they read the bad profile based on its length.