Bug 636 - "libads/kerberos_verify.c", line 77: improper member use: keyblock
Summary: "libads/kerberos_verify.c", line 77: improper member use: keyblock
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Domain Control (show other bugs)
Version: 3.0.0
Hardware: All Solaris
: P3 regression
Target Milestone: none
Assignee: Volker Lendecke
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-16 05:40 UTC by Eric Boehm
Modified: 2005-11-14 09:30 UTC (History)
2 users (show)

See Also:


Attachments
more portable patch for configure.in (1.87 KB, patch)
2003-10-31 10:36 UTC, Guenther Deschner
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Boehm 2003-10-16 05:40:10 UTC
I'm trying to build Samba 3.0.0 CVS 3.0.1pre2 under Solaris 8 with

MIT Kerberos 5 1.3.1
OpenLDAP 2.1.22

using the Sun Workshop 6U2 compiler

Arguments to configure are:

configured by ./configure, generated by GNU Autoconf 2.53,
  with options \"'--with-readline' '--with-libiconv=/usr/local' '--with-ldap' '-
-with-krb5=/usr/local/kerberos' '--with-ldapsam' '--with-automount' '--with-libs
mbclient' '--with-acl-support' '--with-winbind' '--prefix=/usr/local' 'CC=cc' 'C
FLAGS=-xarch=v9a' 'CPPFLAGS=-I/usr/local/include -I/usr/local/openldap/include -
I/usr/local/sasl/include -I/usr/local/kerberos/include -I/usr/local/BerkeleyDB.4
.1/include -I/usr/local/openssl/include' 'LDFLAGS=-L/usr/local/lib/sparcv9 -L/us
r/local/openldap/lib -L/usr/local/sasl/lib -L/usr/local/kerberos/lib -L/usr/loca
l/BerkeleyDB.4.1/lib -L/usr/local/openssl/lib -R/usr/local/lib/sparcv9 -R/usr/lo
cal/openldap/lib -R/usr/local/sasl/lib -R/usr/local/kerberos/lib -R/usr/local/Be
rkeleyDB.4.1/lib -R/usr/local/openssl/lib'\"


I get the following error trying to compile libads/kerberos_verify.c

"libads/kerberos_verify.c", line 77: improper member use: keyblock

The relevant code below looks okay to me


static krb5_error_code create_keytab(krb5_context context,
                                     krb5_principal host_princ,
                                     char *host_princ_s,
                                     krb5_data password,
                                     krb5_enctype *enctypes,
                                     krb5_keytab *keytab,
                                     char *keytab_name)
{
        krb5_keytab_entry entry;
        krb5_kvno kvno = 1;
        krb5_error_code ret;
        krb5_keyblock *key;
        int i;

[... lines deleted ...]


                entry.keyblock  = *key;

The problem is that the structure member name is key, not keyblock.

From krb5.h

typedef struct krb5_keytab_entry_st {
    krb5_magic magic;
    krb5_principal principal;   /* principal of this key */
    krb5_timestamp timestamp;   /* time entry written to keytable */
    krb5_kvno vno;              /* key version number */
    krb5_keyblock key;          /* the secret key */
} krb5_keytab_entry;

Here's a possible patch

--- libads/kerberos_verify.c~   Tue Oct 14 13:28:27 2003
+++ libads/kerberos_verify.c    Thu Oct 16 08:37:20 2003
@@ -74,7 +74,7 @@
                /* this will have to be detected in configure...heimdal
                   calls it keyblock, MIT calls it key, but it does not
                   matter we are creating keytabs with MIT */
-               entry.keyblock  = *key;
+               entry.key       = *key;
 
                DEBUG(10,("adding keytab-entry for (%s) with encryption type
(%d)\n",
                                host_princ_s, enctypes[i]));
Comment 1 Tim Potter 2003-10-16 21:58:53 UTC
I've checked in a fix for this, but I think there is something else tricky going on.

Let me know how the fix works.
Comment 2 Guenther Deschner 2003-10-31 10:35:12 UTC
Tim, 

your fix will not work with older versions of autoconf
(e.g. 2.53 on UnitedLinux / SuSE SLES 8)

from config.log:

-----------------------------------------------------------

configure:25726: checking for krb5_keytab_entry.keyblock
configure:25753: gcc -c -O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -O
-D_GNU_SOURCE -D_LARGEFILE64_SOURCE  -I
/usr/include/afs -I/usr/include/heimdal -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -I/usr/include/heimdal conftest.c >&5
configure: In function `main':
configure:25744: invalid operands to binary !=
configure:25756: $? = 1
configure: failed program was:
#line 25731 "configure"
#include "confdefs.h"
#include <krb5.h>

#ifdef F77_DUMMY_MAIN
#  ifdef __cplusplus
     extern "C"
#  endif
   int F77_DUMMY_MAIN() { return 1; }
#endif
int
main ()
{
static krb5_keytab_entry ac_aggr;
if (ac_aggr.keyblock)
return 0;
  ;
  return 0;
}
configure:25772: result: no
-----------------------------------------------------------

i think it would be better to check for the key/keyblock-members in the same
manner as it is already done for the other variables (e.g.
HAVE_KRB5_KEYBLOCK_KEYVALUE)
Comment 3 Guenther Deschner 2003-10-31 10:36:56 UTC
Created attachment 231 [details]
more portable patch for configure.in
Comment 4 Guenther Deschner 2003-11-03 09:03:52 UTC
tested the new patch on various versions (autoconf) now without any problems. 

tim, what do you think of it?
Comment 5 Volker Lendecke 2003-11-03 10:14:39 UTC
Committed the proposed patch, thanks.
Comment 6 Gerald (Jerry) Carter (dead mail address) 2003-11-04 20:11:00 UTC
make sure you close the bug when it has been fixed.
Comment 7 Volker Lendecke 2003-11-05 02:05:13 UTC
Hmm. Did not see the difference between resolved and closed... ;-)
Comment 8 Gerald (Jerry) Carter (dead mail address) 2005-11-14 09:30:59 UTC
database cleanup