diff options
| author | Anton <anton@picapica> | 2020-01-18 21:18:03 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2020-01-18 21:18:03 +0400 |
| commit | 266dd47e5a04f9f6e864d8b429eea1b17e2113a1 (patch) | |
| tree | 092fb282bd408a04092b79167e40c9530fa7a5df | |
| parent | 98d106b3f74e5c2adc0218d10bdbadf8ffef5ee2 (diff) | |
| download | pica-pica-266dd47e5a04f9f6e864d8b429eea1b17e2113a1.tar.gz pica-pica-266dd47e5a04f9f6e864d8b429eea1b17e2113a1.zip | |
debug messages in MULTILOGIN processing
| -rw-r--r-- | PICA_client.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/PICA_client.c b/PICA_client.c index 9938efc..14d2082 100644 --- a/PICA_client.c +++ b/PICA_client.c @@ -1660,17 +1660,26 @@ static unsigned int procmsg_MULTILOGIN(unsigned char *buf, unsigned int nb, void PICA_TRACEFUNC //TODO report invalid MULTILOGIN messages if (payload_len <= sizeof timestamp + PICA_PROTO_NODELIST_ITEM_IPV4_SIZE) + { + fprintf(stderr, "Invalid payload size of MULTILOGIN message: %u\n", payload_len); return 1; + } timestamp = *(uint64_t*)(buf + 4); if (timestamp <= c2n->multilogin_last_timestamp) + { + fprintf(stderr, "timestamp: received %lu last %lu\n", timestamp, c2n->multilogin_last_timestamp); return 1; + } f = fopen(c2n->acc->cert_file, "r"); if (!f) + { + fprintf(stderr, "Failed to open certificate file %s\n", c2n->acc->cert_file); return 1; + } x = PEM_read_X509(f, 0, 0, 0); fclose(f); @@ -1715,7 +1724,10 @@ static unsigned int procmsg_MULTILOGIN(unsigned char *buf, unsigned int nb, void ret = PICA_signverify(pubkey, sigdatas, sigdatalengths, sig, siglen); if (ret != 1) + { + fprintf(stderr, "signature verification failed\n"); goto multilogin_err2; + } { char ipaddr_string[INET6_ADDRSTRLEN]; @@ -1761,6 +1773,8 @@ static int c2n_optstage7_multilogin(struct PICA_c2n *c2n) sigdatas[1] = ×tamp; sigdatalengths[1] = sizeof timestamp; + fprintf(stderr, "timestamp = %lu\n", timestamp); + //nodeaddr buf, IPv4 for now // TODO IPv6, DNS node_addr[0] = PICA_PROTO_NEWNODE_IPV4; @@ -1816,6 +1830,7 @@ static int c2n_optstage7_multilogin(struct PICA_c2n *c2n) { *((uint16_t*)mp->tail) = sizeof timestamp + sigdatalengths[2] + siglen; memcpy(mp->tail + 2, ×tamp, sizeof timestamp); + fprintf(stderr, "timestamp = %lu\n", timestamp); memcpy(mp->tail + 2 + sizeof timestamp, sigdatas[2], sigdatalengths[2]); memcpy(mp->tail + 2 + sizeof timestamp + sigdatalengths[2], sig, siglen); ret = PICA_OK; |
