tests: modernize tests to compile in warning-as-errorland
[openafs.git] / tests / auth / authcon-t.c
index 4508d8d..359b3a3 100644 (file)
@@ -36,7 +36,7 @@
 #include <rx/rxkad.h>
 #include <afs/cellconfig.h>
 
-#include <tap/basic.h>
+#include <tests/tap/basic.h>
 #include "common.h"
 
 int
@@ -45,10 +45,13 @@ main(int argc, char **argv)
     struct afsconf_dir *dir;
     char *dirname;
     struct rx_securityClass **classes;
+    struct rx_securityClass *secClass;
+    int secIndex;
     int numClasses;
+    struct afsconf_typedKey *key;
 
-    plan(3);
-    dirname = buildTestConfig();
+    plan(9);
+    dirname = afstest_BuildTestConfig();
 
     dir = afsconf_Open(dirname);
     if (dir == NULL) {
@@ -56,6 +59,8 @@ main(int argc, char **argv)
         exit(1);
     }
 
+    rx_Init(0);
+
     /* Server Security objects */
 
     afsconf_BuildServerSecurityObjects(dir, &classes, &numClasses);
@@ -68,5 +73,19 @@ main(int argc, char **argv)
     afsconf_BuildServerSecurityObjects(dir, &classes, &numClasses);
     is_int(4, numClasses, "When encryption is enabled, 4 classes are returned");
 
+    /* Up to date checks */
+
+    ok(afsconf_UpToDate(dir), "Newly opened directory is up to date");
+    is_int(0, afsconf_AddKey(dir,
+                            1, "\x19\x16\xfe\xe6\xba\x77\x2f\xfd", 0),
+          "Adding key worked");
+    ok(!afsconf_UpToDate(dir), "Directory with newly added key isn't");
+    afsconf_ClientAuth(dir, &secClass, &secIndex);
+    ok(afsconf_UpToDate(dir), "afsconf_ClientAuth() resets UpToDate check");
+    afsconf_DeleteKey(dir, 1);
+    ok(!afsconf_UpToDate(dir), "Directory with newly deleted key isn't");
+    afsconf_GetLatestKeyByTypes(dir, afsconf_rxkad, 0, &key);
+    ok(afsconf_UpToDate(dir), "afsconf_GetLatestKeyByTypes resest UpToDate");
+
     return 0;
 }