Merge branch 'rxkad-kdf-master' into HEAD
[openafs.git] / src / auth / keys.c
index 938c731..54b700e 100644 (file)
@@ -300,20 +300,17 @@ _afsconf_InitKeys(struct afsconf_dir *dir)
  * in the original KeyFile, so that we can continue to be compatible with
  * utilities that directly modify that file.
  *
- * All other keys are stored in the file KeyFileEx, which has the following
+ * All other keys are stored in the file KeyFileExt, which has the following
  * format:
  *    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- *   |                        version number                           |
- *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *   |                        number of keys                           |
  *   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  *   | Key data ...
  *   +-+-+-+-+-+-+-+
  *
- * The version number is 1 at present. Version numbers higher than 1
- * indicate a keyfile that is not backwards compatible with this
- * specification.
+ * If the format ever needs to chanage incompatibly, a new file name
+ * will be used.
  *
  * Key data is a sequence of the following records (note that these are
  * not word aligned - the next record begins where the previous one ends)
@@ -365,6 +362,8 @@ _parseOriginalKeyFile(struct afsconf_dir *dir, char *fileName)
     for(i=0; i<nkeys; i++) {
 
        key = afsconf_typedKey_blank();
+       if (key == NULL)
+           goto fail;
 
        key->type = afsconf_rxkad;
        key->subType = 0;
@@ -473,6 +472,8 @@ _parseExtendedKeyFile(struct afsconf_dir *dir, char *fileName)
        afs_int32 reclen;
 
        key = afsconf_typedKey_blank();
+       if (key == NULL)
+           goto fail;
 
        /* The only data version we currently parse has a reclen of 16.
         * Anything smaller indicates a corrupt key file. Anything more,
@@ -518,7 +519,6 @@ _parseExtendedKeyFile(struct afsconf_dir *dir, char *fileName)
        code = read(fd, key->key.val, reclen);
        if (code != reclen) {
            rx_opaque_freeContents(&key->key);
-           free(key);
            goto fail;
        }
        code = addMemoryKey(dir, key, 1);
@@ -846,10 +846,8 @@ afsconf_GetAllKeys(struct afsconf_dir *dir, struct afsconf_typedKeyList **keys)
        typeEntry = opr_queue_Entry(typeCursor, struct keyTypeList, link);
        for (opr_queue_Scan(&typeEntry->kvnoList, kvnoCursor)) {
            kvnoEntry = opr_queue_Entry(kvnoCursor, struct kvnoList, link);
-           for (opr_queue_Scan(&kvnoEntry->subTypeList, subCursor)) {
-               subEntry = opr_queue_Entry(subCursor, struct subTypeList, link);
+           for (opr_queue_Scan(&kvnoEntry->subTypeList, subCursor))
                count++;
-           }
        }
     }