David wrote:
> 
> Hello Alessandro,
> 
> Thanks for all your support on this.
> 
> ldd output:
> 
> ldd /usr/local/libexec/courier-authlib/authdaemond
>        libsocket.so.1 =>        /usr/lib/libsocket.so.1
>        libltdl.so.3 =>  /usr/local/lib/libltdl.so.3
>        libdl.so.1 =>    /usr/lib/libdl.so.1
>        libcourierauthcommon.so.0 =>
> /usr/local/lib/libcourierauthcommon.so.0
>        libcourierauth.so.0 =>   /usr/local/lib/libcourierauth.so.0
>        libc.so.1 =>     /usr/local/lib/libc.so.1
>        libgcc_s.so.1 =>         /usr/local/lib/libgcc_s.so.1
>        libnsl.so.1 =>   /usr/lib/libnsl.so.1
>        libcrypt_i.so.1 =>       /usr/local/lib/libcrypt_i.so.1
>        libmp.so.2 =>    /usr/lib/libmp.so.2
>        libgen.so.1 =>   /usr/lib/libgen.so.1
> 
> ldd crypttest
>        libc.so.1 =>     /usr/local/lib/libc.so.1
>        libdl.so.1 =>    /usr/lib/libdl.so.1
> 
> Same libraries are being linked.

Apparently yes... However the more I think about it the more I suspect
of linking. Also because of the man page

> ERRORS
>     The crypt() function will fail if: 
> 
>     EINVAL
>           An entry in crypt.conf is invalid. 
> 
>     ELIBACC
>           The required shared library was not found. 
> 
>     ENOMEM
>           There is insufficient memory to generate the hash. 
> 
>     ENOSYS
>           The functionality is not supported on this system. 

To check if that's really the case, you might patch checkpassword.c with
the attached file to learn what error does crypt fail for.
(make + make install should suffice after that)

> I can run the crypttest program as a regular user and it works as expected.
> 
> I don't know where to look next.  As a last resort, I will probably just
> reinstall my server with solaris 8 x86 instead of the 9 x86.

Alternatively, reconfigure authlib to use solaris linker and try rebuilding
with that. To reconfigure you should amend the top level configure so that
it reads

   case `$LD -V 2>&1` in

instead of

   case `$LD -V` in

at line 25767.

Good luck!
Ale

>  - David
> 
> Alessandro Vesely writes:
> 
> > Hi David,
> >
> >
> > David wrote:
> >>
> >> Hi Alessandro,
> >>
> >> I just realized that my email client was translating some of the test
> >> program source as smileys.
> >
> > :-)
> >
> >> I have saved the code as an attachment and it
> >> compiles fine as you sent it.
> >>
> >> >gcc crypttest.c
> >> crypttest.c: In function `main':
> >> crypttest.c:8: warning: initialization makes pointer from integer without a
> >> cast
> >> > a.out
> >> r=ba4TuD1iozTxw
> >
> > So it doesn't fail in this case. However, truss clearly said it did in 
> > authdaemond.
> > Please check "man -s 3c crypt" on your system: it should be different than 
> > mine,
> > for I have no /etc/security/crypt.conf either.
> >
> > Try running the crypttest as courier user. It should still not fail, since 
> > any
> > user must be able to use crypt for logging in...
> >
> > Another check that can be done is using ldd to make sure crypttest and
> > /usr/local/libexec/courier-authlib/authdaemond link to the same libc.so.
> >
> >> I read through the config.log file for courier-authlib and found this
> >> regarding crypt:
> >>
> >>
> >> configure:25432: checking for crypt() prototype
> >> configure:25462: gcc -c -I/var/vpop/include -g -O2 -Wall -I.. -I./..
> >> conftest.c >&5
> >> conftest.c:53: error: conflicting types for 'crypt'
> >> /usr/include/crypt.h:29: error: previous declaration of 'crypt' was here
> >> conftest.c:53: error: conflicting types for 'crypt'
> >> /usr/include/crypt.h:29: error: previous declaration of 'crypt' was here
> >> configure:25468: $? = 1
> >> [...]
> >
> > Yes, for some arcane reason there are conflicting declarations of crypt.
> > Probably, including crypt.h instead of unistd.h I could avoid that compile
> > time warning. However, this does not change the way the crypt function in
> > libc is invoked.
> >
> >
> > -------------------------------------------------------
> > This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
> > Tool for open source databases. Create drag-&-drop reports. Save time
> > by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
> > Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> > _______________________________________________
> > courier-users mailing list
> > courier-users@lists.sourceforge.net
> > Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
>
--- checkpassword.original.c    2004-10-21 02:10:49.000000000 +0200
+++ checkpassword.c     2005-01-19 23:44:13.365621000 +0100
@@ -15,6 +15,8 @@
 #endif
 #include       "auth.h"
 #include       "courierauthdebug.h"
+#include <stdio.h>
+#include <errno.h>
 
 static const char rcsid[]="$Id: checkpassword.c,v 1.11 2004/10/21 00:10:49 
mrsam Exp $";
 
@@ -47,14 +49,20 @@
                return (authcheckpasswordsha1(password, encrypted_password));
 #endif
 
-       return (
 #if    HAVE_CRYPT
-               strcmp(encrypted_password,
-                       crypt(password, encrypted_password))
+       {
+               char *r = crypt(password, encrypted_password);
+               if (r == NULL)
+               {
+                       fprintf(stderr, "ERR: crypt failed with errno %d: %s\n",
+                               errno, strerror(errno));
+                       return -1;
+               }
+               return strcmp(encrypted_password, r);
+       }
 #else
-               strcmp(encrypted_password, password)
+       return strcmp(encrypted_password, password);
 #endif
-                               );
 }
 
 int authcheckpassword(const char *password, const char *encrypted_password)

Reply via email to