diff options
author | Michael Vetter <jubalh@iodoru.org> | 2019-10-17 15:29:33 +0200 |
---|---|---|
committer | Michael Vetter <jubalh@iodoru.org> | 2019-10-17 15:32:46 +0200 |
commit | 827af999b7935c56953c8edebe7837e6015496fd (patch) | |
tree | 9e997f1295c00e9861b0dd80c6f3fa66c02f43ba /src/xmpp | |
parent | 8f5d1751b26646c896e58aeb3b8861bc03d65765 (diff) | |
download | profani-tty-827af999b7935c56953c8edebe7837e6015496fd.tar.gz |
Change algo for connection_create_stanza_id()
Diffstat (limited to 'src/xmpp')
-rw-r--r-- | src/xmpp/connection.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/xmpp/connection.c b/src/xmpp/connection.c index 99343585..99d44b90 100644 --- a/src/xmpp/connection.c +++ b/src/xmpp/connection.c @@ -459,17 +459,21 @@ char* connection_create_stanza_id(char *prefix) { unsigned char *digest = (unsigned char*)malloc(XMPP_SHA1_DIGEST_SIZE); - char *uuid = connection_create_uuid(); + char *msgid = get_random_string(10); assert(digest != NULL); - assert(uuid != NULL); + assert(msgid != NULL); - GString *tmp = g_string_new(""); - g_string_printf(tmp, "%s%s", prof_identifier, uuid); - xmpp_sha1_digest((unsigned char*)tmp->str, strlen(tmp->str), digest); - g_string_free(tmp, TRUE); + GString *signature = g_string_new(""); + g_string_printf(signature, "%s%s", prof_identifier, msgid); + xmpp_sha1_digest((unsigned char*)signature->str, strlen(signature->str), digest); + g_string_free(signature, TRUE); - char *b64 = g_base64_encode(digest, XMPP_SHA1_DIGEST_SIZE); + GString *id = g_string_new(""); + g_string_printf(id, "%s%s", digest, msgid); + + char *b64 = g_base64_encode((unsigned char*)id->str, XMPP_SHA1_DIGEST_SIZE); + g_string_free(id, TRUE); assert(b64 != NULL); free(digest); |