[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Compile error with gcc 3.3.1 on solaris 8



Erm,

Problem solved with the help of the mailing list; half the problem is knowing what you need to be searching for :).  Anyway, apparently there are namespace collisions between the OpenSSL crypt functions and the standard Solaris libcrypt functions.  And if you want Kerberos and lmpasswd, you have to modify the headers a little bit.  Below are diffs for the files I changed.

Caveat: I'm no programmer so use at your own risk if needed :)

References:
http://www.openldap.org/lists/openldap-software/200302/msg01024.html
http://www.openldap.org/lists/openldap-software/199910/msg00087.html

Environment (note I had to add -DOPENSSL_DISABLE_OLD_DES_SUPPORT):
CPPFLAGS="-DOPENSSL_DISABLE_OLD_DES_SUPPORT -I/usr/local/ssl/include -I/usr/local/BerkeleyDB.4.1/include"
LDFLAGS="-L/usr/local/ssl/lib -L/usr/local/BerkeleyDB.4.1/lib"
export LDFLAGS CPPFLAGS CFLAGS LD_LIBRARY_PATH

libraries/liblutil/passwd.c diff (since I added -DOPENSSL_DISABLE_OLD_DES_SUPPORT to above, I had to add three functions from openssl/old_des.h):
--- libraries/liblutil/passwd.c.orig    2003-10-20 10:58:58.770667000 -0400
+++ libraries/liblutil/passwd.c 2003-10-20 16:28:26.943104000 -0400
@@ -48,6 +48,16 @@

 #ifdef SLAPD_CRYPT
 # include <ac/crypt.h>
+/* due to -DOPENSSL_DISABLE_OLD_DES_SUPPORT, you have to add
+ * these functions here because /usr/local/ssl/include/openssl/des_old.h
+ * is not automatically included.
+ */
+#define des_ecb_encrypt(i,o,k,e)\
+        DES_ecb_encrypt((i),(o),&(k),(e))
+#define des_set_odd_parity(k)\
+        DES_set_odd_parity((k))
+#define des_set_key_unchecked(k,ks)\
+        DES_set_key_unchecked((k),&(ks))

 # if defined( HAVE_GETPWNAM ) && defined( HAVE_PW_PASSWD )
 #  ifdef HAVE_SHADOW_H
@@ -696,7 +706,7 @@

 static void lmPasswd_to_key(
        const unsigned char *lmPasswd,
-       des_cblock *key)
+       DES_cblock *key)
 {
        /* make room for parity bits */
        ((char *)key)[0] = lmPasswd[0];
@@ -718,10 +728,10 @@
 {
        int i;
        char UcasePassword[15];
-       des_cblock key;
-       des_key_schedule schedule;
-       des_cblock StdText = "KGS!@#$%";
-       des_cblock PasswordHash1, PasswordHash2;
+       DES_cblock key;
+       DES_key_schedule schedule;
+       DES_cblock StdText = "KGS!@#$%";
+       DES_cblock PasswordHash1, PasswordHash2;
        char PasswordHash[33], storedPasswordHash[33];

        for( i=0; i<cred->bv_len; i++) {
@@ -1076,7 +1086,7 @@
                return -1;      /* passwd must behave like a string */
        }

-       cr = crypt( cred->bv_val, passwd->bv_val );
+       cr = DES_crypt( cred->bv_val, passwd->bv_val );

        if( cr == NULL || cr[0] == '\0' ) {
                /* salt must have been invalid */
@@ -1147,7 +1157,7 @@
                return -1;
        }

-       cr = crypt(cred->bv_val, pw);
+       cr = DES_crypt(cred->bv_val, pw);

        if( cr == NULL || cr[0] == '\0' ) {
                /* salt must have been invalid */
@@ -1269,10 +1279,10 @@

        int i;
        char UcasePassword[15];
-       des_cblock key;
-       des_key_schedule schedule;
-       des_cblock StdText = "KGS!@#$%";
-       des_cblock PasswordHash1, PasswordHash2;
+       DES_cblock key;
+       DES_key_schedule schedule;
+       DES_cblock StdText = "KGS!@#$%";
+       DES_cblock PasswordHash1, PasswordHash2;
        char PasswordHash[33];
        struct berval hash;

@@ -1347,7 +1357,7 @@
                snprintf( salt, sizeof(entropy), salt_format, entropy );
        }

-       hash.bv_val = crypt( passwd->bv_val, salt );
+       hash.bv_val = DES_crypt( passwd->bv_val, salt );

        if( hash.bv_val == NULL ) return NULL;



On Mon, 20 Oct 2003, Elliot Metsger wrote:

> All,
>
> I'm attempting make openldap-2.1.23, and I'm getting a parse error.  I'm using GCC 3.3.1 on Solaris 8.  Below is my ./configure and my environment variables.  I suspect however that GCC is to blame for this one but I'm wondering if anyone can confirm or has come across the same error.
>
> Thanks,
> Elliot
>
>
> CPPFLAGS="-I/usr/local/ssl/include -I/usr/local/BerkeleyDB.4.1/include"
> LDFLAGS="-L/usr/local/ssl/lib -L/usr/local/BerkeleyDB.4.1/lib"
>
> ./configure --enable-crypt --enable-lmpasswd --enable-spasswd --enable-rewrite --enable-bdb --enable-ldap --enable-meta --enable-monitor --enable-null --enable-perl --enable-shell --with-tls --with-cyrus-sasl --without-x
>
> Making all in /usr/local/src/openldap-2.1.23/libraries
>   Entering subdirectory liblutil
> gcc -g -O2 -I../../include -I../../include   -I/usr/local/ssl/include -I/usr/local/BerkeleyDB.4.1/include  -I/usr/local/ssl/include -I/usr/local/BerkeleyDB.4.1/include -c  passwd.c
> In file included from ../../include/ac/crypt.h:21,
>                  from passwd.c:50:
> /usr/include/crypt.h:22: error: parse error before '(' token
> /usr/include/crypt.h:22: error: parse error before "const"
> *** Error code 1
> make: Fatal error: Command failed for target `passwd.o'
> Current working directory /usr/local/src/openldap-2.1.23/libraries/liblutil
> *** Error code 1
> make: Fatal error: Command failed for target `all-common'
> Current working directory /usr/local/src/openldap-2.1.23/libraries
> *** Error code 1
> make: Fatal error: Command failed for target `all-common'
>