char *nickname = NULL;
if (!clients_count) {
- printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown nick: %s", rec->nick);
+ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+ "%s: There is no such client", rec->nick);
} else {
if (clients_count > 1) {
silc_parse_userfqdn(rec->nick, &nickname, NULL);
nickname, rec->nick,
&clients_count);
if (!clients) {
- printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown nick: %s",
- rec->nick);
+ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+ "%s: There is no such client", rec->nick);
silc_free(nickname);
goto out;
}
target = clients[0];
+ /* Still check for exact math for nickname, this compares the
+ real (formatted) nickname and the nick (maybe formatted) that
+ use gave. This is to assure that `nick' does not match
+ `nick@host'. */
+ if (strcasecmp(rec->nick, clients[0]->nickname)) {
+ printtext(NULL, NULL, MSGLEVEL_CLIENTERROR,
+ "%s: There is no such client", rec->nick);
+ goto out;
+ }
+
/* Send the private message */
silc_client_send_private_message(client, conn, target, 0,
rec->msg, strlen(rec->msg),
server->conn = conn;
fd = g_io_channel_unix_get_fd(net_sendbuffer_handle(server->handle));
- if (!silc_client_start_key_exchange(silc_client, conn, fd)) {
- /* some internal error occured */
- server_disconnect(SERVER(server));
- signal_stop();
- return;
- }
+ silc_client_start_key_exchange(silc_client, conn, fd);
+ server->ftp_sessions = silc_dlist_init();
server->isnickflag = isnickflag_func;
server->ischannel = ischannel_func;
server->get_nick_flags = get_nick_flags;
{
if (!IS_SILC_SERVER(server))
return;
-
+
+ silc_dlist_uninit(server->ftp_sessions);
+
if (server->conn && server->conn->sock != NULL) {
silc_client_close_connection(silc_client, NULL, server->conn);
return NULL;
}
- server->ftp_sessions = silc_dlist_init();
-
return server;
}
/* SYNTAX: INVITE <channel> [<nickname>[@hostname>] */
/* SYNTAX: INVITE <channel> [+|-[<nickname>[@<server>[!<username>[@hostname>]]]]] */
/* SYNTAX: KEY MSG <nickname> set|unset|list|agreement|negotiate [<arguments>] */
-/* SYNTAX: KEY CHANNEL <channel> set|unset|list|agreement|negotiate [<arguments>] */
+/* SYNTAX: KEY CHANNEL <channel> set|unset|list [<arguments>] */
/* SYNTAX: KICK <channel> <nickname>[@<hostname>] [<comment>] */
/* SYNTAX: KILL <nickname>[@<hostname>] [<comment>] */
/* SYNTAX: OPER <username> [-pubkey] */
/* SYNTAX: PING */
/* SYNTAX: SCONNECT <server> [<port>] */
/* SYNTAX: USERS <channel> */
-/* SYNTAX: FILE SEND <filepath> <nickname> */
+/* SYNTAX: FILE SEND <filepath> <nickname> [<local IP> [<local port>]] */
/* SYNTAX: FILE RECEIVE [<nickname>] */
/* SYNTAX: FILE CLOSE [<nickname>] */
/* SYNTAX: FILE */
+/* SYNTAX: JOIN <channel> [<passphrase>] [-cipher <cipher>] [-hmac <hmac>] [-founder <-pubkey|passwd>] */
void silc_command_exec(SILC_SERVER_REC *server,
const char *command, const char *args)
unsigned char **argv;
uint32 *argv_lens, *argv_types;
char *data, *tmpcmd;
- SilcClientCommand *cmd;
+ SilcClientCommand cmd;
SilcClientCommandContext ctx;
g_return_if_fail(server != NULL);
tmpcmd = g_strdup(command);
g_strup(tmpcmd);
- cmd = silc_client_command_find(tmpcmd);
+ cmd = silc_client_command_find(silc_client, tmpcmd);
g_free(tmpcmd);
if (cmd == NULL)
return;
-
+
/* Now parse all arguments */
data = g_strconcat(command, " ", args, NULL);
silc_parse_command_line(data, &argv, &argv_lens,
ctx->argv_types = argv_types;
/* Execute command */
- (*cmd->cb)(ctx, NULL);
+ silc_client_command_call(cmd, ctx);
}
/* Generic command function to call any SILC command directly. */
uint32 *argv_lens, *argv_types;
int type = 0;
FtpSession ftp;
+ char *local_ip = NULL;
+ uint32 local_port = 0;
if (!server || !IS_SILC_SERVER(server) || !server->connected)
cmd_return_error(CMDERR_NOT_CONNECTED);
/* Now parse all arguments */
tmp = g_strconcat("FILE", " ", data, NULL);
- silc_parse_command_line(tmp, &argv, &argv_lens, &argv_types, &argc, 4);
+ silc_parse_command_line(tmp, &argv, &argv_lens, &argv_types, &argc, 6);
g_free(tmp);
if (argc == 1)
client_entry = entrys[0];
silc_free(entrys);
+ if (argc >= 5)
+ local_ip = argv[4];
+ if (argc >= 6)
+ local_port = atoi(argv[5]);
+
ftp = silc_calloc(1, sizeof(*ftp));
ftp->session_id =
silc_client_file_send(silc_client, conn, silc_client_file_monitor,
- server, client_entry, argv[2]);
+ server, local_ip, local_port,
+ client_entry, argv[2]);
printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
SILCTXT_FILE_SEND, client_entry->nickname,