From 3067b7b267d881963498d277d657e679ac15af45 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 25 Nov 2011 10:23:23 +0100 Subject: rename fishlim main file to avoid confusion --- plugins/fishlim/plugin_xchat.c | 286 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 286 insertions(+) create mode 100644 plugins/fishlim/plugin_xchat.c (limited to 'plugins/fishlim/plugin_xchat.c') diff --git a/plugins/fishlim/plugin_xchat.c b/plugins/fishlim/plugin_xchat.c new file mode 100644 index 00000000..dd410548 --- /dev/null +++ b/plugins/fishlim/plugin_xchat.c @@ -0,0 +1,286 @@ +/* + + Copyright (c) 2010-2011 Samuel Lidén Borell + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#include +#include +#include + +// #pragma GCC visibility push(default) +#include "xchat-plugin.h" +#define XCHAT_MAX_WORDS 32 +// #pragma GCC visibility pop + +//#define EXPORT __attribute((visibility("default"))) +//#define EXPORT + +#include "fish.h" +#include "keystore.h" +#include "irc.h" + +static const char plugin_name[] = "FiSHLiM"; +static const char plugin_desc[] = "Encryption plugin for the FiSH protocol. Less is More!"; +static const char plugin_version[] = "0.0.13"; + +static const char usage_setkey[] = "Usage: SETKEY [] , sets the key for a channel or nick"; +static const char usage_delkey[] = "Usage: DELKEY , deletes the key for a channel or nick"; + +static xchat_plugin *ph; + + +/** + * Returns the path to the key store file. + */ +gchar *get_config_filename() { + return g_build_filename(xchat_get_info(ph, "xchatdirfs"), "blow.ini", NULL); +} + +/** + * Appends data to a string. Returns true if there was sufficient memory. + * Frees *s and returns false if an error occurs. + */ +static bool append(char **s, size_t *length, const char *data) { + size_t datalen = strlen(data); + char *extended = realloc(*s, *length + datalen + 1); + if (!extended) { + free(*s); + return false; + } + memcpy(extended + *length, data, datalen + 1); + *s = extended; + *length += datalen; + return true; +} + + +/*static int handle_debug(char *word[], char *word_eol[], void *userdata) { + xchat_printf(ph, "debug incoming: "); + for (size_t i = 1; word[i] != NULL && word[i][0] != '\0'; i++) { + xchat_printf(ph, ">%s< ", word[i]); + } + xchat_printf(ph, "\n"); + return XCHAT_EAT_NONE; +}*/ + +/** + * Called when a message is to be sent. + */ +static int handle_outgoing(char *word[], char *word_eol[], void *userdata) { + const char *own_nick; + // Encrypt the message if possible + const char *channel = xchat_get_info(ph, "channel"); + char *encrypted = fish_encrypt_for_nick(channel, word_eol[1]); + if (!encrypted) return XCHAT_EAT_NONE; + + // Display message + own_nick = xchat_get_info(ph, "nick"); + xchat_emit_print(ph, "Your Message", own_nick, word_eol[1], NULL); + + // Send message + xchat_commandf(ph, "PRIVMSG %s :+OK %s", channel, encrypted); + + free(encrypted); + return XCHAT_EAT_XCHAT; +} + +/** + * Called when a channel message or private message is received. + */ +static int handle_incoming(char *word[], char *word_eol[], void *userdata) { + const char *prefix; + const char *command; + const char *recipient; + const char *encrypted; + const char *peice; + char *sender_nick; + char *decrypted; + char *message; + size_t w; + size_t ew; + size_t uw; + size_t length; + + if (!irc_parse_message((const char **)word, &prefix, &command, &w)) + return XCHAT_EAT_NONE; + + // Topic (command 332) has an extra parameter + if (!strcmp(command, "332")) w++; + + // Look for encrypted data + ew; + for (ew = w+1; ew < XCHAT_MAX_WORDS-1; ew++) { + const char *s = (ew == w+1 ? word[ew]+1 : word[ew]); + if (strcmp(s, "+OK") == 0) goto has_encrypted_data; + } + return XCHAT_EAT_NONE; + has_encrypted_data: ; + // Extract sender nick and recipient nick/channel + sender_nick = irc_prefix_get_nick(prefix); + recipient = word[w]; + + // Try to decrypt with these (the keys are searched for in the key store) + encrypted = word[ew+1]; + decrypted = fish_decrypt_from_nick(recipient, encrypted); + if (!decrypted) decrypted = fish_decrypt_from_nick(sender_nick, encrypted); + + // Check for error + if (!decrypted) goto decrypt_error; + + // Build unecrypted message + message = NULL; + length = 0; + if (!append(&message, &length, "RECV")) goto decrypt_error; + + for (uw = 1; uw < XCHAT_MAX_WORDS; uw++) { + if (word[uw][0] != '\0' && !append(&message, &length, " ")) goto decrypt_error; + + if (uw == ew) { + // Add the encrypted data + peice = decrypted; + uw++; // Skip "OK+" + } else { + // Add unencrypted data (for example, a prefix from a bouncer or bot) + peice = (uw == w+1 ? word[uw]+1 : word[uw]); + } + + if (!append(&message, &length, peice)) goto decrypt_error; + } + free(decrypted); + + // Simulate unencrypted message + //xchat_printf(ph, "simulating: %s\n", message); + xchat_command(ph, message); + + free(message); + free(sender_nick); + return XCHAT_EAT_XCHAT; + + decrypt_error: + free(decrypted); + free(sender_nick); + return XCHAT_EAT_NONE; +} + +/** + * Command handler for /setkey + */ +static int handle_setkey(char *word[], char *word_eol[], void *userdata) { + const char *nick; + const char *key; + + // Check syntax + if (*word[2] == '\0') { + xchat_printf(ph, "%s\n", usage_setkey); + return XCHAT_EAT_XCHAT; + } + + if (*word[3] == '\0') { + // /setkey password + nick = xchat_get_info(ph, "channel"); + key = word_eol[2]; + } else { + // /setkey #channel password + nick = word[2]; + key = word_eol[3]; + } + + // Set password + if (keystore_store_key(nick, key)) { + xchat_printf(ph, "Stored key for %s\n", nick); + } else { + xchat_printf(ph, "\00305Failed to store key in blow.ini\n", nick, key); + } + + return XCHAT_EAT_XCHAT; +} + +/** + * Command handler for /delkey + */ +static int handle_delkey(char *word[], char *word_eol[], void *userdata) { + const char *nick; + + // Check syntax + if (*word[2] == '\0' || *word[3] != '\0') { + xchat_printf(ph, "%s\n", usage_delkey); + return XCHAT_EAT_XCHAT; + } + + nick = word_eol[2]; + + // Delete the given nick from the key store + if (keystore_delete_nick(nick)) { + xchat_printf(ph, "Deleted key for %s\n", nick); + } else { + xchat_printf(ph, "\00305Failed to delete key in blow.ini!\n", nick); + } + + return XCHAT_EAT_XCHAT; +} + +/** + * Returns the plugin name version information. + */ +void xchat_plugin_get_info(const char **name, const char **desc, + const char **version, void **reserved) { + *name = plugin_name; + *desc = plugin_desc; + *version = plugin_version; +} + +/** + * Plugin entry point. + */ +int xchat_plugin_init(xchat_plugin *plugin_handle, + const char **name, + const char **desc, + const char **version, + char *arg) { + ph = plugin_handle; + + /* Send our info to XChat */ + *name = plugin_name; + *desc = plugin_desc; + *version = plugin_version; + + /* Register commands */ + xchat_hook_command(ph, "SETKEY", XCHAT_PRI_NORM, handle_setkey, usage_setkey, NULL); + xchat_hook_command(ph, "DELKEY", XCHAT_PRI_NORM, handle_delkey, usage_delkey, NULL); + + /* Add handlers */ + xchat_hook_command(ph, "", XCHAT_PRI_NORM, handle_outgoing, NULL, NULL); + xchat_hook_server(ph, "NOTICE", XCHAT_PRI_NORM, handle_incoming, NULL); + xchat_hook_server(ph, "PRIVMSG", XCHAT_PRI_NORM, handle_incoming, NULL); + //xchat_hook_server(ph, "RAW LINE", XCHAT_PRI_NORM, handle_debug, NULL); + xchat_hook_server(ph, "TOPIC", XCHAT_PRI_NORM, handle_incoming, NULL); + xchat_hook_server(ph, "332", XCHAT_PRI_NORM, handle_incoming, NULL); + + xchat_printf (ph, "%s plugin loaded\n", plugin_name); + /* Return success */ + return 1; +} + +int xchat_plugin_deinit(void) { + xchat_printf (ph, "%s plugin unloaded\n", plugin_name); + return 1; +} -- cgit 1.4.1 From 81ed389e71cda96c1bd5935dd5f9cb98327870ce Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 25 Nov 2011 10:24:33 +0100 Subject: get in sync with fishlim upstream --- plugins/fishlim/Makefile | 6 +++--- plugins/fishlim/README | 2 +- plugins/fishlim/fish.c | 28 ++++++++++++++-------------- plugins/fishlim/keystore.c | 2 +- plugins/fishlim/keystore.h | 2 +- plugins/fishlim/plugin_xchat.c | 24 ++++++++++++++---------- plugins/fishlim/plugin_xchat.h | 30 ++++++++++++++++++++++++++++++ plugins/fishlim/test.c | 8 ++++++++ 8 files changed, 72 insertions(+), 30 deletions(-) (limited to 'plugins/fishlim/plugin_xchat.c') diff --git a/plugins/fishlim/Makefile b/plugins/fishlim/Makefile index 7a5081e4..a1832c84 100644 --- a/plugins/fishlim/Makefile +++ b/plugins/fishlim/Makefile @@ -4,17 +4,17 @@ OURCFLAGS = -Wall -Wextra -Wno-unused-parameter -std=c99 -pedantic `pkg-config - OURLINKFLAGS = `pkg-config --libs glib-2.0 libcrypto` $(CFLAGS) $(LDFLAGS) BASE_OBJECTS = irc.o fish.o keystore.o misc.o -PLUGIN_OBJECTS = $(BASE_OBJECTS) xchat_plugin.o +PLUGIN_OBJECTS = $(BASE_OBJECTS) plugin_xchat.o TEST_OBJECTS = $(BASE_OBJECTS) test.o all: fishlim.so test fish.o: fish.h keystore.h misc.h irc.o: irc.h -keystore.o: keystore.h irc.h fish.h misc.h +keystore.o: keystore.h irc.h fish.h misc.h plugin_xchat.h misc.o: misc.h test.o: fish.h -xchat_plugin.o: fish.h irc.h keystore.h +plugin_xchat.o: fish.h irc.h keystore.h plugin_xchat.h .c.o: $(CC) $(OURCFLAGS) -c $< -o $@ diff --git a/plugins/fishlim/README b/plugins/fishlim/README index 9c5cd5fc..4f315b44 100644 --- a/plugins/fishlim/README +++ b/plugins/fishlim/README @@ -2,7 +2,7 @@ FiSHLiM - http://fishlim.slbdata.se/ + http://fishlim.kodafritt.se/ FiSHLiM is an XChat plugin for FiSH IRC encryption. It's my attempt at making diff --git a/plugins/fishlim/fish.c b/plugins/fishlim/fish.c index 0d92ecc9..cb977d7f 100644 --- a/plugins/fishlim/fish.c +++ b/plugins/fishlim/fish.c @@ -58,14 +58,14 @@ static const signed char fish_unbase64[256] = { char *fish_encrypt(const char *key, size_t keylen, const char *message) { BF_KEY bfkey; - size_t messagelen; - size_t i; - int j; - char *encrypted; - char *end; - unsigned char bit; - unsigned char word; - unsigned char d; + size_t messagelen; + size_t i; + int j; + char *encrypted; + char *end; + unsigned char bit; + unsigned char word; + unsigned char d; BF_set_key(&bfkey, keylen, (const unsigned char*)key); messagelen = strlen(message); @@ -111,12 +111,12 @@ char *fish_encrypt(const char *key, size_t keylen, const char *message) { char *fish_decrypt(const char *key, size_t keylen, const char *data) { BF_KEY bfkey; - size_t i; - char *decrypted; - char *end; - unsigned char bit; - unsigned char word; - unsigned char d; + size_t i; + char *decrypted; + char *end; + unsigned char bit; + unsigned char word; + unsigned char d; BF_set_key(&bfkey, keylen, (const unsigned char*)key); decrypted = malloc(strlen(data)+1); diff --git a/plugins/fishlim/keystore.c b/plugins/fishlim/keystore.c index ff30faa7..ce029a2e 100644 --- a/plugins/fishlim/keystore.c +++ b/plugins/fishlim/keystore.c @@ -29,7 +29,7 @@ #include "fish.h" #include "misc.h" #include "keystore.h" -#include "xchat_plugin.h" +#include "plugin_xchat.h" static char *keystore_password = NULL; diff --git a/plugins/fishlim/keystore.h b/plugins/fishlim/keystore.h index e6c527c7..b0c1c69c 100644 --- a/plugins/fishlim/keystore.h +++ b/plugins/fishlim/keystore.h @@ -33,7 +33,7 @@ #include char *keystore_get_key(const char *nick); -int keystore_store_key(const char *nick, const char *key); +bool keystore_store_key(const char *nick, const char *key); bool keystore_delete_nick(const char *nick); void keystore_secure_free(void *ptr, size_t size); diff --git a/plugins/fishlim/plugin_xchat.c b/plugins/fishlim/plugin_xchat.c index dd410548..ba0e1280 100644 --- a/plugins/fishlim/plugin_xchat.c +++ b/plugins/fishlim/plugin_xchat.c @@ -27,7 +27,11 @@ #include // #pragma GCC visibility push(default) +#ifdef _MSC_VER #include "xchat-plugin.h" +#else +#include +#endif #define XCHAT_MAX_WORDS 32 // #pragma GCC visibility pop @@ -40,7 +44,7 @@ static const char plugin_name[] = "FiSHLiM"; static const char plugin_desc[] = "Encryption plugin for the FiSH protocol. Less is More!"; -static const char plugin_version[] = "0.0.13"; +static const char plugin_version[] = "0.0.14"; static const char usage_setkey[] = "Usage: SETKEY [] , sets the key for a channel or nick"; static const char usage_delkey[] = "Usage: DELKEY , deletes the key for a channel or nick"; @@ -112,7 +116,7 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) { const char *recipient; const char *encrypted; const char *peice; - char *sender_nick; + char *sender_nick; char *decrypted; char *message; size_t w; @@ -127,7 +131,6 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) { if (!strcmp(command, "332")) w++; // Look for encrypted data - ew; for (ew = w+1; ew < XCHAT_MAX_WORDS-1; ew++) { const char *s = (ew == w+1 ? word[ew]+1 : word[ew]); if (strcmp(s, "+OK") == 0) goto has_encrypted_data; @@ -242,7 +245,7 @@ static int handle_delkey(char *word[], char *word_eol[], void *userdata) { * Returns the plugin name version information. */ void xchat_plugin_get_info(const char **name, const char **desc, - const char **version, void **reserved) { + const char **version, void **reserved) { *name = plugin_name; *desc = plugin_desc; *version = plugin_version; @@ -252,10 +255,10 @@ void xchat_plugin_get_info(const char **name, const char **desc, * Plugin entry point. */ int xchat_plugin_init(xchat_plugin *plugin_handle, - const char **name, - const char **desc, - const char **version, - char *arg) { + const char **name, + const char **desc, + const char **version, + char *arg) { ph = plugin_handle; /* Send our info to XChat */ @@ -275,12 +278,13 @@ int xchat_plugin_init(xchat_plugin *plugin_handle, xchat_hook_server(ph, "TOPIC", XCHAT_PRI_NORM, handle_incoming, NULL); xchat_hook_server(ph, "332", XCHAT_PRI_NORM, handle_incoming, NULL); - xchat_printf (ph, "%s plugin loaded\n", plugin_name); + xchat_printf(ph, "%s plugin loaded\n", plugin_name); /* Return success */ return 1; } int xchat_plugin_deinit(void) { - xchat_printf (ph, "%s plugin unloaded\n", plugin_name); + xchat_printf(ph, "%s plugin unloaded\n", plugin_name); return 1; } + diff --git a/plugins/fishlim/plugin_xchat.h b/plugins/fishlim/plugin_xchat.h index 40e21816..0243e81f 100644 --- a/plugins/fishlim/plugin_xchat.h +++ b/plugins/fishlim/plugin_xchat.h @@ -1 +1,31 @@ +/* + + Copyright (c) 2010 Samuel Lidén Borell + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +*/ + +#ifndef XCHAT_PLUGIN_H +#define XCHAT_PLUGIN_H + gchar *get_config_filename(); + +#endif + diff --git a/plugins/fishlim/test.c b/plugins/fishlim/test.c index 2032496a..3511bbb1 100644 --- a/plugins/fishlim/test.c +++ b/plugins/fishlim/test.c @@ -22,10 +22,18 @@ */ +#include #include #include #include "fish.h" +// We can't use the XChat plugin API from here... +gchar *get_config_filename() { + const gchar *homedir = g_get_home_dir(); + return g_build_filename(homedir, ".xchat2", "blow.ini", NULL); +} + + static int decrypt(int nick_count, char *nicks[]) { char encrypted[8192]; while (fgets(encrypted, sizeof(encrypted), stdin)) { -- cgit 1.4.1 From 18404054b0e7bad84c552530fa5771f38469f2d3 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Tue, 3 Jan 2012 16:38:40 +0100 Subject: sync with fishlim head --- plugins/fishlim/Makefile | 2 +- plugins/fishlim/keystore.c | 4 ++-- plugins/fishlim/plugin_xchat.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins/fishlim/plugin_xchat.c') diff --git a/plugins/fishlim/Makefile b/plugins/fishlim/Makefile index a1832c84..3f0e93d2 100644 --- a/plugins/fishlim/Makefile +++ b/plugins/fishlim/Makefile @@ -23,7 +23,7 @@ fishlim.so: $(PLUGIN_OBJECTS) $(CC) -shared $(OURLINKFLAGS) $(PLUGIN_OBJECTS) -o $@ test: $(TEST_OBJECTS) - $(CC) $(OURLINKFLAGS) $(TEST_OBJECTS) -o $@ + $(CC) $(TEST_OBJECTS) -o $@ $(OURLINKFLAGS) .PHONY: all clean distclean install uninstall diff --git a/plugins/fishlim/keystore.c b/plugins/fishlim/keystore.c index ce029a2e..d97107fd 100644 --- a/plugins/fishlim/keystore.c +++ b/plugins/fishlim/keystore.c @@ -164,8 +164,8 @@ bool keystore_store_key(const char *nick, const char *key) { encrypted = fish_encrypt(password, strlen(password), key); if (!encrypted) goto end; - // Prepend "OK+ " - wrapped = g_strconcat("OK+ ", encrypted, NULL); + // Prepend "+OK " + wrapped = g_strconcat("+OK ", encrypted, NULL); g_free(encrypted); // Store encrypted in file diff --git a/plugins/fishlim/plugin_xchat.c b/plugins/fishlim/plugin_xchat.c index ba0e1280..01f5d747 100644 --- a/plugins/fishlim/plugin_xchat.c +++ b/plugins/fishlim/plugin_xchat.c @@ -44,7 +44,7 @@ static const char plugin_name[] = "FiSHLiM"; static const char plugin_desc[] = "Encryption plugin for the FiSH protocol. Less is More!"; -static const char plugin_version[] = "0.0.14"; +static const char plugin_version[] = "0.0.15"; static const char usage_setkey[] = "Usage: SETKEY [] , sets the key for a channel or nick"; static const char usage_delkey[] = "Usage: DELKEY , deletes the key for a channel or nick"; -- cgit 1.4.1 From 9d91db6be80b7b25fc6b3b89c8ec6b0163f217a1 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 16 Mar 2012 00:17:03 +0100 Subject: sync with fishlim head --- plugins/fishlim/plugin_xchat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/fishlim/plugin_xchat.c') diff --git a/plugins/fishlim/plugin_xchat.c b/plugins/fishlim/plugin_xchat.c index 01f5d747..8bbcf3e2 100644 --- a/plugins/fishlim/plugin_xchat.c +++ b/plugins/fishlim/plugin_xchat.c @@ -133,7 +133,7 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) { // Look for encrypted data for (ew = w+1; ew < XCHAT_MAX_WORDS-1; ew++) { const char *s = (ew == w+1 ? word[ew]+1 : word[ew]); - if (strcmp(s, "+OK") == 0) goto has_encrypted_data; + if (strcmp(s, "+OK") == 0 || strcmp(s, "mcps") == 0) goto has_encrypted_data; } return XCHAT_EAT_NONE; has_encrypted_data: ; -- cgit 1.4.1 From 21f1427cc6f6201444566ae20a92b7a9aa6b5eaa Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Fri, 4 May 2012 19:29:02 +0200 Subject: sync with fishlim head --- plugins/fishlim/LICENSE | 2 +- plugins/fishlim/fish.c | 2 +- plugins/fishlim/fish.h | 2 +- plugins/fishlim/irc.c | 2 +- plugins/fishlim/irc.h | 2 +- plugins/fishlim/keystore.c | 2 +- plugins/fishlim/keystore.h | 2 +- plugins/fishlim/misc.c | 2 +- plugins/fishlim/misc.h | 2 +- plugins/fishlim/plugin_xchat.c | 2 +- plugins/fishlim/plugin_xchat.h | 2 +- plugins/fishlim/test.c | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) (limited to 'plugins/fishlim/plugin_xchat.c') diff --git a/plugins/fishlim/LICENSE b/plugins/fishlim/LICENSE index 427f2631..a3e0474a 100644 --- a/plugins/fishlim/LICENSE +++ b/plugins/fishlim/LICENSE @@ -1,5 +1,5 @@ -Copyright (c) 2010-2011 Samuel Lidén Borell +Copyright (c) 2010-2011 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/fish.c b/plugins/fishlim/fish.c index cb977d7f..d4f7b118 100644 --- a/plugins/fishlim/fish.c +++ b/plugins/fishlim/fish.c @@ -1,6 +1,6 @@ /* - Copyright (c) 2010 Samuel Lidén Borell + Copyright (c) 2010 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/fish.h b/plugins/fishlim/fish.h index d4057a7b..5a4e85d0 100644 --- a/plugins/fishlim/fish.h +++ b/plugins/fishlim/fish.h @@ -1,6 +1,6 @@ /* - Copyright (c) 2010 Samuel Lidén Borell + Copyright (c) 2010 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/irc.c b/plugins/fishlim/irc.c index a96c4c91..3586921b 100644 --- a/plugins/fishlim/irc.c +++ b/plugins/fishlim/irc.c @@ -1,6 +1,6 @@ /* - Copyright (c) 2010 Samuel Lidén Borell + Copyright (c) 2010 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/irc.h b/plugins/fishlim/irc.h index 0c1e7463..58a58c83 100644 --- a/plugins/fishlim/irc.h +++ b/plugins/fishlim/irc.h @@ -1,6 +1,6 @@ /* - Copyright (c) 2010 Samuel Lidén Borell + Copyright (c) 2010 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/keystore.c b/plugins/fishlim/keystore.c index d97107fd..e628c289 100644 --- a/plugins/fishlim/keystore.c +++ b/plugins/fishlim/keystore.c @@ -1,6 +1,6 @@ /* - Copyright (c) 2010 Samuel Lidén Borell + Copyright (c) 2010 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/keystore.h b/plugins/fishlim/keystore.h index b0c1c69c..edf54992 100644 --- a/plugins/fishlim/keystore.h +++ b/plugins/fishlim/keystore.h @@ -1,6 +1,6 @@ /* - Copyright (c) 2010 Samuel Lidén Borell + Copyright (c) 2010 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/misc.c b/plugins/fishlim/misc.c index 32fe3595..2b78961d 100644 --- a/plugins/fishlim/misc.c +++ b/plugins/fishlim/misc.c @@ -1,6 +1,6 @@ /* - Copyright (c) 2010 Samuel Lidén Borell + Copyright (c) 2010 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/misc.h b/plugins/fishlim/misc.h index 0adc928c..ee4fc5b8 100644 --- a/plugins/fishlim/misc.h +++ b/plugins/fishlim/misc.h @@ -1,6 +1,6 @@ /* - Copyright (c) 2010 Samuel Lidén Borell + Copyright (c) 2010 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/plugin_xchat.c b/plugins/fishlim/plugin_xchat.c index 8bbcf3e2..80e6c8cd 100644 --- a/plugins/fishlim/plugin_xchat.c +++ b/plugins/fishlim/plugin_xchat.c @@ -1,6 +1,6 @@ /* - Copyright (c) 2010-2011 Samuel Lidén Borell + Copyright (c) 2010-2011 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/plugin_xchat.h b/plugins/fishlim/plugin_xchat.h index 0243e81f..d606526d 100644 --- a/plugins/fishlim/plugin_xchat.h +++ b/plugins/fishlim/plugin_xchat.h @@ -1,6 +1,6 @@ /* - Copyright (c) 2010 Samuel Lidén Borell + Copyright (c) 2010 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/plugins/fishlim/test.c b/plugins/fishlim/test.c index 3511bbb1..9e6a1f5f 100644 --- a/plugins/fishlim/test.c +++ b/plugins/fishlim/test.c @@ -1,6 +1,6 @@ /* - Copyright (c) 2010 Samuel Lidén Borell + Copyright (c) 2010 Samuel Lidén Borell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal -- cgit 1.4.1 From 5a50da6f827f96f12739a50d8917d43e28191551 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sun, 13 May 2012 14:45:32 +0200 Subject: Sync with FiSHLiM HEAD --- plugins/fishlim/README | 1 + plugins/fishlim/plugin_xchat.c | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'plugins/fishlim/plugin_xchat.c') diff --git a/plugins/fishlim/README b/plugins/fishlim/README index 4f315b44..00d7f682 100644 --- a/plugins/fishlim/README +++ b/plugins/fishlim/README @@ -26,6 +26,7 @@ Not working: * Password-protected key storage * Topic encryption * Remote exploitation (hopefully!) + * Plaintext content that contain +OK is decrypted twice Commands diff --git a/plugins/fishlim/plugin_xchat.c b/plugins/fishlim/plugin_xchat.c index 80e6c8cd..5e261116 100644 --- a/plugins/fishlim/plugin_xchat.c +++ b/plugins/fishlim/plugin_xchat.c @@ -44,7 +44,7 @@ static const char plugin_name[] = "FiSHLiM"; static const char plugin_desc[] = "Encryption plugin for the FiSH protocol. Less is More!"; -static const char plugin_version[] = "0.0.15"; +static const char plugin_version[] = "0.0.16"; static const char usage_setkey[] = "Usage: SETKEY [] , sets the key for a channel or nick"; static const char usage_delkey[] = "Usage: DELKEY , deletes the key for a channel or nick"; @@ -161,9 +161,15 @@ static int handle_incoming(char *word[], char *word_eol[], void *userdata) { // Add the encrypted data peice = decrypted; uw++; // Skip "OK+" + + if (ew == w+1) { + // Prefix with colon, which gets stripped out otherwise + if (!append(&message, &length, ":")) goto decrypt_error; + } + } else { // Add unencrypted data (for example, a prefix from a bouncer or bot) - peice = (uw == w+1 ? word[uw]+1 : word[uw]); + peice = word[uw]; } if (!append(&message, &length, peice)) goto decrypt_error; -- cgit 1.4.1