Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save philpennock/3f24e00cd7f3e1cb6b11974ff0eb8d47 to your computer and use it in GitHub Desktop.
Save philpennock/3f24e00cd7f3e1cb6b11974ff0eb8d47 to your computer and use it in GitHub Desktop.
perlgssapi GSSAPI module patch to fix compilation on macOS
Index: GSSAPI.xs
===================================================================
--- GSSAPI.xs (revision 73)
+++ GSSAPI.xs (working copy)
@@ -6,6 +6,8 @@
#define __GSS_KRB5_NT_PRINCIPAL_NAME &mygss_nt_krb5_principal
#define __gss_mech_krb5_v2 &mygss_mech_krb5_v2
+#define GSSKRB_APPLE_DEPRECATED(x) /**/
+
/*
| Defines explanation:
|
Index: Makefile.PL
===================================================================
--- Makefile.PL (revision 73)
+++ Makefile.PL (working copy)
@@ -256,7 +256,13 @@
return `$cfgcmd --version`;
}
#-------------------------------------------------
+sub krb5_vendor {
+ my ($cfgcmd) = @_;
+ $cfgcmd || die 'no $cfgcmd ';
+ return `$cfgcmd --vendor`;
+}
#-------------------------------------------------
+#-------------------------------------------------
sub is_heimdal {
my ($cfgcmd) = @_;
my $r = undef;
@@ -269,6 +275,18 @@
}
}
}
+ return $r if $r;
+
+ @vinfo = krb5_vendor( $cfgcmd );
+ FOUND: {
+ foreach ( @vinfo) {
+ if ( m/^Apple MITKerberosShim/) {
+ $r = 1;
+ last FOUND;
+ }
+ }
+ }
+
return $r;
}
#-------------------------------------------------
Index: t/test.t
===================================================================
--- t/test.t (revision 73)
+++ t/test.t (working copy)
@@ -22,11 +22,11 @@
SKIP:
{
- skip('oid_to_str not supportetd on Heimdal', 2) if GSSAPI::gssapi_implementation_is_heimdal();
-
$status = $oid->to_str($str);
ok($status, ' $oid->to_str($str) ');
- cmp_ok($str, 'eq', '{ 1 2 840 113554 1 2 1 1 }', q{ $str eq '{ 1 2 840 113554 1 2 1 1 }' });
+ my $want = '1 2 840 113554 1 2 1 1';
+ $want = "{ $want }" unless GSSAPI::gssapi_implementation_is_heimdal();
+ cmp_ok($str, 'eq', $want, qq{ \$str eq '${want}' });
}
@@ -128,4 +128,4 @@
$buf .= chr(rand(0xFF));
}
$buf
-}
\ No newline at end of file
+}
Index: xs/OID.xs
===================================================================
--- xs/OID.xs (revision 73)
+++ xs/OID.xs (working copy)
@@ -13,20 +13,23 @@
PREINIT:
OM_uint32 minor;
PPCODE:
-#if !defined(HEIMDAL)
if (oid != NULL &&
+ oid != GSS_C_NO_OID &&
oid != __KRB5_MECHTYPE_OID &&
oid != __KRB5_OLD_MECHTYPE_OID &&
oid != __GSS_KRB5_NT_USER_NAME &&
oid != __GSS_KRB5_NT_PRINCIPAL_NAME &&
oid != __SPNEGO_MECHTYPE_OID &&
+ oid != GSS_C_NT_USER_NAME &&
+ oid != GSS_C_NT_MACHINE_UID_NAME &&
+ oid != GSS_C_NT_STRING_UID_NAME &&
+ oid != GSS_C_NT_HOSTBASED_SERVICE_X &&
+ oid != GSS_C_NT_HOSTBASED_SERVICE &&
+ oid != GSS_C_NT_ANONYMOUS &&
+ oid != GSS_C_NT_EXPORT_NAME &&
oid != __gss_mech_krb5_v2 ) {
(void)gss_release_oid(&minor, &oid);
}
-#endif
-#if defined(HEIMDAL)
-# warn("gss_release_oid is unsupported and not Part of the API!");
-#endif
GSSAPI::Status
from_str(class, oid, str)
@@ -34,12 +37,7 @@
GSSAPI::OID_out oid
gss_buffer_str str
CODE:
-#if !defined(HEIMDAL)
RETVAL.major = gss_str_to_oid(&RETVAL.minor, &str, &oid);
-#endif
-#if defined(HEIMDAL)
- croak("gss_str_to_oid() is not defined in Heimdal API!");
-#endif
OUTPUT:
RETVAL
oid
@@ -53,12 +51,7 @@
sv_setsv_mg(ST(1), &PL_sv_undef);
XSRETURN_UNDEF;
}
-#if !defined(HEIMDAL)
RETVAL.major = gss_oid_to_str(&RETVAL.minor, oid, &str);
-#endif
-#if defined(HEIMDAL)
- croak("gss_oid_to_str() is not defined in Heimdal API!");
-#endif
OUTPUT:
RETVAL
str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment