projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Changed SILC code to use new SRT and SCT APIs.
[silc.git]
/
lib
/
silcclient
/
client_ftp.c
diff --git
a/lib/silcclient/client_ftp.c
b/lib/silcclient/client_ftp.c
index a057a6d25cc973746965306ba09225b5c790424b..b4e8d46ec2724c77da6af638777fb44f5820fc55 100644
(file)
--- a/
lib/silcclient/client_ftp.c
+++ b/
lib/silcclient/client_ftp.c
@@
-4,7
+4,7
@@
Author: Pekka Riikonen <priikone@silcnet.org>
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2001 - 200
7
Pekka Riikonen
+ Copyright (C) 2001 - 200
8
Pekka Riikonen
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
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
@@
-16,7
+16,6
@@
GNU General Public License for more details.
*/
GNU General Public License for more details.
*/
-/* $Id$ */
#include "silc.h"
#include "silcclient.h"
#include "silc.h"
#include "silcclient.h"
@@
-27,6
+26,7
@@
/* File transmission session */
struct SilcClientFtpSessionStruct {
SilcClient client; /* Client */
/* File transmission session */
struct SilcClientFtpSessionStruct {
SilcClient client; /* Client */
+ SilcClientConnection server_conn; /* Connection to server */
SilcClientConnection conn; /* Connection to remote host */
SilcClientEntry client_entry; /* The client entry */
SilcClientListener listener; /* Listener */
SilcClientConnection conn; /* Connection to remote host */
SilcClientEntry client_entry; /* The client entry */
SilcClientListener listener; /* Listener */
@@
-107,7
+107,7
@@
static void silc_client_ftp_data(SilcSFTP sftp,
silc_sftp_close(sftp, session->read_handle, NULL, NULL);
session->read_handle = NULL;
silc_sftp_close(sftp, session->read_handle, NULL, NULL);
session->read_handle = NULL;
- /* Close the rea
d
file descriptor */
+ /* Close the rea
l
file descriptor */
silc_file_close(session->fd);
return;
}
silc_file_close(session->fd);
return;
}
@@
-129,7
+129,7
@@
static void silc_client_ftp_data(SilcSFTP sftp,
silc_sftp_close(sftp, session->read_handle, NULL, NULL);
session->read_handle = NULL;
silc_sftp_close(sftp, session->read_handle, NULL, NULL);
session->read_handle = NULL;
- /* Close the rea
d
file descriptor */
+ /* Close the rea
l
file descriptor */
silc_file_close(session->fd);
return;
}
silc_file_close(session->fd);
return;
}
@@
-192,7
+192,7
@@
static void silc_client_ftp_open_handle(SilcSFTP sftp,
SILC_CLIENT_MESSAGE_ERROR,
"File `%s' open failed: %s",
session->filepath,
SILC_CLIENT_MESSAGE_ERROR,
"File `%s' open failed: %s",
session->filepath,
- s
trerror(
errno));
+ s
ilc_errno_string(silc_
errno));
if (session->monitor)
(*session->monitor)(session->client, session->conn,
if (session->monitor)
(*session->monitor)(session->client, session->conn,
@@
-379,6
+379,8
@@
static void silc_client_ftp_session_free(SilcClientFtpSession session)
{
SILC_LOG_DEBUG(("Free session %d", session->session_id));
{
SILC_LOG_DEBUG(("Free session %d", session->session_id));
+ silc_schedule_task_del_by_context(session->client->schedule, session);
+
silc_dlist_del(session->client->internal->ftp_sessions, session);
/* Abort connecting */
silc_dlist_del(session->client->internal->ftp_sessions, session);
/* Abort connecting */
@@
-403,7
+405,7
@@
static void silc_client_ftp_session_free(SilcClientFtpSession session)
if (session->stream)
silc_stream_destroy(session->stream);
if (session->stream)
silc_stream_destroy(session->stream);
- silc_client_unref_client(session->client, session->conn,
+ silc_client_unref_client(session->client, session->
server_
conn,
session->client_entry);
silc_free(session->hostname);
silc_free(session->filepath);
session->client_entry);
silc_free(session->hostname);
silc_free(session->filepath);
@@
-697,6
+699,7
@@
silc_client_file_send(SilcClient client,
return SILC_CLIENT_FILE_ERROR;
session->session_id = ++client->internal->next_session_id;
session->client = client;
return SILC_CLIENT_FILE_ERROR;
session->session_id = ++client->internal->next_session_id;
session->client = client;
+ session->server_conn = conn;
session->initiator = TRUE;
session->client_entry = silc_client_ref_client(client, conn, client_entry);
session->monitor = monitor;
session->initiator = TRUE;
session->client_entry = silc_client_ref_client(client, conn, client_entry);
session->monitor = monitor;
@@
-734,7
+737,8
@@
silc_client_file_send(SilcClient client,
if (!session->listener) {
client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot create listener for file transfer: "
if (!session->listener) {
client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot create listener for file transfer: "
- "%s", strerror(errno));
+ "%s", silc_errno_string(silc_errno));
+
silc_free(session);
return SILC_CLIENT_FILE_NO_MEMORY;
}
silc_free(session);
return SILC_CLIENT_FILE_NO_MEMORY;
}
@@
-851,6
+855,11
@@
silc_client_file_receive(SilcClient client,
/* Add the listener for the key agreement */
SILC_LOG_DEBUG(("Creating listener for file transfer"));
if (!params || (!params->local_ip && !params->bind_ip)) {
/* Add the listener for the key agreement */
SILC_LOG_DEBUG(("Creating listener for file transfer"));
if (!params || (!params->local_ip && !params->bind_ip)) {
+ session->client->internal->ops->say(session->client, session->conn,
+ SILC_CLIENT_MESSAGE_ERROR,
+ "Cannot create listener for file "
+ "transfer; IP address and/or port "
+ "not provided");
silc_free(session);
return SILC_CLIENT_FILE_ERROR;
}
silc_free(session);
return SILC_CLIENT_FILE_ERROR;
}
@@
-862,7
+871,8
@@
silc_client_file_receive(SilcClient client,
if (!session->listener) {
client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot create listener for file transfer: "
if (!session->listener) {
client->internal->ops->say(client, conn, SILC_CLIENT_MESSAGE_ERROR,
"Cannot create listener for file transfer: "
- "%s", strerror(errno));
+ "%s", silc_errno_string(silc_errno));
+
silc_free(session);
return SILC_CLIENT_FILE_NO_MEMORY;
}
silc_free(session);
return SILC_CLIENT_FILE_NO_MEMORY;
}
@@
-965,7
+975,7
@@
SILC_FSM_STATE(silc_client_ftp)
SilcClientFtpSession session;
SilcClientID remote_id;
SilcClientEntry remote_client;
SilcClientFtpSession session;
SilcClientID remote_id;
SilcClientEntry remote_client;
- SilcKeyAgreementPayload payload;
+ SilcKeyAgreementPayload payload
= NULL
;
char *hostname;
SilcUInt16 port;
char *hostname;
SilcUInt16 port;
@@
-1037,6
+1047,7
@@
SILC_FSM_STATE(silc_client_ftp)
goto out;
session->session_id = ++client->internal->next_session_id;
session->client = client;
goto out;
session->session_id = ++client->internal->next_session_id;
session->client = client;
+ session->server_conn = conn;
session->client_entry = silc_client_ref_client(client, conn,
remote_client);
if (hostname && port) {
session->client_entry = silc_client_ref_client(client, conn,
remote_client);
if (hostname && port) {
@@
-1076,6
+1087,8
@@
SILC_FSM_STATE(silc_client_ftp)
}
out:
}
out:
+ if (payload)
+ silc_key_agreement_payload_free(payload);
silc_packet_free(packet);
return SILC_FSM_FINISH;
}
silc_packet_free(packet);
return SILC_FSM_FINISH;
}