Fixed format of DIDs when sending DNA resolution replies from

new keyring format.
This commit is contained in:
gardners 2012-04-13 10:27:38 +09:30
parent 099e7ab118
commit aa7da3e2c9

View File

@ -294,13 +294,12 @@ int processRequest(unsigned char *packet,int len,
found=keyring_find_sid(keyring,&cn,&in,&kp,packedSid); found=keyring_find_sid(keyring,&cn,&in,&kp,packedSid);
} else { } else {
found=keyring_find_did(keyring,&cn,&in,&kp,did); found=keyring_find_did(keyring,&cn,&in,&kp,did);
printf("found=%d, instance=%d\n",found,instance);
} }
struct response r; struct response r;
unsigned char packedDid[64];
if (found&&(instance==-1||instance==count)) { if (found&&(instance==-1||instance==count)) {
printf("preparing response\n");
/* We have a matching identity/DID, now see what variable /* We have a matching identity/DID, now see what variable
they want. they want.
VAR_DIDS and VAR_LOCATIONS are the only ones we support VAR_DIDS and VAR_LOCATIONS are the only ones we support
@ -309,9 +308,12 @@ int processRequest(unsigned char *packet,int len,
r.var_instance=instance; r.var_instance=instance;
switch(var_id) { switch(var_id) {
case VAR_DIDS: case VAR_DIDS:
r.response=keyring->contexts[cn]->identities[in] /* We need to pack the DID before sending off */
->keypairs[kp]->private_key; r.value_len=0;
r.value_len=strlen((char *)r.response); stowDid(packedDid,&r.value_len,
(char *)keyring->contexts[cn]->identities[in]
->keypairs[kp]->private_key);
r.response=packedDid;
break; break;
case VAR_LOCATIONS: case VAR_LOCATIONS:
r.response=(unsigned char *)"4000@"; r.response=(unsigned char *)"4000@";