From: Pekka Riikonen Date: Thu, 7 Jun 2001 18:49:53 +0000 (+0000) Subject: updates. X-Git-Tag: robodoc-323~207 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=01f3ed70ac686777ebfb992e062d65f2322d8998 updates. --- diff --git a/CHANGES b/CHANGES index 8b223f56..2d784a57 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,9 @@ Thu Jun 7 16:29:56 EEST 2001 Pekka Riikonen if the server disconnected us and the connection is not valid anymore. Affected file irssi/src/silc/core/silc-channels.c. + * Moved the silc_client_[chmode|chumode|chumode_char] away from + the library to the lib/silcutil/silcutil.[ch]. + Thu Jun 7 08:57:16 CEST 2001 Pekka Riikonen * Close log file after open. Affected file diff --git a/README b/README index 5b8b3e46..13e88e5a 100644 --- a/README +++ b/README @@ -29,314 +29,6 @@ server give the command: This will launch the server on to the background. -SILC Commands -============= - - - /SERVER [[:]] - - Connects to remote SILC server. - - /NICK [] - - Changes/sets nickname. Note that in SILC there can be - multiple same nicknames. However, the logic on working - with multiple nicknames on user interface is pretty much - still missing. Also note that nicknames in SILC are - case-sensitive. - - /JOIN - - Joins to a channel. Channel names start with `#' - character. - - /LEAVE - - Leaves the channel. If /leave * is given the client - leaves the current channel. - - /CMODE +|- [{ }] - - Changes/sets channel mode. Most of the modes require - special privileges, such as channel operator or channel - founder privileges to work. The mode is added by adding - + before the option(s) and removed by adding - before - the option(s). Following modes are available: - - p Set/unset channel as private channel - s Set/unset channel as secret channel - k Set/unset that channel uses private channel key - i Set/unset channel as invite only channel - t Set/unset that only channel operator or - founder may set channel topic - l Set/unset channel's user limit - a Set/unset passphrase for channel that must - be provided when joining to the channel. - c Set/unset channel's cipher - h Set/unset channel's hmac - f <-pubkey| - 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 - to the channel. If -pubkey is set then - the authentication will be done using the - client's public key. You can claim the - founder rights using the CUMODE command. - - 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. - - /CUMODE +|- [@] [-pubkey|] - - Changes/set user's mode on a channel. Most of the modes - require that the client who changes some client's mode must - be channel founder or channel operator. Following channel - user modes are available: - - a [@] - - Set/unset all modes (cannot be used to set - both founder and operator rights, can be used - only to remove both modes at once). - - f [@] [-pubkey|] - - Set/Unset channel founder. If the -pubkey - option or is provided then the - client is claiming the founder rights by - providing the channel founder authentication - data. If the -pubkey is provided then the - authentication is performed using the - client's public key. If you are channel - founder you can set the channel founder - authentication using CMODE command. - - o [@] - - Set/unset channel operator. Requires that - you are channel operator or channel founder. - - /UMODE +|- - - Sets/unsets user mode. Note that some of the modes the - client cannot set itself. The following user modes are - available: - - a Unset all modes - s Unset server operator privileges - r Unset router operator privileges - g Set/unset to be gone (or use /AWAY command) - - - /MSG - - Sends private message to remote client. Support for - handling multiple same nicknames with /MSG command is - still missing. - - /WHOIS [@] [] - - Gives a little information about a client. Support for - handling multiple same nicknames with this command is - still missing. - - /WHOWAS [@] [] - - Gives a little history information about a client. - - /INVITE [[@server>] - [+|-[[@[![@hostname>]]]]] - - Invites client to a channel or manages the invite list of - the channel. The first argument is used if an - client is invited to the channel. The second +|- - argument is used to either add or delete invite from the - channel's invite list. Wildcards may be used with this - command. - - /BAN [+|-[[@[![@hostname>]]]]] - - Manages the ban list of the channel. Wildcards may be used - with this command. You must be channel operator to be - able to use this command. - - /KICK [@] [] - - Kicks client from channel. You have to be at least channel - operator to be able to kick client from channel. Note: - you cannot kick channel founder even if you are channel - operator. - - /PING [] - - Pings server. Only locally connected server may be - pinged. - - /INFO [] - - Requests information about a server. If argument is - not specified current server is used. - - /AWAY [] - - Sets away message. When private message is received and - away message is set the client automatically replies to - the sender with the away message. To remove away message - give the command without arguments. - - /QUIT - - Quits session. Connection to remote server is closed. - - /CLEAR - - Clears current screen. - - /VERSION - - Shows client version. - - /OPER [] - - Obtains server operator privileges. - - /SILCOPER [] - - Obtains router operator privileges. - - /KILL [] - - Router operator can use this command to remove an client - from the SILC Network temporarily. - - /CONNECT [] - - Connects to server the remote . You must be - server operator to be able to do this. - - - /CLOSE [] - - Closes connection to the . You must be server - operator to be able to do this. - - /SHUTDOWN - - Shutdowns the server. You must be server operator to be - able to do this. - - /MOTD [] - - Display the MOTD of the server. If server is not specified - the current server is used. - - /LIST [] - - Lists all channels in the current server, or the channel - specified. If the channel cannot be found then all - channels are listed. - - /KEY msg|channel - set|unset|list|agreement|negotiate [] - - This command is used to set and unset private keys for - channels, set and unset private keys for private messages - with remote clients and to send key agreement requests and - negotiate the key agreement protocol with remote client. - The key agreement is supported only to negotiate private - message keys, it currently cannot be used to negotiate - private keys for channels, as it is not convenient for that - purpose. - - Types: - - msg The command is performed for private messages - affecting the . - - channel The command is performed for channel affecting - the . - - - Commands: - - set [ [] []] - - Set the key into use. If the is provided it - is used as the key material. If the is not - provided the negotiated key material is used. If - the negotiation has not been performed this command - has no effect. - - If the type is `msg' and the is `*' then - random key will be generated automatically. - - The may be set for both private message - and channel private keys and the may be set - only to the channel private keys. - - unset [] - - Unset the key. The private key is not used after - this command. The key must be set again or the key - material must be re-negotiated to be able to use - the private keys again. - - The channel may have several private keys set. The - can be used to indicate what key is being - unset. If it is not provided all keys are removed. - - - list List all private keys that has been set. - - If the type is `msg' and the is ยด*' then - all private message keys that you've set will be - listed. - - agreement [ []] - - Send key agreement request to remote client. If - the is provided it is sent in the request. - The receiver may use the hostname to start the - key agreement. If the is also provided your - key agreement protocol server is bound to that - port. Note that it cannot be privileged port (<1023). - If the and is not provided then - the receiver will never initiate the key agreement. - In this case you must start the key agreement after - receiving the reply to the request, by giving the - /KEYAGR start command. - - This command may be used to send reply to the - remote client. When receiving empty key agreement - you can reply to the sender with the hostname and - port of your key agreement server with this command. - - negotiate [ []] - - This may be called to start the key agreement with - . This command has effect only if the - has replied to your key agreement request. - You will see a notify on the screen when the reply - arrives. The and is the hostname - and port of the remote client's key agreement - server. - - /ME - - This command is used to send an action to the channel. - This equals to CTCP's ACTION (IRC's /ME) command. - - /NOTICE - - This command is used to send for example informational - notice messages to the channel. - - /GETKEY - - Fetches remote client's public key. - Features ======== diff --git a/README.CVS b/README.CVS index 9db7980e..486a221e 100644 --- a/README.CVS +++ b/README.CVS @@ -19,21 +19,21 @@ There are no password restrictions in the SILC anonymous CVS repository. For those who are using sh/ksh/bash the check out is done as follows: -export CVSROOT=:pserver:silc@silc.pspt.fi:/storage/silc/CVS +export CVSROOT=:pserver:cvs@cvs.silcnet.org:/cvs/silc cvs login cvs co silc For those who are using csh/tcsh the check out is done as follows: -setenv CVSROOT :pserver:silc@silc.pspt.fi:/storage/silc/CVS +setenv CVSROOT :pserver:cvs@cvs.silcnet.org:/cvs/silc cvs login cvs co silc If you don't want to set $CVSROOT environment variable you can set the path to the cvs as command line options: -cvs -d:pserver:silc@silc.pspt.fi:/storage/silc/CVS login -cvs -d:pserver:silc@silc.pspt.fi:/storage/silc/CVS co silc +cvs -d:pserver:cvs@cvs.silcnet.org:/cvs/silc login +cvs -d:pserver:cvs@cvs.silcnet.org:/cvs/silc co silc What ever method you decide to use, after you have done cvs login you will be prompted for password: @@ -69,11 +69,58 @@ Following directories currently exist in SILC source tree. Includes SILC include files. + irssi/ + + Includes the Irssi SILC Client. + lib/ Includes SILC libraries. There maybe libraries on the CVS that does not appear on public distribution. + lib/contrib/ + + Contrib directory for routines that some of the platforms might + not have. In that case these routines are provided by the SILC. + + lib/silcclient/ + + The SILC Client library. Implementation of the SILC Client without + the user interface. The library provides an interface for user + interface designers. + + lib/silccore/ + + The SILC Protocol Core library. Implementation of all the core + components of the SILC Protocol. This is used by all the SILC + applications. + + lib/silccrypt/ + + The SILC Crypto library. Provides all cryptographic algorithms + used in the SILC. Provides also the Cryptographically strong + random number generator. + + lib/silcmath/ + + The SILC Math library. Provides the Math and MP routines for + SILC applications. The MP library is actually the GMP. + + lib/silsim/ + + The SILC Modules library. Provides the dynamically loadable + modules. + + lib/silcske/ + + The SILC Key Exchange (SKE) library. Implementation of the + SKE protocol. This is used by all SILC applications. + + lib/silcutil/ + + The SILC Utility library. Provides various utility functions + for the appliations. + public_html/ Includes the official SILC web pages and everything that relates diff --git a/TODO b/TODO index a2541e33..4b01996c 100644 --- a/TODO +++ b/TODO @@ -35,9 +35,6 @@ TODO/bugs In SILC Client Library o silc_client_close_connection leaks memory. Read the XXX from code. - o Move the silc_client_[chmode|chumode|chumode_char] away from the library, - may be to util library. - o Some of the ops->say's should be removed and moved to the application from the library. Go through these. diff --git a/apps/irssi/src/silc/core/client_ops.c b/apps/irssi/src/silc/core/client_ops.c index c11963da..2e315f79 100644 --- a/apps/irssi/src/silc/core/client_ops.c +++ b/apps/irssi/src/silc/core/client_ops.c @@ -484,7 +484,9 @@ silc_command_reply(SilcClient client, SilcClientConnection conn, signal_emit("channel topic changed", 1, chanrec); } - mode = silc_client_chmode(modei, channel_entry); + mode = silc_client_chmode(modei, + channel_entry->channel_key->cipher->name, + channel_entry->hmac->hmac->name); g_free_not_null(chanrec->mode); chanrec->mode = g_strdup(mode == NULL ? "" : mode); signal_emit("channel mode changed", 1, chanrec); diff --git a/apps/irssi/src/silc/core/silc-channels.c b/apps/irssi/src/silc/core/silc-channels.c index 1614ff44..f6dc52f8 100644 --- a/apps/irssi/src/silc/core/silc-channels.c +++ b/apps/irssi/src/silc/core/silc-channels.c @@ -290,7 +290,9 @@ static void event_cmode(SILC_SERVER_REC *server, va_list va) (void)va_arg(va, char *); channel = va_arg(va, SilcChannelEntry); - mode = silc_client_chmode(modei, channel); + mode = silc_client_chmode(modei, + channel->channel_key->cipher->name, + channel->hmac->hmac->name); chanrec = silc_channel_find_entry(server, channel); if (chanrec != NULL) { diff --git a/apps/silc/client_ops.c b/apps/silc/client_ops.c index 33de05c6..47761266 100644 --- a/apps/silc/client_ops.c +++ b/apps/silc/client_ops.c @@ -363,7 +363,9 @@ void silc_notify(SilcClient client, SilcClientConnection conn, (void)va_arg(vp, char *); channel_entry = va_arg(vp, SilcChannelEntry); - tmp = silc_client_chmode(tmp_int, channel_entry); + tmp = silc_client_chmode(tmp_int, + channel_entry->channel_key->cipher->name, + channel_entry->hmac->hmac->name); if (tmp) { if (client_entry) { @@ -819,7 +821,9 @@ void silc_command_reply(SilcClient client, SilcClientConnection conn, app->screen->bottom_line->channel, topic); app->screen->bottom_line->channel_mode = - silc_client_chmode(mode, channel); + silc_client_chmode(mode, + channel->channel_key->cipher->name, + channel->hmac->hmac->name); silc_screen_print_bottom_line(app->screen, 0); /* Resolve the client information */ diff --git a/lib/silcclient/client.c b/lib/silcclient/client.c index 583d0221..0fbc909d 100644 --- a/lib/silcclient/client.c +++ b/lib/silcclient/client.c @@ -1408,102 +1408,6 @@ void silc_client_replace_from_channels(SilcClient client, silc_idcache_list_free(list); } -/* Parses mode mask and returns the mode as string. */ - -char *silc_client_chmode(uint32 mode, SilcChannelEntry channel) -{ - char string[100]; - - if (!mode) - return NULL; - - memset(string, 0, sizeof(string)); - - if (mode & SILC_CHANNEL_MODE_PRIVATE) - strncat(string, "p", 1); - - if (mode & SILC_CHANNEL_MODE_SECRET) - strncat(string, "s", 1); - - if (mode & SILC_CHANNEL_MODE_PRIVKEY) - strncat(string, "k", 1); - - if (mode & SILC_CHANNEL_MODE_INVITE) - strncat(string, "i", 1); - - if (mode & SILC_CHANNEL_MODE_TOPIC) - strncat(string, "t", 1); - - if (mode & SILC_CHANNEL_MODE_ULIMIT) - strncat(string, "l", 1); - - if (mode & SILC_CHANNEL_MODE_PASSPHRASE) - strncat(string, "a", 1); - - if (mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) - strncat(string, "f", 1); - - if (mode & SILC_CHANNEL_MODE_CIPHER) { - char cipher[30]; - memset(cipher, 0, sizeof(cipher)); - snprintf(cipher, sizeof(cipher), " c (%s)", - channel->channel_key->cipher->name); - strncat(string, cipher, strlen(cipher)); - } - - if (mode & SILC_CHANNEL_MODE_HMAC) { - char hmac[30]; - memset(hmac, 0, sizeof(hmac)); - snprintf(hmac, sizeof(hmac), " h (%s)", - channel->hmac->hmac->name); - strncat(string, hmac, strlen(hmac)); - } - - /* Rest of mode is ignored */ - - return strdup(string); -} - -/* Parses channel user mode mask and returns te mode as string */ - -char *silc_client_chumode(uint32 mode) -{ - char string[4]; - - if (!mode) - return NULL; - - memset(string, 0, sizeof(string)); - - if (mode & SILC_CHANNEL_UMODE_CHANFO) - strncat(string, "f", 1); - - if (mode & SILC_CHANNEL_UMODE_CHANOP) - strncat(string, "o", 1); - - return strdup(string); -} - -/* Parses channel user mode and returns it as special mode character. */ - -char *silc_client_chumode_char(uint32 mode) -{ - char string[4]; - - if (!mode) - return NULL; - - memset(string, 0, sizeof(string)); - - if (mode & SILC_CHANNEL_UMODE_CHANFO) - strncat(string, "*", 1); - - if (mode & SILC_CHANNEL_UMODE_CHANOP) - strncat(string, "@", 1); - - return strdup(string); -} - /* Registers failure timeout to process the received failure packet with timeout. */ diff --git a/lib/silcclient/client.h b/lib/silcclient/client.h index bd1c7e88..fff7d017 100644 --- a/lib/silcclient/client.h +++ b/lib/silcclient/client.h @@ -280,9 +280,6 @@ void silc_client_replace_from_channels(SilcClient client, SilcClientConnection conn, SilcClientEntry old, SilcClientEntry new); -char *silc_client_chmode(uint32 mode, SilcChannelEntry channel); -char *silc_client_chumode(uint32 mode); -char *silc_client_chumode_char(uint32 mode); void silc_client_process_failure(SilcClient client, SilcSocketConnection sock, SilcPacketContext *packet); diff --git a/lib/silcutil/silcutil.c b/lib/silcutil/silcutil.c index 3e969c73..5f21beeb 100644 --- a/lib/silcutil/silcutil.c +++ b/lib/silcutil/silcutil.c @@ -919,3 +919,89 @@ bool silc_hash_data_compare(void *key1, void *key2, void *user_context) uint32 len = (uint32)user_context; return !memcmp(key1, key2, len); } + +/* Parses mode mask and returns the mode as string. */ + +char *silc_client_chmode(uint32 mode, const char *cipher, const char *hmac) +{ + char string[100]; + + if (!mode) + return NULL; + + memset(string, 0, sizeof(string)); + + if (mode & SILC_CHANNEL_MODE_PRIVATE) + strncat(string, "p", 1); + + if (mode & SILC_CHANNEL_MODE_SECRET) + strncat(string, "s", 1); + + if (mode & SILC_CHANNEL_MODE_PRIVKEY) + strncat(string, "k", 1); + + if (mode & SILC_CHANNEL_MODE_INVITE) + strncat(string, "i", 1); + + if (mode & SILC_CHANNEL_MODE_TOPIC) + strncat(string, "t", 1); + + if (mode & SILC_CHANNEL_MODE_ULIMIT) + strncat(string, "l", 1); + + if (mode & SILC_CHANNEL_MODE_PASSPHRASE) + strncat(string, "a", 1); + + if (mode & SILC_CHANNEL_MODE_FOUNDER_AUTH) + strncat(string, "f", 1); + + if (mode & SILC_CHANNEL_MODE_CIPHER) + strncat(string, cipher, strlen(cipher)); + + if (mode & SILC_CHANNEL_MODE_HMAC) + strncat(string, hmac, strlen(hmac)); + + /* Rest of mode is ignored */ + + return strdup(string); +} + +/* Parses channel user mode mask and returns te mode as string */ + +char *silc_client_chumode(uint32 mode) +{ + char string[4]; + + if (!mode) + return NULL; + + memset(string, 0, sizeof(string)); + + if (mode & SILC_CHANNEL_UMODE_CHANFO) + strncat(string, "f", 1); + + if (mode & SILC_CHANNEL_UMODE_CHANOP) + strncat(string, "o", 1); + + return strdup(string); +} + +/* Parses channel user mode and returns it as special mode character. */ + +char *silc_client_chumode_char(uint32 mode) +{ + char string[4]; + + if (!mode) + return NULL; + + memset(string, 0, sizeof(string)); + + if (mode & SILC_CHANNEL_UMODE_CHANFO) + strncat(string, "*", 1); + + if (mode & SILC_CHANNEL_UMODE_CHANOP) + strncat(string, "@", 1); + + return strdup(string); +} diff --git a/lib/silcutil/silcutil.h b/lib/silcutil/silcutil.h index 4556699c..33cf92c0 100644 --- a/lib/silcutil/silcutil.h +++ b/lib/silcutil/silcutil.h @@ -59,5 +59,8 @@ bool silc_hash_string_compare(void *key1, void *key2, void *user_context); bool silc_hash_id_compare(void *key1, void *key2, void *user_context); bool silc_hash_client_id_compare(void *key1, void *key2, void *user_context); bool silc_hash_data_compare(void *key1, void *key2, void *user_context); +char *silc_client_chmode(uint32 mode, const char *cipher, const char *hmac); +char *silc_client_chumode(uint32 mode); +char *silc_client_chumode_char(uint32 mode); #endif