Wykres commitów

104 Commity (1.0.29)

Autor SHA1 Wiadomość Data
Olaf Meeuwissen 5cba3bd465 saned: Fix misleading log messages caused by fall through 2019-08-11 10:37:10 +09:00
Povilas Kanapickas e40596c2a5 Fix -Wimplicit-fallthrough warnings by adding standard annotations 2019-06-30 11:58:32 +03:00
Olaf Meeuwissen f9a76395da saned: Fix typo in help message 2017-09-29 21:48:14 +09:00
Luiz Angelo Daros de Luca 5288dd5f61 saned: reorganize flags, remove run_mode SANED_RUN_DEBUG
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>
2017-09-29 20:43:36 +09:00
Farid Benamrouche 1f68d8d8c4 saned: Cancel scan if data connection appears to have gone away
The data connection timeout default to 4000ms but is configurable
in saned.conf.

See Alioth 315765
2017-09-07 22:37:31 +09:00
Luiz Angelo Daros de Luca fc57a5a6a5 saned: fix --debug help message (output is stderr)
Man page was correct.

Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2017-07-29 17:54:01 +09:00
Olaf Meeuwissen 23891a2646 .editorconfig: trim trailing whitespace 2017-05-29 21:14:29 +09:00
Olaf Meeuwissen 4289693982 Address memory corruption and information leakage.
Addresses CVE-2017-6318, Alioth#315576 and Debian's BTS#854804.
2017-03-20 20:54:08 +09:00
Olaf Meeuwissen 23f052113b saned: fix [-Wunused-parameter] compiler warning
The `__sane_unused__` attribute has been moved from sanei_backend.h to
sanei.h to make it generally useful instead of limited to backends.
2016-09-04 12:50:19 +09:00
Yurii Kolesnykov 00984cd111 Fix compilation of saned.c under OS X 2016-06-25 10:53:15 +09:00
Olaf Meeuwissen f3471c2ca6 saned: Use system header IPv6 test macros if available
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.
2016-01-02 17:50:34 +09:00
Olaf Meeuwissen cadb4b0fff saned: fix [-Wmaybe-uninitialized] compiler warning 2015-12-27 18:41:55 +09:00
Olaf Meeuwissen 18e4c4a086 Revert "Prevent use of uninitialized variable"
This change introduces a variable that shadows the file scope one.

