浏览代码

Merge pull request #803 from athonet-open/patch/fix-auth-vectors-order

ims_auth: Put fresh keys from HSS on top of list
Daniel-Constantin Mierla 9 年之前
父节点
当前提交
088b3a415e
共有 1 个文件被更改,包括 6 次插入5 次删除
  1. 6 5
      modules/ims_auth/authorize.c

+ 6 - 5
modules/ims_auth/authorize.c

@@ -1689,12 +1689,13 @@ int add_auth_vector(str private_identity, str public_identity, auth_vector * av)
         private_identity.len, private_identity.s, aud->hash);
 
 
-    av->prev = aud->tail;
-    av->next = 0;
+    av->prev = 0;
+    if (aud->head) {
+        av->next = aud->head;
+        aud->head->prev = av;
+    }
 
-    if (!aud->head) aud->head = av;
-    if (aud->tail) aud->tail->next = av;
-    aud->tail = av;
+    aud->head = av;
 
     auth_data_unlock(aud->hash);
     return 1;