[linux-cifs-client] Patch to get cifs.upcall to compile with Heimdal

Jeff Layton jlayton at samba.org
Thu Apr 1 06:12:00 MDT 2010


On Thu, 1 Apr 2010 14:01:42 +0200
Torsten Kurbad <samba-technical at tk-webart.de> wrote:

> Hi Jeff,
> 
> find attached a new version of the patch against current git.
> 
> On Wed, 31 Mar 2010 15:16:07 -0400, Jeff Layton <jlayton at samba.org>
> wrote:
> >>  #include <getopt.h>
> >> +#ifdef HAVE_KRB5_KRB5_H
> >>  #include <krb5/krb5.h>
> >> +#elif defined(HAVE_KRB5_H)
> >> +#include <krb5.h>
> >> +#endif
> >
> >^^^^
> >I think it would be better to munge the CFLAGS so that
> >-I/usr/include/krb5 precedes the other paths if HAVE_KRB5_KRB5_H is
> >set. That would leave cifs.upcall.c with less #ifdef goop.
> 
> The new patch incorporates a quick hack to accomplish this. I didn't do
> much refinement here yet, since there's one problem: We don't really
> know the "base directory" of the headers. Consider an installation
> where the krb5.h resides in /usr/local/include/krb5/. User invokes
> configure by setting CPPFLAGS="-I/usr/local/include", AC_CHECK_HEADERS
> _does_ find <krb5/krb5.h>, but setting "-I/usr/include/krb5" would not
> lead to the desired result... So, there must be a way to find out,
> _where_ exactly AC_CHECK_HEADERS found krb5.h. I don't know how to do
> that, though, even after some very intense googling. ;-)
> 

That's a very valid point. I'm not sure of the proper way to do this,
so let's just go with your original fix for the includes. We can
consider changing it later if we find a cleaner way to do it.

> >>  
> >> +#ifdef HAVE_KRB5_AUTH_CON_GETSENDSUBKEY
> >>  	ret = krb5_auth_con_getsendsubkey(context, auth_context,
> >> &tokb); +#else
> >> +	ret = krb5_auth_con_getlocalsubkey(context, auth_context,
> >> &tokb); +#endif
> 
> I fixed that one, too, similar to how we handle
> HAVE_KRB5_PRINCIPAL_GET_REALM.
> 
> >> +
> >> +#ifdef HAVE_KRB5_KEYBLOCK_KEYVALUE /* Heimdal */
> >> +	*sess_key = data_blob(tokb->keyvalue.data,
> >> tokb->keyvalue.length); +#else /* MIT */
> >>  	*sess_key = data_blob(tokb->contents, tokb->length);
> >> +#endif
> >>  
> >
> >I think it would be better to declare the same macros that samba uses:
> >
> >KRB5_KEY_DATA
> >KRB5_KEY_LENGTH
> 
> I put the necessary macros in replace.h. Looks much clea(n|r)er now.
> 
> Best regards,
> Torsten
> -- 
> There is one way to find out if a man is honest -- ask him.  If he says
> "Yes" you know he is crooked.
> 		-- Groucho Marx

Much better.

Thanks,
-- 
Jeff Layton <jlayton at samba.org>


More information about the linux-cifs-client mailing list