1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Use random string for random-bytes identifier

And rename `instance` to `identifier`.

Regards https://github.com/profanity-im/profanity/issues/1207
This commit is contained in:
Michael Vetter 2019-10-16 10:43:56 +02:00
parent f9eb302a59
commit 46f0304f89

View File

@ -49,6 +49,7 @@
#include <strophe.h> #include <strophe.h>
#endif #endif
#include "common.h"
#include "log.h" #include "log.h"
#include "config/files.h" #include "config/files.h"
#include "config/preferences.h" #include "config/preferences.h"
@ -632,11 +633,11 @@ static void _random_bytes_init()
rndbytes = g_key_file_new(); rndbytes = g_key_file_new();
g_key_file_load_from_file(rndbytes, rndbytes_loc, G_KEY_FILE_KEEP_COMMENTS, NULL); g_key_file_load_from_file(rndbytes, rndbytes_loc, G_KEY_FILE_KEEP_COMMENTS, NULL);
if (g_key_file_has_group(rndbytes, "instance")) { if (g_key_file_has_group(rndbytes, "identifier")) {
random_bytes = g_key_file_get_string(rndbytes, "instance", "random_bytes", NULL); random_bytes = g_key_file_get_string(rndbytes, "identifier", "random_bytes", NULL);
} else { } else {
random_bytes = g_strdup("ASDF"); random_bytes = get_random_string(10);
g_key_file_set_string(rndbytes, "instance", "random_bytes", random_bytes); g_key_file_set_string(rndbytes, "identifier", "random_bytes", random_bytes);
gsize g_data_size; gsize g_data_size;
gchar *g_accounts_data = g_key_file_to_data(rndbytes, &g_data_size, NULL); gchar *g_accounts_data = g_key_file_to_data(rndbytes, &g_data_size, NULL);