]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
Hide differences between MIT and Heimdal in macros
authorKevin Coffman <kwc@citi.umich.edu>
Fri, 30 Mar 2007 22:32:10 +0000 (18:32 -0400)
committerNeil Brown <neilb@suse.de>
Fri, 30 Mar 2007 23:08:02 +0000 (09:08 +1000)
Clean up a lot of #ifdef'd code using macros, masking
the differences between MIT and Heimdal implementations.
The currently unused macros will be used in later patches.

Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
utils/gssd/krb5_util.c
utils/gssd/krb5_util.h

index a0ee1100d29560fece53042ba5675b9ebbe41ad7..7ef690bfabcafc7ea5d353ddb3d85122b6accbae 100644 (file)
@@ -364,11 +364,7 @@ gssd_get_single_krb5_cred(krb5_context context,
                            "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;
        }
 
@@ -497,11 +493,7 @@ gssd_process_krb5_keytab(krb5_context context, krb5_keytab kt, char *kt_name)
                        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;
@@ -521,11 +513,7 @@ gssd_process_krb5_keytab(krb5_context context, krb5_keytab kt, char *kt_name)
                                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;
@@ -535,11 +523,7 @@ gssd_process_krb5_keytab(krb5_context context, krb5_keytab kt, char *kt_name)
                                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;
@@ -555,11 +539,7 @@ gssd_process_krb5_keytab(krb5_context context, krb5_keytab kt, char *kt_name)
                        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);
        }
 
index da04530fdaeddd9d0adfac4f2ac31da8696643a8..36dfcc87f07b66bac35380525585f4728be6b07a 100644 (file)
@@ -27,4 +27,19 @@ void gssd_destroy_krb5_machine_creds(void);
 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 */