+Wed Oct 16 17:40:56 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
+
+ * Added support for parsing VCard fields that do not have
+ the TYPE= for types. Affected file lib/silcutil/silcvcard.c.
+
+ * Fixed a double free bug in hash table foreach function
+ if the entry was deleted in the foreach callback. Affected
+ file lib/silcutil/silchashtable.c.
+
Tue Oct 15 18:05:24 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
* Added silc_attribute_get_verify_data to return the signature
void *hash_user_context;
void *compare_user_context;
void *destructor_user_context;
- bool auto_rehash;
+ unsigned int auto_rehash : 1;
};
/* Prime sizes for the hash table. The size of the table will always
SilcHashForeach foreach,
void *foreach_user_context)
{
- SilcHashTableEntry *entry, *tmp;
+ SilcHashTableEntry e, tmp;
bool auto_rehash, found = FALSE;
SilcUInt32 i = SILC_HASH_TABLE_HASH(hash, hash_user_context);
auto_rehash = ht->auto_rehash;
ht->auto_rehash = FALSE;
- entry = &ht->table[i];
+ e = ht->table[i];
if (compare) {
- while (*entry) {
- if (compare((*entry)->key, key, compare_user_context)) {
- tmp = &(*entry)->next;
- foreach((*entry)->key, (*entry)->context, foreach_user_context);
+ while (e) {
+ tmp = e->next;
+ if (compare(e->key, key, compare_user_context)) {
found = TRUE;
- entry = tmp;
- continue;
+ foreach(e->key, e->context, foreach_user_context);
}
- entry = &(*entry)->next;
+ e = tmp;
}
} else {
- while (*entry) {
- if ((*entry)->key == key) {
- tmp = &(*entry)->next;
- foreach((*entry)->key, (*entry)->context, foreach_user_context);
+ while (e) {
+ tmp = e->next;
+ if (e->key == key) {
found = TRUE;
- entry = tmp;
- continue;
+ foreach(e->key, e->context, foreach_user_context);
}
- entry = &(*entry)->next;
+ e = tmp;
}
}
continue; \
}
-/* Take on TYPE= token and prepare for next token */
-#define VCARD_TYPETOKEN(x) \
- if (!(x)) { \
- int tmpi; \
- (x) = silc_memdup(val + off + 5, i - off - 5 - 1); \
- tmpi = off + 5 + strlen((x)) + 1; \
- off = i; \
- i = tmpi; \
+/* Take on TYPE= token and prepare for next token, accept the
+ type also without TYPE= as it is possible */
+#define VCARD_TYPETOKEN(x) \
+ if (!(x)) { \
+ int tmpi = 0; \
+ if (!strcasecmp(val + off, "TYPE=")) \
+ tmpi = 5; \
+ (x) = silc_memdup(val + off + tmpi, i - off - tmpi - 1); \
+ tmpi = off + tmpi + strlen((x)) + 1; \
+ off = i; \
+ i = tmpi; \
}
/* Take last token */