asetkey: Fix random_key for Heimdal 52/13652/3
authorAndrew Deason <adeason@dson.org>
Sun, 23 Jun 2019 21:25:27 +0000 (16:25 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 28 Jun 2019 14:47:41 +0000 (10:47 -0400)
Go through our deref_key_length/deref_key_contents abstractions, so we
can compile with Heimdal krb5.

Also fix these macros to properly separate the 'key' macro argument,
so we can use the macros in these new places.

Change-Id: I3ee53bc70494a67ac5463819dc575c8ee37647c9
Reviewed-on: https://gerrit.openafs.org/13652
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Tim Creech <tcreech@tcreech.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/aklog/asetkey.c

index 134b5fe..f24dddf 100644 (file)
@@ -95,16 +95,16 @@ keyFromCommandLine(afsconf_keyType type, int kvno, int subType,
 
 #ifdef USING_HEIMDAL
 #define deref_key_length(key)                  \
-           key->keyvalue.length
+           (key)->keyvalue.length
 
 #define deref_key_contents(key)                        \
-           key->keyvalue.data
+           (key)->keyvalue.data
 #else
 #define deref_key_length(key)                  \
-           key->length
+           (key)->length
 
 #define deref_key_contents(key)                        \
-           key->contents
+           (key)->contents
 #endif
 
 static struct afsconf_typedKey *
@@ -260,8 +260,8 @@ random_key(char **argv, int type, int kvno, int subtype)
     }
 
     memset(&key, 0, sizeof(key));
-    key.len = keyblock.length;
-    key.val = keyblock.contents;
+    key.len = deref_key_length(&keyblock);
+    key.val = deref_key_contents(&keyblock);
 
     typedKey = afsconf_typedKey_new(type, kvno, subtype, &key);