about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authormoppman <moppman@users.noreply.github.com>2020-02-14 14:58:48 +0100
committerMichael Vetter <jubalh@iodoru.org>2020-02-17 08:02:00 +0100
commit674a8aaf7ec08f9ec8be79e41cc7d4c8f3e81970 (patch)
tree87ee6297b21b727b17c6d7490ce391644f06a4fe
parentca3afa7e05ae87158b6c1bfca1758763d4b0d8a2 (diff)
downloadprofani-tty-674a8aaf7ec08f9ec8be79e41cc7d4c8f3e81970.tar.gz
Disallow sendfile in e2ee chat sessions
-rw-r--r--src/command/cmd_funcs.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 93b002f4..8ac15535 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -4797,6 +4797,41 @@ cmd_sendfile(ProfWin *window, const char *const command, gchar **args)
         return TRUE;
     }
 
+    switch (window->type) {
+        case WIN_MUC:
+        {
+            ProfMucWin *mucwin = (ProfMucWin*)window;
+            assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+            if (mucwin->is_omemo) { //no pgp or otr available in MUCs
+				cons_show_error("Uploading '%s' failed: Encrypted file uploads not yet implemented!", filename); 
+				win_println(window, THEME_ERROR, '-', "Sending encrypted files via http_upload is not possible yet.");
+				free(filename);
+				return TRUE;
+				}
+            break;
+        }
+        case WIN_CHAT:
+        {
+            ProfChatWin *chatwin = (ProfChatWin*)window;
+            assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+            if (chatwin->pgp_send || chatwin->is_omemo || chatwin->is_otr) {
+				cons_show_error("Uploading '%s' failed: Encrypted file uploads not yet implemented!", filename); 
+				win_println(window, THEME_ERROR, '-', "Sending encrypted files via http_upload is not possible yet.");
+				free(filename);
+				return TRUE;
+				}
+            break;
+        }
+        case WIN_PRIVATE:
+        {
+            break; //we don't support encryption in private muc windows anyway
+        }
+        default:
+			cons_show_error("Unsupported window for file transmission.");
+			free(filename);
+			return TRUE;
+        }
+        
     if (access(filename, R_OK) != 0) {
         cons_show_error("Uploading '%s' failed: File not found!", filename);
         free(filename);