From 382d15d447b7a95390decfa783836ae4fe255b3d Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 7 Jan 2003 10:25:44 +0000 Subject: [PATCH] Merged from silc_1_0_branch. --- .cvsignore | 3 + CHANGES | 312 ++ INSTALL | 5 + Makefile.am.pre | 2 +- TODO | 18 +- apps/irssi/Makefile.am | 4 +- apps/irssi/default.theme | 58 + apps/irssi/docs/help/in/action.in | 5 +- apps/irssi/docs/help/in/admin.in | 5 +- apps/irssi/docs/help/in/ban.in | 9 +- apps/irssi/docs/help/in/cat.in | 2 +- apps/irssi/docs/help/in/cd.in | 2 +- apps/irssi/docs/help/in/close.in | 7 +- apps/irssi/docs/help/in/cmode.in | 11 +- apps/irssi/docs/help/in/cumode.in | 9 + apps/irssi/docs/help/in/dehilight.in | 7 +- apps/irssi/docs/help/in/exec.in | 3 + apps/irssi/docs/help/in/getkey.in | 1 + apps/irssi/docs/help/in/info.in | 1 + apps/irssi/docs/help/in/invite.in | 7 + apps/irssi/docs/help/in/key.in | 2 + apps/irssi/docs/help/in/kick.in | 2 +- apps/irssi/docs/help/in/lastlog.in | 2 +- apps/irssi/docs/help/in/layout.in | 6 +- apps/irssi/docs/help/in/list.in | 15 +- apps/irssi/docs/help/in/load.in | 7 +- apps/irssi/docs/help/in/log.in | 18 +- apps/irssi/docs/help/in/motd.in | 5 +- apps/irssi/docs/help/in/msg.in | 21 +- apps/irssi/docs/help/in/names.in | 10 +- apps/irssi/docs/help/in/part.in | 5 +- apps/irssi/docs/help/in/query.in | 8 +- apps/irssi/docs/help/in/quit.in | 8 +- apps/irssi/docs/help/in/save.in | 6 +- apps/irssi/docs/help/in/sconnect.in | 5 +- apps/irssi/docs/help/in/script.in | 2 +- apps/irssi/docs/help/in/server.in | 11 +- apps/irssi/docs/help/in/shutdown.in | 3 +- apps/irssi/docs/help/in/smsg.in | 33 + apps/irssi/docs/help/in/stats.in | 2 + apps/irssi/docs/help/in/upgrade.in | 9 - apps/irssi/docs/help/in/users.in | 7 +- apps/irssi/docs/help/in/whois.in | 2 +- apps/irssi/silc.conf | 23 +- apps/irssi/src/core/chat-commands.c | 7 +- apps/irssi/src/core/core.c | 4 +- apps/irssi/src/core/net-nonblock.c | 44 +- apps/irssi/src/core/net-nonblock.h | 4 +- apps/irssi/src/core/network.c | 19 +- apps/irssi/src/core/servers.c | 26 +- apps/irssi/src/core/session.c | 4 +- apps/irssi/src/fe-common/core/fe-messages.c | 2 +- apps/irssi/src/fe-common/core/fe-messages.h | 2 + apps/irssi/src/fe-common/core/themes.c | 60 +- apps/irssi/src/fe-common/silc/Makefile.am | 3 +- .../irssi/src/fe-common/silc/fe-common-silc.c | 5 + apps/irssi/src/fe-common/silc/fe-messages.c | 248 ++ .../irssi/src/fe-common/silc/module-formats.c | 30 + .../irssi/src/fe-common/silc/module-formats.h | 30 + apps/irssi/src/fe-text/Makefile.am | 4 +- apps/irssi/src/silc/core/client_ops.c | 223 +- apps/irssi/src/silc/core/client_ops.h | 2 + apps/irssi/src/silc/core/silc-commands.h | 8 + apps/irssi/src/silc/core/silc-core.c | 1 + apps/irssi/src/silc/core/silc-core.h | 4 + apps/irssi/src/silc/core/silc-nicklist.c | 4 +- apps/irssi/src/silc/core/silc-servers.c | 98 +- apps/silcd/command.c | 34 +- apps/silcd/command_reply.c | 42 +- apps/silcd/idlist.c | 37 +- apps/silcd/packet_receive.c | 39 +- apps/silcd/packet_send.c | 51 +- apps/silcd/server.c | 106 +- apps/silcd/server.h | 15 +- apps/silcd/server_backup.c | 106 +- apps/silcd/server_internal.h | 1 + apps/silcd/server_query.c | 2 +- apps/silcd/server_util.c | 37 +- apps/silcd/server_util.h | 4 + apps/silcd/serverconfig.c | 162 +- apps/silcd/silcd.c | 130 +- configure.in.pre | 125 +- doc/Makefile.am.pre | 10 +- ...raft-riikonen-silc-flags-payloads-02.nroff | 421 +++ doc/draft-riikonen-silc-spec-07.nroff | 2517 +++++++++++++++++ doc/example_silcd.conf.in | 20 +- doc/silc.yo | 7 +- doc/silcd.conf.yo | 2 +- doc/silcd.yo | 2 +- includes/silcwin32.h | 14 + lib/Makefile.am.pre | 29 +- lib/contrib/.cvsignore | 2 + lib/silcclient/client.c | 8 +- lib/silcclient/client_attrs.c | 2 +- lib/silcclient/client_channel.c | 17 +- lib/silcclient/client_notify.c | 113 +- lib/silcclient/client_ops_example.c | 8 +- lib/silcclient/client_prvmsg.c | 9 +- lib/silcclient/command.c | 99 +- lib/silcclient/command_reply.c | 16 + lib/silcclient/silcclient.h | 11 +- lib/silccore/silcargument.c | 12 +- lib/silccore/silcattrs.c | 17 +- lib/silccore/silcauth.c | 2 +- lib/silccore/silcchannel.c | 45 +- lib/silccore/silcchannel_i.h | 61 - lib/silccore/silccommand.c | 15 +- lib/silccore/silcidcache.c | 51 +- lib/silccore/silcmessage.c | 217 +- lib/silccore/silcmessage.h | 106 +- lib/silccore/silcnotify.c | 17 +- lib/silccore/silcpacket.c | 37 +- lib/silccore/silcpacket.h | 2 +- lib/silccore/tests/Makefile.am | 27 + lib/silccore/tests/test_silcargument.c | 190 ++ lib/silccrypt/Makefile.am | 11 +- lib/silccrypt/md5_internal.h | 6 +- lib/silccrypt/silccipher.c | 10 + lib/silccrypt/silcpkcs.c | 115 +- lib/silccrypt/silcpkcs.h | 193 +- lib/silccrypt/tests/Makefile.am | 38 + lib/silccrypt/tests/inst_aes | 7 - lib/silccrypt/tests/inst_twofish | 7 - lib/silccrypt/tests/test_hmacmd5.c | 124 + lib/silccrypt/tests/test_hmacsha1.c | 124 + lib/silccrypt/tests/test_mars.c | 56 - lib/silccrypt/tests/test_md5.c | 92 + lib/silccrypt/tests/test_sha1.c | 76 + lib/silcmath/Makefile.am | 2 +- lib/silcsftp/sftp_util.c | 8 +- lib/silcsftp/tests/sftp_client.c | 153 +- lib/silcsftp/tests/sftp_server.c | 54 +- lib/silcsim/Makefile.am | 11 +- lib/silcske/payload.c | 18 +- lib/silcske/silcske.c | 64 +- lib/silcutil/silcbuffmt.c | 95 +- lib/silcutil/silcconfig.c | 58 +- lib/silcutil/silcfileutil.c | 14 +- lib/silcutil/silcmemory.c | 8 +- lib/silcutil/silcschedule.c | 17 +- lib/silcutil/silcsockconn.c | 2 +- lib/silcutil/silcutil.c | 14 +- lib/silcutil/silcutil.h | 3 +- lib/silcutil/silcvcard.c | 12 +- lib/silcutil/silcvcard.h | 4 +- lib/silcutil/stacktrace.c | 13 +- lib/silcutil/unix/silcunixmutex.c | 6 +- lib/silcutil/unix/silcunixsockconn.c | 2 + lib/silcutil/win32/silcwin32mutex.c | 23 +- lib/silcutil/win32/silcwin32sockconn.c | 2 + lib/silcutil/win32/silcwin32thread.c | 19 +- lib/silcutil/win32/silcwin32util.c | 10 + libtoolfix | 63 + prepare | 2 +- tutorial/mybot/mybot.c | 17 +- win32/libsilc/libsilc.def | 1177 ++++---- win32/libsilc/libsilc.dsp | 32 +- win32/silcdefs.h | 2 + 158 files changed, 7467 insertions(+), 1809 deletions(-) create mode 100644 apps/irssi/docs/help/in/smsg.in delete mode 100644 apps/irssi/docs/help/in/upgrade.in create mode 100644 apps/irssi/src/fe-common/silc/fe-messages.c create mode 100644 doc/draft-riikonen-silc-flags-payloads-02.nroff create mode 100644 doc/draft-riikonen-silc-spec-07.nroff create mode 100644 lib/contrib/.cvsignore delete mode 100644 lib/silccore/silcchannel_i.h create mode 100644 lib/silccore/tests/Makefile.am create mode 100644 lib/silccore/tests/test_silcargument.c create mode 100644 lib/silccrypt/tests/Makefile.am delete mode 100644 lib/silccrypt/tests/inst_aes delete mode 100644 lib/silccrypt/tests/inst_twofish create mode 100644 lib/silccrypt/tests/test_hmacmd5.c create mode 100644 lib/silccrypt/tests/test_hmacsha1.c delete mode 100644 lib/silccrypt/tests/test_mars.c create mode 100644 lib/silccrypt/tests/test_md5.c create mode 100644 lib/silccrypt/tests/test_sha1.c create mode 100755 libtoolfix diff --git a/.cvsignore b/.cvsignore index 33fa3fee..b79d574a 100644 --- a/.cvsignore +++ b/.cvsignore @@ -7,6 +7,8 @@ Makefile.defines_int Makefile.defines_int.in acconfig.h aclocal.m4 +autom4te.cache +autom4te-*.cache config.cache config.guess config.h @@ -19,5 +21,6 @@ configure.in libtool libtool-shared ltconfig +ltmain.sh stamp-h stamp-h.in diff --git a/CHANGES b/CHANGES index 15b5754a..40e281ac 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,315 @@ +Thu Dec 26 14:19:29 EET 2002 Pekka Riikonen + + * Added some sanity checks in server for correctness of the + server configuration. Affected file silcd/serverconfig.c. + +Fri Dec 20 10:47:59 CET 2002 Pekka Riikonen + + * Prevent endless resolving of user informations in USERS + command by checking the command reply status correctly. + Affected file lib/silcclient/command_reply.c. + +Tue Dec 17 10:05:00 CET 2002 Pekka Riikonen + + * Fixed file writing on WIN32 to use O_BINARY flag. Affected + file is lib/silcutil/silcfileutil.c. A patch by Matthew + Aldous . + + * Added better implementation using CriticalSection of + SilcMutex on WIN32. A patch by Mikko Lähteenmäki + . + + * Added some Winsock WIN32 compatiblity defines into + includes/silcwin32.h. + +Mon Dec 16 19:33:05 EET 2002 Pekka Riikonen + + * Fixed double free in async host lookup code. Affected file + lib/silcutil/silcsockconn.c. + + * On backup router handle now the SERVER_SIGNOFF from router + for local connected servers too, and close the connections. + + Do not process them as normally signing off servers when they + really signoff by sending EOF fe, but always assume that + router sends the SERVER_SIGNOFF. + + Affected files silcd/server.c and silcd/packet_receive.c. + + * Fixed socket unsetting when closing connections. Affected + files silcd/server.c and silcd/packet_send.c. + + * Do not print the nickname in SERVER_SIGNOFF if we do not + have it. Prevents asserts in Irssi core. It is possible we + don't have the nick if it was just being resolved when server + signoff. Affected file irssi/src/silc/core/client_ops.c. + +Thu Dec 12 23:22:50 EET 2002 Pekka Riikonen + + * Fixed autonick crashbug in client library. Affected file + lib/silcclient/client.c. + + * Fixed Unix implementation of SilcMutex to really assert if + the mutex is locked/unlcoked already. Affected file + lib/silcutil/unix/silcunixmutex.c. + + * Fixed locking in silc_schedule_uninit. It didn't lock + when dispatching timeout tasks. Affected file is + lib/silcutil/silcschedule.c. + + * Changed Win32 implementation of SilcThread to use modern + Win32 interface. Affected file is + lib/silcutil/win32/silcwin32thread.c A patch by Mikko L. + +Thu Dec 12 12:06:59 CET 2002 Jochen Eisinger + + * Don't print signed messages when sending failed. Affected files + irssi/src/silc/core/silc-[servers.c/commands.h] + + * Send adquate signal when founding a channel by joing it. Affect + file irssi/src/silc/core/client_ops.c + +Wed Dec 11 21:46:19 CET 2002 Jochen Eisinger + + * Fix theme abstracts parsing. Affected files irssi/default.theme, + irssi/src/fe-common/core/themes.c + +Wed Dec 11 20:20:07 EET 2002 Pekka Riikonen + + * Fixed close command to use the port correctly when closing + server connections. Affected file silcd/idlist.c. + + * Check for NULL outbuf in silc_socket_write. It is possible + that it is NULL is some odd case. Affected files are + lib/silcutil/[unix/win32]/silc[unix/win32]sockconn.c. + + * Do not call final protocol callback for backup router + resuming protocol when closing connection. It is closed + by timeout in case of error. Affected file silcd/server.c. + + * Backup reconnect to router if backup resuming protocol + failed. Affected file silcd/server_backup.c. + +Wed Dec 11 10:01:26 CET 2002 Pekka Riikonen + + * Fixed double free in SKE library error hadling when signature + error occurred. Affected file lib/silcske/silcske.c. + + * Save the fingerprint to new SilcClientEntry after changing + nickname. Affected file lib/silcclient/client_notify.c. + + * Print SIGNOFF in Irssi SILC client only if the nickname is + known. Prevents asserts in Irssi core. It is possible we + don't have the nick if it was just being resolved when it + quit. Affected file irssi/src/silc/core/client_ops.c. + +Tue Dec 10 21:47:56 EET 2002 Pekka Riikonen + + * Fixed double free in invite list adding code when adding + invite strings. Affected file silcd/server_util.c. + +Fri Dec 6 17:40:24 EET 2002 Pekka Riikonen + + * More log printing during backup router protocol. Affected + file silcd/server_backup.c. + + * Removed backwards support for old private key file format. + Affected file lib/silccrypt/silcpkcs.c. + + * Removed backwards support for not-so-strict decryption length + check, it's strict now. Affected lib/silccrypt/silccipher.c. + + * GETKEY to update the client entrys fingerprint too. + Affected file lib/silcclient/command_reply.c. + + * Added --without-libtoolfix for package builders using weird + wrappers around libtool (BSD at least). + +Thu Dec 5 22:29:46 EET 2002 Pekka Riikonen + + * Fixed backup router bugs: When backup resumes router and + receives a CHANNEL_MESSAGE packet the backup must not act + as router since the packet header decryption would be + different. Also, when relaying packets to channel, do + not re-encrypt packets on backup that came from the primary + since the connection isn't really router-router connection. + Affected files silcd/server.c, silcd/packet_send.c. + + * Added checks in encryption/decryption that encryption/decryption + length sent as argument really is multiple by block size. Helps + catching really weird bugs like the above backup router bugs + when packets are being decrypted in wrong way. Affected files + lib/silccore/silcpacket.c, and lib/silccrypt/silccipher.c. + + * Fixed padding generation in private key file encryption. + Affected file lib/silccrypt/silcpkcs.c. + +Thu Dec 5 16:35:23 EET 2002 Pekka Riikonen + + * Added ignore_message_signatures setting which can be used + to ignore signatures in messages. Affected files are + irssi/src/silc/core/client_ops.c, silc-core.c. + + * Fixed the libtoolfix to use command line options instead of + environment variables. They didn't work as expected. Now, + the libtool is fully run-time configurable. + +Wed Dec 4 21:08:52 CET 2002 Jochen Eisinger + + * Verify signature payload for signed messages. Affected files + irssi/src/silc/core/client_ops.h, irssi/src/silc/core/silc-servers.c, + irssi/src/silc/core/silc-core.h + + * Display signature verification result in public and private + messages using theme abstracts. See irssi/default.theme for + examples on their usage. Affected files + irssi/default.theme, irssi/src/fe-common/silc/fe-messages.h, + irssi/src/fe-common/silc/module-formats.[ch], + irssi/src/fe-common/silc/fe-common-silc.c, + irssi/src/fe-common/silc/Makefile.am + irssi/src/fe-common/core/fe-messages.[ch] + + * Fixed bugs in Irssi's theme parsing. Affected files + irssi/src/fe-common/core/themes.c + +Wed Dec 4 18:29:13 EET 2002 Pekka Riikonen + + * Calculate the correct length for signed messages before + encrypting, it must be multiple by block size. Affected + file lib/silccore/silcmessage.c. + + * silc_message_signed_get_public_key returns now both + decoded and encoded public key. Affected files are + lib/silccore/silcmessage.[ch]. + + * Added libtoolfix script that makes the libtool more generic + and configurable in run-time. Now we can specify in run-time + if what kind of libraries we want to create, regardless of + configuration. SIMs are now creates even if --disable-shared + was explicitly given. + +Tue Dec 3 23:26:55 EET 2002 Pekka Riikonen + + * Fixed founder key sending in CMODE command in client. + Affected file lib/silcclient/command.c. + + * Fixed CUMODE founder authentication in server to not check + for client's public key since it's not supposed to do that. + Affected file silcd/command.c. + +Tue Dec 3 12:02:41 CET 2002 Jochen Eisinger + + * Set realname and hostname in NICK_REC records. Affected file + irssi/src/silc/core/silc-nicklist.c + +Mon Dec 2 20:50:20 EET 2002 Pekka Riikonen + + * Remove 1.0 protocol backwards compat code from client + library. + + * Added more reliable check for whether nickname did change + or not, or whether only Client ID changed in NICK_CHANGE + notify. Affected file lib/silcclient/client_notify.c. + Fixes bug in '@' character handling in a nickname. + + * Added support for automatically parsing signature from + the message payload. Added new function + silc_message_get_signature to return the payload to + application. Affected files lib/silccore/silcmessage.[ch]. + + * Changed the private_message and channel_message client + operations to deliver the SilcMessagePayload to the + application too. Application can use it fe. to get the + signature from the message for verification. Affected + file lib/silcclient/silcclient.h, client_channel.c and + client_prvmsg.c. + + * Redefined the signed payload for message payloads. + Updated protocol specs and implemented. + +Mon Dec 2 16:28:29 EET 2002 Pekka Riikonen + + * Fixed wrong invite and ban list handling in server command + reply. Affected files are silcd/command_reply.c, + silcd/server_util.[ch]. + +Sun Dec 1 20:48:17 EET 2002 Pekka Riikonen + + * Fixed CMODE setting in server when founder mode was set. + Affected file silcd/command.c. Bug #95. + + * Added support to setting specific public key in CMODE in + Irssi SILC client. Affected file lib/silcclient/command.c. + + * Added support to use specific public key in CUMODE in + Irssi SILC Client. Affected file lib/silcclient/command.c. + + * Added support for inviting and banning by public key in + Irssi SILC client. Affected file lib/silcclient/command.c. + + * Fixed fingerprint/babbleprint showing in invite and ban + list command replys. Affected file is + irssi/src/silc/core/client_ops.c. + +Sun Dec 1 16:32:03 CET 2002 Jochen Eisinger + + * Format CMODE +c and +h to display both the mode and the argument + +Sun Dec 1 18:17:22 EET 2002 Pekka Riikonen + + * Added test vectors and test programs for SHA-1, MD5, + HMAC-SHA1 and HMAC-MD5. New tests are located in + lib/silccrypt/tests/. Fixed also argument decoding bug in + MD5 implementation. Affected file lib/silccrypt/md5.c. + + * Changed the channel private key and private message key + generation (with static keys) to use SHA1 instead of MD5, + as SHA1 is the mandatory hash function in SILC. Affected + file lib/silcclient/client_[channel/prvmsg].c. + + * Changed the private key file encryption to use SHA1 instead + of MD5. Added support for the old generation and added + automatic change of the key (to be removed later). Affected + files lib/silccrypt/silcpkcs.c. + +Sat Nov 30 19:07:52 EET 2002 Pekka Riikonen + + * Load only files with .pub suffix in PublicKeyDir. Affected + file silcd/serverconfig.c. + +Sat Nov 30 14:29:34 CET 2002 Johnny Mnemonic + + * Extended the SILC_SERVER_LOG_ERROR macro to all available logging + channels. Affected files silcd/silcd.c, silcd/server.h. + + * Added the config directive PublicKeyDir for the client block. + Affected files doc/exampe_silcd.conf.in, silcd/serverconfig.[ch]. + +Sat Nov 30 09:30:55 CET 2002 Pekka Riikonen + + * Merged Toni's irssi/silc.conf patch. + + * ROBODoc cleanup patch to lib/silccrypt/silcpkcs.h by johnny. + + * Max alloc tests in allocation routines. Affected file + lib/silcutil/silcmemory.c. + +Fri Nov 29 23:44:29 EET 2002 Pekka Riikonen + + * Fixed a typo in resuming code that fixed detach/resume code + in server. Bug #93. Affected file silcd/packet_receive.c. + +Thu Nov 28 17:17:11 CET 2002 Jochen Eisinger + + * Do reverse lookups for server when /connecting. Affected files + irssi/silc.conf, irssi/src/core/servers.c, irssi/src/core/network.c, + irssi/src/core/net-nonblock.* + +Thu Nov 28 16:19:18 CET 2002 Pekka Riikonen + + * Added library versioning for shared libraries. Affected + files configure.in.pre and lib/Makefile.am.pre. + Wed Nov 27 21:51:52 CET 2002 Jochen Eisinger * Display INVITE and BAN lists as specified by SILC 1.2 diff --git a/INSTALL b/INSTALL index 847e9e68..9871e92e 100644 --- a/INSTALL +++ b/INSTALL @@ -49,6 +49,11 @@ package or does not want to use them, you can give the --disable-asm option to the `configure' script. This will assure that assembler optimized code is not compiled in. +`--enabled-shared' + + If you wish to compile and install shared libraries then enable this +option. By default all libraries are compiled as static libraries. + `--enable-debug' If you would like to enable the debugging for the compiled programs diff --git a/Makefile.am.pre b/Makefile.am.pre index 522f7f2c..e20a823b 100644 --- a/Makefile.am.pre +++ b/Makefile.am.pre @@ -33,7 +33,7 @@ dist-bzip: distdir -rm -rf $(distdir) SILC_EXTRA_DIST = SILC_DISTRIBUTION_EXTRA -EXTRA_DIST = CHANGES CREDITS $(SILC_EXTRA_DIST) +EXTRA_DIST = libtoolfix CHANGES CREDITS $(SILC_EXTRA_DIST) # # Installing of SILC into the system diff --git a/TODO b/TODO index 7ed56659..1d5f3a69 100644 --- a/TODO +++ b/TODO @@ -1,14 +1,6 @@ TODO for Irssi SILC Client 1.0 ============================== - o Support to set arbitrary pulic key in CMODE. - - o INVITE/BAN by public key file. - - o Signed message payload handling on UI - - o bugs parsing nicknames with @ in NICK_CHANGE - o Testing - See test plan: http://silcnet.org/docs/silc-client-1.0-test.pdf http://silcnet.org/docs/silc-client-1.0-test.ps @@ -17,6 +9,8 @@ TODO for Irssi SILC Client 1.0 TODO for SILC Server 1.0 ======================== + o Fix CUMODE_CHANGE and CMODE_CHANGE for founder key things. + o 1.2 backup router support o Testing @@ -25,9 +19,11 @@ TODO for SILC Server 1.0 TODO/bugs In SILC Libraries =========================== - o WIN32 silc_net_create_connection_async does not work the same way - than on Unix. Do it with threads on WIN32. The function works but - is not actually async currently (Fix this to 0.9.x). + o Test cases for all cryptographic primitive in lib/silccrypt/ + + o Test cases for all payload encoding and decoding routins in lib/silccore/ + + o Test cases for math library routines in lib/silcmath/ TODO in Toolkit Documentation diff --git a/apps/irssi/Makefile.am b/apps/irssi/Makefile.am index 4665195f..69891b7b 100644 --- a/apps/irssi/Makefile.am +++ b/apps/irssi/Makefile.am @@ -19,7 +19,7 @@ include $(top_srcdir)/Makefile.defines.in #confdir = $(sysconfdir) confdir = $(silc_etcdir) -conf_DATA = silc.conf +conffile = silc.conf themedir = $(datadir)/silc/themes theme_DATA = default.theme @@ -33,7 +33,7 @@ EXTRA_DIST = \ file2header.sh \ irssi.spec \ irssi.spec.in \ - $(conf_DATA) \ + $(conffile) \ $(theme_DATA) \ irssi-config.in \ irssi-icon.png \ diff --git a/apps/irssi/default.theme b/apps/irssi/default.theme index 121ca945..1e2dca6f 100644 --- a/apps/irssi/default.theme +++ b/apps/irssi/default.theme @@ -273,6 +273,64 @@ abstracts = { sb_act_hilight = "%M$*"; # hilight with specified color, $0 = color, $1 = text sb_act_hilight_color = "$0$1-%n"; + + # signed messages + # the following formats fit the Irssi default theme: + # + # flag_signed = "%GS%n"; + # flag_unknown = "%Y?%n"; + # flag_failed = "%RF%n"; + # + # pubmsghinick_signed = "{msgnick {flag_signed} $0$2-%n}"; + # pubmsghinick_unknown = "{msgnick {flag_unknown} $0$2-%n}"; + # pubmsghinick_failed = "{msgnick {flag_failed} $0$2-%n}"; + # + # pubmsgmenick_signed = "{msgnick {flag_signed} $1-}"; + # pubmsgmenick_unknown = "{msgnick {flag_unknown} $1-}"; + # pubmsgmenick_failed = "{msgnick {flag_failed} $1-}"; + # + # pubmsgnick_signed = "{msgnick {flag_signed} $1-}"; + # pubmsgnick_unknown = "{msgnick {flag_unknown} $1-}"; + # pubmsgnick_failed = "{msgnick {flag_failed} $1-}"; + # + # privmsg_signed = "{privmsg {flag_signed}$0 $1}"; + # privmsg_unknown = "{privmsg {flag_unknown}$0 $1}"; + # privmsg_failed = "{privmsg {flag_failed}$0 $1}"; + # + # privmsgnick_signed = "{msgnick {flag_signed} %R$*%n}"; + # privmsgnick_unknown = "{msgnick {flag_unknown} %R$*%n}"; + # privmsgnick_failed = "{msgnick {flag_failed} %R$*%n}"; + # + # ownmsgnick_signed = "{msgnick {flag_signed} $1-}"; + # ownprivmsgnick_signed = "{msgnick {flag_signed} $*}"; + # + flag_signed = "[%cS%n]"; + flag_unknown = "[%Y?%n]"; + flag_failed = "[%RF%n]"; + + pubmsghinick_signed = "{msgnick {flag_signed} $0$2-%n}"; + pubmsghinick_unknown = "{msgnick {flag_unknown} $0$2-%n}"; + pubmsghinick_failed = "{msgnick {flag_failed} $0$2-%n}"; + + pubmsgmenick_signed = "%g<{flag_signed}$1->%n %|"; + pubmsgmenick_unknown = "%g<{flag_unknown}$1->%n %|"; + pubmsgmenick_failed = "%g<{flag_failed}$1->%n %|"; + + pubmsgnick_signed = "{msgnick {flag_signed}$0 $1-}"; + pubmsgnick_unknown = "{msgnick {flag_unknown}$0 $1-}"; + pubmsgnick_failed = "{msgnick {flag_failed}$0 $1-}"; + + privmsg_signed = "{privmsg {flag_signed}$0 $1}"; + privmsg_unknown = "{privmsg {flag_unknown}$0 $1}"; + privmsg_failed = "{privmsg {flag_failed}$0 $1}"; + + privmsgnick_signed = "{privmsgnick {flag_signed}$0}"; + privmsgnick_unknown = "{privmsgnick {flag_unknown}$0}"; + privmsgnick_failed = "{privmsgnick {flag_failed}$0}"; + + ownmsgnick_signed = "{msgnick {flag_signed} $1-}%g"; + ownprivmsg_signed = "->*%c{flag_signed}$1-%n* %g"; + ownprivmsgnick_signed = "->*%c{flag_signed}$0%n* %g$1-"; }; # diff --git a/apps/irssi/docs/help/in/action.in b/apps/irssi/docs/help/in/action.in index 89123fcc..6f0b9f1b 100644 --- a/apps/irssi/docs/help/in/action.in +++ b/apps/irssi/docs/help/in/action.in @@ -1,9 +1,6 @@ @SYNTAX:action@ -Same as ME, but gets channel as an additional parameter. -Example: /ACTION #irssi yawns -(This outputs the following to #irssi: * Nick yawns) +Same as ME, but gets channel as an additional parameter. Example: /ACTION silc yawns (This outputs the following to channel silc: * Nick yawns) See also: ME - diff --git a/apps/irssi/docs/help/in/admin.in b/apps/irssi/docs/help/in/admin.in index f854cd0f..76160f02 100644 --- a/apps/irssi/docs/help/in/admin.in +++ b/apps/irssi/docs/help/in/admin.in @@ -5,7 +5,6 @@ Displays the administrative details about the given server. If no server is specified, the server you are connected to is used. -This command may be an alias. - -See also: INFO +This command is an alias of INFO. +See also: INFO, STATS diff --git a/apps/irssi/docs/help/in/ban.in b/apps/irssi/docs/help/in/ban.in index 32bf76e9..f6b7496a 100644 --- a/apps/irssi/docs/help/in/ban.in +++ b/apps/irssi/docs/help/in/ban.in @@ -5,6 +5,9 @@ This command is used to manage the ban list of the channel. You must be channel operator to be able to use this command. Wildcards may be used with this command. +In ban list it is possible to add nicknames, server name, username, +hostname or netmask (IP/MASK), and public keys. + Examples: /BAN #mychannel +foobar!mr.bar@foo.bar.com Adds nickname `foobar' with username `mr.bar' from host @@ -17,6 +20,10 @@ Examples: Adds foo* nicknames from any server with any username from *.foobar.com hosts to the ban list on current channel. + /BAN * +/path/to/public_key.pub + Adds the public key from file /path/to/public_key.pub to + ban list of the current channel. + /BAN * -looser Removes the nickname `looser' from the ban list on current channel. @@ -24,5 +31,5 @@ Examples: /BAN * Shows the ban list of the current channel. -See also: KNOCKOUT, KICKBAN +See also: KICK diff --git a/apps/irssi/docs/help/in/cat.in b/apps/irssi/docs/help/in/cat.in index ea324aa3..51c07678 100644 --- a/apps/irssi/docs/help/in/cat.in +++ b/apps/irssi/docs/help/in/cat.in @@ -4,5 +4,5 @@ Outputs the contents of the specified file. Equivalent to UNIX 'cat' command. -See also: CD +See also: EXEC diff --git a/apps/irssi/docs/help/in/cd.in b/apps/irssi/docs/help/in/cd.in index dd62f710..1d9f8d62 100644 --- a/apps/irssi/docs/help/in/cd.in +++ b/apps/irssi/docs/help/in/cd.in @@ -4,5 +4,5 @@ Changes the current working directory. Equivalent to UNIX 'cd' command. -See also: DCC GET +See also: EXEC diff --git a/apps/irssi/docs/help/in/close.in b/apps/irssi/docs/help/in/close.in index 7ce6dffd..e7f8043f 100644 --- a/apps/irssi/docs/help/in/close.in +++ b/apps/irssi/docs/help/in/close.in @@ -4,5 +4,10 @@ Operator command. Makes the server to close connection to another server or router. -See also: OPER, SILCOPER +You need to use same name of the server as configured in silcd.conf. + +Example: /CLOSE sauna.silcnet.org + +See also: SCONNECT, OPER, SILCOPER + diff --git a/apps/irssi/docs/help/in/cmode.in b/apps/irssi/docs/help/in/cmode.in index 6f4f25db..6806bea1 100644 --- a/apps/irssi/docs/help/in/cmode.in +++ b/apps/irssi/docs/help/in/cmode.in @@ -24,7 +24,8 @@ option(s). The following modes are available: be provided when joining to the channel. c Set/unset channel's cipher h Set/unset channel's hmac - f Set/unset channel founder authentication. + f [ []] + Set/unset channel founder authentication. Channel founder may set this mode so that if the client leaves the channel it can claim the founder rights when it returns @@ -32,6 +33,14 @@ option(s). The following modes are available: be permanent channel. You can claim the founder rights using CUMODE or JOIN commands. + If the and is + provided then the will the used + as founder public key, and the private key + is used to compute a signature for the SILC + server. If these are omitted then the default + SILC keypair is used. Normally you do not need + to provide these arguments. + Multiple modes can be set/unset at once if the modes does not require any arguments. If mode requires an argument then only one mode can be set at once. diff --git a/apps/irssi/docs/help/in/cumode.in b/apps/irssi/docs/help/in/cumode.in index 2bb44bca..623c7e54 100644 --- a/apps/irssi/docs/help/in/cumode.in +++ b/apps/irssi/docs/help/in/cumode.in @@ -15,11 +15,20 @@ are available: only to remove both modes at once). f [@] + [ []] Set/Unset channel founder. If you are channel founder you can set the channel founder authentication using CMODEc command. + If the and is + provided then the will the used + as founder public key, and the private key + is used to compute a signature for the SILC + server. If these are omitted then the default + SILC keypair is used. Normally you do not need + to provide these arguments. + o [@] Set/unset channel operator. Requires that diff --git a/apps/irssi/docs/help/in/dehilight.in b/apps/irssi/docs/help/in/dehilight.in index 34f856a5..7c87d1f9 100644 --- a/apps/irssi/docs/help/in/dehilight.in +++ b/apps/irssi/docs/help/in/dehilight.in @@ -1,9 +1,6 @@ @SYNTAX:dehilight@ -Makes irssi not to highlight items containing the text. -If parameter is a number, deletes the specified hilight -entry from the list. - -See also: HILIGHT +Remove given highlight. If parameter is a number, deletes the specified hilight entry from the list. +See also: HILIGHT, SET HILIGHT diff --git a/apps/irssi/docs/help/in/exec.in b/apps/irssi/docs/help/in/exec.in index c33ec59f..d88af57f 100644 --- a/apps/irssi/docs/help/in/exec.in +++ b/apps/irssi/docs/help/in/exec.in @@ -35,3 +35,6 @@ standard input of the process with -in option. kill the process. It is meant to remove the processes that don't die even with SIGKILL. This option just closes the pipes used to communicate with the process and frees all memory it used. + +See also: CAT, CD + diff --git a/apps/irssi/docs/help/in/getkey.in b/apps/irssi/docs/help/in/getkey.in index bb1c4c58..82fdfdb6 100644 --- a/apps/irssi/docs/help/in/getkey.in +++ b/apps/irssi/docs/help/in/getkey.in @@ -8,3 +8,4 @@ client posesses the corresponding private key as well. You will be prompted to verify and accept the fetched public key. The public key is saved into your local key directory (~/.silc/clientkeys/). +See also: WHOIS, KEY diff --git a/apps/irssi/docs/help/in/info.in b/apps/irssi/docs/help/in/info.in index 12e0b2f3..e4e9eec7 100644 --- a/apps/irssi/docs/help/in/info.in +++ b/apps/irssi/docs/help/in/info.in @@ -5,3 +5,4 @@ Displays the administrative details about the given server. If no server is specified, the server you are connected to is used. +See also: STATS diff --git a/apps/irssi/docs/help/in/invite.in b/apps/irssi/docs/help/in/invite.in index 7d11e262..21afbd18 100644 --- a/apps/irssi/docs/help/in/invite.in +++ b/apps/irssi/docs/help/in/invite.in @@ -4,6 +4,9 @@ This command is used to invite an client to a channel and to manage the channel's invite list. Wildcards may be used with this command. +In invite list it is possible to add nicknames, server name, username, +hostname or netmask (IP/MASK), and public keys. + Examples: /INVITE silc joe Invites nickname `joe' to channel 'silc', and adds the client @@ -17,6 +20,10 @@ Examples: Adds nicknames foo* from silcnet.org server from *.foobar.com hosts to the invite list of the current channel. + /INVITE * +/path/to/public_key.pub + Adds the public key from file /path/to/public_key.pub to + invite list of the current channel. + /INVITE * -joe Removes nickname `joe' from the invite list of the current channel. diff --git a/apps/irssi/docs/help/in/key.in b/apps/irssi/docs/help/in/key.in index 062c2ad3..a14b49f1 100644 --- a/apps/irssi/docs/help/in/key.in +++ b/apps/irssi/docs/help/in/key.in @@ -103,3 +103,5 @@ Examples: /KEY MSG nick set secretkey -responder /KEY MSG foo agreement 10.2.1.7 5000 /KEY MSG bar negotiate 10.2.1.7 5000 + +See also: WHOIS, CHANNEL, GETKEY diff --git a/apps/irssi/docs/help/in/kick.in b/apps/irssi/docs/help/in/kick.in index 3e73dbe2..1f67d34f 100644 --- a/apps/irssi/docs/help/in/kick.in +++ b/apps/irssi/docs/help/in/kick.in @@ -8,5 +8,5 @@ you are channel operator. The default alias for /KICK is /K. -See also: KNOCKOUT +See also: BAN diff --git a/apps/irssi/docs/help/in/lastlog.in b/apps/irssi/docs/help/in/lastlog.in index 0c508c4f..732a4712 100644 --- a/apps/irssi/docs/help/in/lastlog.in +++ b/apps/irssi/docs/help/in/lastlog.in @@ -18,5 +18,5 @@ Shows the given number of lines of log from the current window. -See also: +See also: LOG, SET LOG, WINDOW LOG diff --git a/apps/irssi/docs/help/in/layout.in b/apps/irssi/docs/help/in/layout.in index d0cde15e..0d6d26f9 100644 --- a/apps/irssi/docs/help/in/layout.in +++ b/apps/irssi/docs/help/in/layout.in @@ -7,7 +7,9 @@ run irssi, all the channels and queries are exactly in the same windows where they were when you called /LAYOUT SAVE. Channels aren't actually joined in those windows immediately, they're -just marked "next time you join to '#channel' in server that has tag -'ircnet' place it to this window". +just marked "next time you join to 'channel' in server that has tag +'silcnet' place it to this window". /LAYOUT RESET removes the saved layout. + +See also: SAVE diff --git a/apps/irssi/docs/help/in/list.in b/apps/irssi/docs/help/in/list.in index a1f697e7..ae4b02d9 100644 --- a/apps/irssi/docs/help/in/list.in +++ b/apps/irssi/docs/help/in/list.in @@ -1,16 +1,9 @@ @SYNTAX:list@ -Lists the channel names. Trying to list all the channel -names usually causes you to be disconnected from the -server with the reason "Excess flood", as usually all -40000 channels form together and server naively attempts -to send you them. +Lists all channel names and number of people on them. Channel topics +are also shown. -Thus, on IRCNet, you should rather use service ALIS -(Advanced Listing Service), which will allow you to query -for channel with specific name, topic, mode or usercount. -Type /SQUERY ALIS HELP to get more info about it. - -See also: SQUERY +Your server only knows number of people on channels if it has local +clients joined onto those. This is why you'll see N/A for some channels. diff --git a/apps/irssi/docs/help/in/load.in b/apps/irssi/docs/help/in/load.in index 16ce9be5..7b427454 100644 --- a/apps/irssi/docs/help/in/load.in +++ b/apps/irssi/docs/help/in/load.in @@ -4,11 +4,8 @@ Load a plugin. If full path isn't given, irssi searches the plugin from directories: - ~/.irssi/modules/ - /lib/irssi/modules/ - -See plugins page of http://irssi.org/ to see if there's any plugins -you'd want to use. +~/.silc/modules/ +/path/to/silc/modules/ (by default /usr/local/silc/modules) See also: UNLOAD diff --git a/apps/irssi/docs/help/in/log.in b/apps/irssi/docs/help/in/log.in index 6a61ef9f..ea5948f3 100644 --- a/apps/irssi/docs/help/in/log.in +++ b/apps/irssi/docs/help/in/log.in @@ -22,19 +22,19 @@ All of these are parsed with strftime(): /SET log_close_string - Text written to log when it's closed /SET log_day_changed - Text written to log when day changes -NOTE: Log files are locked after opened, so two Irssis can't +NOTE: Log files are locked after opened, so two clients can't accidentally try to write to the same log file. Examples: -/LOG OPEN -targets cras ~/irclogs/cras.log MSGS - - Logs all messages from/to nick `cras' +/LOG OPEN -targets Toni ~/silclogs/Toni.log MSGS + - Logs all messages from/to nick `Toni' -/LOG OPEN -targets #linux ~/irclogs/linux/linux-%%Y-%%m-%%d - - Logs all messages in channel #linux. Log is rotated daily, so - logs in 1. May 2000 goes to file "linux-2000-05-01", when the - day is changed, Irssi closes the log and starts logging to - "linux-2000-05-02" etc. +/LOG OPEN -targets silc ~/silclogs/silc/silc-%%Y-%%m-%%d + - Logs all messages in channel silc. Log is rotated daily, so + logs in 1. May 2000 goes to file "silc-2000-05-01", when the + day is changed the log is closed and new log is opened as + "silc-2000-05-02". -See also: SET LOG, WINDOW LOG +See also: LASTLOG, SET LOG, WINDOW LOG diff --git a/apps/irssi/docs/help/in/motd.in b/apps/irssi/docs/help/in/motd.in index ba354408..d066ee68 100644 --- a/apps/irssi/docs/help/in/motd.in +++ b/apps/irssi/docs/help/in/motd.in @@ -1,7 +1,6 @@ @SYNTAX:motd@ -Shows the motd of the current server. This contains -usually some useful info on the server, administrator and -the rules. +Shows the motd of the current or given server. This contains usually some useful info on the server, administrator and the rules. +See also: INFO, ADMIN, STATS diff --git a/apps/irssi/docs/help/in/msg.in b/apps/irssi/docs/help/in/msg.in index 6267a679..fb7c4fc7 100644 --- a/apps/irssi/docs/help/in/msg.in +++ b/apps/irssi/docs/help/in/msg.in @@ -1,9 +1,22 @@ @SYNTAX:msg@ -Sends a message to a remote client. Usually this -is used for sending private messages to other persons. +Sends a private message to other user in the network. -Examples: +It is possible to digitally sign your messages. The receiver +may then verify the message with your public key. By default +messages are not signed. If you want your private messages +to be signed you SMSG command instead of this MSG command. -/MSG friend Hi, what's up? +If -channel option is provided then this command actually +send channel message to the specified channel. The message +IS NOT private message, it is normal channel message. It is +also possible to digitally sign channel messages by using +SMSG command or by doing /set sign_channel_messages on, in +which case _all_ channel messages will be signed. + +Example: + +/MSG Toni Hi, what's up? + +See also: QUERY SMSG diff --git a/apps/irssi/docs/help/in/names.in b/apps/irssi/docs/help/in/names.in index d3512d0b..6882ecba 100644 --- a/apps/irssi/docs/help/in/names.in +++ b/apps/irssi/docs/help/in/names.in @@ -6,17 +6,15 @@ -voices: show voiced people in list -normal: show rest of the people in list -Shows the names (nicks) in the specified channels. /NAMES ** -shows all nicks in all channels, you probably don't want -to do this. +Shows users of specified channels. /NAMES ** shows all nicks in all channels, you probably don't want to do this. Examples: /NAMES - shows nicks in the current channel. -/NAMES -ops #c1,#c2 - - shows operators in channels #c1 and #c2 +/NAMES -ops silc,beginners + - shows operators in channels silc and beginners -See also: WHO, CHANNEL +See also: USERS, WHO, WHOIS, WHOWAS, CHANNEL diff --git a/apps/irssi/docs/help/in/part.in b/apps/irssi/docs/help/in/part.in index ff3b12fb..c10d6e75 100644 --- a/apps/irssi/docs/help/in/part.in +++ b/apps/irssi/docs/help/in/part.in @@ -1,8 +1,7 @@ @SYNTAX:part@ -Parts from the current or specified channel. Depending -on your settings, closes the corresponding window, too. +Parts from the current or specified channel. Depending on your settings it closes the corresponding window also. -See also: LEAVE, JOIN +See also: JOIN diff --git a/apps/irssi/docs/help/in/query.in b/apps/irssi/docs/help/in/query.in index 52f191ee..2631e68a 100644 --- a/apps/irssi/docs/help/in/query.in +++ b/apps/irssi/docs/help/in/query.in @@ -1,13 +1,9 @@ @SYNTAX:query@ -Starts a private conversation with the nick. All text you -type that would normally be sent to your channel now goes to -the specified nick in the form of MSGs. +Starts a private conversation with given person. -Usually this command opens up a new window, too. - -The query is ended by giving command UNQUERY +The query session is ended by giving command UNQUERY See also: UNQUERY, WINDOW, MSG, SET QUERY diff --git a/apps/irssi/docs/help/in/quit.in b/apps/irssi/docs/help/in/quit.in index 1c1e7bac..39cf8842 100644 --- a/apps/irssi/docs/help/in/quit.in +++ b/apps/irssi/docs/help/in/quit.in @@ -1,10 +1,8 @@ @SYNTAX:quit@ -This ends your session. If a quit message is supplied, it -will be displayed to anyone else on any channel you were on -before quitting. If one isn't specified, the text "Leaving" is -used. +This ends your session. -/EXIT does the same. +If a quit message is supplied, it will be displayed to everyone on all channels you were on before quitting. If quit message isn't specified, the text "leaving" is used. +See also: EXIT diff --git a/apps/irssi/docs/help/in/save.in b/apps/irssi/docs/help/in/save.in index a6d5ea5b..664d8668 100644 --- a/apps/irssi/docs/help/in/save.in +++ b/apps/irssi/docs/help/in/save.in @@ -1,8 +1,6 @@ @SYNTAX:save@ -Saves the current Irssi configuration into the configuration -file. - -See also: RELOAD +Saves the current configuration. +See also: RELOAD, LAYOUT diff --git a/apps/irssi/docs/help/in/sconnect.in b/apps/irssi/docs/help/in/sconnect.in index f77c5d3d..61627774 100644 --- a/apps/irssi/docs/help/in/sconnect.in +++ b/apps/irssi/docs/help/in/sconnect.in @@ -5,7 +5,8 @@ Operator command. Makes an server to connect to another server or router. The is the hostname or IP addres of the server. -Example: /SCONNECT silc.silcnet.org 706 +You need to use same name of the server as configured in silcd.conf. -See also: OPER, SILCOPER, CLOSE, SHUTDOWN +Example: /SCONNECT sauna.silcnet.org +See also: CLOSE, OPER, SILCOPER diff --git a/apps/irssi/docs/help/in/script.in b/apps/irssi/docs/help/in/script.in index 0354512b..fc2f6410 100644 --- a/apps/irssi/docs/help/in/script.in +++ b/apps/irssi/docs/help/in/script.in @@ -15,5 +15,5 @@ Without any parameters, /SCRIPT acts in same way as if you would call /SCRIPT LI /SCRIPT RESET unloads all loaded scripts and resets the perl interpreter. -See also: LOAD, UNLOAD +See also: LOAD, UNLOAD, RUN diff --git a/apps/irssi/docs/help/in/server.in b/apps/irssi/docs/help/in/server.in index ac514f73..2256e982 100644 --- a/apps/irssi/docs/help/in/server.in +++ b/apps/irssi/docs/help/in/server.in @@ -4,11 +4,9 @@ -4, -6: specify explicitly whether to use IPv4 or IPv6 address -auto: Automatically connect to server at startup (default) -noauto: Don't connect to server at startup - -silcnet: Specify what network this server belongs to - -host: Specify what host name to use, if you have multiple + -silcnet: Specify the network this server belongs to + -host: Specify what host name to bind to, if you have multiple interfaces -!: don't autojoin channels - -cmdspeed: Same as /SET cmd_queue_speed, see section 3.1 - -cmdmax: Same as /SET cmd_max_at_once, see section 3.1 -port: This is pretty much like the port argument later, except this can be used to modify existing server's port. @@ -25,7 +23,4 @@ where the server is connected (ie. /window new hide; /SERVER REMOVE
[] -/SERVER LIST - -See also: RMRECONNS, DISCONNECT, RECONNECT - +See also: RMRECONNS, DISCONNECT, RECONNECT, CONNECT diff --git a/apps/irssi/docs/help/in/shutdown.in b/apps/irssi/docs/help/in/shutdown.in index 48ff58c9..e71d1007 100644 --- a/apps/irssi/docs/help/in/shutdown.in +++ b/apps/irssi/docs/help/in/shutdown.in @@ -1,7 +1,6 @@ @SYNTAX:shutdown@ -Operator command. Shutdowns the server. +Operator command. Shuts the server down. See also: OPER, SILCOPER, CLOSE - diff --git a/apps/irssi/docs/help/in/smsg.in b/apps/irssi/docs/help/in/smsg.in new file mode 100644 index 00000000..86d3fb19 --- /dev/null +++ b/apps/irssi/docs/help/in/smsg.in @@ -0,0 +1,33 @@ + +@SYNTAX:smsg@ + +Sends a signed private message to other user in the network. +The message will be digitally signed and the receiver may verify +the message by using your public key. + +If -channel option is provided then this command actually +send channel message to the specified channel. The message +IS NOT private message, it is normal channel message. Also this +message will be signed and can be verified by using your public +key. + +The default theme of Irssi SILC Client shows the digital signed +messages with [S] at start of the nickname who sent the message, when +the message was successfully verified, [?] if the message could not +be verified since the public key of the sender isn't cached locally, +or [F] if the signature verificationn failed. If you do not have +the sender's public key you can fetch it with GETKEY command. + +If you don't want to verify the signatures from received messages +you may do /SET ignore_message_signatures on. In this case +signatures in messages are ignored and they appear as normal +non-signed messages. By default, all message signatures are +verified. + +Examples: + +/SMSG Foobar Very authenticated message +/SMSG -channel silc Another signed message +/SMSG * I truly said this + +See also: MSG QUERY GETKEY diff --git a/apps/irssi/docs/help/in/stats.in b/apps/irssi/docs/help/in/stats.in index 58418794..310cc87c 100644 --- a/apps/irssi/docs/help/in/stats.in +++ b/apps/irssi/docs/help/in/stats.in @@ -2,3 +2,5 @@ @SYNTAX:stats@ Shows various server and network statistics. + +See also: INFO, ADMIN diff --git a/apps/irssi/docs/help/in/upgrade.in b/apps/irssi/docs/help/in/upgrade.in deleted file mode 100644 index 00c9c189..00000000 --- a/apps/irssi/docs/help/in/upgrade.in +++ /dev/null @@ -1,9 +0,0 @@ - -@SYNTAX:upgrade@ - -Upgrade irssi to new version on-the-fly without disconnecting from -server, so other people won't even notice you quit from network. This ONLY -executes the new binary, it does NOT download/compile/whatever irssi. - -NOTE: THIS COMMAND DOES NOT WORK WITH Irssi-SILC CLIENT! - diff --git a/apps/irssi/docs/help/in/users.in b/apps/irssi/docs/help/in/users.in index 71cf2db2..4fe4760b 100644 --- a/apps/irssi/docs/help/in/users.in +++ b/apps/irssi/docs/help/in/users.in @@ -1,11 +1,8 @@ @SYNTAX:users@ -Shows users of the specified channel. The channel must be either joined or it -needs to be a public channel (without secret or private flags set). +Lists users of given channel. The channel must be either joined or it needs to be a public channel (without secret or private flags set). Alias WHO is by default USERS * command. -See also: WHOIS, WHOWAS - - +See also: NAMES, WHOIS, WHOWAS diff --git a/apps/irssi/docs/help/in/whois.in b/apps/irssi/docs/help/in/whois.in index 1533b0c3..d153a023 100644 --- a/apps/irssi/docs/help/in/whois.in +++ b/apps/irssi/docs/help/in/whois.in @@ -26,5 +26,5 @@ informations is received. If you want to send your information in WHOIS you can set the information with ATTR command. See HELP ATTR. -See also: WHOWAS, CHANNEL, ATTR +See also: WHOIS, CHANNEL, ATTR, NAMES, WHO diff --git a/apps/irssi/silc.conf b/apps/irssi/silc.conf index 559e4cde..c2bd1c69 100644 --- a/apps/irssi/silc.conf +++ b/apps/irssi/silc.conf @@ -1,10 +1,10 @@ # # Configured servers # +# silc.silcnet.org is DNS round robin for all (currently) known public SILCNet servers. +# servers = ( - { address = "silc.silcnet.org"; chatnet = SILCNet; port = 706; }, - { address = "silc.ytti.fi"; chatnet = SILCNet; port = 706; }, - { address = "silc.peelo.com"; chatnet = SILCNet; port = 706; }, + { address = "silc.silcnet.org"; chatnet = SILCNet; port = 706; autoconnect = "yes"; } ); # @@ -37,8 +37,6 @@ aliases = { EXIT = "quit"; SIGNOFF = "quit"; DESCRIBE = "action"; - DATE = "time"; - HOST = "userhost"; LAST = "lastlog"; SAY = "msg *"; WHO = "users *"; @@ -56,15 +54,12 @@ aliases = { KN = "knockout"; BANS = "ban"; B = "ban"; - MUB = "unban *"; - UB = "unban"; IG = "ignore"; UNIG = "unignore"; SB = "scrollback"; WC = "window close"; WN = "window new hide"; GOTO = "sb goto"; - CHAT = "dcc chat"; ADMIN = "info"; RUN = "SCRIPT LOAD"; UPTIME = "eval exec - expr `date +%s` - \\$F | awk '{print \"Irssi uptime: \"int(\\\\\\$1/3600/24)\"d \"int(\\\\\\$1/3600%24)\"h \"int(\\\\\\$1/60%60)\"m \"int(\\\\\\$1%60)\"s\" }'"; @@ -73,6 +68,7 @@ aliases = { Q = "QUERY"; MOOD = "ATTR status_mood"; OP = "CUMODE $C +o"; + DEOP = "CUMODE $C -o"; }; # @@ -179,7 +175,7 @@ statusbar = { placement = "top"; position = "1"; visible = "always"; - disabled = "yes"; + disabled = "no"; items = { barstart = { priority = "100"; }; topic = { }; @@ -201,7 +197,6 @@ statusbar = { # aes-256-cbc, aes-192-cbc, aes-128-cbc, # twofish-256-cbc, twofish-192-cbc, twofish-128-cbc, # rc6-256-cbc, rc6-192-cbc, rc6-128-cbc, -# mars-256-cbc, mars-192-cbc, mars-128-cbc, # cast-256-cbc, cast-192-cbc and cast-128-cbc # # Available hash functions are (default: sha1): @@ -219,15 +214,17 @@ settings = { crypto_default_hmac = "hmac-sha1-96"; }; "fe-common/core" = { - autocreate_own_query = "no"; + autocreate_own_query = "yes"; use_status_window = "no"; autoclose_windows = "no"; use_msgs_window = "no"; - autocreate_windows = "no"; - autocreate_query_level = "none"; + autocreate_windows = "yes"; + autocreate_query_level = "MSG"; + reuse_unused_windows = "yes"; }; core = { server_reconnect_time = "10000"; + resolve_reverse_lookup = "yes"; }; "fe-text" = { indent = "8"; }; }; diff --git a/apps/irssi/src/core/chat-commands.c b/apps/irssi/src/core/chat-commands.c index 16c3a0e9..722d3df5 100644 --- a/apps/irssi/src/core/chat-commands.c +++ b/apps/irssi/src/core/chat-commands.c @@ -112,7 +112,7 @@ static SERVER_CONNECT_REC *get_server_connect(const char *data, int *plus_addr, return conn; } -/* SYNTAX: CONNECT [-4 | -6] [-ssl] [-noproxy] [-ircnet ] +/* SYNTAX: CONNECT [-4 | -6] [-ssl] [-noproxy] [-silcnet ] [-host ] [-rawlog ]
| [ [ []]] */ static void cmd_connect(const char *data) @@ -214,7 +214,7 @@ static void sig_default_command_server(const char *data, SERVER_REC *server, signal_emit("command server connect", 3, data, server, item); } -/* SYNTAX: SERVER [-4 | -6] [-ssl] [-noproxy] [-ircnet ] +/* SYNTAX: SERVER [-4 | -6] [-ssl] [-noproxy] [-silcnet ] [-host ] [-rawlog ] [+]
| [ [ []]] */ static void cmd_server_connect(const char *data, SERVER_REC *server) @@ -289,7 +289,6 @@ static void cmd_quit(const char *data) signal_emit("gui exit", 0); } -/* SYNTAX: JOIN [-invite] [-] [] */ static void cmd_join(const char *data, SERVER_REC *server) { GHashTable *optlist; @@ -320,7 +319,7 @@ static void cmd_join(const char *data, SERVER_REC *server) cmd_params_free(free_arg); } -/* SYNTAX: MSG [-] [-channel | -nick] */ +/* SYNTAX: MSG [-channel] */ static void cmd_msg(const char *data, SERVER_REC *server, WI_ITEM_REC *item) { GHashTable *optlist; diff --git a/apps/irssi/src/core/core.c b/apps/irssi/src/core/core.c index b4e6d6e0..7125344f 100644 --- a/apps/irssi/src/core/core.c +++ b/apps/irssi/src/core/core.c @@ -155,8 +155,8 @@ static void sig_init_finished(void) void core_init_paths(int argc, char *argv[]) { static struct poptOption options[] = { - { "config", 0, POPT_ARG_STRING, NULL, 0, "Configuration file location (~/.irssi/config)", "PATH" }, - { "home", 0, POPT_ARG_STRING, NULL, 0, "Irssi home dir location (~/.irssi)", "PATH" }, + { "config", 0, POPT_ARG_STRING, NULL, 0, "Configuration file location (~/.silc/config)", "PATH" }, + { "home", 0, POPT_ARG_STRING, NULL, 0, "Irssi home dir location (~/.silc)", "PATH" }, { NULL, '\0', 0, NULL } }; const char *home; diff --git a/apps/irssi/src/core/net-nonblock.c b/apps/irssi/src/core/net-nonblock.c index 6af87a96..ce6be49a 100644 --- a/apps/irssi/src/core/net-nonblock.c +++ b/apps/irssi/src/core/net-nonblock.c @@ -73,13 +73,15 @@ static int g_io_channel_read_block(GIOChannel *channel, void *data, int len) /* nonblocking gethostbyname(), ip (IPADDR) + error (int, 0 = not error) is written to pipe when found PID of the resolver child is returned */ -int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe) +int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, + int reverse_lookup) { RESOLVED_IP_REC rec; const char *errorstr; #ifndef WIN32 int pid; #endif + int len; g_return_val_if_fail(addr != NULL, FALSE); @@ -103,6 +105,13 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe) rec.error = net_gethostbyname(addr, &rec.ip4, &rec.ip6); if (rec.error == 0) { errorstr = NULL; + if (reverse_lookup) { + /* reverse lookup the IP, ignore any error */ + if (rec.ip4.family != 0) + net_gethostbyaddr(&rec.ip4, &rec.host4); + if (rec.ip6.family != 0) + net_gethostbyaddr(&rec.ip6, &rec.host6); + } } else { errorstr = net_gethosterror(rec.error); rec.errlen = errorstr == NULL ? 0 : strlen(errorstr)+1; @@ -111,6 +120,22 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe) g_io_channel_write_block(pipe, &rec, sizeof(rec)); if (rec.errlen != 0) g_io_channel_write_block(pipe, (void *) errorstr, rec.errlen); + else { + if (rec.host4) { + len = strlen(rec.host4) + 1; + g_io_channel_write_block(pipe, (void *) &len, + sizeof(int)); + g_io_channel_write_block(pipe, (void *) rec.host4, + len); + } + if (rec.host6) { + len = strlen(rec.host6) + 1; + g_io_channel_write_block(pipe, (void *) &len, + sizeof(int)); + g_io_channel_write_block(pipe, (void *) rec.host6, + len); + } + } #ifndef WIN32 if (pid == 0) @@ -124,8 +149,12 @@ int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe) /* get the resolved IP address */ int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec) { + int len; + rec->error = -1; rec->errorstr = NULL; + rec->host4 = NULL; + rec->host6 = NULL; #ifndef WIN32 fcntl(g_io_channel_unix_get_fd(pipe), F_SETFL, O_NONBLOCK); @@ -143,6 +172,17 @@ int net_gethostbyname_return(GIOChannel *pipe, RESOLVED_IP_REC *rec) reason, just ignore it. */ rec->errorstr = g_malloc0(rec->errlen+1); g_io_channel_read_block(pipe, rec->errorstr, rec->errlen); + } else { + if (rec->host4) { + g_io_channel_read_block(pipe, &len, sizeof(int)); + rec->host4 = g_malloc0(len); + g_io_channel_read_block(pipe, rec->host4, len); + } + if (rec->host6) { + g_io_channel_read_block(pipe, &len, sizeof(int)); + rec->host6 = g_malloc0(len); + g_io_channel_read_block(pipe, rec->host6, len); + } } return 0; @@ -244,7 +284,7 @@ int net_connect_nonblock(const char *server, int port, const IPADDR *my_ip, rec->pipes[1] = g_io_channel_unix_new(fd[1]); /* start nonblocking host name lookup */ - net_gethostbyname_nonblock(server, rec->pipes[1]); + net_gethostbyname_nonblock(server, rec->pipes[1], 0); rec->tag = g_input_add(rec->pipes[0], G_INPUT_READ, (GInputFunction) simple_readpipe, rec); diff --git a/apps/irssi/src/core/net-nonblock.h b/apps/irssi/src/core/net-nonblock.h index a0e5cddf..32cfac70 100644 --- a/apps/irssi/src/core/net-nonblock.h +++ b/apps/irssi/src/core/net-nonblock.h @@ -9,6 +9,7 @@ typedef struct { int errlen; /* error text length */ char *errorstr; /* error string - dynamically allocated, you'll need to free() it yourself unless it's NULL */ + char *host4, *host6; /* dito */ } RESOLVED_IP_REC; typedef struct { @@ -24,7 +25,8 @@ typedef void (*NET_CALLBACK) (GIOChannel *, void *); typedef void (*NET_HOST_CALLBACK) (RESOLVED_NAME_REC *, void *); /* nonblocking gethostbyname(), PID of the resolver child is returned. */ -int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe); +int net_gethostbyname_nonblock(const char *addr, GIOChannel *pipe, + int reverse_lookup); /* Get host's name, call func when finished */ int net_gethostbyaddr_nonblock(IPADDR *ip, NET_HOST_CALLBACK func, void *data); /* get the resolved IP address. returns -1 if some error occured with read() */ diff --git a/apps/irssi/src/core/network.c b/apps/irssi/src/core/network.c index 6b2ceab4..bb46dd54 100644 --- a/apps/irssi/src/core/network.c +++ b/apps/irssi/src/core/network.c @@ -468,18 +468,19 @@ int net_gethostbyaddr(IPADDR *ip, char **name) #ifdef HAVE_IPV6 struct addrinfo req, *ai; int host_error; + char hostname[NI_MAXHOST]; + char ipname[MAX_IP_LEN]; #else struct hostent *hp; #endif - char ipname[MAX_IP_LEN]; g_return_val_if_fail(ip != NULL, -1); g_return_val_if_fail(name != NULL, -1); - net_ip2host(ip, ipname); - *name = NULL; #ifdef HAVE_IPV6 + net_ip2host(ip, ipname); + memset(&req, 0, sizeof(struct addrinfo)); req.ai_socktype = SOCK_STREAM; req.ai_flags = AI_CANONNAME; @@ -488,11 +489,19 @@ int net_gethostbyaddr(IPADDR *ip, char **name) host_error = getaddrinfo(ipname, NULL, &req, &ai); if (host_error != 0) return host_error; - *name = g_strdup(ai->ai_canonname); + host_error = getnameinfo(ai->ai_addr, ai->ai_addrlen, + hostname, NI_MAXHOST, NULL, 0, 0); + if (host_error != 0) { + freeaddrinfo(ai); + return host_error; + } + + *name = g_strdup(hostname); freeaddrinfo(ai); #else - hp = gethostbyaddr(ipname, strlen(ipname), AF_INET); + if (ip->family != AF_INET) return -1; + hp = gethostbyaddr(&ip->ip, 4, AF_INET); if (hp == NULL) return -1; *name = g_strdup(hp->h_name); diff --git a/apps/irssi/src/core/servers.c b/apps/irssi/src/core/servers.c index 92a6e5ac..f9ab791a 100644 --- a/apps/irssi/src/core/servers.c +++ b/apps/irssi/src/core/servers.c @@ -213,6 +213,7 @@ static void server_connect_callback_readpipe(SERVER_REC *server) RESOLVED_IP_REC iprec; IPADDR *ip; const char *errormsg; + char *servername = NULL; g_source_remove(server->connect_tag); server->connect_tag = -1; @@ -234,20 +235,31 @@ static void server_connect_callback_readpipe(SERVER_REC *server) } else if (server->connrec->family == AF_INET) { /* force IPv4 connection */ ip = iprec.ip4.family == 0 ? NULL : &iprec.ip4; + servername = iprec.host4; } else if (server->connrec->family == AF_INET6) { /* force IPv6 connection */ ip = iprec.ip6.family == 0 ? NULL : &iprec.ip6; + servername = iprec.host6; } else { /* pick the one that was found, or if both do it like /SET resolve_prefer_ipv6 says. */ - ip = iprec.ip4.family == 0 || - (iprec.ip6.family != 0 && - settings_get_bool("resolve_prefer_ipv6")) ? - &iprec.ip6 : &iprec.ip4; + if (iprec.ip4.family == 0 || + (iprec.ip6.family != 0 && + settings_get_bool("resolve_prefer_ipv6"))) { + ip = &iprec.ip6; + servername = iprec.host6; + } else { + ip = &iprec.ip4; + servername = iprec.host4; + } } if (ip != NULL) { /* host lookup ok */ + if (servername) { + g_free(server->connrec->address); + server->connrec->address = g_strdup(servername); + } server_real_connect(server, ip, NULL); errormsg = NULL; } else { @@ -273,6 +285,8 @@ static void server_connect_callback_readpipe(SERVER_REC *server) } g_free(iprec.errorstr); + g_free(iprec.host4); + g_free(iprec.host6); } SERVER_REC *server_connect(SERVER_CONNECT_REC *conn) @@ -356,7 +370,8 @@ int server_start_connect(SERVER_REC *server) server->connrec->proxy : server->connrec->address; server->connect_pid = net_gethostbyname_nonblock(connect_address, - server->connect_pipe[1]); + server->connect_pipe[1], + settings_get_bool("resolve_reverse_lookup")); server->connect_tag = g_input_add(server->connect_pipe[0], G_INPUT_READ, (GInputFunction) @@ -666,6 +681,7 @@ static void sig_chat_protocol_deinit(CHAT_PROTOCOL_REC *proto) void servers_init(void) { settings_add_bool("server", "resolve_prefer_ipv6", FALSE); + settings_add_bool("server", "resolve_reverse_lookup", FALSE); lookup_servers = servers = NULL; signal_add("chat protocol deinit", (SIGNAL_FUNC) sig_chat_protocol_deinit); diff --git a/apps/irssi/src/core/session.c b/apps/irssi/src/core/session.c index 004cd4f7..7ebd8f82 100644 --- a/apps/irssi/src/core/session.c +++ b/apps/irssi/src/core/session.c @@ -357,7 +357,7 @@ void session_init(void) session_file = NULL; args_register(options); - command_bind("upgrade", NULL, (SIGNAL_FUNC) cmd_upgrade); + /*command_bind("upgrade", NULL, (SIGNAL_FUNC) cmd_upgrade);*/ signal_add("session save", (SIGNAL_FUNC) sig_session_save); signal_add("session restore", (SIGNAL_FUNC) sig_session_restore); @@ -372,7 +372,7 @@ void session_deinit(void) { g_free_not_null(irssi_binary); - command_unbind("upgrade", (SIGNAL_FUNC) cmd_upgrade); + /*command_unbind("upgrade", (SIGNAL_FUNC) cmd_upgrade);*/ signal_remove("session save", (SIGNAL_FUNC) sig_session_save); signal_remove("session restore", (SIGNAL_FUNC) sig_session_restore); diff --git a/apps/irssi/src/fe-common/core/fe-messages.c b/apps/irssi/src/fe-common/core/fe-messages.c index e210c2a2..31bbbfad 100644 --- a/apps/irssi/src/fe-common/core/fe-messages.c +++ b/apps/irssi/src/fe-common/core/fe-messages.c @@ -39,7 +39,7 @@ #define ishighalnum(c) ((unsigned char) (c) >= 128 || i_isalnum(c)) -static GHashTable *printnicks; +GHashTable *printnicks; /* convert _underlined_ and *bold* words (and phrases) to use real underlining or bolding */ diff --git a/apps/irssi/src/fe-common/core/fe-messages.h b/apps/irssi/src/fe-common/core/fe-messages.h index afe7644d..07ecef80 100644 --- a/apps/irssi/src/fe-common/core/fe-messages.h +++ b/apps/irssi/src/fe-common/core/fe-messages.h @@ -7,4 +7,6 @@ char *expand_emphasis(WI_ITEM_REC *item, const char *text); char *channel_get_nickmode(CHANNEL_REC *channel, const char *nick); +extern GHashTable *printnicks; + #endif diff --git a/apps/irssi/src/fe-common/core/themes.c b/apps/irssi/src/fe-common/core/themes.c index baa1d3e5..437b118f 100644 --- a/apps/irssi/src/fe-common/core/themes.c +++ b/apps/irssi/src/fe-common/core/themes.c @@ -301,12 +301,51 @@ static int data_is_empty(const char **data) return FALSE; } +/* return "data" from {abstract data} string */ +char *theme_format_expand_get(THEME_REC *theme, const char **format) +{ + GString *str; + char *ret, dummy; + int braces = 1; /* we start with one brace opened */ + + str = g_string_new(NULL); + while ((**format != '\0') && (braces)) { + if (**format == '{') + braces++; + else if (**format == '}') + braces--; + else if ((braces > 1) && (**format == ' ')) { + g_string_append(str, "\\x20"); + (*format)++; + continue; + } else { + theme_format_append_next(theme, str, format, + 'n', 'n', + &dummy, &dummy, 0); + continue; + } + + if (!braces) { + (*format)++; + break; + } + + g_string_append_c(str, **format); + (*format)++; + } + + ret = str->str; + g_string_free(str, FALSE); + return ret; +} + /* expand a single {abstract ...data... } */ static char *theme_format_expand_abstract(THEME_REC *theme, const char **formatp, char default_fg, char default_bg, int flags) { + GString *str; const char *p, *format; char *abstract, *data, *ret; int len; @@ -345,9 +384,8 @@ static char *theme_format_expand_abstract(THEME_REC *theme, abstract = g_strdup(data); /* we'll need to get the data part. it may contain - more abstracts, they are automatically expanded. */ - data = theme_format_expand_data(theme, formatp, default_fg, default_bg, - NULL, NULL, flags); + more abstracts, they are _NOT_ expanded. */ + data = theme_format_expand_get(theme, formatp); len = strlen(data); if (len > 1 && i_isdigit(data[len-1]) && data[len-2] == '$') { @@ -367,7 +405,21 @@ static char *theme_format_expand_abstract(THEME_REC *theme, PARSE_FLAG_ONLY_ARGS); g_free(abstract); g_free(data); - abstract = ret; + str = g_string_new(NULL); + p = ret; + while (*p != '\0') { + if (*p == '\\') { + int chr; + p++; + chr = expand_escape(&p); + g_string_append_c(str, chr != -1 ? chr : *p); + } else + g_string_append_c(str, *p); + p++; + } + g_free(ret); + abstract = str->str; + g_string_free(str, FALSE); /* abstract may itself contain abstracts or replaces */ p = abstract; diff --git a/apps/irssi/src/fe-common/silc/Makefile.am b/apps/irssi/src/fe-common/silc/Makefile.am index 72abc05e..1a89f348 100644 --- a/apps/irssi/src/fe-common/silc/Makefile.am +++ b/apps/irssi/src/fe-common/silc/Makefile.am @@ -27,7 +27,8 @@ libfe_common_silc_a_SOURCES = \ fe-channels.c \ fe-common-silc.c \ module-formats.c \ - silc-modules.c + silc-modules.c \ + fe-messages.c noinst_HEADERS = \ module-formats.h \ diff --git a/apps/irssi/src/fe-common/silc/fe-common-silc.c b/apps/irssi/src/fe-common/silc/fe-common-silc.c index e1912d5c..51047a00 100644 --- a/apps/irssi/src/fe-common/silc/fe-common-silc.c +++ b/apps/irssi/src/fe-common/silc/fe-common-silc.c @@ -30,18 +30,23 @@ void fe_silc_channels_deinit(void); void fe_silc_modules_init(void); void fe_silc_modules_deinit(void); +void fe_silc_messages_init(void); +void fe_silc_messages_deinit(void); + void fe_silc_init(void) { theme_register(fecommon_silc_formats); fe_silc_channels_init(); fe_silc_modules_init(); + fe_silc_messages_init(); module_register("silc", "fe"); } void fe_silc_deinit(void) { + fe_silc_messages_deinit(); fe_silc_modules_deinit(); fe_silc_channels_deinit(); diff --git a/apps/irssi/src/fe-common/silc/fe-messages.c b/apps/irssi/src/fe-common/silc/fe-messages.c new file mode 100644 index 00000000..41e05144 --- /dev/null +++ b/apps/irssi/src/fe-common/silc/fe-messages.c @@ -0,0 +1,248 @@ +/* + + fe-messages.c + + Author: Jochen Eisinger + + Copyright (C) 2002 Jochen Eisinger + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + +*/ + +#include "module.h" +#include "modules.h" +#include "signals.h" +#include "themes.h" +#include "levels.h" +#include "misc.h" +#include "special-vars.h" +#include "settings.h" + +#include "servers.h" +#include "channels.h" +#include "nicklist.h" +#include "ignore.h" + +#include "window-items.h" +#include "fe-queries.h" +#include "fe-messages.h" +#include "hilight-text.h" +#include "printtext.h" +#include "module-formats.h" + +#define VERIFIED_MSG(v,msg) (v == SILC_MSG_SIGNED_VERIFIED ? \ + msg##_SIGNED : (v == SILC_MSG_SIGNED_UNKNOWN ? \ + msg##_UNKNOWN : msg##_FAILED)) + +static void sig_signed_message_public(SERVER_REC * server, const char *msg, + const char *nick, + const char *address, + const char *target, + int verified) +{ + CHANNEL_REC *chanrec; + NICK_REC *nickrec = NULL; /* we cheat here a little to keep the limit of + 6 parameters to a signal handler ... */ + const char *nickmode, *printnick; + int for_me, print_channel, level; + char *color, *freemsg = NULL; + + /* NOTE: this may return NULL if some channel is just closed with + /WINDOW CLOSE and server still sends the few last messages */ + chanrec = channel_find(server, target); + if (nickrec == NULL && chanrec != NULL) + nickrec = nicklist_find(chanrec, nick); + + for_me = !settings_get_bool("hilight_nick_matches") ? FALSE : + nick_match_msg(chanrec, msg, server->nick); + color = for_me ? NULL : + hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, + msg); + + print_channel = chanrec == NULL || + !window_item_is_active((WI_ITEM_REC *) chanrec); + if (!print_channel && settings_get_bool("print_active_channel") && + window_item_window((WI_ITEM_REC *) chanrec)->items->next != NULL) + print_channel = TRUE; + + level = MSGLEVEL_PUBLIC; + if (for_me || color != NULL) + level |= MSGLEVEL_HILIGHT; + + if (settings_get_bool("emphasis")) + msg = freemsg = expand_emphasis((WI_ITEM_REC *) chanrec, msg); + + /* get nick mode & nick what to print the msg with + (in case there's multiple identical nicks) */ + nickmode = channel_get_nickmode(chanrec, nick); + printnick = nickrec == NULL ? nick : + g_hash_table_lookup(printnicks, nickrec); + if (printnick == NULL) + printnick = nick; + + if (!print_channel) { + /* message to active channel in window */ + if (color != NULL) { + /* highlighted nick */ + printformat_module("fe-common/silc", server, target, + level, VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT), + color, printnick, msg, nickmode); + } else { + printformat_module("fe-common/silc", server, target, level, + for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME) : + VERIFIED_MSG(verified,SILCTXT_PUBMSG), + printnick, msg, nickmode); + } + } else { + /* message to not existing/active channel */ + if (color != NULL) { + /* highlighted nick */ + printformat_module("fe-common/silc", server, target, level, + VERIFIED_MSG(verified, SILCTXT_PUBMSG_HILIGHT_CHANNEL), + color, printnick, target, msg, nickmode); + } else { + printformat_module("fe-common/silc", server, target, level, + for_me ? VERIFIED_MSG(verified, SILCTXT_PUBMSG_ME_CHANNEL) : + VERIFIED_MSG(verified, SILCTXT_PUBMSG_CHANNEL), + printnick, target, msg, nickmode); + } + } + + g_free_not_null(freemsg); + g_free_not_null(color); +} + +static void sig_signed_message_private(SERVER_REC * server, + const char *msg, const char *nick, + const char *address, int verified) +{ + QUERY_REC *query; + char *freemsg = NULL; + + query = query_find(server, nick); + + if (settings_get_bool("emphasis")) + msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, msg); + + printformat_module("fe-common/silc", server, nick, MSGLEVEL_MSGS, + query == NULL ? VERIFIED_MSG(verified, SILCTXT_MSG_PRIVATE) : + VERIFIED_MSG(verified, SILCTXT_MSG_PRIVATE_QUERY), nick, address, msg); + + g_free_not_null(freemsg); +} + +static void sig_signed_message_own_public(SERVER_REC * server, + const char *msg, + const char *target) +{ + WINDOW_REC *window; + CHANNEL_REC *channel; + const char *nickmode; + char *freemsg = NULL; + int print_channel; + + channel = channel_find(server, target); + if (channel != NULL) + target = channel->visible_name; + + nickmode = channel_get_nickmode(channel, server->nick); + + window = channel == NULL ? NULL : + window_item_window((WI_ITEM_REC *) channel); + + print_channel = window == NULL || + window->active != (WI_ITEM_REC *) channel; + + if (!print_channel && settings_get_bool("print_active_channel") && + window != NULL && g_slist_length(window->items) > 1) + print_channel = TRUE; + + if (settings_get_bool("emphasis")) + msg = freemsg = expand_emphasis((WI_ITEM_REC *) channel, msg); + + if (!print_channel) { + printformat_module("fe-common/silc", server, target, + MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT | + MSGLEVEL_NO_ACT, SILCTXT_OWN_MSG_SIGNED, server->nick, msg, + nickmode); + } else { + printformat_module("fe-common/silc", server, target, + MSGLEVEL_PUBLIC | MSGLEVEL_NOHILIGHT | + MSGLEVEL_NO_ACT, SILCTXT_OWN_MSG_CHANNEL_SIGNED, + server->nick, target, msg, nickmode); + } + + g_free_not_null(freemsg); +} + +static void sig_signed_message_own_private(SERVER_REC * server, + const char *msg, + const char *target, + const char *origtarget) +{ + QUERY_REC *query; + char *freemsg = NULL; + + g_return_if_fail(server != NULL); + g_return_if_fail(msg != NULL); + + if (target == NULL) { + /* this should only happen if some special target failed and + we should display some error message. currently the special + targets are only ',' and '.'. */ + g_return_if_fail(strcmp(origtarget, ",") == 0 || + strcmp(origtarget, ".") == 0); + + printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CLIENTNOTICE, + *origtarget == ',' ? SILCTXT_NO_MSGS_GOT : + SILCTXT_NO_MSGS_SENT); + signal_stop(); + return; + } + + query = privmsg_get_query(server, target, TRUE, MSGLEVEL_MSGS); + + if (settings_get_bool("emphasis")) + msg = freemsg = expand_emphasis((WI_ITEM_REC *) query, msg); + + printformat_module("fe-common/silc", server, target, + MSGLEVEL_MSGS | MSGLEVEL_NOHILIGHT | MSGLEVEL_NO_ACT, + query == NULL ? SILCTXT_OWN_MSG_PRIVATE_SIGNED : + SILCTXT_OWN_MSG_PRIVATE_QUERY_SIGNED, target, msg, + server->nick); + + g_free_not_null(freemsg); +} + +void fe_silc_messages_init(void) +{ + signal_add_last("message signed_public", + (SIGNAL_FUNC) sig_signed_message_public); + signal_add_last("message signed_private", + (SIGNAL_FUNC) sig_signed_message_private); + signal_add_last("message signed_own_public", + (SIGNAL_FUNC) sig_signed_message_own_public); + signal_add_last("message signed_own_private", + (SIGNAL_FUNC) sig_signed_message_own_private); +} + +void fe_silc_messages_deinit(void) +{ + signal_remove("message signed_public", + (SIGNAL_FUNC) sig_signed_message_public); + signal_remove("message signed_private", + (SIGNAL_FUNC) sig_signed_message_private); + signal_remove("message signed_own_public", + (SIGNAL_FUNC) sig_signed_message_own_public); + signal_remove("message signed_own_private", + (SIGNAL_FUNC) sig_signed_message_own_private); +} diff --git a/apps/irssi/src/fe-common/silc/module-formats.c b/apps/irssi/src/fe-common/silc/module-formats.c index 050f4e6c..09440ca5 100644 --- a/apps/irssi/src/fe-common/silc/module-formats.c +++ b/apps/irssi/src/fe-common/silc/module-formats.c @@ -50,6 +50,36 @@ FORMAT_REC fecommon_silc_formats[] = { { "killed", "{nick $0} has been killed from the SILC Network by {nick $1} ($2)", 3, { 0, 0, 0 } }, { "quieted", "You have been queited and cannot talk on {channel $0}", 1, { 0 } }, { "appears", "{channick $0} now appears as {channick_hilight $1}", 4, { 0, 0, 0, 0 } }, + { "pubmsg_hilight_signed", "{pubmsghinick_signed $0 $3 $1}$2", 4, { 0, 0, 0, 0 } }, + { "pubmsg_hilight_unknown", "{pubmsghinick_unknown $0 $3 $1}$2", 4, { 0, 0, 0, 0 } }, + { "pubmsg_hilight_failed", "{pubmsghinick_failed $0 $3 $1}$2", 4, { 0, 0, 0, 0 } }, + { "pubmsg_me_signed", "{pubmsgmenick_signed $2 {menick $0}}$1", 3, { 0, 0, 0 } }, + { "pubmsg_me_unknown", "{pubmsgmenick_unknown $2 {menick $0}}$1", 3, { 0, 0, 0 } }, + { "pubmsg_me_failed", "{pubmsgmenick_failed $2 {menick $0}}$1", 3, { 0, 0, 0 } }, + { "pubmsg_signed", "{pubmsgnick_signed $2 {pubnick $0}}$1", 3, { 0, 0, 0 } }, + { "pubmsg_unknown", "{pubmsgnick_unknown $2 {pubnick $0}}$1", 3, { 0, 0, 0 } }, + { "pubmsg_failed", "{pubmsgnick_failed $2 {pubnick $0}}$1", 3, { 0, 0, 0 } }, + { "pubmsg_hilight_channel_signed", "{pubmsghinick_signed $0 $4 $1{msgchannel $2}}$3", 5, { 0, 0, 0, 0, 0 } }, + { "pubmsg_hilight_channel_unknown", "{pubmsghinick_unknown $0 $4 $1{msgchannel $2}}$3", 5, { 0, 0, 0, 0, 0 } }, + { "pubmsg_hilight_channel_failed", "{pubmsghinick_failed $0 $4 $1{msgchannel $2}}$3", 5, { 0, 0, 0, 0, 0 } }, + { "pubmsg_me_channel_signed", "{pubmsgmenick_signed $3 {menick $0}{msgchannel $1}}$2", 4, { 0, 0, 0, 0 } }, + { "pubmsg_me_channel_unknown", "{pubmsgmenick_unknown $3 {menick $0}{msgchannel $1}}$2", 4, { 0, 0, 0, 0 } }, + { "pubmsg_me_channel_failed", "{pubmsgmenick_failed $3 {menick $0}{msgchannel $1}}$2", 4, { 0, 0, 0, 0 } }, + { "pubmsg_channel_signed", "{pubmsgnick_signed $3 {pubnick $0}{msgchannel $1}}$2", 4, { 0, 0, 0, 0 } }, + { "pubmsg_channel_unknown", "{pubmsgnick_unknown $3 {pubnick $0}{msgchannel $1}}$2", 4, { 0, 0, 0, 0 } }, + { "pubmsg_channel_failed", "{pubmsgnick_failed $3 {pubnick $0}{msgchannel $1}}$2", 4, { 0, 0, 0, 0 } }, + { "msg_private_signed", "{privmsg_signed $0 $1}$2", 3, { 0, 0, 0 } }, + { "msg_private_unknown", "{privmsg_unknown $0 $1}$2", 3, { 0, 0, 0 } }, + { "msg_private_failed", "{privmsg_failed $0 $1}$2", 3, { 0, 0, 0 } }, + { "msg_private_query_signed", "{privmsgnick_signed $0}$2", 3, { 0, 0, 0 } }, + { "msg_private_query_unknown", "{privmsgnick_unknown $0}$2", 3, { 0, 0, 0 } }, + { "msg_private_query_failed", "{privmsgnick_failed $0}$2", 3, { 0, 0, 0 } }, + { "own_msg_signed", "{ownmsgnick_signed $2 {ownnick $0}}$1", 3, { 0, 0, 0 } }, + { "own_msg_channel_signed", "{ownmsgnick_signed $3 {ownnick $0}{msgchannel $1}}$2", 4, { 0, 0, 0, 0 } }, + { "no_msgs_got", "You have not received a message from anyone yet", 0 }, + { "no_msgs_sent", "You have not sent a message to anyone yet", 0 }, + { "own_msg_private_signed", "{ownprivmsg_signed msg $0}$1", 2, { 0, 0 } }, + { "own_msg_private_query_signed", "{ownprivmsgnick_signed {ownprivnick $2}}$1", 3, { 0, 0, 0 } }, /* WHOIS, WHOWAS and USERS (alias WHO) messages */ { NULL, "Who Queries", 0 }, diff --git a/apps/irssi/src/fe-common/silc/module-formats.h b/apps/irssi/src/fe-common/silc/module-formats.h index 27c92de0..7df09206 100644 --- a/apps/irssi/src/fe-common/silc/module-formats.h +++ b/apps/irssi/src/fe-common/silc/module-formats.h @@ -47,6 +47,36 @@ enum { SILCTXT_CHANNEL_KILLED, SILCTXT_CHANNEL_QUIETED, SILCTXT_CHANNEL_APPEARS, + SILCTXT_PUBMSG_HILIGHT_SIGNED, + SILCTXT_PUBMSG_HILIGHT_UNKNOWN, + SILCTXT_PUBMSG_HILIGHT_FAILED, + SILCTXT_PUBMSG_ME_SIGNED, + SILCTXT_PUBMSG_ME_UNKNOWN, + SILCTXT_PUBMSG_ME_FAILED, + SILCTXT_PUBMSG_SIGNED, + SILCTXT_PUBMSG_UNKNOWN, + SILCTXT_PUBMSG_FAILED, + SILCTXT_PUBMSG_HILIGHT_CHANNEL_SIGNED, + SILCTXT_PUBMSG_HILIGHT_CHANNEL_UNKNOWN, + SILCTXT_PUBMSG_HILIGHT_CHANNEL_FAILED, + SILCTXT_PUBMSG_ME_CHANNEL_SIGNED, + SILCTXT_PUBMSG_ME_CHANNEL_UNKNOWN, + SILCTXT_PUBMSG_ME_CHANNEL_FAILED, + SILCTXT_PUBMSG_CHANNEL_SIGNED, + SILCTXT_PUBMSG_CHANNEL_UNKNOWN, + SILCTXT_PUBMSG_CHANNEL_FAILED, + SILCTXT_MSG_PRIVATE_SIGNED, + SILCTXT_MSG_PRIVATE_UNKNOWN, + SILCTXT_MSG_PRIVATE_FAILED, + SILCTXT_MSG_PRIVATE_QUERY_SIGNED, + SILCTXT_MSG_PRIVATE_QUERY_UNKNOWN, + SILCTXT_MSG_PRIVATE_QUERY_FAILED, + SILCTXT_OWN_MSG_SIGNED, + SILCTXT_OWN_MSG_CHANNEL_SIGNED, + SILCTXT_NO_MSGS_GOT, + SILCTXT_NO_MSGS_SENT, + SILCTXT_OWN_MSG_PRIVATE_SIGNED, + SILCTXT_OWN_MSG_PRIVATE_QUERY_SIGNED, SILCTXT_FILL_2, diff --git a/apps/irssi/src/fe-text/Makefile.am b/apps/irssi/src/fe-text/Makefile.am index d1d51c46..02cb3dd8 100644 --- a/apps/irssi/src/fe-text/Makefile.am +++ b/apps/irssi/src/fe-text/Makefile.am @@ -19,12 +19,12 @@ silc_DEPENDENCIES = \ LIBS = $(SILC_COMMON_LIBS) silc_LDADD = \ @COMMON_LIBS@ \ + -L../../../lib -lsilcclient \ @PERL_LINK_LIBS@ \ @PERL_FE_LINK_LIBS@ \ @PERL_LINK_FLAGS@ \ @PROG_LIBS@ \ - @TEXTUI_LIBS@ \ - -L../../../lib -lsilcclient + @TEXTUI_LIBS@ silc_LDFLAGS = -export-dynamic tparm_sources = \ diff --git a/apps/irssi/src/silc/core/client_ops.c b/apps/irssi/src/silc/core/client_ops.c index 78f0781a..b55b0d31 100644 --- a/apps/irssi/src/silc/core/client_ops.c +++ b/apps/irssi/src/silc/core/client_ops.c @@ -153,17 +153,107 @@ void silc_say_error(char *msg, ...) va_end(va); } +/* try to verify a message using locally stored public key data */ +int verify_message_signature(SilcClientEntry sender, + SilcMessageSignedPayload sig, + SilcMessagePayload message) +{ + SilcPublicKey pk; + char file[256], filename[256]; + char *fingerprint, *fingerprint2; + unsigned char *pk_data; + SilcUInt32 pk_datalen; + struct stat st; + int ret = SILC_MSG_SIGNED_VERIFIED, i; + + if (sig == NULL) + return SILC_MSG_SIGNED_UNKNOWN; + + /* get public key from the signature payload and compare it with the + one stored in the client entry */ + pk = silc_message_signed_get_public_key(sig, &pk_data, &pk_datalen); + + if (pk != NULL) { + fingerprint = silc_hash_fingerprint(NULL, pk_data, pk_datalen); + + if (sender->fingerprint) { + fingerprint2 = silc_fingerprint(sender->fingerprint, + sender->fingerprint_len); + if (strcmp(fingerprint, fingerprint2)) { + /* since the public key differs from the senders public key, the + verification _failed_ */ + silc_pkcs_public_key_free(pk); + silc_free(fingerprint); + ret = SILC_MSG_SIGNED_UNKNOWN; + } + silc_free(fingerprint2); + } + } else if (sender->fingerprint) + fingerprint = silc_fingerprint(sender->fingerprint, + sender->fingerprint_len); + else + /* no idea, who or what signed that message ... */ + return SILC_MSG_SIGNED_UNKNOWN; + + /* search our local client key cache */ + for (i = 0; i < strlen(fingerprint); i++) + if (fingerprint[i] == ' ') + fingerprint[i] = '_'; + + snprintf(file, sizeof(file) - 1, "clientkey_%s.pub", fingerprint); + snprintf(filename, sizeof(filename) - 1, "%s/clientkeys/%s", + get_irssi_dir(), file); + silc_free(fingerprint); + + if (stat(filename, &st) < 0) + /* we don't have the public key cached ... use the one from the sig */ + ret = SILC_MSG_SIGNED_UNKNOWN; + else { + SilcPublicKey cached_pk=NULL; + + /* try to load the file */ + if (!silc_pkcs_load_public_key(filename, &cached_pk, SILC_PKCS_FILE_PEM) && + !silc_pkcs_load_public_key(filename, &cached_pk, + SILC_PKCS_FILE_BIN)) { + printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP, + SILCTXT_PUBKEY_COULD_NOT_LOAD, "client"); + if (pk == NULL) + return SILC_MSG_SIGNED_UNKNOWN; + else + ret = SILC_MSG_SIGNED_UNKNOWN; + } + + if (cached_pk) { + if (pk) + silc_pkcs_public_key_free(pk); + pk = cached_pk; + } + } + + /* the public key is now in pk, our "level of trust" in ret */ + if ((pk) && silc_message_signed_verify(sig, message, pk, + silc_client->sha1hash)!= SILC_AUTH_OK) + ret = SILC_MSG_SIGNED_FAILED; + + if (pk) + silc_pkcs_public_key_free(pk); + + return ret; +} + /* Message for a channel. The `sender' is the nickname of the sender received in the packet. The `channel_name' is the name of the channel. */ void silc_channel_message(SilcClient client, SilcClientConnection conn, SilcClientEntry sender, SilcChannelEntry channel, + SilcMessagePayload payload, SilcMessageFlags flags, const unsigned char *message, SilcUInt32 message_len) { SILC_SERVER_REC *server; SILC_NICK_REC *nick; SILC_CHANNEL_REC *chanrec; + int verified = 0; SILC_LOG_DEBUG(("Start")); @@ -183,6 +273,16 @@ void silc_channel_message(SilcClient client, SilcClientConnection conn, nick = silc_nicklist_insert(chanrec, chu, FALSE); } + /* If the messages is digitally signed, verify it, if possible. */ + if (flags & SILC_MESSAGE_FLAG_SIGNED) { + if (!settings_get_bool("ignore_message_signatures")) { + SilcMessageSignedPayload sig = silc_message_get_signature(payload); + verified = verify_message_signature(sender, sig, payload); + } else { + flags &= ~SILC_MESSAGE_FLAG_SIGNED; + } + } + if (flags & SILC_MESSAGE_FLAG_DATA) { /* MIME object received, try to display it as well as we can */ char type[128], enc[128]; @@ -211,6 +311,8 @@ void silc_channel_message(SilcClient client, SilcClientConnection conn, if (!message) return; + /* FIXME: replace those printformat calls with signals and add signature + information to them (if present) */ if (flags & SILC_MESSAGE_FLAG_ACTION) printformat_module("fe-common/silc", server, channel->channel_name, MSGLEVEL_ACTIONS, SILCTXT_CHANNEL_ACTION, @@ -232,18 +334,30 @@ void silc_channel_message(SilcClient client, SilcClientConnection conn, silc_utf8_decode(message, message_len, SILC_STRING_LANGUAGE, cp, message_len); - signal_emit("message public", 6, server, cp, - nick == NULL ? "[]" : nick->nick, - nick == NULL ? "" : nick->host == NULL ? "" : nick->host, - chanrec->name, nick); + if (flags & SILC_MESSAGE_FLAG_SIGNED) + signal_emit("message signed_public", 6, server, cp, + nick == NULL ? "[]" : nick->nick, + nick == NULL ? "" : nick->host == NULL ? "" : nick->host, + chanrec->name, verified); + else + signal_emit("message public", 6, server, cp, + nick == NULL ? "[]" : nick->nick, + nick == NULL ? "" : nick->host == NULL ? "" : nick->host, + chanrec->name, nick); silc_free(dm); return; } - signal_emit("message public", 6, server, message, - nick == NULL ? "[]" : nick->nick, - nick == NULL ? "" : nick->host == NULL ? "" : nick->host, - chanrec->name, nick); + if (flags & SILC_MESSAGE_FLAG_SIGNED) + signal_emit("message signed_public", 6, server, message, + nick == NULL ? "[]" : nick->nick, + nick == NULL ? "" : nick->host == NULL ? "" : nick->host, + chanrec->name, verified); + else + signal_emit("message public", 6, server, message, + nick == NULL ? "[]" : nick->nick, + nick == NULL ? "" : nick->host == NULL ? "" : nick->host, + chanrec->name, nick); } } @@ -251,12 +365,14 @@ void silc_channel_message(SilcClient client, SilcClientConnection conn, sender received in the packet. */ void silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessageFlags flags, + SilcClientEntry sender, SilcMessagePayload payload, + SilcMessageFlags flags, const unsigned char *message, SilcUInt32 message_len) { SILC_SERVER_REC *server; char userhost[256]; + int verified = 0; SILC_LOG_DEBUG(("Start")); @@ -266,6 +382,16 @@ void silc_private_message(SilcClient client, SilcClientConnection conn, snprintf(userhost, sizeof(userhost) - 1, "%s@%s", sender->username, sender->hostname); + /* If the messages is digitally signed, verify it, if possible. */ + if (flags & SILC_MESSAGE_FLAG_SIGNED) { + if (!settings_get_bool("ignore_message_signatures")) { + SilcMessageSignedPayload sig = silc_message_get_signature(payload); + verified = verify_message_signature(sender, sig, payload); + } else { + flags &= ~SILC_MESSAGE_FLAG_SIGNED; + } + } + if (flags & SILC_MESSAGE_FLAG_DATA) { /* MIME object received, try to display it as well as we can */ char type[128], enc[128]; @@ -307,16 +433,26 @@ void silc_private_message(SilcClient client, SilcClientConnection conn, silc_utf8_decode(message, message_len, SILC_STRING_LANGUAGE, cp, message_len); - signal_emit("message private", 4, server, cp, - sender->nickname ? sender->nickname : "[]", - sender->username ? userhost : NULL); + if (flags & SILC_MESSAGE_FLAG_SIGNED) + signal_emit("message signed_private", 5, server, cp, + sender->nickname ? sender->nickname : "[]", + sender->username ? userhost : NULL, verified); + else + signal_emit("message private", 4, server, cp, + sender->nickname ? sender->nickname : "[]", + sender->username ? userhost : NULL); silc_free(dm); return; } - signal_emit("message private", 4, server, message, - sender->nickname ? sender->nickname : "[]", - sender->username ? userhost : NULL); + if (flags & SILC_MESSAGE_FLAG_SIGNED) + signal_emit("message signed_private", 5, server, message, + sender->nickname ? sender->nickname : "[]", + sender->username ? userhost : NULL, verified); + else + signal_emit("message private", 4, server, message, + sender->nickname ? sender->nickname : "[]", + sender->username ? userhost : NULL); } /* Notify message to the client. The notify arguments are sent in the @@ -422,9 +558,9 @@ void silc_notify(SilcClient client, SilcClientConnection conn, snprintf(buf, sizeof(buf) - 1, "%s@%s", client_entry->username, client_entry->hostname); signal_emit("message part", 5, server, channel->channel_name, - client_entry->nickname, client_entry->username ? + client_entry->nickname, client_entry->username ? buf : "", client_entry->nickname); - + chanrec = silc_channel_find_entry(server, channel); if (chanrec != NULL) { nickrec = silc_nicklist_find(chanrec, client_entry); @@ -444,15 +580,20 @@ void silc_notify(SilcClient client, SilcClientConnection conn, tmp = va_arg(va, char *); silc_server_free_ftp(server, client_entry); - - memset(buf, 0, sizeof(buf)); - if (client_entry->username) - snprintf(buf, sizeof(buf) - 1, "%s@%s", - client_entry->username, client_entry->hostname); - signal_emit("message quit", 4, server, client_entry->nickname, - client_entry->username ? buf : "", - tmp ? tmp : ""); - + + /* Print only if we have the nickname. If this cliente has just quit + when we were only resolving it, it is possible we don't have the + nickname. */ + if (client_entry->nickname) { + memset(buf, 0, sizeof(buf)); + if (client_entry->username) + snprintf(buf, sizeof(buf) - 1, "%s@%s", + client_entry->username, client_entry->hostname); + signal_emit("message quit", 4, server, client_entry->nickname, + client_entry->username ? buf : "", + tmp ? tmp : ""); + } + list1 = nicklist_get_same_unique(SERVER(server), client_entry); for (list_tmp = list1; list_tmp != NULL; list_tmp = list_tmp->next->next) { @@ -791,12 +932,18 @@ void silc_notify(SilcClient client, SilcClientConnection conn, for (i = 0; i < clients_count; i++) { memset(buf, 0, sizeof(buf)); - if (clients[i]->username) - snprintf(buf, sizeof(buf) - 1, "%s@%s", - clients[i]->username, clients[i]->hostname); - signal_emit("message quit", 4, server, clients[i]->nickname, - clients[i]->username ? buf : "", - "server signoff"); + + /* Print only if we have the nickname. If this client has just quit + when we were only resolving it, it is possible we don't have the + nickname. */ + if (clients[i]->nickname) { + if (clients[i]->username) + snprintf(buf, sizeof(buf) - 1, "%s@%s", + clients[i]->username, clients[i]->hostname); + signal_emit("message quit", 4, server, clients[i]->nickname, + clients[i]->username ? buf : "", + "server signoff"); + } silc_server_free_ftp(server, clients[i]); @@ -1060,12 +1207,13 @@ static void silc_client_join_get_users(SilcClient client, channel->channel_name, chanrec->topic); if (founder) { - if (founder == conn->local_entry) + if (founder == conn->local_entry) { printformat_module("fe-common/silc", server, channel->channel_name, MSGLEVEL_CRAP, SILCTXT_CHANNEL_FOUNDER_YOU, channel->channel_name); - else + signal_emit("nick mode changed", 2, chanrec, ownnick); + } else printformat_module("fe-common/silc", server, channel->channel_name, MSGLEVEL_CRAP, SILCTXT_CHANNEL_FOUNDER, @@ -1157,9 +1305,10 @@ void silc_parse_inviteban_list(SilcClient client, /* a public key */ char *fingerprint, *babbleprint; - fingerprint = silc_hash_fingerprint(NULL, tmp, len); - babbleprint = silc_hash_fingerprint(NULL, tmp, len); - + /* tmp is Public Key Payload, take public key from it. */ + fingerprint = silc_hash_fingerprint(NULL, tmp + 4, len - 4); + babbleprint = silc_hash_babbleprint(NULL, tmp + 4, len - 4); + printformat_module("fe-common/silc", server, (chanrec ? chanrec->visible_name : NULL), MSGLEVEL_CRAP, SILCTXT_CHANNEL_INVITEBAN_PUBKEY, diff --git a/apps/irssi/src/silc/core/client_ops.h b/apps/irssi/src/silc/core/client_ops.h index 68e2b09e..8c3f7630 100644 --- a/apps/irssi/src/silc/core/client_ops.h +++ b/apps/irssi/src/silc/core/client_ops.h @@ -27,11 +27,13 @@ void silc_say_error(char *msg, ...); void silc_channel_message(SilcClient client, SilcClientConnection conn, SilcClientEntry sender, SilcChannelEntry channel, + SilcMessagePayload payload, SilcMessageFlags flags, const unsigned char *message, SilcUInt32 message_len); void silc_private_message(SilcClient client, SilcClientConnection conn, SilcClientEntry sender, + SilcMessagePayload payload, SilcMessageFlags flags, const unsigned char *message, SilcUInt32 message_len); diff --git a/apps/irssi/src/silc/core/silc-commands.h b/apps/irssi/src/silc/core/silc-commands.h index d2ba8367..a2832f0f 100644 --- a/apps/irssi/src/silc/core/silc-commands.h +++ b/apps/irssi/src/silc/core/silc-commands.h @@ -18,4 +18,12 @@ cmd_return_error(CMDERR_NOT_CONNECTED); \ } G_STMT_END +/* Returning from command function with error */ +#define cmd_return_error_value(a,v) \ + G_STMT_START { \ + signal_emit("error command", 1, GINT_TO_POINTER(a)); \ + signal_stop(); \ + return (v); \ + } G_STMT_END + #endif diff --git a/apps/irssi/src/silc/core/silc-core.c b/apps/irssi/src/silc/core/silc-core.c index caf8b508..eeea2685 100644 --- a/apps/irssi/src/silc/core/silc-core.c +++ b/apps/irssi/src/silc/core/silc-core.c @@ -395,6 +395,7 @@ void silc_core_init(void) settings_add_int("server", "key_exchange_rekey_secs", 3600); settings_add_int("server", "connauth_request_secs", 2); settings_add_int("server", "heartbeat", 300); + settings_add_bool("server", "ignore_message_signatures", FALSE); /* Requested Attributes settings */ settings_add_bool("silc", "attr_allow", TRUE); diff --git a/apps/irssi/src/silc/core/silc-core.h b/apps/irssi/src/silc/core/silc-core.h index 0ae04ab2..594c3ffe 100644 --- a/apps/irssi/src/silc/core/silc-core.h +++ b/apps/irssi/src/silc/core/silc-core.h @@ -29,4 +29,8 @@ extern SilcClient silc_client; #define IS_SILC_ITEM(rec) (IS_SILC_CHANNEL(rec) || IS_SILC_QUERY(rec)) +#define SILC_MSG_SIGNED_VERIFIED 0 +#define SILC_MSG_SIGNED_UNKNOWN 1 +#define SILC_MSG_SIGNED_FAILED 2 + #endif diff --git a/apps/irssi/src/silc/core/silc-nicklist.c b/apps/irssi/src/silc/core/silc-nicklist.c index 2a517db2..a8c302bc 100644 --- a/apps/irssi/src/silc/core/silc-nicklist.c +++ b/apps/irssi/src/silc/core/silc-nicklist.c @@ -36,7 +36,9 @@ SILC_NICK_REC *silc_nicklist_insert(SILC_CHANNEL_REC *channel, rec = g_new0(SILC_NICK_REC, 1); rec->nick = g_strdup(user->client->nickname); - rec->host = g_strdup(user->client->username); + rec->host = g_strdup_printf("%s@%s", user->client->username, + user->client->hostname); + rec->realname = g_strdup(user->client->realname); rec->silc_user = user; rec->unique_id = user->client; diff --git a/apps/irssi/src/silc/core/silc-servers.c b/apps/irssi/src/silc/core/silc-servers.c index 4d68aeb0..c6cbdb48 100644 --- a/apps/irssi/src/silc/core/silc-servers.c +++ b/apps/irssi/src/silc/core/silc-servers.c @@ -50,20 +50,20 @@ void silc_servers_reconnect_init(void); void silc_servers_reconnect_deinit(void); -static void silc_send_channel(SILC_SERVER_REC *server, - char *channel, char *msg) +static int silc_send_channel(SILC_SERVER_REC *server, + char *channel, char *msg, + SilcMessageFlags flags) { SILC_CHANNEL_REC *rec; rec = silc_channel_find(server, channel); if (rec == NULL || rec->entry == NULL) { - cmd_return_error(CMDERR_NOT_JOINED); - return; + cmd_return_error_value(CMDERR_NOT_JOINED, FALSE); } silc_client_send_channel_message(silc_client, server->conn, rec->entry, - NULL, SILC_MESSAGE_FLAG_UTF8, - msg, strlen(msg), TRUE); + NULL, flags, msg, strlen(msg), TRUE); + return TRUE; } typedef struct { @@ -134,8 +134,8 @@ static void silc_send_msg_clients(SilcClient client, g_free(rec); } -static void silc_send_msg(SILC_SERVER_REC *server, char *nick, char *msg, - int msg_len, SilcMessageFlags flags) +static int silc_send_msg(SILC_SERVER_REC *server, char *nick, char *msg, + int msg_len, SilcMessageFlags flags) { PRIVMSG_REC *rec; SilcClientEntry *clients; @@ -145,7 +145,7 @@ static void silc_send_msg(SILC_SERVER_REC *server, char *nick, char *msg, if (!silc_parse_userfqdn(nick, &nickname, NULL)) { printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP, SILCTXT_BAD_NICK, nick); - return; + return FALSE; } /* Find client entry */ @@ -163,7 +163,7 @@ static void silc_send_msg(SILC_SERVER_REC *server, char *nick, char *msg, silc_client_get_clients(silc_client, server->conn, nickname, NULL, silc_send_msg_clients, rec); silc_free(nickname); - return; + return FALSE; } /* Send the private message directly */ @@ -171,6 +171,7 @@ static void silc_send_msg(SILC_SERVER_REC *server, char *nick, char *msg, silc_client_send_private_message(silc_client, server->conn, clients[0], flags, msg, msg_len, TRUE); + return TRUE; } void silc_send_mime(SILC_SERVER_REC *server, WI_ITEM_REC *to, @@ -249,7 +250,8 @@ static void send_message(SILC_SERVER_REC *server, char *target, } if (target_type == SEND_TARGET_CHANNEL) - silc_send_channel(server, target, message ? message : msg); + silc_send_channel(server, target, message ? message : msg, + SILC_MESSAGE_FLAG_UTF8); else silc_send_msg(server, target, message ? message : msg, message ? strlen(message) : strlen(msg), @@ -444,6 +446,7 @@ char *silc_server_get_channels(SILC_SERVER_REC *server) /* SYNTAX: WATCH [<-add | -del> ] */ /* SYNTAX: STATS */ /* SYNTAX: ATTR [<-del>