Wykres commitów

23 Commity (ad08e768be8842e134cb8334fa0f841a692ba3c8)

Autor SHA1 Wiadomość Data
David Ward 1a933bba7e Cast pointer arguments if needed when using "%p" format specifier
Pointer arguments must have type (void *) when printed with the format
specifier "%p".
2022-03-08 19:00:00 -05:00
Wolfram Sang eb42ad08d5 treewide: use SANE_CURRENT_* macros consistently
Backends use a mixture of SANE_CURRENT_{MAJOR | MINOR} and V_{MAJOR |
MINOR} with all kind of permutations. I was confused by this and one
comment in pieusb.c tells me I was not alone. Some items in old
changelogs suggest to use the SANE_CURRENT_ macros in backends, so let's
switch to do that with the exception of net.c and dll.c. Done with:

$ find backend -name '*.[ch]' | xargs sed -i '/nearly every/ ! { s/\<V_M/SANE_CURRENT_M/g }'
$ git checkout backend/net.c backend/dll.c

And manually removing the comment from pieusb.c. Everything still builds
fine.
2021-06-08 19:01:41 +02:00
pobrn 45f84a569c respect 'local_only' parameter of sane_get_devices()
Certain backends do network scans even if the 'local_only'
parameter for 'sane_get_devices()' is true. Fix that.

Changes:

1. Modify 'sanei_configure_attach()' so that backend specific
   data may be passed to the 'attach()' function.

2. Use this in certain backends to pass the value of the
   'local_only' parameter so that network related activities
   are only carried out when the value is false.
2020-08-12 12:29:38 +02:00
Olaf Meeuwissen 2b4aa45bad Merge branch 'issue11-read_of_uninitialized_data' into '279-confidential-issue'
magicolor: Added security mediation to device discovery

See merge request paddy-hack/backends!2
2020-05-04 08:24:19 +00:00
Ralph Little 07e3834127 magicolor: Added security mediation to device discovery
Extraction of values from the SNMP response were not checked.
Also fixed a bug that mistakenly matched any SNMP OIDs with the
first model in the model list, in function mc_get_device_from_identification().
2020-04-30 23:21:00 -07:00
Ralph Little af0442f15c magicolor: Added security remediation for pixels_per_line.
This implements a security issue reported by GitHub Security Lab.
The details are disclosed in GitLab issue #279.
The issue relates to an invalid scan parameter block being sent to
the backend containing 8 bytes of 0x00 which leads to pixels_per_line
being set to 0. Later arithmetic involves the division by this value
which causes a div by zero crash.
2020-04-26 13:04:41 -07:00
Olaf Meeuwissen 797cd1fb37 epson2, epsonds, kodakaio, magicolor: Don't set invalid value
If the value to be set is not valid, it should not change the sval
structure (even if doing so has no negative side effects).

This also makes the fallthrough less confusing by removing the first
cast of two for the br-x and br-y values.
2019-08-11 10:04:19 +09:00
Povilas Kanapickas e40596c2a5 Fix -Wimplicit-fallthrough warnings by adding standard annotations 2019-06-30 11:58:32 +03:00
Olaf Meeuwissen e04261673f magicolor: Fix [-Wmisleading-indentation] compiler warning
The assumption is that the failure should be returned to the caller.
2017-06-26 17:57:14 +09:00
Olaf Meeuwissen 23891a2646 .editorconfig: trim trailing whitespace 2017-05-29 21:14:29 +09:00
Olaf Meeuwissen 4eaefe4371 magicolor: fix [-Werror] compiler warning
This casts away const-ness in the hope that libsnmp doesn't change
the session.peername.
2016-08-28 15:27:50 +09:00
Olaf Meeuwissen 31ac0db736 magicolor: fix [-Werror=pointer-sign] compiler warnings
The libsnmp API requires a u_char *session.community :-(
2016-08-28 15:25:43 +09:00
Olaf Meeuwissen 26aa8b52f6 magicolor: fix [-Wunused-function] compiler warning
This function is only used when SNMP support is activated.
2015-12-27 18:41:44 +09:00
Olaf Meeuwissen 292dd42bb6 magicolor: fix [-Wunused-but-set-variable] compiler warning 2015-12-27 18:38:50 +09:00
Eduard - Gabriel Munteanu ac1bf8d754 magicolor: add support for magicolor 4690MF
Currently, this works for USB, but the network OID needs to be
filled in properly.

Signed-off-by: Eduard - Gabriel Munteanu <edgmnt@gmail.com>
2015-09-19 12:02:57 -04:00
Eduard - Gabriel Munteanu afd22f7722 magicolor: complete support for duplex ADF
This is needed to fully-support scanners like magicolor 4960MF.

Signed-off-by: Eduard - Gabriel Munteanu <edgmnt@gmail.com>
2015-09-19 12:02:57 -04:00
Eduard - Gabriel Munteanu d0c3b22d7d magicolor: fix USB device detection
Only the generic device was being picked.

Signed-off-by: Eduard - Gabriel Munteanu <edgmnt@gmail.com>
2015-09-19 12:02:57 -04:00
Chris Bagwell 2c4b1da0bf add FreeBSD Port's patches
epson2-commands.c: Include <sys/types.h> to resolve u_long.
epson2.c, magicolor.c, xerox_mfp-tcp.c: Include <sys/types.h>
and to <sys/socket.h> for anyone using setsockopt().
sanei_tcp.h: Include <sys/types.h> since ssize_t is referenced.
sanei_usb.c: Newer FreeBSD version checks.

All changes in this patch set come from FreeBSD ports patches.
Bug #312503.
2011-11-20 20:08:15 -06:00
Reinhold Kainhofer b0058051f0 Magicolor: Fix SNMP detection with multiple snmp agents in the network.
So far, the snmp detection would stop working after the first response, because libsnmp
haved like that if we return 1 in the callback. Since we want multiple responses to one
broadcast query, we don't tell libsnmp that the response has answered our query.
As a drawback, libsnmp will send the same query in 1-second-intervals, and each device
will answer again. So, we have to keep a list of all devices already detected.
2011-09-19 19:28:59 +02:00
Reinhold Kainhofer e7532c03c5 magicolor: Get rid of the byteorder macros, copy the bytes manually to/from little endian
This also fixes some compiler error on 64-bit systems
2011-01-25 21:25:00 +01:00
Reinhold Kainhofer f054a4e8ee magicolor: cast size_t arguments to unsigned long for debug output and use the %lu format 2011-01-20 21:23:51 +01:00
Reinhold Kainhofer 2d9f458992 magicolor: Get rid of compiler warning 2011-01-20 21:23:51 +01:00
Reinhold Kainhofer 6a7888ef26 New backend: magicolor (for KONICA MINOLTA magicolor devices)
-) LAN and USB communication
-) SNMP LAN auto-detection (using libsnmp, added configure check!)
-) Based on the epson2 backend, with many structural changes
-) B/W, Gray, Color scanning works in 150/300/600dpi (full-page
   color scan only possible with <=300dpi)

-) The timeouts (SNMP, scan data, other data) are configurable in the
   magicolor.conf file

-) Keeps list of known scanners in sane_get_devices, does not destroy
   existing handles; Also correctly calls sanei_usb_init.
2011-01-15 22:10:34 +01:00