"principal '%s' from keytab '%s'\n",
error_message(code),
pname ? pname : "<unparsable>", kt_name);
-#ifdef HAVE_KRB5
- if (pname) krb5_free_unparsed_name(context, pname);
-#else
- if (pname) free(pname);
-#endif
+ if (pname) k5_free_unparsed_name(context, pname);
goto out;
}
if (ple == NULL) {
printerr(0, "ERROR: could not allocate storage "
"for principal list entry\n");
-#ifdef HAVE_KRB5
- krb5_free_unparsed_name(context, pname);
-#else
- free(pname);
-#endif
+ k5_free_unparsed_name(context, pname);
krb5_kt_free_entry(context, &kte);
retval = ENOMEM;
goto out;
printerr(0, "ERROR: %s while copying realm to "
"principal list entry\n",
"not enough memory");
-#ifdef HAVE_KRB5
- krb5_free_unparsed_name(context, pname);
-#else
- free(pname);
-#endif
+ k5_free_unparsed_name(context, pname);
krb5_kt_free_entry(context, &kte);
retval = ENOMEM;
goto out;
printerr(0, "ERROR: %s while copying principal "
"to principal list entry\n",
error_message(code));
-#ifdef HAVE_KRB5
- krb5_free_unparsed_name(context, pname);
-#else
- free(pname);
-#endif
+ k5_free_unparsed_name(context, pname);
krb5_kt_free_entry(context, &kte);
retval = code;
goto out;
printerr(2, "We will NOT use this entry (%s)\n",
pname);
}
-#ifdef HAVE_KRB5
- krb5_free_unparsed_name(context, pname);
-#else
- free(pname);
-#endif
+ k5_free_unparsed_name(context, pname);
krb5_kt_free_entry(context, &kte);
}
int limit_krb5_enctypes(struct rpc_gss_sec *sec, uid_t uid);
#endif
+/*
+ * Hide away some of the MIT vs. Heimdal differences
+ * here with macros...
+ */
+
+#ifdef HAVE_KRB5
+#define k5_free_unparsed_name(ctx, name) krb5_free_unparsed_name((ctx), (name))
+#define k5_free_default_realm(ctx, realm) krb5_free_default_realm((ctx), (realm))
+#define k5_free_kt_entry(ctx, kte) krb5_free_keytab_entry_contents((ctx),(kte))
+#else /* Heimdal */
+#define k5_free_unparsed_name(ctx, name) free(name)
+#define k5_free_default_realm(ctx, realm) free(realm)
+#define k5_free_kt_entry(ctx, kte) krb5_kt_free_entry((ctx),(kte))
+#endif
+
#endif /* KRB5_UTIL_H */