This reverts commit 45e66aee95.
2015-10-13 23:32:40 +09:00
Olaf Meeuwissen 36876a8366 saned: minor improvement of help message wording 2015-10-12 20:55:19 +09:00
Olaf Meeuwissen 32986192bd fix: declaration-after-statement warning 2015-10-12 20:49:55 +09:00
Olaf Meeuwissen 42aa01e4e5 fix: missing-field-initializers warning 2015-10-12 20:49:55 +09:00
Olaf Meeuwissen fa001c2193 Follow getopt_long usage in scanimage.c
This is on the off chance that getopt_long is not in the system's
standard library.
2015-10-12 20:49:07 +09:00
Olaf Meeuwissen 45e66aee95 Prevent use of uninitialized variable 2015-10-12 20:47:43 +09:00
Matteo Croce eab8fd457d saned: add '-b' option to bind to a specific address 2015-10-12 20:25:15 +09:00
Matteo Croce fed2a2cf60 saned: use getopt_long() for option parsing
The help message has been adjusted to match getopt_long conventions.
2015-10-12 20:24:59 +09:00
Matteo Croce 418d1ecea7 saned: move help message to usage() function 2015-10-12 17:11:49 +09:00
Matteo Croce a79cd0abe7 saned: parse inetd args in main()
move argument parsing logic from run_inetd() to main()
2015-10-12 16:52:01 +09:00
Matteo Croce 2c3cb206ce saned: parse standalone args in main()
move argument parsing logic from run_standalone() to main()
2015-10-12 16:52:01 +09:00
Nils Philippsen fab378a681 Add short help message to saned 2013-07-08 15:09:51 +02:00
Louis Lagendijk 3276babdec Added optional support in saned for systemd socket activation. This will allow for
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.
2013-01-10 20:59:26 +01:00
Pino Toscano 56e39a9080 Define PATH_MAX if needed 2011-03-04 18:19:06 +01:00
Julien BLACHE f7ee384569 Exit the Avahi process on error and when the poll loop terminates 2010-09-16 18:23:12 +02:00
Julien BLACHE ec295e359a Fix standalone polling loop
Not explicitely checking for POLLIN leads to breakage. Unbreak saned.
2009-12-24 17:22:46 +01:00
Julien BLACHE 161ca93aa5 Explicitely check for errors on fds
Previous code checked for no activity (!POLLIN) and would error out with
2 fds and only one active.
2009-08-09 09:31:12 +02:00
Julien BLACHE d3f1f6fa50 Guard sin6 union member by #ifdef ENABLE_IPV6 2009-06-16 15:11:45 +02:00
Julien BLACHE f06cf4770b Fix strict aliasing issues
Strict aliasing warnings can now lead to broken code with gcc 4.4. Replace
various sockaddr casts by unions.
2009-06-16 15:07:00 +02:00
Julien BLACHE d92a20febb Close network fds in the Avahi process
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.
2009-05-06 11:38:16 +02:00
Julien BLACHE f29d2ac068 Explicitly bind IPv6 addresses first. 2009-03-13 17:02:25 +00:00
Ilia Sotnikov 2ddc741dac - Remove unnecessary 'res' variable assignment in check_host()
(AF-indep version)
2009-03-13 11:43:57 +00:00
Julien BLACHE 9cdf75633d Rework Ilia's changes in check_host(). 2009-03-13 08:59:31 +00:00
Ilia Sotnikov 6940d841eb * Allow host checking to proceed if no local name was found 2009-03-12 15:54:00 +00:00
Ilia Sotnikov d32a9420da * Use hstrerror (h_errno) instead of strerror(errno) on gethostbyname()
errors
2009-03-12 12:41:46 +00:00
Julien BLACHE b72c29cd75 Make sure backends can't break the network dialog and crash the remote net
backend by writing to stdin/stdout/stderr.
2009-03-02 11:21:52 +00:00
Chris Bagwell 70f3fdfba4 * acinclude.m4, backend/*.[ch], tools/*.[ch], frontend/*.[ch]:
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.
2009-02-26 03:15:43 +00:00
Julien BLACHE 25818023c6 Fix handling of Avahi server restart. 2009-02-18 13:19:51 +00:00
Chris Bagwell 0330a4d416 * aclocalm4: fix prototype of internal strcasestr and usleep.
* 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.
2009-02-02 03:17:32 +00:00
Chris Bagwell 907cbe7ac6 Replace usage of getgrouplist() with
getgrent() and friends.  getgrouplist is not posix and not
on several platforms including cygwin.
2009-01-31 02:18:41 +00:00
Chris Bagwell b52b0c0c14 * backend/epson2.c backend/pixma_bjnp.c, include/sane/sanei_backend.h,
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.
2009-01-29 15:10:19 +00:00
Julien BLACHE b9807541c7 Add a data_portrange configuration file option to saned. 2008-12-12 15:51:15 +00:00
Julien BLACHE 3dfc5881ea Fix crasher typo in IPv4-only code. 2008-12-12 15:29:59 +00:00
Julien BLACHE 383947f31d Fix erroneous comment. 2008-12-12 15:29:10 +00:00
Julien BLACHE 9f7441d267 Initialize ngroups to 0, ditto for runas_{u,g}id (instead of -1). 2008-08-05 09:27:39 +00:00
Julien BLACHE 32b343dcea Set supplemental group list in addition to setting euid and egid. Reported by Cameron Hutchison. 2008-07-31 09:42:33 +00:00
Julien BLACHE 125ed414d4 Call setegid() before seteuid(), aka while we're still root. 2008-07-28 10:48:41 +00:00
Julien BLACHE 0ec211ef87 Rework error/exit path in process_request() to properly terminate the Avahi thread in debug mode. 2008-06-24 19:41:44 +00:00