projects
/
silc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
576393b
)
Debug printing changes.
author
Pekka Riikonen
<priikone@silcnet.org>
Sun, 24 Jun 2007 14:14:06 +0000
(14:14 +0000)
committer
Pekka Riikonen
<priikone@silcnet.org>
Sun, 24 Jun 2007 14:14:06 +0000
(14:14 +0000)
lib/silcskr/silcskr.c
patch
|
blob
|
history
diff --git
a/lib/silcskr/silcskr.c
b/lib/silcskr/silcskr.c
index 56d0024b4dc780777d8e5e6b8f0d2757b5d6600e..0f2eef54b74669adc04d1272e8e2cb3dd9e79408 100644
(file)
--- a/
lib/silcskr/silcskr.c
+++ b/
lib/silcskr/silcskr.c
@@
-51,16
+51,16
@@
typedef struct {
#if defined(SILC_DEBUG)
static const char *find_name[] = {
#if defined(SILC_DEBUG)
static const char *find_name[] = {
- "PKCS TYPE",
- "USERNAME",
- "HOST",
- "REALNAME",
- "EMAIL",
- "ORG",
- "COUNTRY",
+ "PKCS TYPE
",
+ "USERNAME
",
+ "HOST
",
+ "REALNAME
",
+ "EMAIL
",
+ "ORG
",
+ "COUNTRY
",
"PUBLIC KEY",
"PUBLIC KEY",
- "CONTEXT",
- "USAGE",
+ "CONTEXT
",
+ "USAGE
",
NULL
};
#endif /* SILC_DEBUG */
NULL
};
#endif /* SILC_DEBUG */
@@
-78,7
+78,7
@@
static void silc_skr_type_string(SilcSKRFindType type, void *data,
case SILC_SKR_FIND_PKCS_TYPE:
case SILC_SKR_FIND_USAGE:
silc_snprintf(retbuf, retbuf_size, "[%s] [%d]", find_name[type],
case SILC_SKR_FIND_PKCS_TYPE:
case SILC_SKR_FIND_USAGE:
silc_snprintf(retbuf, retbuf_size, "[%s] [%d]", find_name[type],
- (int)SILC_PTR_TO_32(data));
+
(int)SILC_PTR_TO_32(data));
break;
case SILC_SKR_FIND_PUBLIC_KEY:
break;
case SILC_SKR_FIND_PUBLIC_KEY:
@@
-88,7
+88,7
@@
static void silc_skr_type_string(SilcSKRFindType type, void *data,
default:
silc_snprintf(retbuf, retbuf_size, "[%s] [%s]", find_name[type],
default:
silc_snprintf(retbuf, retbuf_size, "[%s] [%s]", find_name[type],
- (char *)data);
+
(char *)data);
}
}
#endif /* SILC_DEBUG */
}
}
#endif /* SILC_DEBUG */
@@
-271,6
+271,13
@@
static SilcBool silc_skr_add_entry(SilcSKR skr, SilcSKRFindType type,
{
SilcSKREntry entry;
{
SilcSKREntry entry;
+#if defined(SILC_DEBUG)
+ char tmp[256];
+ memset(tmp, 0, sizeof(tmp));
+ silc_skr_type_string(type, type_data, tmp, sizeof(tmp) - 1);
+ SILC_LOG_DEBUG(("Search constraint %s", tmp));
+#endif /* SILC_DEBUG */
+
entry = silc_calloc(1, sizeof(*entry));
if (!entry)
return FALSE;
entry = silc_calloc(1, sizeof(*entry));
if (!entry)
return FALSE;
@@
-363,12
+370,16
@@
static SilcSKRStatus silc_skr_add_silc(SilcSKR skr,
SilcSKRStatus status = SILC_SKR_ERROR;
SilcPublicKeyIdentifier ident;
SilcSILCPublicKey silc_pubkey;
SilcSKRStatus status = SILC_SKR_ERROR;
SilcPublicKeyIdentifier ident;
SilcSILCPublicKey silc_pubkey;
+#if defined(SILC_DEBUG)
+ char tmp[256];
+#endif /* SILC_DEBUG */
/* Get the SILC public key */
silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
ident = &silc_pubkey->identifier;
/* Get the SILC public key */
silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
ident = &silc_pubkey->identifier;
- SILC_LOG_DEBUG(("Adding SILC public key [%s]", ident->username));
+ SILC_LOG_DEBUG(("Adding SILC public key %p [%s], context %p",
+ public_key, ident->username, key_context));
silc_mutex_lock(skr->lock);
silc_mutex_lock(skr->lock);
@@
-391,6
+402,12
@@
static SilcSKRStatus silc_skr_add_silc(SilcSKR skr,
key->key.key = public_key;
key->key.key_context = key_context;
key->key.key = public_key;
key->key.key_context = key_context;
+#if defined(SILC_DEBUG)
+ silc_skr_type_string(SILC_SKR_FIND_USAGE, SILC_32_TO_PTR(usage),
+ tmp, sizeof(tmp) - 1);
+ SILC_LOG_DEBUG((" Search constraint %s", tmp));
+#endif /* SILC_DEBUG */
+
/* Add key specifics */
if (!silc_skr_add_entry(skr, SILC_SKR_FIND_PUBLIC_KEY,
/* Add key specifics */
if (!silc_skr_add_entry(skr, SILC_SKR_FIND_PUBLIC_KEY,
@@
-854,6
+871,8
@@
SilcBool silc_skr_find_set_public_key(SilcSKRFind find,
SilcBool silc_skr_find_set_context(SilcSKRFind find, void *context)
{
SilcBool silc_skr_find_set_context(SilcSKRFind find, void *context)
{
+ if (!context)
+ return TRUE;
return silc_hash_table_add(find->constr,
SILC_32_TO_PTR(SILC_SKR_FIND_CONTEXT), context);
}
return silc_hash_table_add(find->constr,
SILC_32_TO_PTR(SILC_SKR_FIND_CONTEXT), context);
}
@@
-882,6
+901,9
@@
SilcAsyncOperation silc_skr_find(SilcSKR skr, SilcSchedule schedule,
SilcHashTableList htl;
SilcDList list, results = NULL;
void *type, *ctx, *usage = NULL;
SilcHashTableList htl;
SilcDList list, results = NULL;
void *type, *ctx, *usage = NULL;
+#if defined(SILC_DEBUG)
+ char tmp[256];
+#endif /* SILC_DEBUG */
SILC_LOG_DEBUG(("Finding key from repository"));
SILC_LOG_DEBUG(("Finding key from repository"));
@@
-894,21
+916,28
@@
SilcAsyncOperation silc_skr_find(SilcSKR skr, SilcSchedule schedule,
silc_hash_table_find(find->constr, SILC_32_TO_PTR(SILC_SKR_FIND_USAGE),
NULL, &usage);
silc_hash_table_find(find->constr, SILC_32_TO_PTR(SILC_SKR_FIND_USAGE),
NULL, &usage);
+#if defined(SILC_DEBUG)
+ if (usage) {
+ memset(tmp, 0, sizeof(tmp));
+ silc_skr_type_string(SILC_SKR_FIND_USAGE, usage, tmp, sizeof(tmp) - 1);
+ SILC_LOG_DEBUG(("Finding key by %s", tmp));
+ }
+#endif /* SILC_DEBUG */
+
silc_hash_table_list(find->constr, &htl);
while (silc_hash_table_get(&htl, &type, &ctx)) {
silc_hash_table_list(find->constr, &htl);
while (silc_hash_table_get(&htl, &type, &ctx)) {
+ /* SILC_SKR_FIND_USAGE is handled separately while searching the keys. */
+ if ((SilcSKRFindType)SILC_32_TO_PTR(type) == SILC_SKR_FIND_USAGE)
+ continue;
+
#if defined(SILC_DEBUG)
#if defined(SILC_DEBUG)
- char tmp[256];
memset(tmp, 0, sizeof(tmp));
silc_skr_type_string((SilcSKRFindType)SILC_32_TO_PTR(type),
ctx, tmp, sizeof(tmp) - 1);
SILC_LOG_DEBUG(("Finding key by %s", tmp));
#endif /* SILC_DEBUG */
memset(tmp, 0, sizeof(tmp));
silc_skr_type_string((SilcSKRFindType)SILC_32_TO_PTR(type),
ctx, tmp, sizeof(tmp) - 1);
SILC_LOG_DEBUG(("Finding key by %s", tmp));
#endif /* SILC_DEBUG */
- /* SILC_SKR_FIND_USAGE is handled separately while searching the keys. */
- if ((SilcSKRFindType)SILC_32_TO_PTR(type) == SILC_SKR_FIND_USAGE)
- continue;
-
/* Find entries by this search constraint */
if (!silc_skr_find_entry(skr, &status,
(SilcSKRFindType)SILC_32_TO_PTR(type),
/* Find entries by this search constraint */
if (!silc_skr_find_entry(skr, &status,
(SilcSKRFindType)SILC_32_TO_PTR(type),