sane-project-website/old-archive/2000-11/0233.html

422 wiersze
13 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>sane-devel: Re: Patches for saned/net/scanimage/user-authorizat</TITLE>
<META NAME="Author" CONTENT="Henning Meier-Geinitz (hmg-ml@gmx.de)">
<META NAME="Subject" CONTENT="Re: Patches for saned/net/scanimage/user-authorization....">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Re: Patches for saned/net/scanimage/user-authorization....</H1>
<!-- received="Sat Nov 18 11:16:59 2000" -->
<!-- isoreceived="20001118191659" -->
<!-- sent="Sat, 18 Nov 2000 20:33:09 +0100" -->
<!-- isosent="20001118193309" -->
<!-- name="Henning Meier-Geinitz" -->
<!-- email="hmg-ml@gmx.de" -->
<!-- subject="Re: Patches for saned/net/scanimage/user-authorization...." -->
<!-- id="20001118203309.A20821@vortex.swb.de" -->
<!-- inreplyto="3A1509EB.17079626@gno.de" -->
<STRONG>From:</STRONG> Henning Meier-Geinitz (<A HREF="mailto:hmg-ml@gmx.de?Subject=Re:%20Patches%20for%20saned/net/scanimage/user-authorization....&In-Reply-To=&lt;20001118203309.A20821@vortex.swb.de&gt;"><EM>hmg-ml@gmx.de</EM></A>)<BR>
<STRONG>Date:</STRONG> Sat Nov 18 2000 - 11:33:09 PST
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0234.html">Oliver Neukum: "Re: Linux Support for Current Microtek Scanners"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0232.html">Henning Meier-Geinitz: "Compilation status"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0216.html">Jochen Eisinger: "Patches for saned/net/scanimage/user-authorization...."</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0235.html">Jochen Eisinger: "Re: Patches for saned/net/scanimage/user-authorization...."</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0235.html">Jochen Eisinger: "Re: Patches for saned/net/scanimage/user-authorization...."</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#233">[ date ]</A>
<A HREF="index.html#233">[ thread ]</A>
<A HREF="subject.html#233">[ subject ]</A>
<A HREF="author.html#233">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi,
<BR>
<P>First: Compilation, installation and testing with saned and scanimage
<BR>
results:
<BR>
<P>****************************************************************************
<BR>
Linux 2.2 i386
<BR>
everything works
<BR>
****************************************************************************
<BR>
<P>****************************************************************************
<BR>
Sun Solaris with gcc:
<BR>
gcc -c -DHAVE_CONFIG_H -I. -I. -I../include -I../include -D_GNU_SOURCE
<BR>
-DPATH_SANE_CONFIG_DIR=/tmp/sane-bin/etc/sane.d
<BR>
-DPATH_SANE_DATA_DIR=/tmp/sane-bin/share -DV_MAJOR=1 -DV_MINOR=0 -g
<BR>
-O2 -W -Wall -Wstrict-prototypes -Wreturn-type -Wcast-align
<BR>
-Wpointer-arith -Wcast-qual -ansi -pedantic -DSCSIBUFFERSIZE=131072
<BR>
sanei_auth.c -fPIC -DPIC -o .libs/sanei_auth.lo
<BR>
In file included from sanei_auth.c:43:
<BR>
../include/sane/config.h:371: warning: function declaration isn't a
<BR>
prototype
<BR>
../include/sane/config.h:376: warning: function declaration isn't a
<BR>
prototype
<BR>
sanei_auth.c: In function sanei_authorize':
<BR>
sanei_auth.c:194: warning: implicit declaration of function index'
<BR>
sanei_auth.c:194: invalid operands to binary -
<BR>
sanei_auth.c:223: warning: unsigned int format, long unsigned int arg
<BR>
(arg 4)
<BR>
sanei_auth.c:223: warning: long unsigned int format, unsigned int arg
<BR>
(arg 6)
<BR>
sanei_auth.c:238: invalid operands to binary -
<BR>
sanei_auth.c:241: warning: assignment makes pointer from integer
<BR>
without a cast
<BR>
sanei_auth.c:244: invalid operands to binary -
<BR>
sanei_auth.c:247: warning: assignment makes pointer from integer
<BR>
without a cast
<BR>
gmake[1]: *** [sanei_auth.o] Error 1
<BR>
<P>The problem is that strings.h is not included. From man index:
<BR>
SYNOPSIS
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;#include &lt;strings.h&gt;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char *index(const char *s, int c);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;char *rindex(const char *s, int c);
<BR>
<P>Adding #include &lt;strings.h&gt; works. So add a test to
<BR>
configure.in/config.h for strings.h?
<BR>
<P>Then in scanimage.c:
<BR>
gcc -c -DHAVE_CONFIG_H -I. -I. -I../include -I../include
<BR>
-I/usr/local/include -D_GNU_SOURCE
<BR>
-DPATH_SANE_CONFIG_DIR=/tmp/sane-bin/etc/sane.d
<BR>
-DPATH_SANE_DATA_DIR=/tmp/sane-bin/share -DV_MAJOR=1
<BR>
-DV_MINOR=0 -g -O2 -W -Wall -Wstrict-prototypes -Wreturn-type
<BR>
-Wcast-align -Wpointer-arith -Wcast-qual -ansi -pedantic
<BR>
-DSCSIBUFFERSIZE=131072 scanimage.c
<BR>
In file included from scanimage.c:25:
<BR>
../include/sane/config.h:371: warning: function declaration isn't a
<BR>
prototype
<BR>
../include/sane/config.h:376: warning: function declaration isn't a
<BR>
prototype
<BR>
In file included from scanimage.c:29:
<BR>
../include/getopt.h:104: warning: function declaration isn't a prototype
<BR>
scanimage.c: In function auth_callback':
<BR>
scanimage.c:148: warning: implicit declaration of function index'
<BR>
scanimage.c:148: invalid operands to binary -
<BR>
scanimage.c:154: warning: passing arg 2 of strncpy' makes pointer from
<BR>
integer without a cast
<BR>
scanimage.c:160: warning: passing arg 2 of strncpy' makes pointer from
<BR>
integer without a cast
<BR>
scanimage.c: In function fetch_options':
<BR>
scanimage.c:682: warning: cast discards qualifiers from pointer target
<BR>
type
<BR>
scanimage.c: In function process_backend_option':
<BR>
scanimage.c:872: warning: cast discards qualifiers from pointer target
<BR>
type
<BR>
gmake[1]: *** [scanimage.o] Error 1
<BR>
<P>Same problem, same solution.
<BR>
Also saned:
<BR>
gcc -c -DHAVE_CONFIG_H -I. -I. -I../include -I../include
<BR>
-I/usr/local/include -D_GNU_SOURCE
<BR>
-DPATH_SANE_CONFIG_DIR=/tmp/sane-bin/etc/sane.d
<BR>
-DPATH_SANE_DATA_DIR=/tmp/sane-bin/share -DV_MAJOR=1
<BR>
-DV_MINOR=0 -g -O2 -W -Wall -Wstrict-prototypes -Wreturn-type
<BR>
-Wcast-align -Wpointer-arith -Wcast-qual -ansi -pedantic
<BR>
-DSCSIBUFFERSIZE=131072 saned.c
<BR>
In file included from saned.c:27:
<BR>
../include/sane/config.h:371: warning: function declaration isn't a
<BR>
prototype
<BR>
../include/sane/config.h:376: warning: function declaration isn't a
<BR>
prototype
<BR>
saned.c: In function auth_callback':
<BR>
saned.c:173: warning: cast discards qualifiers from pointer target type
<BR>
saned.c:183: warning: cast discards qualifiers from pointer target type
<BR>
saned.c:194: warning: cast discards qualifiers from pointer target type
<BR>
saned.c: In function decode_handle':
<BR>
saned.c:312: warning: comparison between signed and unsigned
<BR>
saned.c: In function store_reclen':
<BR>
saned.c:539: warning: comparison between signed and unsigned
<BR>
saned.c:542: warning: comparison between signed and unsigned
<BR>
saned.c:545: warning: comparison between signed and unsigned
<BR>
saned.c:548: warning: comparison between signed and unsigned
<BR>
saned.c: In function do_scan':
<BR>
saned.c:651: warning: comparison between signed and unsigned
<BR>
saned.c:665: warning: comparison between signed and unsigned
<BR>
saned.c: In function process_request':
<BR>
saned.c:744: warning: implicit declaration of function index'
<BR>
saned.c:745: invalid type argument of unary *'
<BR>
saned.c:807: warning: cast discards qualifiers from pointer target type
<BR>
saned.c:823: warning: comparison between signed and unsigned
<BR>
saned.c: In function main':
<BR>
saned.c:984: warning: passing arg 4 of setsockopt' from incompatible pointer type
<BR>
gmake[1]: *** [saned.o] Error 1
<BR>
<P>Same problem, same solution :-)
<BR>
After adding these three #include &lt;strings.h&gt; lines, everything works.
<BR>
<P>****************************************************************************
<BR>
<P>****************************************************************************
<BR>
Irix 6.2 with SGI cc:
<BR>
cc -c -DHAVE_CONFIG_H -I. -I. -I../include -I../include -D_GNU_SOURCE
<BR>
-DPATH_SANE_CONFIG_DIR=/tmp/sane-bin/etc/sane.d
<BR>
-DPATH_SANE_DATA_DIR=/tmp/sane-bin/share -DV_MAJOR=1 -DV_MINOR=0 -g
<BR>
-DSCSIBUFFERSIZE=131072 sanei_auth.c -DPIC -o .libs/sanei_auth.lo
<BR>
cfe: Error: sanei_auth.c, line 194: Unacceptable operand of '-'.
<BR>
&nbsp;&nbsp;if (((index (line, ':')) - line) == (signed) strlen (resource))
<BR>
---------------------------^
<BR>
cfe: Error: sanei_auth.c, line 238: Unacceptable operand of '-'.
<BR>
&nbsp;&nbsp;(((index (line, ':')) - line) == (signed) strlen (resource)))
<BR>
------------------------^
<BR>
cfe: Warning 712: sanei_auth.c, line 241: illegal combination of pointer and integer
<BR>
&nbsp;&nbsp;linep = index (line, ':') + 1;
<BR>
--------^
<BR>
cfe: Error: sanei_auth.c, line 244: Unacceptable operand of '-'.
<BR>
&nbsp;&nbsp;(((index (linep, ':')) - linep) == (signed) strlen (username)))
<BR>
-----------------------------^
<BR>
cfe: Warning 712: sanei_auth.c, line 247: illegal combination of pointer and integer
<BR>
&nbsp;&nbsp;linep = index (linep, ':') + 1;
<BR>
------------^
<BR>
gmake[1]: *** [sanei_auth.o] Error 1
<BR>
<P>For Irix, the man page says index is in string.h. But that's untrue.
<BR>
The compiler doesn't find a prototype and uses a return type of int.
<BR>
Thtat's the source of the error (you can't do (int) - (char *). Took
<BR>
me some time to find out :-)
<BR>
Changing string.h to strings.h in sanei_auth.c, saned.c and scanimage.c
<BR>
works.
<BR>
<P>****************************************************************************
<BR>
AIX with gcc:
<BR>
Works.
<BR>
****************************************************************************
<BR>
<P>index() is also used in mustek_pp (maybe others) so we should look a bit
<BR>
more at this. You don't seem to use pointer arithmetics (or in a
<BR>
different way) in mustek_pp so probably this is why the compilers
<BR>
don't bail out there.
<BR>
<P>On Fri, Nov 17, 2000 at 11:35:23AM +0100, Jochen Eisinger wrote:
<BR>
<EM>&gt; SANE Standard (then 1.0.2)
</EM><BR>
<P>I think this small change is acceptable. Have anyone used authorization
<BR>
at all until now?
<BR>
<P>The concept looks ok but I didn't look into the details (and I'm not an
<BR>
expert in encryption things).
<BR>
<P><EM>&gt; lib/md5.c include/md5.h include/sane/sanei_auth.h sanei/sanei_auth.c:
</EM><BR>
<P>mhh, ugly k&amp;r style C :-). Seems to work however.
<BR>
<P><EM>&gt; frontend/scanimage.c frontend/saned.c doc/saned.man doc/scanimage.man:
</EM><BR>
<EM>&gt;
</EM><BR>
<EM>&gt; furthermore, I've modified scanimage to handle such requests... if a
</EM><BR>
<EM>&gt; file ~/.sane/pass exists, it is used to automate the process
</EM><BR>
<EM>&gt; (permissions must be 0600 at least, the format is the same as for
</EM><BR>
<EM>&gt; sanei_authorize). To make sure the frontend isn't replying to old
</EM><BR>
<EM>&gt; unsecures password-request, you can use the command-line option
</EM><BR>
<EM>&gt; --accept-md5-only.
</EM><BR>
<P>The output
<BR>
[resource] user:
<BR>
may be a bit confusing because the debug output uses a similar form.
<BR>
Can we use a more detailed output like:
<BR>
&quot;Authentification required for resource %s. Enter username: &quot;
<BR>
&quot;Enter password:&quot;
<BR>
<P><EM>&gt; please send feedback!!
</EM><BR>
<P>In my opinion you can add the changes to CVS when the index problems
<BR>
are resolved.
<BR>
<P>Bye,
<BR>
&nbsp;&nbsp;Henning
<BR>
<P><PRE>
--
Source code, list archive, and docs: <A HREF="http://www.mostang.com/sane/">http://www.mostang.com/sane/</A>
To unsubscribe: echo unsubscribe sane-devel | mail <A HREF="mailto:majordomo@mostang.com?Subject=Re:%20Patches%20for%20saned/net/scanimage/user-authorization....&In-Reply-To=&lt;20001118203309.A20821@vortex.swb.de&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0234.html">Oliver Neukum: "Re: Linux Support for Current Microtek Scanners"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0232.html">Henning Meier-Geinitz: "Compilation status"</A>
<LI><STRONG>In reply to:</STRONG> <A HREF="0216.html">Jochen Eisinger: "Patches for saned/net/scanimage/user-authorization...."</A>
<!-- nextthread="start" -->
<LI><STRONG>Next in thread:</STRONG> <A HREF="0235.html">Jochen Eisinger: "Re: Patches for saned/net/scanimage/user-authorization...."</A>
<LI><STRONG>Reply:</STRONG> <A HREF="0235.html">Jochen Eisinger: "Re: Patches for saned/net/scanimage/user-authorization...."</A>
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#233">[ date ]</A>
<A HREF="index.html#233">[ thread ]</A>
<A HREF="subject.html#233">[ subject ]</A>
<A HREF="author.html#233">[ author ]</A>
</UL>
<!-- trailer="footer" -->
<HR NOSHADE>
<P>
<SMALL>
<EM>
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
: <EM>Sat Nov 18 2000 - 11:17:34 PST</EM>
</EM>
</SMALL>
</BODY>
</HTML>