+static void silc_client_ftp_ask_name(const char *filepath,
+ void *context)
+{
+ SilcClientFtpSession session = (SilcClientFtpSession)context;
+ SilcSFTPAttributesStruct attr;
+ char *remote_file = NULL;
+
+ SILC_LOG_DEBUG(("Start"));
+
+ if (filepath) {
+ remote_file = session->filepath;
+ session->filepath = NULL;
+ silc_free(session->path);
+ session->path = NULL;
+ session->filepath = strdup(filepath);
+ } else {
+ remote_file = strdup(session->filepath);
+ }
+
+ /* Now open the file */
+ memset(&attr, 0, sizeof(attr));
+ silc_sftp_open(session->sftp, remote_file, SILC_SFTP_FXF_READ, &attr,
+ silc_client_ftp_open_handle, session);
+
+ /* Close the directory handle */
+ silc_sftp_close(session->sftp, session->dir_handle, NULL, NULL);
+ session->dir_handle = NULL;
+
+ silc_free(remote_file);
+}
+