ports/net/nss_ldap/files/patch-ldap-init-krb5-cache.c
Dag-Erling Smørgrav 8e584a521a Functional changes:
- Add a SASL port option

  - Fix the KERBEROS ports option - it was a no-op, setting a
    configure flag which modifies how Kerberos was used without
    setting the flag that actually enables it.

  - Use GSSAPI instead of $ENV{KRB5CCNAME} to set the credential
    cache.  The latter pollutes the unsuspecting application's
    environment and does not always work (for instance, it breaks when
    nss_ldap is invoked from OpenSSH, although I haven't quite
    determined why)

  - Add patches to support Heimdal in addition to MIT Kerberos.  Note
    that I tried to ensure that the code is unchanged in the
    non-Heimdal case, but that I have no way of testing with MIT
    Kerberos.

  With the above changes, I have successfully configured a FreeBSD 9.2
  server to authenticate users against a Microsoft Windows 2012 Active
  Directory server.

Non-functional changes:

  - Modernize and stagify

  - Remove text in pkg-message about a change that was made ten years ago

  - Take maintainership as current maintainer has been AWOL for 2+ years

  - Bump PORTREVISION

Approved by:	maintainer hasn't been heard of for 2+ years
2014-01-14 14:19:05 +00:00

62 lines
1.6 KiB
C

--- ldap-init-krb5-cache.c.orig
+++ ldap-init-krb5-cache.c
@@ -109,6 +109,10 @@
#include <gssapi/gssapi.h>
#include <gssapi/gssapi_krb5.h>
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 1024
+#endif
+
#define MAX_RENEW_TIME "365d"
#define KT_PATH_MAX 256
@@ -213,14 +217,25 @@
{
krb5_error_code code = 0;
krb5_keytab __keytab;
+#ifdef HEIMDAL
+ char kttypebuf[KRB5_KT_PREFIX_MAX_LEN];
+ size_t kttypesize = sizeof kttypebuf;
+#endif
+ char *kttype;
debug ("==> krb5_cache_kt_is_accessible: ktname %s", __ktname);
assert (context != NULL);
if (!(code = krb5_kt_resolve (context, __ktname, &__keytab)))
{
+#ifdef HEIMDAL
+ krb5_kt_get_type (context, __keytab, kttypebuf, kttypesize);
+ kttype = kttypebuf;
+#else
+ kttype = krb5_kt_get_type (context, __keytab);
+#endif
debug ("==> krb5_cache_kt_is_accessible: resolved ktname %s - %s",
- __ktname, krb5_kt_get_type (context, __keytab));
- if (strcmp ("FILE", krb5_kt_get_type (context, __keytab)) == 0)
+ __ktname, kttype);
+ if (strcmp ("FILE", kttype) == 0)
{
debug ("==> krb5_cache_kt_is_accessible: kt type = FILE");
uid_t ruid = getuid ();
@@ -542,7 +557,7 @@
}
profile_release (profile);
#else
- skew = context->max_skew;
+ /* skew = context->max_skew; */
#endif
ccname = krb5_cache_get_ccname (config);
debug ("==> krb5_cache_setup: credential cache name %s",
@@ -671,7 +686,11 @@
ccname ? ccname : "NULL");
}
}
+#ifdef HEIMDAL
+ free (principal_name);
+#else
krb5_free_unparsed_name (context, principal_name);
+#endif
}
}