Compare commits
3 Commits
merge-impr
...
merge/upst
| Author | SHA1 | Date | |
|---|---|---|---|
|
36f4377b4c
|
|||
|
1dd22af294
|
|||
|
d3d7c328b4
|
@@ -43,7 +43,8 @@ _sanitize_account_name(const char* const name)
|
||||
gchar* sanitized = g_strdup(name);
|
||||
gchar* p = sanitized;
|
||||
while (*p) {
|
||||
if (*p == '[' || *p == ']' || *p == '=') {
|
||||
// GKeyFile special characters: [ ] = # \n \r
|
||||
if (*p == '[' || *p == ']' || *p == '=' || *p == '#' || *p == '\n' || *p == '\r') {
|
||||
*p = '_';
|
||||
}
|
||||
p++;
|
||||
|
||||
@@ -804,8 +804,16 @@ omemo_on_message_send(ProfWin* win, const char* const message, gboolean request_
|
||||
tag_len = AES128_GCM_TAG_LENGTH;
|
||||
tag = gcry_malloc_secure(tag_len);
|
||||
key_tag = gcry_malloc_secure(AES128_GCM_KEY_LENGTH + AES128_GCM_TAG_LENGTH);
|
||||
if (!tag || !key_tag) {
|
||||
log_error("[OMEMO][SEND] cannot allocate secure buffers");
|
||||
goto out;
|
||||
}
|
||||
|
||||
key = gcry_random_bytes_secure(AES128_GCM_KEY_LENGTH + AES128_GCM_IV_LENGTH, GCRY_VERY_STRONG_RANDOM);
|
||||
if (!key) {
|
||||
log_error("[OMEMO][SEND] cannot generate random key/IV");
|
||||
goto out;
|
||||
}
|
||||
iv = key + AES128_GCM_KEY_LENGTH;
|
||||
|
||||
res = aes128gcm_encrypt(ciphertext, &ciphertext_len, tag, &tag_len, (const unsigned char* const)message, strlen(message), iv, key);
|
||||
@@ -1989,10 +1997,6 @@ _cache_device_identity(const char* const jid, uint32_t device_id, ec_public_key*
|
||||
g_hash_table_insert(omemo_static_data.fingerprint_ac, strdup(jid), ac);
|
||||
}
|
||||
|
||||
if (!fingerprint) {
|
||||
return;
|
||||
}
|
||||
|
||||
char* formatted_fingerprint = omemo_format_fingerprint(fingerprint);
|
||||
if (formatted_fingerprint) {
|
||||
autocomplete_add(ac, formatted_fingerprint);
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "ncurses.h"
|
||||
#include "ui/ui.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
#include "ui/ui.h"
|
||||
|
||||
typedef struct EditorContext
|
||||
{
|
||||
@@ -121,6 +120,12 @@ launch_editor(gchar* initial_content, void (*callback)(gchar* content, void* dat
|
||||
|
||||
ui_suspend();
|
||||
|
||||
// Force GLib to install its SIGCHLD handler before forking. Creating a
|
||||
// GChildWatchSource for our own pid is the documented trigger; we never
|
||||
// attach or dispatch it, just rely on the side effect.
|
||||
GSource* sigchld_warmup = g_child_watch_source_new(getpid());
|
||||
g_source_unref(sigchld_warmup);
|
||||
|
||||
pid_t pid = fork();
|
||||
if (pid == -1) {
|
||||
log_error("[Editor] Failed to fork: %s", strerror(errno));
|
||||
|
||||
@@ -55,6 +55,8 @@ static GTimeZone* tz;
|
||||
static StatusBar* statusbar;
|
||||
static WINDOW* statusbar_win;
|
||||
|
||||
#define CONSOLE_TAB_ID 10 // Console tab ID in status bar hash table
|
||||
|
||||
void _get_range_bounds(guint* start, guint* end, gboolean is_static);
|
||||
static guint _status_bar_draw_time(guint pos);
|
||||
static guint _status_bar_draw_maintext(guint pos);
|
||||
@@ -157,7 +159,7 @@ void
|
||||
status_bar_current(guint i)
|
||||
{
|
||||
if (i == 0) {
|
||||
statusbar->current_tab = 10;
|
||||
statusbar->current_tab = CONSOLE_TAB_ID;
|
||||
} else {
|
||||
statusbar->current_tab = i;
|
||||
}
|
||||
@@ -168,12 +170,7 @@ status_bar_current(guint i)
|
||||
void
|
||||
status_bar_inactive(const int win)
|
||||
{
|
||||
int true_win = win;
|
||||
if (true_win == 0) {
|
||||
true_win = 10;
|
||||
}
|
||||
|
||||
g_hash_table_remove(statusbar->tabs, GINT_TO_POINTER(true_win));
|
||||
g_hash_table_remove(statusbar->tabs, GINT_TO_POINTER((win == 0) ? CONSOLE_TAB_ID : win));
|
||||
|
||||
status_bar_draw();
|
||||
}
|
||||
@@ -181,8 +178,6 @@ status_bar_inactive(const int win)
|
||||
void
|
||||
_create_tab(const int win, win_type_t wintype, char* identifier, gboolean highlight)
|
||||
{
|
||||
int true_win = win == 0 ? 10 : win;
|
||||
|
||||
StatusBarTab* tab = g_new0(StatusBarTab, 1);
|
||||
tab->identifier = strdup(identifier);
|
||||
tab->highlight = highlight;
|
||||
@@ -212,7 +207,7 @@ _create_tab(const int win, win_type_t wintype, char* identifier, gboolean highli
|
||||
}
|
||||
}
|
||||
|
||||
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER(true_win), tab);
|
||||
g_hash_table_replace(statusbar->tabs, GINT_TO_POINTER((win == 0) ? CONSOLE_TAB_ID : win), tab);
|
||||
|
||||
status_bar_draw();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <glib.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "log.h"
|
||||
#include "xmpp/jid.h"
|
||||
|
||||
#define JID_MAX_PART_LEN 1023
|
||||
@@ -32,6 +33,7 @@ Jid*
|
||||
jid_create(const gchar* const str)
|
||||
{
|
||||
if (!jid_is_valid(str)) {
|
||||
log_debug("[JID] invalid JID: '%s'", str ?: "(null)");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user