public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Mattias Ellert <mattias.ellert@physics.uu.se>
To: git-commits@fedoraproject.org
Subject: [rpms/globus-ftp-client] rawhide: Fix compiler and doxygen warnings
Date: Sun, 14 Jun 2026 08:45:56 GMT [thread overview]
Message-ID: <178142675628.1.13302290531297924239.rpms-globus-ftp-client-92080bc9890b@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/globus-ftp-client
Branch : rawhide
Commit : 92080bc9890b9097d6df7e40343626b6e8cb220b
Author : Mattias Ellert <mattias.ellert@physics.uu.se>
Date : 2026-06-14T10:39:12+02:00
Stats : +11579/-1 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/globus-ftp-client/c/92080bc9890b9097d6df7e40343626b6e8cb220b?branch=rawhide
Log:
Fix compiler and doxygen warnings
---
diff --git a/0001-Untabify-and-remove-trailing-white-space.patch b/0001-Untabify-and-remove-trailing-white-space.patch
new file mode 100644
index 0000000..0b20138
--- /dev/null
+++ b/0001-Untabify-and-remove-trailing-white-space.patch
@@ -0,0 +1,11456 @@
+From 3ccdaa0236230bbcbcbf339e7dfdfaf23c10bd6f Mon Sep 17 00:00:00 2001
+From: Mattias Ellert <mattias.ellert@physics.uu.se>
+Date: Wed, 20 May 2026 00:15:37 +0200
+Subject: [PATCH 1/2] Untabify and remove trailing white-space
+
+---
+ gridftp/client/source/globus_ftp_client.h | 652 +-
+ .../client/source/globus_ftp_client_state.c | 8056 ++++++++---------
+ .../client/source/test/lingering-get-test.c | 46 +-
+ .../source/test/multiple-block-get-test.c | 100 +-
+ 4 files changed, 4427 insertions(+), 4427 deletions(-)
+
+diff --git a/gridftp/client/source/globus_ftp_client.h b/gridftp/client/source/globus_ftp_client.h
+index 2827d5e95..3bef542a2 100644
+--- a/gridftp/client/source/globus_ftp_client.h
++++ b/gridftp/client/source/globus_ftp_client.h
+@@ -57,7 +57,7 @@
+ * structure contains context information about FTP operations which are
+ * being executed, a cache of FTP control and data connections, and
+ * information about plugins which are being used. The specifics of the
+- * connection caching and plugins are found in the
++ * connection caching and plugins are found in the
+ * @ref globus_ftp_client_handleattr section of this manual.
+ *
+ * Once the handle is created, one may begin transferring files or doing
+@@ -68,7 +68,7 @@
+ * commands. All FTP operations may have a set of attributes, defined
+ * in the @ref globus_ftp_client_operationattr section, associated with
+ * them to tune various FTP parameters. The data structures and functions
+- * needed to restart a file transfer are described in the
++ * needed to restart a file transfer are described in the
+ * @ref globus_ftp_client_restart_marker section of this manual. For operations
+ * which require the user to send to or receive data from an FTP server
+ * the must call the functions in the @ref globus_ftp_client_data section
+@@ -167,18 +167,18 @@ typedef struct
+ /**
+ * @internal
+ * Must be GLOBUS_FTP_CLIENT_STREAM
+- */
+- globus_ftp_client_restart_type_t type;
++ */
++ globus_ftp_client_restart_type_t type;
+ /**
+ * @internal
+ * The offset of a binary file transfer.
+ */
+- globus_off_t offset;
++ globus_off_t offset;
+ /**
+ * @internal
+ * The offset of an ASCII file transfer.
+ */
+- globus_off_t ascii_offset;
++ globus_off_t ascii_offset;
+ }
+ globus_ftp_client_restart_stream_t;
+
+@@ -198,13 +198,13 @@ typedef struct
+ /**
+ * @internal
+ * Must be GLOBUS_FTP_CLIENT_RESTART_EXTENDED_BLOCK
+- */
+- globus_ftp_client_restart_type_t type;
++ */
++ globus_ftp_client_restart_type_t type;
+ /**
+ * @internal
+ * A fifo of globus_i_ftp_client_range_t byte range entries
+ */
+- globus_fifo_t ranges;
++ globus_fifo_t ranges;
+ }
+ globus_ftp_client_restart_extended_block_t;
+
+@@ -223,9 +223,9 @@ globus_ftp_client_restart_extended_block_t;
+ */
+ typedef union
+ {
+- globus_ftp_client_restart_type_t type;
+- globus_ftp_client_restart_stream_t stream;
+- globus_ftp_client_restart_extended_block_t extended_block;
++ globus_ftp_client_restart_type_t type;
++ globus_ftp_client_restart_stream_t stream;
++ globus_ftp_client_restart_extended_block_t extended_block;
+ }
+ globus_ftp_client_restart_marker_t;
+
+@@ -280,9 +280,9 @@ typedef struct globus_i_ftp_client_plugin_t * globus_ftp_client_plugin_t;
+ * or GLOBUS_SUCCESS, if the operation completed successfully.
+ */
+ typedef void (*globus_ftp_client_complete_callback_t) (
+- void * user_arg,
+- globus_ftp_client_handle_t * handle,
+- globus_object_t * error);
++ void * user_arg,
++ globus_ftp_client_handle_t * handle,
++ globus_object_t * error);
+
+ /**
+ * Data Callback.
+@@ -313,13 +313,13 @@ typedef void (*globus_ftp_client_complete_callback_t) (
+ * GLOBUS_TRUE for multiple callbacks.
+ */
+ typedef void (*globus_ftp_client_data_callback_t) (
+- void * user_arg,
+- globus_ftp_client_handle_t * handle,
+- globus_object_t * error,
+- globus_byte_t * buffer,
+- globus_size_t length,
+- globus_off_t offset,
+- globus_bool_t eof);
++ void * user_arg,
++ globus_ftp_client_handle_t * handle,
++ globus_object_t * error,
++ globus_byte_t * buffer,
++ globus_size_t length,
++ globus_off_t offset,
++ globus_bool_t eof);
+
+ /**
+ * @brief Operation Attributes.
+@@ -366,38 +366,38 @@ typedef struct
+ #ifndef DOXYGEN
+ globus_result_t
+ globus_ftp_client_restart_marker_init(
+- globus_ftp_client_restart_marker_t * marker);
++ globus_ftp_client_restart_marker_t * marker);
+
+ globus_result_t
+ globus_ftp_client_restart_marker_destroy(
+- globus_ftp_client_restart_marker_t * marker);
++ globus_ftp_client_restart_marker_t * marker);
+
+ globus_result_t
+ globus_ftp_client_restart_marker_copy(
+- globus_ftp_client_restart_marker_t * new_marker,
+- globus_ftp_client_restart_marker_t * marker);
++ globus_ftp_client_restart_marker_t * new_marker,
++ globus_ftp_client_restart_marker_t * marker);
+
+ globus_result_t
+ globus_ftp_client_restart_marker_insert_range(
+- globus_ftp_client_restart_marker_t * marker,
+- globus_off_t offset,
+- globus_off_t end_offset);
++ globus_ftp_client_restart_marker_t * marker,
++ globus_off_t offset,
++ globus_off_t end_offset);
+
+ globus_result_t
+ globus_ftp_client_restart_marker_set_offset(
+- globus_ftp_client_restart_marker_t * marker,
+- globus_off_t offset);
++ globus_ftp_client_restart_marker_t * marker,
++ globus_off_t offset);
+
+ globus_result_t
+ globus_ftp_client_restart_marker_set_ascii_offset(
+- globus_ftp_client_restart_marker_t * marker,
+- globus_off_t offset,
+- globus_off_t ascii_offset);
++ globus_ftp_client_restart_marker_t * marker,
++ globus_off_t offset,
++ globus_off_t ascii_offset);
+
+ globus_result_t
+ globus_ftp_client_restart_marker_get_total(
+- globus_ftp_client_restart_marker_t * marker,
+- globus_off_t * total_bytes);
++ globus_ftp_client_restart_marker_t * marker,
++ globus_off_t * total_bytes);
+
+ globus_result_t
+ globus_ftp_client_restart_marker_get_first_block(
+@@ -407,13 +407,13 @@ globus_ftp_client_restart_marker_get_first_block(
+
+ globus_result_t
+ globus_ftp_client_restart_marker_to_string(
+- globus_ftp_client_restart_marker_t * marker,
+- char ** marker_string);
++ globus_ftp_client_restart_marker_t * marker,
++ char ** marker_string);
+
+ globus_result_t
+ globus_ftp_client_restart_marker_from_string(
+- globus_ftp_client_restart_marker_t * marker,
+- const char * marker_string);
++ globus_ftp_client_restart_marker_t * marker,
++ const char * marker_string);
+ #endif
+
+ /**
+@@ -434,39 +434,39 @@ globus_ftp_client_restart_marker_from_string(
+ #ifndef DOXYGEN
+ globus_result_t
+ globus_ftp_client_handle_init(
+- globus_ftp_client_handle_t * handle,
+- globus_ftp_client_handleattr_t* attr);
++ globus_ftp_client_handle_t * handle,
++ globus_ftp_client_handleattr_t* attr);
+
+ globus_result_t
+ globus_ftp_client_handle_destroy(
+- globus_ftp_client_handle_t * handle);
++ globus_ftp_client_handle_t * handle);
+
+ globus_result_t
+ globus_ftp_client_handle_borrow_connection(
+- globus_ftp_client_handle_t * from_handle,
++ globus_ftp_client_handle_t * from_handle,
+ globus_bool_t from_is_source,
+- globus_ftp_client_handle_t * to_handle,
++ globus_ftp_client_handle_t * to_handle,
+ globus_bool_t to_is_source);
+
+ globus_result_t
+ globus_ftp_client_handle_cache_url_state(
+- globus_ftp_client_handle_t * handle,
+- const char * url);
++ globus_ftp_client_handle_t * handle,
++ const char * url);
+
+ globus_result_t
+ globus_ftp_client_handle_flush_url_state(
+- globus_ftp_client_handle_t * handle,
+- const char * url);
++ globus_ftp_client_handle_t * handle,
++ const char * url);
+
+ globus_result_t
+ globus_ftp_client_handle_set_user_pointer(
+- globus_ftp_client_handle_t * handle,
+- void * user_pointer);
++ globus_ftp_client_handle_t * handle,
++ void * user_pointer);
+
+ globus_result_t
+ globus_ftp_client_handle_get_user_pointer(
+- const globus_ftp_client_handle_t * handle,
+- void ** user_pointer);
++ const globus_ftp_client_handle_t * handle,
++ void ** user_pointer);
+
+ globus_result_t
+ globus_ftp_client_handle_get_restart_marker(
+@@ -475,13 +475,13 @@ globus_ftp_client_handle_get_restart_marker(
+
+ globus_result_t
+ globus_ftp_client_handle_add_plugin(
+- globus_ftp_client_handle_t * handle,
+- globus_ftp_client_plugin_t * plugin);
++ globus_ftp_client_handle_t * handle,
++ globus_ftp_client_plugin_t * plugin);
+
+ globus_result_t
+ globus_ftp_client_handle_remove_plugin(
+- globus_ftp_client_handle_t * handle,
+- globus_ftp_client_plugin_t * plugin);
++ globus_ftp_client_handle_t * handle,
++ globus_ftp_client_plugin_t * plugin);
+
+ #endif
+
+@@ -502,46 +502,46 @@ globus_ftp_client_handle_remove_plugin(
+ #ifndef DOXYGEN
+ globus_result_t
+ globus_ftp_client_handleattr_init(
+- globus_ftp_client_handleattr_t * attr);
++ globus_ftp_client_handleattr_t * attr);
+
+ globus_result_t
+ globus_ftp_client_handleattr_destroy(
+- globus_ftp_client_handleattr_t * attr);
++ globus_ftp_client_handleattr_t * attr);
+
+ globus_result_t
+ globus_ftp_client_handleattr_copy(
+- globus_ftp_client_handleattr_t * dest,
+- globus_ftp_client_handleattr_t * src);
++ globus_ftp_client_handleattr_t * dest,
++ globus_ftp_client_handleattr_t * src);
+
+ globus_result_t
+ globus_ftp_client_handleattr_add_cached_url(
+- globus_ftp_client_handleattr_t * attr,
+- const char * url);
++ globus_ftp_client_handleattr_t * attr,
++ const char * url);
+
+ globus_result_t
+ globus_ftp_client_handleattr_remove_cached_url(
+- globus_ftp_client_handleattr_t * attr,
+- const char * url);
++ globus_ftp_client_handleattr_t * attr,
++ const char * url);
+
+ globus_result_t
+ globus_ftp_client_handleattr_set_cache_all(
+- globus_ftp_client_handleattr_t * attr,
+- globus_bool_t cache_all);
++ globus_ftp_client_handleattr_t * attr,
++ globus_bool_t cache_all);
+
+ globus_result_t
+ globus_ftp_client_handleattr_get_cache_all(
+- const globus_ftp_client_handleattr_t * attr,
+- globus_bool_t * cache_all);
++ const globus_ftp_client_handleattr_t * attr,
++ globus_bool_t * cache_all);
+
+ globus_result_t
+ globus_ftp_client_handleattr_set_rfc1738_url(
+- globus_ftp_client_handleattr_t * attr,
+- globus_bool_t rfc1738_url);
++ globus_ftp_client_handleattr_t * attr,
++ globus_bool_t rfc1738_url);
+
+ globus_result_t
+ globus_ftp_client_handleattr_get_rfc1738_url(
+- const globus_ftp_client_handleattr_t * attr,
+- globus_bool_t * rfc1738_url);
++ const globus_ftp_client_handleattr_t * attr,
++ globus_bool_t * rfc1738_url);
+
+ typedef void (*globus_ftp_client_pipeline_callback_t)(
+ globus_ftp_client_handle_t * handle,
+@@ -565,18 +565,18 @@ globus_ftp_client_handleattr_get_pipeline(
+
+ globus_result_t
+ globus_ftp_client_handleattr_set_gridftp2(
+- globus_ftp_client_handleattr_t * attr,
+- globus_bool_t gridftp2);
++ globus_ftp_client_handleattr_t * attr,
++ globus_bool_t gridftp2);
+
+ globus_result_t
+ globus_ftp_client_handleattr_get_gridftp2(
+- const globus_ftp_client_handleattr_t * attr,
+- globus_bool_t * gridftp2);
++ const globus_ftp_client_handleattr_t * attr,
++ globus_bool_t * gridftp2);
+
+ globus_result_t
+ globus_ftp_client_handleattr_set_netlogger(
+- globus_ftp_client_handleattr_t * attr,
+- globus_netlogger_handle_t * nl_handle);
++ globus_ftp_client_handleattr_t * attr,
++ globus_netlogger_handle_t * nl_handle);
+
+ globus_result_t
+ globus_ftp_client_handleattr_set_clientinfo(
+@@ -601,13 +601,13 @@ globus_ftp_client_handleattr_set_netlogger_ftp_io(
+
+ globus_result_t
+ globus_ftp_client_handleattr_remove_plugin(
+- globus_ftp_client_handleattr_t * attr,
+- globus_ftp_client_plugin_t * plugin);
++ globus_ftp_client_handleattr_t * attr,
++ globus_ftp_client_plugin_t * plugin);
+
+ globus_result_t
+ globus_ftp_client_handleattr_add_plugin(
+- globus_ftp_client_handleattr_t * attr,
+- globus_ftp_client_plugin_t * plugin);
++ globus_ftp_client_handleattr_t * attr,
++ globus_ftp_client_plugin_t * plugin);
+ #endif
+
+ /**
+@@ -624,12 +624,12 @@ globus_ftp_client_handleattr_add_plugin(
+
+ globus_result_t
+ globus_ftp_client_chmod(
+- globus_ftp_client_handle_t * u_handle,
+- const char * url,
+- int mode,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * u_handle,
++ const char * url,
++ int mode,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_chgrp(
+@@ -660,63 +660,63 @@ globus_ftp_client_symlink(
+
+ globus_result_t
+ globus_ftp_client_cksm(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- char * cksm,
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ char * cksm,
+ globus_off_t offset,
+ globus_off_t length,
+- const char * algorithm,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ const char * algorithm,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_delete(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_mkdir(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_rmdir(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_list(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_verbose_list(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_machine_list(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_recursive_list(
+@@ -728,106 +728,106 @@ globus_ftp_client_recursive_list(
+
+ globus_result_t
+ globus_ftp_client_mlst(
+- globus_ftp_client_handle_t * u_handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_byte_t ** mlst_buffer,
++ globus_ftp_client_handle_t * u_handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_byte_t ** mlst_buffer,
+ globus_size_t * mlst_buffer_length,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_cwd(
+- globus_ftp_client_handle_t * u_handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_byte_t ** cwd_buffer,
++ globus_ftp_client_handle_t * u_handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_byte_t ** cwd_buffer,
+ globus_size_t * cwd_buffer_length,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_stat(
+- globus_ftp_client_handle_t * u_handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_byte_t ** stat_buffer,
++ globus_ftp_client_handle_t * u_handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_byte_t ** stat_buffer,
+ globus_size_t * stat_buffer_length,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_move(
+- globus_ftp_client_handle_t * handle,
+- const char * source_url,
+- const char * dest_url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * source_url,
++ const char * dest_url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_get(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_restart_marker_t * restart,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_restart_marker_t * restart,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_put(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_restart_marker_t * restart,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_restart_marker_t * restart,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_third_party_transfer(
+- globus_ftp_client_handle_t * handle,
+- const char * source_url,
+- globus_ftp_client_operationattr_t * source_attr,
+- const char * dest_url,
+- globus_ftp_client_operationattr_t * dest_attr,
+- globus_ftp_client_restart_marker_t * restart,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * source_url,
++ globus_ftp_client_operationattr_t * source_attr,
++ const char * dest_url,
++ globus_ftp_client_operationattr_t * dest_attr,
++ globus_ftp_client_restart_marker_t * restart,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_partial_get(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_restart_marker_t * restart,
+- globus_off_t partial_offset,
+- globus_off_t partial_end_offset,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_restart_marker_t * restart,
++ globus_off_t partial_offset,
++ globus_off_t partial_end_offset,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_partial_put(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_restart_marker_t * restart,
+- globus_off_t partial_offset,
+- globus_off_t partial_end_offset,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_restart_marker_t * restart,
++ globus_off_t partial_offset,
++ globus_off_t partial_end_offset,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_partial_third_party_transfer(
+- globus_ftp_client_handle_t * handle,
+- const char * source_url,
+- globus_ftp_client_operationattr_t * source_attr,
+- const char * dest_url,
+- globus_ftp_client_operationattr_t * dest_attr,
+- globus_ftp_client_restart_marker_t * restart,
+- globus_off_t partial_offset,
+- globus_off_t partial_end_offset,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * source_url,
++ globus_ftp_client_operationattr_t * source_attr,
++ const char * dest_url,
++ globus_ftp_client_operationattr_t * dest_attr,
++ globus_ftp_client_restart_marker_t * restart,
++ globus_off_t partial_offset,
++ globus_off_t partial_end_offset,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_extended_get(
+@@ -864,33 +864,33 @@ globus_ftp_client_extended_third_party_transfer(
+
+ globus_result_t
+ globus_ftp_client_abort(
+- globus_ftp_client_handle_t * handle);
++ globus_ftp_client_handle_t * handle);
+
+ globus_result_t
+ globus_ftp_client_modification_time(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_abstime_t * modification_time,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_abstime_t * modification_time,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_size(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_off_t * size,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_off_t * size,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_exists(
+- globus_ftp_client_handle_t * handle,
+- const char * url,
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_client_complete_callback_t complete_callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ const char * url,
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_complete_callback_t complete_callback,
++ void * callback_arg);
+ #endif
+
+ /**
+@@ -905,21 +905,21 @@ globus_ftp_client_exists(
+ #ifndef DOXYGEN
+ globus_result_t
+ globus_ftp_client_operationattr_init(
+- globus_ftp_client_operationattr_t * attr);
++ globus_ftp_client_operationattr_t * attr);
+
+ globus_result_t
+ globus_ftp_client_operationattr_destroy(
+- globus_ftp_client_operationattr_t * attr);
++ globus_ftp_client_operationattr_t * attr);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_parallelism(
+- globus_ftp_client_operationattr_t * attr,
+- const globus_ftp_control_parallelism_t * parallelism);
++ globus_ftp_client_operationattr_t * attr,
++ const globus_ftp_control_parallelism_t * parallelism);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_parallelism(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_parallelism_t * parallelism);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_parallelism_t * parallelism);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_storage_module(
+@@ -967,202 +967,202 @@ globus_ftp_client_operationattr_get_authz_assert(
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_striped(
+- globus_ftp_client_operationattr_t * attr,
+- globus_bool_t striped);
++ globus_ftp_client_operationattr_t * attr,
++ globus_bool_t striped);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_striped(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_bool_t * striped);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_bool_t * striped);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_layout(
+- globus_ftp_client_operationattr_t * attr,
+- const globus_ftp_control_layout_t * layout);
++ globus_ftp_client_operationattr_t * attr,
++ const globus_ftp_control_layout_t * layout);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_layout(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_layout_t * layout);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_layout_t * layout);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_tcp_buffer(
+- globus_ftp_client_operationattr_t * attr,
+- const globus_ftp_control_tcpbuffer_t * tcp_buffer);
++ globus_ftp_client_operationattr_t * attr,
++ const globus_ftp_control_tcpbuffer_t * tcp_buffer);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_tcp_buffer(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_tcpbuffer_t * tcp_buffer);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_tcpbuffer_t * tcp_buffer);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_type(
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_type_t type);
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_type_t type);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_type(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_type_t * type);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_type_t * type);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_mode(
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_mode_t mode);
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_mode_t mode);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_mode(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_mode_t * mode);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_mode_t * mode);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_list_uses_data_mode(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_bool_t list_uses_data_mode);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_bool_t list_uses_data_mode);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_list_uses_data_mode(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_bool_t * list_uses_data_mode);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_bool_t * list_uses_data_mode);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_delayed_pasv(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_bool_t delayed_pasv);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_bool_t delayed_pasv);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_delayed_pasv(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_bool_t * delayed_pasv);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_bool_t * delayed_pasv);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_dcau(
+- globus_ftp_client_operationattr_t * attr,
+- const globus_ftp_control_dcau_t * dcau);
++ globus_ftp_client_operationattr_t * attr,
++ const globus_ftp_control_dcau_t * dcau);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_dcau(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_dcau_t * dcau);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_dcau_t * dcau);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_data_protection(
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_protection_t protection);
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_protection_t protection);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_data_protection(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_protection_t * protection);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_protection_t * protection);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_control_protection(
+- globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_protection_t protection);
++ globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_protection_t protection);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_control_protection(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_ftp_control_protection_t * protection);
+-
++ const globus_ftp_client_operationattr_t * attr,
++ globus_ftp_control_protection_t * protection);
++
+ globus_result_t
+ globus_ftp_client_operationattr_set_data_security(
+- globus_ftp_client_operationattr_t * attr,
++ globus_ftp_client_operationattr_t * attr,
+ int type,
+ void * credential);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_data_security(
+- const globus_ftp_client_operationattr_t * attr,
++ const globus_ftp_client_operationattr_t * attr,
+ int * type,
+ void ** credential);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_resume_third_party_transfer(
+- globus_ftp_client_operationattr_t * attr,
+- globus_bool_t resume);
++ globus_ftp_client_operationattr_t * attr,
++ globus_bool_t resume);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_resume_third_party_transfer(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_bool_t * resume);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_bool_t * resume);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_authorization(
+- globus_ftp_client_operationattr_t * attr,
+- gss_cred_id_t credential,
+- const char * user,
+- const char * password,
+- const char * account,
+- const char * subject);
++ globus_ftp_client_operationattr_t * attr,
++ gss_cred_id_t credential,
++ const char * user,
++ const char * password,
++ const char * account,
++ const char * subject);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_authorization(
+- const globus_ftp_client_operationattr_t * attr,
+- gss_cred_id_t * credential,
+- char ** user,
+- char ** password,
+- char ** account,
+- char ** subject);
++ const globus_ftp_client_operationattr_t * attr,
++ gss_cred_id_t * credential,
++ char ** user,
++ char ** password,
++ char ** account,
++ char ** subject);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_append(
+- globus_ftp_client_operationattr_t * attr,
+- globus_bool_t append);
++ globus_ftp_client_operationattr_t * attr,
++ globus_bool_t append);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_append(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_bool_t * append);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_bool_t * append);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_read_all(
+- globus_ftp_client_operationattr_t * attr,
+- globus_bool_t read_all,
+- globus_ftp_client_data_callback_t intermediate_callbacks,
+- void * intermediate_callback_arg);
++ globus_ftp_client_operationattr_t * attr,
++ globus_bool_t read_all,
++ globus_ftp_client_data_callback_t intermediate_callbacks,
++ void * intermediate_callback_arg);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_read_all(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_bool_t * read_all,
+- globus_ftp_client_data_callback_t * intermediate_callbacks,
+- void ** intermediate_callback_arg);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_bool_t * read_all,
++ globus_ftp_client_data_callback_t * intermediate_callbacks,
++ void ** intermediate_callback_arg);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_allow_ipv6(
+- globus_ftp_client_operationattr_t * attr,
+- globus_bool_t allow);
++ globus_ftp_client_operationattr_t * attr,
++ globus_bool_t allow);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_allow_ipv6(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_bool_t * allow);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_bool_t * allow);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_allocate(
+- globus_ftp_client_operationattr_t * attr,
+- const globus_off_t allocated_size);
+-
++ globus_ftp_client_operationattr_t * attr,
++ const globus_off_t allocated_size);
++
+ globus_result_t
+ globus_ftp_client_operationattr_get_allocate(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_off_t * allocated_size);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_off_t * allocated_size);
+
+ globus_result_t
+ globus_ftp_client_operationattr_copy(
+- globus_ftp_client_operationattr_t * dst,
+- const globus_ftp_client_operationattr_t * src);
++ globus_ftp_client_operationattr_t * dst,
++ const globus_ftp_client_operationattr_t * src);
+
+ globus_result_t
+ globus_ftp_client_operationattr_set_rfc1738_url(
+- globus_ftp_client_operationattr_t * attr,
+- globus_bool_t rfc1738_url);
++ globus_ftp_client_operationattr_t * attr,
++ globus_bool_t rfc1738_url);
+
+ globus_result_t
+ globus_ftp_client_operationattr_get_rfc1738_url(
+- const globus_ftp_client_operationattr_t * attr,
+- globus_bool_t * rfc1738_url);
++ const globus_ftp_client_operationattr_t * attr,
++ globus_bool_t * rfc1738_url);
+ #endif
+
+ /**
+@@ -1174,7 +1174,7 @@ globus_ftp_client_operationattr_get_rfc1738_url(
+ * for reading or writing data to an FTP server. These operations are
+ * globus_ftp_client_get(), globus_ftp_client_partial_get(),
+ * globus_ftp_client_put(), globus_ftp_client_partial_put(),
+- * globus_ftp_client_list(), globus_ftp_client_machine_list(),
++ * globus_ftp_client_list(), globus_ftp_client_machine_list(),
+ * globus_ftp_client_recursive_list(), and globus_ftp_client_verbose_list().
+ *
+ * When doing these operations, the user must pass data buffers
+@@ -1190,21 +1190,21 @@ globus_ftp_client_operationattr_get_rfc1738_url(
+ #ifndef DOXYGEN
+ globus_result_t
+ globus_ftp_client_register_read(
+- globus_ftp_client_handle_t * handle,
+- globus_byte_t * buffer,
+- globus_size_t buffer_length,
+- globus_ftp_client_data_callback_t callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ globus_byte_t * buffer,
++ globus_size_t buffer_length,
++ globus_ftp_client_data_callback_t callback,
++ void * callback_arg);
+
+ globus_result_t
+ globus_ftp_client_register_write(
+- globus_ftp_client_handle_t * handle,
+- globus_byte_t * buffer,
+- globus_size_t buffer_length,
+- globus_off_t offset,
+- globus_bool_t eof,
+- globus_ftp_client_data_callback_t callback,
+- void * callback_arg);
++ globus_ftp_client_handle_t * handle,
++ globus_byte_t * buffer,
++ globus_size_t buffer_length,
++ globus_off_t offset,
++ globus_bool_t eof,
++ globus_ftp_client_data_callback_t callback,
++ void * callback_arg);
+ #endif
+
+ /**
+@@ -1212,7 +1212,7 @@ globus_ftp_client_register_write(
+ * @ingroup globus_ftp_client_operations
+ * FALSE and TRUE are known to be fact that a feature does or does not exist
+ * MAYBE means that the feature may exist
+- */
++ */
+ typedef enum
+ {
+ GLOBUS_FTP_CLIENT_FALSE = GLOBUS_FALSE,
+@@ -1224,7 +1224,7 @@ globus_ftp_client_tristate_t;
+ /**
+ * Types of features
+ * @ingroup globus_ftp_client_operations
+- */
++ */
+ typedef enum
+ {
+ /* Buffer-size setting commands; keep these at the beginning of
+@@ -1239,7 +1239,7 @@ typedef enum
+ GLOBUS_FTP_CLIENT_FEATURE_BUFSIZE,
+ GLOBUS_FTP_CLIENT_FEATURE_SBUF,
+ GLOBUS_FTP_CLIENT_FEATURE_ABUF,
+-
++
+ GLOBUS_FTP_CLIENT_FEATURE_REST_STREAM,
+ GLOBUS_FTP_CLIENT_FEATURE_PARALLELISM,
+ GLOBUS_FTP_CLIENT_FEATURE_DCAU,
+@@ -1278,7 +1278,7 @@ typedef struct globus_i_ftp_client_features_s * globus_ftp_client_features_t;
+
+ globus_result_t
+ globus_ftp_client_feat(
+- globus_ftp_client_handle_t * u_handle,
++ globus_ftp_client_handle_t * u_handle,
+ char * url,
+ globus_ftp_client_operationattr_t * attr,
+ globus_ftp_client_features_t * u_features,
+@@ -1300,10 +1300,10 @@ globus_result_t globus_ftp_client_features_destroy(
+ * returns the FTP response code for GLOBUS_ERROR_TYPE_FTP errors.
+ * this function will search the entire chain for the correct type error and
+ * return the code stored in that error.
+- *
++ *
+ * @param error
+ * an error object or chain with type GLOBUS_ERROR_TYPE_FTP
+- *
++ *
+ * @return
+ * the associated FTP response code if found, 0 otherwise.
+ */
+@@ -1313,7 +1313,7 @@ globus_error_ftp_error_get_code(
+
+ #define GLOBUS_ERROR_TYPE_FTP (&GLOBUS_ERROR_TYPE_FTP_DEFINITION)
+ extern const globus_object_type_t GLOBUS_ERROR_TYPE_FTP_DEFINITION;
+-
++
+ #endif
+ EXTERN_C_END
+
+diff --git a/gridftp/client/source/globus_ftp_client_state.c b/gridftp/client/source/globus_ftp_client_state.c
+index f00670704..cf62dce0c 100644
+--- a/gridftp/client/source/globus_ftp_client_state.c
++++ b/gridftp/client/source/globus_ftp_client_state.c
+@@ -23,8 +23,8 @@
+
+ #include "globus_i_ftp_client.h"
+
+-#include <string.h> /* strstr(), strncmp() */
+-#include <ctype.h> /* isupper() */
++#include <string.h> /* strstr(), strncmp() */
++#include <ctype.h> /* isupper() */
+ #include <time.h>
+
+ #define CRLF "\r\n"
+@@ -33,77 +33,77 @@
+ static
+ globus_object_t *
+ globus_l_ftp_client_parse_site_help(
+- globus_i_ftp_client_target_t * target,
+- globus_ftp_control_response_t * response);
++ globus_i_ftp_client_target_t * target,
++ globus_ftp_control_response_t * response);
+
+ static
+ void
+ globus_l_ftp_client_parse_feat(
+- globus_i_ftp_client_target_t * target,
+- globus_ftp_control_response_t * response);
++ globus_i_ftp_client_target_t * target,
++ globus_ftp_control_response_t * response);
+
+ static
+ void
+ globus_l_ftp_client_parse_pasv(
+ globus_ftp_control_handle_t * handle,
+- globus_ftp_control_response_t * response,
+- globus_ftp_control_host_port_t ** host_port,
+- int * num_pasv_addresses);
++ globus_ftp_control_response_t * response,
++ globus_ftp_control_host_port_t ** host_port,
++ int * num_pasv_addresses);
+
+ static
+ void
+ globus_l_ftp_client_parse_restart_marker(
+- globus_i_ftp_client_handle_t * handle,
+- globus_ftp_control_response_t * response);
++ globus_i_ftp_client_handle_t * handle,
++ globus_ftp_control_response_t * response);
+
+ static
+ char *
+ globus_l_ftp_client_parallelism_string(
+- globus_i_ftp_client_target_t * target);
++ globus_i_ftp_client_target_t * target);
+
+ static
+ char *
+ globus_l_ftp_client_layout_string(
+- globus_i_ftp_client_target_t * target);
++ globus_i_ftp_client_target_t * target);
+
+ static
+ void
+ globus_l_ftp_client_connection_error(
+- globus_i_ftp_client_handle_t * client_handle,
+- globus_i_ftp_client_target_t * target,
+- globus_object_t * error,
+- globus_ftp_control_response_t * response);
++ globus_i_ftp_client_handle_t * client_handle,
++ globus_i_ftp_client_target_t * target,
++ globus_object_t * error,
++ globus_ftp_control_response_t * response);
+
+ static
+ const char *
+ globus_l_ftp_client_guess_buffer_command(
+- globus_i_ftp_client_handle_t * handle,
+- globus_i_ftp_client_target_t * target);
++ globus_i_ftp_client_handle_t * handle,
++ globus_i_ftp_client_target_t * target);
+
+ static
+ void
+ globus_l_ftp_client_update_buffer_feature(
+- globus_i_ftp_client_handle_t * handle,
+- globus_i_ftp_client_target_t * target,
+- globus_ftp_client_tristate_t ok);
++ globus_i_ftp_client_handle_t * handle,
++ globus_i_ftp_client_target_t * target,
++ globus_ftp_client_tristate_t ok);
+
+ static
+ globus_bool_t
+ globus_l_ftp_client_can_cache_data_connection(
+- globus_i_ftp_client_target_t * target);
++ globus_i_ftp_client_target_t * target);
+
+ static
+ void
+ globus_l_ftp_client_data_force_close_callback(
+- void * callback_arg,
+- globus_ftp_control_handle_t * control_handle,
+- globus_object_t * error);
++ void * callback_arg,
++ globus_ftp_control_handle_t * control_handle,
++ globus_object_t * error);
+
+ static
+ void
+ globus_l_ftp_client_parse_mdtm(
+- globus_i_ftp_client_handle_t * client_handle,
+- globus_ftp_control_response_t * response);
++ globus_i_ftp_client_handle_t * client_handle,
++ globus_ftp_control_response_t * response);
+
+ static
+ void
+@@ -114,20 +114,20 @@ globus_l_ftp_client_parse_cksm(
+ static
+ void
+ globus_l_ftp_client_parse_mlst(
+- globus_i_ftp_client_handle_t * client_handle,
+- globus_ftp_control_response_t * response);
++ globus_i_ftp_client_handle_t * client_handle,
++ globus_ftp_control_response_t * response);
+
+ static
+ void
+ globus_l_ftp_client_parse_cwd(
+- globus_i_ftp_client_handle_t * client_handle,
+- globus_ftp_control_response_t * response);
++ globus_i_ftp_client_handle_t * client_handle,
++ globus_ftp_control_response_t * response);
+
+ static
+ void
+ globus_l_ftp_client_parse_stat(
+- globus_i_ftp_client_handle_t * client_handle,
+- globus_ftp_control_response_t * response);
++ globus_i_ftp_client_handle_t * client_handle,
++ globus_ftp_control_response_t * response);
+
+ static
+ globus_result_t
+@@ -164,27 +164,27 @@ globus_l_ftp_client_pp_xfer_src_add(
+ static
+ globus_result_t
+ globus_l_ftp_client_use_gridftp2_getput(
+- globus_i_ftp_client_target_t * target,
++ globus_i_ftp_client_target_t * target,
+ globus_bool_t * getput);
+
+ static
+ globus_result_t
+ globus_l_ftp_client_send_get(
+- globus_i_ftp_client_target_t * target,
++ globus_i_ftp_client_target_t * target,
+ char * pathname,
+ globus_bool_t pasv);
+
+ static
+ globus_result_t
+ globus_l_ftp_client_send_put(
+- globus_i_ftp_client_target_t * target,
++ globus_i_ftp_client_target_t * target,
+ char * pathname,
+ globus_bool_t pasv);
+
+ /**
+ * Buffer size command applicability information.
+ * @internal
+- *
++ *
+ * This structure is associated with each of the TCP buffer
+ * setting commands to help the client library decide whether
+ * a command is compatible with the operation being done.
+@@ -193,17 +193,17 @@ globus_l_ftp_client_send_put(
+ * @see globus_l_ftp_client_buffer_cmd_info,
+ * globus_l_ftp_client_guess_buffer_command()
+ */
+-typedef struct
++typedef struct
+ {
+ /**
+ * The command string. It should match the server's HELP response if
+ * applicable.
+ */
+- char * string;
++ char * string;
+ /** True if this command is usable for STOR */
+- globus_bool_t stor_ok;
++ globus_bool_t stor_ok;
+ /** True if this command is usable for RETR */
+- globus_bool_t retr_ok;
++ globus_bool_t retr_ok;
+ }
+ globus_l_ftp_client_buffer_cmd_info_t;
+
+@@ -250,7 +250,7 @@ globus_l_ftp_client_buffer_cmd_info_t globus_l_ftp_client_buffer_cmd_info[] =
+ * The control handle associated with this response.
+ * @param error
+ * A Globus error object or the value GLOBUS_SUCCESS if the
+- * response was received and parsed without error.
++ * response was received and parsed without error.
+ * @param response
+ * The parsed response string from the server. This is
+ * interpreted based on the command currently being processed
+@@ -258,37 +258,37 @@ globus_l_ftp_client_buffer_cmd_info_t globus_l_ftp_client_buffer_cmd_info[] =
+ */
+ void
+ globus_i_ftp_client_response_callback(
+- void * user_arg,
+- globus_ftp_control_handle_t * handle,
+- globus_object_t * in_error,
+- globus_ftp_control_response_t * response)
++ void * user_arg,
++ globus_ftp_control_handle_t * handle,
++ globus_object_t * in_error,
++ globus_ftp_control_response_t * response)
+ {
+- globus_i_ftp_client_target_t * target;
++ globus_i_ftp_client_target_t * target;
+ globus_object_t * error;
+- globus_i_ftp_client_handle_t * client_handle;
+- globus_result_t result;
+- globus_bool_t registered=GLOBUS_FALSE;
+- char * tmpstr = GLOBUS_NULL;
+- char * argstr = GLOBUS_NULL;
+- const char * buffer_cmd = GLOBUS_NULL;
+- char * parallelism_opt = GLOBUS_NULL;
+- char * layout_opt = GLOBUS_NULL;
+- char * list_str = GLOBUS_NULL;
+- unsigned long pbsz = 0;
+- int rc, oldrc, i;
++ globus_i_ftp_client_handle_t * client_handle;
++ globus_result_t result;
++ globus_bool_t registered=GLOBUS_FALSE;
++ char * tmpstr = GLOBUS_NULL;
++ char * argstr = GLOBUS_NULL;
++ const char * buffer_cmd = GLOBUS_NULL;
++ char * parallelism_opt = GLOBUS_NULL;
++ char * layout_opt = GLOBUS_NULL;
++ char * list_str = GLOBUS_NULL;
++ unsigned long pbsz = 0;
++ int rc, oldrc, i;
+ char * pathname;
+- globus_bool_t gridftp2_getput;
++ globus_bool_t gridftp2_getput;
+ GlobusFuncName(globus_i_ftp_client_response_callback);
+-
++
+ target = (globus_i_ftp_client_target_t *) user_arg;
+ client_handle = target->owner;
+-
+- globus_i_ftp_client_debug_printf(1, (stderr,
++
++ globus_i_ftp_client_debug_printf(1, (stderr,
+ "globus_i_ftp_client_response_callback() entering\n"));
+ globus_i_ftp_client_debug_states(2, client_handle);
+
+ globus_assert(! GLOBUS_I_FTP_CLIENT_BAD_MAGIC(&client_handle));
+-
++
+ if(in_error)
+ {
+ error = globus_object_copy(in_error);
+@@ -297,16 +297,16 @@ globus_i_ftp_client_response_callback(
+ {
+ error = GLOBUS_NULL;
+ }
+-
++
+ globus_i_ftp_client_handle_lock(client_handle);
+-
+-
+-
++
++
++
+ if(response && (response->code == 125 || response->code == 150) &&
+ client_handle->attr.pipeline_callback)
+- {
++ {
+ globus_i_ftp_client_url_ent_t * url_ent = NULL;
+-
++
+ if(target == client_handle->source)
+ {
+ if(!globus_fifo_empty(&client_handle->src_response_pending_queue))
+@@ -341,10 +341,10 @@ globus_i_ftp_client_response_callback(
+ client_handle->dest_url = globus_libc_strdup(url_ent->dest_url);
+ }
+ }
+- }
+-
+-
+-
++ }
++
++
++
+ if(response)
+ {
+ globus_i_ftp_client_plugin_notify_response(
+@@ -358,8 +358,8 @@ globus_i_ftp_client_response_callback(
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART)
+ {
+- goto finish;
+- }
++ goto finish;
++ }
+
+ /* The behaviour of several states depends on whether to use the
+ * GFD.47 (a.k.a GridFTP 2) GETPUT extension.
+@@ -373,579 +373,163 @@ globus_i_ftp_client_response_callback(
+ /* This redo is used to make a second run through the state
+ * machine, which a few states will require.
+ */
+-
++
+ pathname = target->url.url_path ? target->url.url_path : "/";
+-
++
+ redo:
+ switch(target->state)
+ {
+ case GLOBUS_FTP_CLIENT_TARGET_CONNECT:
+- globus_assert(
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- /* Successfully connected. Begin authentication */
+- target->state = GLOBUS_FTP_CLIENT_TARGET_AUTHENTICATE;
+-
+- globus_i_ftp_client_plugin_notify_authenticate(
+- client_handle,
+- target->url_string,
+- &target->auth_info);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT
+- ||
+- client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+-
+- result =
+- globus_ftp_control_authenticate(
+- handle,
+- &target->attr->auth_info,
+- target->url.scheme_type==GLOBUS_URL_SCHEME_GSIFTP,
+- globus_i_ftp_client_response_callback,
+- user_arg);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- /*
+- * If authentication fails without registration, notify the
+- * plugins, then deal with the fault.
+- */
+- goto result_fault;
+-
+- }
+- }
+- else if(error || response->response_class
+- != GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY)
+- {
+- /* Connection failed, deal with it (connect_error
+- * unlocks the handle)
+- */
+- if(!error && response && response->response_buffer)
+- {
+- error = GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
+- }
+- goto notify_fault;
+- }
+- /* Else, (success + 1yz response), which just means: server will
+- * get to you in a moment)
+- */
+- break;
+- case GLOBUS_FTP_CLIENT_TARGET_AUTHENTICATE:
+- globus_assert(
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+-# if BUILD_DEBUG
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_FAULT;
+- }
+-# else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_HELP;
+- }
+-# endif
+- goto redo;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
+- break;
+-# if BUILD_DEBUG
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_FAULT:
+- globus_assert(
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SITE_FAULT;
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
+-
+- tmpstr = getenv("GLOBUS_FTP_CLIENT_FAULT_MODE");
+-
+- if(! tmpstr)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_HELP;
+-
+- goto redo;
+- }
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "SITE FAULT %s" CRLF,
+- tmpstr);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT
+- ||
+- client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "SITE FAULT %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- tmpstr);
+-
+- globus_libc_unsetenv("GLOBUS_FTP_CLIENT_FAULT_MODE");
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ globus_assert(
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+
+- case GLOBUS_FTP_CLIENT_TARGET_SITE_FAULT:
+- globus_assert(
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_HELP;
+- goto redo;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
+- break;
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ /* Successfully connected. Begin authentication */
++ target->state = GLOBUS_FTP_CLIENT_TARGET_AUTHENTICATE;
+
+-# endif
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_HELP:
+- globus_assert(
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
++ globus_i_ftp_client_plugin_notify_authenticate(
++ client_handle,
++ target->url_string,
++ &target->auth_info);
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SITE_HELP;
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
+-
+- target->features = globus_i_ftp_client_features_init();
+- if(!target->features)
+- {
+- error = GLOBUS_I_FTP_CLIENT_ERROR_OUT_OF_MEMORY();
+- goto notify_fault;
+- }
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "SITE HELP" CRLF);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT
+- ||
+- client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "SITE HELP" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
+- case GLOBUS_FTP_CLIENT_TARGET_SITE_HELP:
+- globus_assert(
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+-
+- if(error != GLOBUS_SUCCESS)
+- {
+- goto notify_fault;
+- }
+- else if(response->response_class==GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- /*
+- * Parse the reply to find out what is implemented by this
+- * server
+- */
+- error = globus_l_ftp_client_parse_site_help(target, response);
+- if(error != GLOBUS_SUCCESS)
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+ {
+- goto notify_fault;
++ break;
+ }
+- }
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_FEAT;
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "FEAT" CRLF);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+- globus_assert(
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "FEAT" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg);
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
+- case GLOBUS_FTP_CLIENT_TARGET_FEAT:
+- globus_assert(
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+-
+- if(error != GLOBUS_SUCCESS)
+- {
+- goto notify_fault;
+- }
+- if(response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- /*
+- * Parse the reply to find out what is implemented by this
+- * server
+- */
+- globus_l_ftp_client_parse_feat(target, response);
+- }
+-
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_CLIENTINFO,
+- GLOBUS_FTP_CLIENT_MAYBE);
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CLIENTINFO;
+
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT)
+- {
+- client_handle->state =
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION;
+- }
+- else
+- {
+- client_handle->state =
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION;
+- }
+- goto redo;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_CLIENTINFO:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_CLIENTINFO;
++ globus_assert(
++ client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT
++ ||
++ client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+
+- if(globus_i_ftp_client_feature_get(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_CLIENTINFO) == GLOBUS_FALSE)
+- {
+- goto skip_clientinfo;
+- }
++ result =
++ globus_ftp_control_authenticate(
++ handle,
++ &target->attr->auth_info,
++ target->url.scheme_type==GLOBUS_URL_SCHEME_GSIFTP,
++ globus_i_ftp_client_response_callback,
++ user_arg);
+
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
+-
+- argstr = globus_common_create_string("scheme=%s;", target->url.scheme);
+- if(client_handle->attr.clientinfo_app_name)
+- {
+- tmpstr = globus_common_create_string(
+- "%sappname=\"%s\";", argstr, client_handle->attr.clientinfo_app_name);
+- globus_free(argstr);
+- argstr = tmpstr;
+- }
+- if(client_handle->attr.clientinfo_app_ver)
+- {
+- tmpstr = globus_common_create_string(
+- "%sappver=\"%s\";", argstr, client_handle->attr.clientinfo_app_ver);
+- globus_free(argstr);
+- argstr = tmpstr;
++ if(result != GLOBUS_SUCCESS)
++ {
++ /*
++ * If authentication fails without registration, notify the
++ * plugins, then deal with the fault.
++ */
++ goto result_fault;
++
++ }
+ }
+- if(client_handle->attr.clientinfo_other)
++ else if(error || response->response_class
++ != GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY)
+ {
+- tmpstr = globus_common_create_string(
+- "%s%s", argstr, client_handle->attr.clientinfo_other);
+- globus_free(argstr);
+- argstr = tmpstr;
++ /* Connection failed, deal with it (connect_error
++ * unlocks the handle)
++ */
++ if(!error && response && response->response_buffer)
++ {
++ error = GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
++ }
++ goto notify_fault;
+ }
++ /* Else, (success + 1yz response), which just means: server will
++ * get to you in a moment)
++ */
++ break;
++ case GLOBUS_FTP_CLIENT_TARGET_AUTHENTICATE:
++ globus_assert(
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+
+- if(target->attr->clientinfo_argstr)
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+ {
+- globus_free(target->attr->clientinfo_argstr);
+- }
+- target->attr->clientinfo_argstr = argstr;
+-
+- if(target->clientinfo_argstr &&
+- strcmp(target->clientinfo_argstr,
+- target->attr->clientinfo_argstr) == 0)
+- {
+- goto skip_clientinfo;
+- }
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "SITE CLIENTINFO %s",
+- target->attr->clientinfo_argstr);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION
+- ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "SITE CLIENTINFO %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- target->attr->clientinfo_argstr);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- break;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_CLIENTINFO:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- if(target->clientinfo_argstr)
+- {
+- globus_free(target->clientinfo_argstr);
+- }
+- target->clientinfo_argstr =
+- globus_libc_strdup(target->attr->clientinfo_argstr);
+- }
+- else if (response)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_CLIENTINFO,
+- GLOBUS_FTP_CLIENT_FALSE);
+- response->response_class = GLOBUS_FTP_POSITIVE_COMPLETION_REPLY;
+- globus_object_free(error);
+- error = NULL;
++# if BUILD_DEBUG
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_FAULT;
++ }
++# else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_HELP;
++ }
++# endif
++ goto redo;
+ }
+ else
+ {
+- goto notify_fault;
+- }
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+
+- skip_clientinfo:
+- if (client_handle->op == GLOBUS_FTP_CLIENT_FEAT)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_TYPE;
++ goto notify_fault;
+ }
+- goto redo;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_TYPE:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_TYPE;
+-
+- if(target->attr->type == target->type)
+- {
+- goto skip_type;
+- }
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "TYPE %c",
+- (char) target->attr->type);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION
+- ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "TYPE %c" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- (char) target->attr->type);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- break;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_TYPE:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- target->type = target->attr->type;
+- result = globus_ftp_control_local_type(target->control_handle,
+- target->type,
+- 8);
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
++ break;
++# if BUILD_DEBUG
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_FAULT:
++ globus_assert(
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+
+- skip_type:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_AUTHZ_ASSERT;
+- goto redo;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SITE_FAULT;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_AUTHZ_ASSERT:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_AUTHZ_ASSERT;
++ tmpstr = getenv("GLOBUS_FTP_CLIENT_FAULT_MODE");
+
+- if (!target->attr->authz_assert)
+- {
+- goto skip_authz_assert;
+- }
+- if(target->authz_assert &&
+- !strcmp(target->attr->authz_assert, target->authz_assert) &&
+- target->attr->cache_authz_assert)
++ if(! tmpstr)
+ {
+- goto skip_authz_assert;
+- }
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_HELP;
+
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_MISC;
++ goto redo;
++ }
+
+ globus_i_ftp_client_plugin_notify_command(
+ client_handle,
+ target->url_string,
+ target->mask,
+- "SITE AUTHZ_ASSERT %s",
+- target->attr->authz_assert);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ "SITE FAULT %s" CRLF,
++ tmpstr);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
++ {
+ break;
+ }
++
+ globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION
++ client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT
+ ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "SITE AUTHZ_ASSERT %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- target->attr->authz_assert);
+-
++ client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "SITE FAULT %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ tmpstr);
++
++ globus_libc_unsetenv("GLOBUS_FTP_CLIENT_FAULT_MODE");
++
+ if(result != GLOBUS_SUCCESS)
+- {
++ {
+ goto result_fault;
+ }
+-
+ break;
+
+- case GLOBUS_FTP_CLIENT_TARGET_AUTHZ_ASSERT:
++ case GLOBUS_FTP_CLIENT_TARGET_SITE_FAULT:
+ globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+
+ if((!error) &&
+ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+ {
+- if (target->authz_assert)
+- {
+- if (strcmp(target->authz_assert, target->attr->authz_assert))
+- {
+- globus_free(target->authz_assert);
+- target->authz_assert = globus_libc_strdup(
+- target->attr->authz_assert);
+- }
+- }
+- else
+- {
+- target->authz_assert =
+- globus_libc_strdup(target->attr->authz_assert);
+- }
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_HELP;
++ goto redo;
+ }
+ else
+ {
+@@ -953,32 +537,29 @@ redo:
+
+ goto notify_fault;
+ }
++ break;
+
+- skip_authz_assert:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SETNETSTACK;
+- goto redo;
++# endif
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_SITE_HELP:
++ globus_assert(
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SITE_HELP;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_SETNETSTACK:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETNETSTACK;
+- if(target->attr->net_stack_str == NULL ||
+- (target->net_stack_str != NULL &&
+- strcmp(target->attr->net_stack_str, target->net_stack_str) == 0))
++ target->features = globus_i_ftp_client_features_init();
++ if(!target->features)
+ {
+- goto skip_setnetstack;
++ error = GLOBUS_I_FTP_CLIENT_ERROR_OUT_OF_MEMORY();
++ goto notify_fault;
+ }
+-
+- memset(&target->cached_data_conn,
+- '\0',
+- sizeof(globus_i_ftp_client_data_target_t));
+
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
+ globus_i_ftp_client_plugin_notify_command(
+ client_handle,
+ target->url_string,
+ target->mask,
+- "SITE SETNETSTACK %s" CRLF,
+- target->attr->net_stack_str);
++ "SITE HELP" CRLF);
+
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+@@ -988,101 +569,1321 @@ redo:
+ }
+
+ globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++ client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT
++ ||
++ client_handle->state==GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "SITE HELP" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg);
+
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "SITE SETNETSTACK %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- target->attr->net_stack_str);
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+ }
+-
+ break;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_SETNETSTACK:
++ case GLOBUS_FTP_CLIENT_TARGET_SITE_HELP:
+ globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
+
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ if(error != GLOBUS_SUCCESS)
+ {
+- globus_xio_stack_t stack;
+-
+- if(target->net_stack_str)
++ goto notify_fault;
++ }
++ else if(response->response_class==GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ /*
++ * Parse the reply to find out what is implemented by this
++ * server
++ */
++ error = globus_l_ftp_client_parse_site_help(target, response);
++ if(error != GLOBUS_SUCCESS)
+ {
+- globus_free(target->net_stack_str);
++ goto notify_fault;
+ }
+- target->net_stack_str =
+- globus_libc_strdup(target->attr->net_stack_str);
+-
++ }
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_FEAT;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "FEAT" CRLF);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++ globus_assert(
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "FEAT" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
++ case GLOBUS_FTP_CLIENT_TARGET_FEAT:
++ globus_assert(
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_CONNECT);
++
++ if(error != GLOBUS_SUCCESS)
++ {
++ goto notify_fault;
++ }
++ if(response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ /*
++ * Parse the reply to find out what is implemented by this
++ * server
++ */
++ globus_l_ftp_client_parse_feat(target, response);
++ }
++
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_CLIENTINFO,
++ GLOBUS_FTP_CLIENT_MAYBE);
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CLIENTINFO;
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT)
++ {
++ client_handle->state =
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION;
++ }
++ else
++ {
++ client_handle->state =
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION;
++ }
++ goto redo;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_CLIENTINFO:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_CLIENTINFO;
++
++ if(globus_i_ftp_client_feature_get(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_CLIENTINFO) == GLOBUS_FALSE)
++ {
++ goto skip_clientinfo;
++ }
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
++
++ argstr = globus_common_create_string("scheme=%s;", target->url.scheme);
++ if(client_handle->attr.clientinfo_app_name)
++ {
++ tmpstr = globus_common_create_string(
++ "%sappname=\"%s\";", argstr, client_handle->attr.clientinfo_app_name);
++ globus_free(argstr);
++ argstr = tmpstr;
++ }
++ if(client_handle->attr.clientinfo_app_ver)
++ {
++ tmpstr = globus_common_create_string(
++ "%sappver=\"%s\";", argstr, client_handle->attr.clientinfo_app_ver);
++ globus_free(argstr);
++ argstr = tmpstr;
++ }
++ if(client_handle->attr.clientinfo_other)
++ {
++ tmpstr = globus_common_create_string(
++ "%s%s", argstr, client_handle->attr.clientinfo_other);
++ globus_free(argstr);
++ argstr = tmpstr;
++ }
++
++ if(target->attr->clientinfo_argstr)
++ {
++ globus_free(target->attr->clientinfo_argstr);
++ }
++ target->attr->clientinfo_argstr = argstr;
++
++ if(target->clientinfo_argstr &&
++ strcmp(target->clientinfo_argstr,
++ target->attr->clientinfo_argstr) == 0)
++ {
++ goto skip_clientinfo;
++ }
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "SITE CLIENTINFO %s",
++ target->attr->clientinfo_argstr);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION
++ ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "SITE CLIENTINFO %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ target->attr->clientinfo_argstr);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_CLIENTINFO:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ if(target->clientinfo_argstr)
++ {
++ globus_free(target->clientinfo_argstr);
++ }
++ target->clientinfo_argstr =
++ globus_libc_strdup(target->attr->clientinfo_argstr);
++ }
++ else if (response)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_CLIENTINFO,
++ GLOBUS_FTP_CLIENT_FALSE);
++ response->response_class = GLOBUS_FTP_POSITIVE_COMPLETION_REPLY;
++ globus_object_free(error);
++ error = NULL;
++ }
++ else
++ {
++ goto notify_fault;
++ }
++
++ skip_clientinfo:
++ if (client_handle->op == GLOBUS_FTP_CLIENT_FEAT)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_TYPE;
++ }
++ goto redo;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_TYPE:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_TYPE;
++
++ if(target->attr->type == target->type)
++ {
++ goto skip_type;
++ }
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "TYPE %c",
++ (char) target->attr->type);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION
++ ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "TYPE %c" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ (char) target->attr->type);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_TYPE:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ target->type = target->attr->type;
++ result = globus_ftp_control_local_type(target->control_handle,
++ target->type,
++ 8);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ }
++
++ skip_type:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_AUTHZ_ASSERT;
++ goto redo;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_AUTHZ_ASSERT:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_AUTHZ_ASSERT;
++
++ if (!target->attr->authz_assert)
++ {
++ goto skip_authz_assert;
++ }
++ if(target->authz_assert &&
++ !strcmp(target->attr->authz_assert, target->authz_assert) &&
++ target->attr->cache_authz_assert)
++ {
++ goto skip_authz_assert;
++ }
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_MISC;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "SITE AUTHZ_ASSERT %s",
++ target->attr->authz_assert);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION
++ ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "SITE AUTHZ_ASSERT %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ target->attr->authz_assert);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_AUTHZ_ASSERT:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ if (target->authz_assert)
++ {
++ if (strcmp(target->authz_assert, target->attr->authz_assert))
++ {
++ globus_free(target->authz_assert);
++ target->authz_assert = globus_libc_strdup(
++ target->attr->authz_assert);
++ }
++ }
++ else
++ {
++ target->authz_assert =
++ globus_libc_strdup(target->attr->authz_assert);
++ }
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ }
++
++ skip_authz_assert:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SETNETSTACK;
++ goto redo;
++
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_SETNETSTACK:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETNETSTACK;
++ if(target->attr->net_stack_str == NULL ||
++ (target->net_stack_str != NULL &&
++ strcmp(target->attr->net_stack_str, target->net_stack_str) == 0))
++ {
++ goto skip_setnetstack;
++ }
++
++ memset(&target->cached_data_conn,
++ '\0',
++ sizeof(globus_i_ftp_client_data_target_t));
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "SITE SETNETSTACK %s" CRLF,
++ target->attr->net_stack_str);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "SITE SETNETSTACK %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ target->attr->net_stack_str);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETNETSTACK:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ globus_xio_stack_t stack;
++
++ if(target->net_stack_str)
++ {
++ globus_free(target->net_stack_str);
++ }
++ target->net_stack_str =
++ globus_libc_strdup(target->attr->net_stack_str);
++
+ if(client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER)
+ {
+- if(target->net_stack_list)
+- {
+- globus_i_ftp_control_unload_xio_drivers(
+- target->net_stack_list);
+- target->net_stack_list = GLOBUS_NULL;
+- }
+-
+- result = globus_i_ftp_control_load_xio_drivers(
+- target->net_stack_str, &target->net_stack_list);
+- if(result != GLOBUS_SUCCESS)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto result_fault;
+- }
+- result = globus_i_ftp_control_create_stack(
+- target->control_handle, target->net_stack_list, &stack);
+- if(result != GLOBUS_SUCCESS)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto result_fault;
+- }
+-
+- result = globus_i_ftp_control_data_set_stack(
+- target->control_handle, stack);
+- if(result != GLOBUS_SUCCESS)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto result_fault;
+- }
+- globus_xio_stack_destroy(stack);
+- }
++ if(target->net_stack_list)
++ {
++ globus_i_ftp_control_unload_xio_drivers(
++ target->net_stack_list);
++ target->net_stack_list = GLOBUS_NULL;
++ }
++
++ result = globus_i_ftp_control_load_xio_drivers(
++ target->net_stack_str, &target->net_stack_list);
++ if(result != GLOBUS_SUCCESS)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto result_fault;
++ }
++ result = globus_i_ftp_control_create_stack(
++ target->control_handle, target->net_stack_list, &stack);
++ if(result != GLOBUS_SUCCESS)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto result_fault;
++ }
++
++ result = globus_i_ftp_control_data_set_stack(
++ target->control_handle, stack);
++ if(result != GLOBUS_SUCCESS)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto result_fault;
++ }
++ globus_xio_stack_destroy(stack);
++ }
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ }
++
++ skip_setnetstack:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SETDISKSTACK;
++ goto redo;
++
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_SETDISKSTACK:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETDISKSTACK;
++ if(target->attr->disk_stack_str == NULL ||
++ (target->disk_stack_str != NULL &&
++ strcmp(target->attr->disk_stack_str, target->disk_stack_str) == 0))
++ {
++ goto skip_setdiskstack;
++ }
++
++ memset(&target->cached_data_conn,
++ '\0',
++ sizeof(globus_i_ftp_client_data_target_t));
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "SITE SETDISKSTACK %s" CRLF,
++ target->attr->disk_stack_str);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "SITE SETDISKSTACK %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ target->attr->disk_stack_str);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETDISKSTACK:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ if(target->disk_stack_str)
++ {
++ globus_free(target->disk_stack_str);
++ }
++ target->disk_stack_str =
++ globus_libc_strdup(target->attr->disk_stack_str);
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ }
++
++ skip_setdiskstack:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_MODE;
++ goto redo;
++
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_MODE:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_MODE;
++ if(target->attr->mode == target->mode)
++ {
++ goto skip_mode;
++ }
++ memset(&target->cached_data_conn,
++ '\0',
++ sizeof(globus_i_ftp_client_data_target_t));
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "MODE %c" CRLF,
++ (char) target->attr->mode);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "MODE %c" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ (char) target->attr->mode);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_MODE:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ target->mode = target->attr->mode;
++
++ /* disable source pasv */
++ if(target->mode == GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK)
++ {
++ client_handle->source_pasv = GLOBUS_FALSE;
++ }
++
++ result = globus_ftp_control_local_mode(target->control_handle,
++ target->mode);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ }
++
++ skip_mode:
++ if(client_handle->op == GLOBUS_FTP_CLIENT_CKSM)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CKSM;
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SIZE;
++ }
++ goto redo;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_CKSM:
++
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "CKSM %s %" GLOBUS_OFF_T_FORMAT " %" GLOBUS_OFF_T_FORMAT " %s" CRLF,
++ client_handle->checksum_alg,
++ client_handle->checksum_offset,
++ client_handle->checksum_length,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "CKSM %s %" GLOBUS_OFF_T_FORMAT " %" GLOBUS_OFF_T_FORMAT " %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ client_handle->checksum_alg,
++ client_handle->checksum_offset,
++ client_handle->checksum_length,
++ pathname);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_SIZE:
++ /*
++ * Doing a SIZE isn't necessary but is nice for
++ * - resuming stream mode 3rd party transfers
++ *
++ * Skip if
++ * - server doesn't do SIZE
++ * - not interesting
++ * where interesting is
++ * - destination of stream mode 3rd party transfer w/ resume
++ * attr set to true
++ */
++ if(globus_i_ftp_client_feature_get(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_SIZE) == GLOBUS_FALSE
++ ||
++ (!
++ (
++ (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ target == client_handle->dest &&
++ target->attr->resume_third_party &&
++ target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM)
++ ||
++ (client_handle->op == GLOBUS_FTP_CLIENT_SIZE)
++ )
++ )
++ )
++ {
++ if(client_handle->op == GLOBUS_FTP_CLIENT_SIZE)
++ {
++ error = GLOBUS_I_FTP_CLIENT_ERROR_UNSUPPORTED_FEATURE("SIZE");
++
++ goto notify_fault;
++
++ }
++ goto skip_size;
++ }
++
++ if(client_handle->op == GLOBUS_FTP_CLIENT_SIZE)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SIZE;
++ }
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "SIZE %s" CRLF,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "SIZE %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ pathname);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SIZE:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION
++ ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if(error != GLOBUS_SUCCESS)
++ {
++ goto notify_fault;
++ }
++ if(response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_SIZE,
++ GLOBUS_FTP_CLIENT_TRUE);
++
++ if(client_handle->source == target)
++ {
++ globus_libc_scan_off_t((char *) response->response_buffer+4,
++ &client_handle->source_size,
++ GLOBUS_NULL);
++ }
++ else
++ {
++ globus_byte_t * size;
++ const globus_byte_t * p;
++ globus_byte_t *q;
++
++ size = globus_libc_malloc(
++ strlen((char *) response->response_buffer+3));
++ for(p = response->response_buffer+4, q = size;
++ isdigit(*p);
++ p++,q++)
++ {
++ *q = *p;
++ }
++ *q = '\0';
++
++ if(target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM &&
++ client_handle->restart_marker.type ==
++ GLOBUS_FTP_CLIENT_RESTART_NONE)
++ {
++ client_handle->restart_marker.type =
++ GLOBUS_FTP_CLIENT_RESTART_STREAM;
++
++ globus_libc_scan_off_t(
++ (char *) size,
++ &client_handle->restart_marker.stream.offset,
++ GLOBUS_NULL);
++
++ client_handle->restart_marker.stream.ascii_offset =
++ client_handle->restart_marker.stream.offset;
++ }
++ globus_libc_free(size);
++ }
++
++ }
++ else if(response->code / 10 == 50)
++ {
++ /* A 500 response means the server doesn't know about SIZE */
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_SIZE,
++ GLOBUS_FTP_CLIENT_FALSE);
++
++ }
++ else if(response->code == 550 && /* file unavailable */
++ client_handle->dest == target)
++ {
++ /*
++ * The file may not exist on the remote side if we're
++ * restarting.
++ */
++ ;
++ }
++ else
++ {
++ /* Any other response is not good. */
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++ if((!client_handle->err) && (!error))
++ {
++ error = GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
++ }
++ goto connection_error;
++ }
++
++ skip_size:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_BUFSIZE;
++ goto redo;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_BUFSIZE:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_BUFSIZE;
++
++ /*
++ * TODO: compare buffer mode/size properly for all instances
++ * of union components
++ */
++ if(target->attr->buffer.mode == target->tcp_buffer.mode &&
++ target->attr->buffer.fixed.size == target->tcp_buffer.fixed.size)
++ {
++ goto skip_bufsize;
++ }
++ if(!(client_handle->op == GLOBUS_FTP_CLIENT_GET ||
++ client_handle->op == GLOBUS_FTP_CLIENT_PUT ||
++ client_handle->op == GLOBUS_FTP_CLIENT_LIST ||
++ client_handle->op == GLOBUS_FTP_CLIENT_NLST ||
++ client_handle->op == GLOBUS_FTP_CLIENT_MLSD ||
++ client_handle->op == GLOBUS_FTP_CLIENT_MLSR ||
++ client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER))
++ {
++ goto skip_bufsize;
++ }
++
++ buffer_cmd = globus_l_ftp_client_guess_buffer_command(client_handle,
++ target);
++ if(buffer_cmd == GLOBUS_NULL)
++ {
++ error = GLOBUS_I_FTP_CLIENT_ERROR_UNSUPPORTED_FEATURE(
++ "Adjust socket buffer");
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ }
++
++ /* Choose the proper string to pass along with the chosen
++ * buffer size command.
++ */
++ switch(target->attr->buffer.mode)
++ {
++ case GLOBUS_FTP_CONTROL_TCPBUFFER_DEFAULT:
++ target->attr->buffer.fixed.size = 0UL;
++ case GLOBUS_FTP_CONTROL_TCPBUFFER_FIXED:
++ break;
++ case GLOBUS_FTP_CONTROL_TCPBUFFER_AUTOMATIC:
++ error = GLOBUS_I_FTP_CLIENT_ERROR_UNSUPPORTED_FEATURE("ABUF");
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ }
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "%s %lu" CRLF,
++ buffer_cmd,
++ target->attr->buffer.fixed.size);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "%s %lu" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ buffer_cmd,
++ target->attr->buffer.fixed.size);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_BUFSIZE:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ globus_l_ftp_client_update_buffer_feature(
++ client_handle, target, GLOBUS_FTP_CLIENT_TRUE);
++
++ target->tcp_buffer = target->attr->buffer;
++
++ result = globus_ftp_control_local_tcp_buffer(
++ target->control_handle,
++ &target->tcp_buffer);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ }
++ else if(error)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ }
++ else
++ {
++ globus_l_ftp_client_update_buffer_feature(
++ client_handle, target, GLOBUS_FTP_CLIENT_FALSE);
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_BUFSIZE;
++ goto redo;
++ }
++
++ skip_bufsize:
++ if(target->mode == GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK &&
++ (client_handle->op == GLOBUS_FTP_CLIENT_GET ||
++ client_handle->op == GLOBUS_FTP_CLIENT_MLSD ||
++ client_handle->op == GLOBUS_FTP_CLIENT_MLSR ||
++ client_handle->op == GLOBUS_FTP_CLIENT_LIST ||
++ client_handle->op == GLOBUS_FTP_CLIENT_NLST ||
++ (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ target == client_handle->source)))
++ {
++ /* Only send OPTS RETR if the source control handle will
++ * be used.
++ */
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_REMOTE_RETR_OPTS;
++ }
++ else if(target->mode == GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK &&
++ client_handle->op == GLOBUS_FTP_CLIENT_PUT)
++ {
++ /* Only do local_layout and local_parallelism if we are
++ * receiving the data (not 3rd party)
++ */
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_LOCAL_RETR_OPTS;
++ }
++ else
++ {
++ goto skip_opts_retr;
++ }
++
++ goto redo;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_REMOTE_RETR_OPTS:
++
++ parallelism_opt = globus_l_ftp_client_parallelism_string(target);
++ layout_opt = globus_l_ftp_client_layout_string(target);
++
++ if((!parallelism_opt) && (!layout_opt))
++ {
++ goto skip_opts_retr;
++ }
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "OPTS RETR %s%s" CRLF,
++ layout_opt ? layout_opt : "",
++ parallelism_opt ? parallelism_opt : "");
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ if(parallelism_opt)
++ {
++ globus_libc_free(parallelism_opt);
++ }
++ if(layout_opt)
++ {
++ globus_libc_free(layout_opt);
++ }
++ break;
++ }
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "OPTS RETR %s%s" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ layout_opt ? layout_opt : "",
++ parallelism_opt ? parallelism_opt : "");
++
++ if(parallelism_opt)
++ {
++ globus_libc_free(parallelism_opt);
++ }
++ if(layout_opt)
++ {
++ globus_libc_free(layout_opt);
++ }
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_REMOTE_RETR_OPTS;
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_LOCAL_RETR_OPTS:
++
++ if(target->attr->parallelism.mode == target->parallelism.mode &&
++ (target->parallelism.mode != GLOBUS_FTP_CONTROL_PARALLELISM_FIXED
++ || target->attr->parallelism.fixed.size ==
++ target->parallelism.fixed.size) &&
++ target->attr->layout.mode == target->layout.mode &&
++ (target->layout.mode !=
++ GLOBUS_FTP_CONTROL_STRIPING_BLOCKED_ROUND_ROBIN
++ || target->attr->layout.round_robin.block_size ==
++ target->layout.round_robin.block_size))
++ {
++ goto skip_opts_retr;
++ }
++
++ result = globus_ftp_control_local_parallelism(
++ target->control_handle,
++ &target->attr->parallelism);
++
++ if(result)
++ {
++ goto result_fault;
++ }
++ result = globus_ftp_control_local_layout(target->control_handle,
++ &target->attr->layout,
++ 0);
++ if(result)
++ {
++ goto result_fault;
++ }
++
++ memcpy(&target->parallelism,
++ &target->attr->parallelism,
++ sizeof(globus_ftp_control_parallelism_t));
++
++ memcpy(&target->parallelism,
++ &target->attr->parallelism,
++ sizeof(globus_ftp_control_parallelism_t));
++
++ goto skip_opts_retr;
++
++ case GLOBUS_FTP_CLIENT_TARGET_REMOTE_RETR_OPTS:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION
++ ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ memcpy(&target->parallelism,
++ &target->attr->parallelism,
++ sizeof(globus_ftp_control_parallelism_t));
++ memcpy(&target->layout,
++ &target->attr->layout,
++ sizeof(globus_ftp_control_layout_t));
++ }
++ else if((!error) && response->code / 10 == 50)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_PARALLELISM,
++ GLOBUS_FTP_CLIENT_FALSE);
++
++ if(target->attr->parallelism.mode
++ == GLOBUS_FTP_CONTROL_PARALLELISM_NONE &&
++ target->attr->layout.mode == GLOBUS_FTP_CONTROL_STRIPING_NONE)
++ {
++ memcpy(&target->parallelism,
++ &target->attr->parallelism,
++ sizeof(globus_ftp_control_parallelism_t));
++ memcpy(&target->layout,
++ &target->attr->layout,
++ sizeof(globus_ftp_control_layout_t));
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto connection_error;
++ }
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ }
++
++ skip_opts_retr:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_DCSC;
++ goto redo;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_DCSC:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_DCSC;
++
++ if(target->attr->dcsc_type == 0 ||
++ (target->attr->dcsc_type == target->dcsc_type &&
++ target->dcsc_blob && target->attr->dcsc_blob &&
++ strcmp(target->attr->dcsc_blob, target->dcsc_blob) == 0))
++ {
++ goto skip_dcsc;
++ }
++
++ if(globus_i_ftp_client_feature_get(target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_DCSC) != GLOBUS_FTP_CLIENT_TRUE &&
++ target->url.scheme_type == GLOBUS_URL_SCHEME_GSIFTP)
++ {
++ goto skip_dcsc;
++ }
++
++ /* changing DCSC forces us to trash our old data connections */
++ memset(&target->cached_data_conn,
++ '\0',
++ sizeof(globus_i_ftp_client_data_target_t));
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "DCSC %c%s%s" CRLF,
++ (char) target->attr->dcsc_type,
++ target->attr->dcsc_type == 'D' ? "" : " ",
++ target->attr->dcsc_type == 'D' ? "" : target->attr->dcsc_blob);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "DCSC %c%s%s" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ (char) target->attr->dcsc_type,
++ target->attr->dcsc_type == 'D' ? "" : " ",
++ target->attr->dcsc_type == 'D' ? "" : target->attr->dcsc_blob);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_DCSC:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ target->dcsc_type = target->attr->dcsc_type;
++ if(target->dcsc_blob)
++ {
++ globus_free(target->dcsc_blob);
++ }
++ target->dcsc_blob = globus_libc_strdup(target->attr->dcsc_blob);
++ target->dcsc_p_cred = target->attr->dcsc_p_cred;
+ }
+ else
+ {
++ error = GLOBUS_I_FTP_CLIENT_ERROR_UNSUPPORTED_FEATURE("DCSC");
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+
+ goto notify_fault;
+ }
+
+- skip_setnetstack:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SETDISKSTACK;
++ skip_dcsc:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_DCAU;
+ goto redo;
+
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_DCAU:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_DCAU;
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_SETDISKSTACK:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETDISKSTACK;
+- if(target->attr->disk_stack_str == NULL ||
+- (target->disk_stack_str != NULL &&
+- strcmp(target->attr->disk_stack_str, target->disk_stack_str) == 0))
++ if(target->dcsc_p_cred != GSS_C_NO_CREDENTIAL)
+ {
+- goto skip_setdiskstack;
++ target->attr->dcau.mode = GLOBUS_FTP_CONTROL_DCAU_SELF;
++ }
++ if(target->attr->dcau.mode == target->dcau.mode &&
++ target->dcau.mode != GLOBUS_FTP_CONTROL_DCAU_DEFAULT)
++ {
++ goto skip_dcau;
++ }
++ if(target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT &&
++ globus_i_ftp_client_feature_get(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_DCAU) != GLOBUS_FTP_CLIENT_TRUE)
++ {
++ goto skip_dcau;
++ }
++ if(target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT &&
++ (target->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SELF ||
++ target->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT))
++ {
++ goto finish_dcau;
+ }
+-
++
++ /* changing DCAU forces us to trash our old data connections */
+ memset(&target->cached_data_conn,
+ '\0',
+ sizeof(globus_i_ftp_client_data_target_t));
+@@ -1092,8 +1893,13 @@ redo:
+ client_handle,
+ target->url_string,
+ target->mask,
+- "SITE SETDISKSTACK %s" CRLF,
+- target->attr->disk_stack_str);
++ "DCAU %c%s%s" CRLF,
++ (char) target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT
++ ? GLOBUS_FTP_CONTROL_DCAU_SELF : target->attr->dcau.mode,
++ target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SUBJECT
++ ? " " : "",
++ target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SUBJECT
++ ? target->attr->dcau.subject.subject : "");
+
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+@@ -1110,10 +1916,16 @@ redo:
+
+ result = globus_ftp_control_send_command(
+ target->control_handle,
+- "SITE SETDISKSTACK %s" CRLF,
++ "DCAU %c%s%s" CRLF,
+ globus_i_ftp_client_response_callback,
+ target,
+- target->attr->disk_stack_str);
++ (char) target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT
++ ? GLOBUS_FTP_CONTROL_DCAU_SELF : target->attr->dcau.mode,
++ target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SUBJECT
++ ? " " : "",
++ target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SUBJECT
++ ? target->attr->dcau.subject.subject : "");
++
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+@@ -1121,7 +1933,7 @@ redo:
+
+ break;
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETDISKSTACK:
++ case GLOBUS_FTP_CLIENT_TARGET_DCAU:
+ globus_assert(
+ client_handle->state ==
+ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+@@ -1131,12 +1943,62 @@ redo:
+ if((!error) &&
+ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+ {
+- if(target->disk_stack_str)
++
++ if(target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SUBJECT)
+ {
+- globus_free(target->disk_stack_str);
++ char * tmp_subj;
++ tmp_subj = target->dcau.subject.subject;
++
++ target->dcau.subject.subject =
++ globus_libc_strdup(target->attr->dcau.subject.subject);
++ if(! target->dcau.subject.subject)
++ {
++ error = GLOBUS_I_FTP_CLIENT_ERROR_OUT_OF_MEMORY();
++ target->dcau.subject.subject = tmp_subj;
++
++ goto notify_fault;
++ }
++ else if(tmp_subj)
++ {
++ globus_libc_free(tmp_subj);
++ }
++ }
++ finish_dcau:
++ if(target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT)
++ {
++ if(!globus_i_ftp_client_feature_get(
++ target->features, GLOBUS_FTP_CLIENT_FEATURE_DCAU))
++ {
++ target->dcau.mode = GLOBUS_FTP_CONTROL_DCAU_NONE;
++ }
++ else
++ {
++ target->dcau.mode = GLOBUS_FTP_CONTROL_DCAU_SELF;
++ }
++ }
++ else
++ {
++ target->dcau.mode = target->attr->dcau.mode;
++ }
++
++ if(target->dcsc_p_cred != GSS_C_NO_CREDENTIAL)
++ {
++ result = globus_ftp_control_local_dcau(
++ target->control_handle,
++ &target->dcau,
++ target->dcsc_p_cred);
++ }
++ else
++ {
++ result = globus_ftp_control_local_dcau(
++ target->control_handle,
++ &target->dcau,
++ target->control_handle->cc_handle.auth_info.credential_handle);
++ }
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
+ }
+- target->disk_stack_str =
+- globus_libc_strdup(target->attr->disk_stack_str);
+ }
+ else
+ {
+@@ -1145,1067 +2007,205 @@ redo:
+ goto notify_fault;
+ }
+
+- skip_setdiskstack:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_MODE;
++ skip_dcau:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PBSZ;
+ goto redo;
+
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_PBSZ:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_PBSZ;
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_MODE:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_MODE;
+- if(target->attr->mode == target->mode)
+- {
+- goto skip_mode;
+- }
+- memset(&target->cached_data_conn,
+- '\0',
+- sizeof(globus_i_ftp_client_data_target_t));
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "MODE %c" CRLF,
+- (char) target->attr->mode);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "MODE %c" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- (char) target->attr->mode);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- break;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_MODE:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- target->mode = target->attr->mode;
+-
+- /* disable source pasv */
+- if(target->mode == GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK)
+- {
+- client_handle->source_pasv = GLOBUS_FALSE;
+- }
+-
+- result = globus_ftp_control_local_mode(target->control_handle,
+- target->mode);
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
+-
+- skip_mode:
+- if(client_handle->op == GLOBUS_FTP_CLIENT_CKSM)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CKSM;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SIZE;
+- }
+- goto redo;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_CKSM:
++ if(target->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_NONE)
++ {
++ goto skip_pbsz;
++ }
+
++ result = globus_ftp_control_get_pbsz(
++ target->control_handle,
++ &pbsz);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ if(target->pbsz == pbsz)
++ {
++ goto skip_pbsz;
++ }
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
++ /* changing PBSZ forces us to trash our old data connections */
++ memset(&target->cached_data_conn,
++ '\0',
++ sizeof(globus_i_ftp_client_data_target_t));
+
+- globus_i_ftp_client_plugin_notify_command(
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
++ globus_i_ftp_client_plugin_notify_command(
+ client_handle,
+ target->url_string,
+- target->mask,
+- "CKSM %s %" GLOBUS_OFF_T_FORMAT " %" GLOBUS_OFF_T_FORMAT " %s" CRLF,
+- client_handle->checksum_alg,
+- client_handle->checksum_offset,
+- client_handle->checksum_length,
+- pathname);
++ target->mask,
++ "PBSZ %lu" CRLF,
++ pbsz);
+
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+ {
+ break;
+ }
+
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+
+ result = globus_ftp_control_send_command(
+ target->control_handle,
+- "CKSM %s %" GLOBUS_OFF_T_FORMAT " %" GLOBUS_OFF_T_FORMAT " %s" CRLF,
++ "PBSZ %lu" CRLF,
+ globus_i_ftp_client_response_callback,
+ target,
+- client_handle->checksum_alg,
+- client_handle->checksum_offset,
+- client_handle->checksum_length,
+- pathname);
++ pbsz);
+
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+ }
++
+ break;
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_SIZE:
+- /*
+- * Doing a SIZE isn't necessary but is nice for
+- * - resuming stream mode 3rd party transfers
+- *
+- * Skip if
+- * - server doesn't do SIZE
+- * - not interesting
+- * where interesting is
+- * - destination of stream mode 3rd party transfer w/ resume
+- * attr set to true
+- */
+- if(globus_i_ftp_client_feature_get(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_SIZE) == GLOBUS_FALSE
+- ||
+- (!
+- (
+- (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- target == client_handle->dest &&
+- target->attr->resume_third_party &&
+- target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM)
+- ||
+- (client_handle->op == GLOBUS_FTP_CLIENT_SIZE)
+- )
+- )
+- )
+- {
+- if(client_handle->op == GLOBUS_FTP_CLIENT_SIZE)
+- {
+- error = GLOBUS_I_FTP_CLIENT_ERROR_UNSUPPORTED_FEATURE("SIZE");
+-
+- goto notify_fault;
+-
+- }
+- goto skip_size;
+- }
+-
+- if(client_handle->op == GLOBUS_FTP_CLIENT_SIZE)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SIZE;
+- }
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_INFORMATION;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "SIZE %s" CRLF,
+- pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "SIZE %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- pathname);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ case GLOBUS_FTP_CLIENT_TARGET_PBSZ:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+
+- case GLOBUS_FTP_CLIENT_TARGET_SIZE:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION
+- ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if(error != GLOBUS_SUCCESS)
+- {
+- goto notify_fault;
+- }
+- if(response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_SIZE,
+- GLOBUS_FTP_CLIENT_TRUE);
+-
+- if(client_handle->source == target)
+- {
+- globus_libc_scan_off_t((char *) response->response_buffer+4,
+- &client_handle->source_size,
+- GLOBUS_NULL);
+- }
+- else
+- {
+- globus_byte_t * size;
+- const globus_byte_t * p;
+- globus_byte_t *q;
+-
+- size = globus_libc_malloc(
+- strlen((char *) response->response_buffer+3));
+- for(p = response->response_buffer+4, q = size;
+- isdigit(*p);
+- p++,q++)
+- {
+- *q = *p;
+- }
+- *q = '\0';
+-
+- if(target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM &&
+- client_handle->restart_marker.type ==
+- GLOBUS_FTP_CLIENT_RESTART_NONE)
+- {
+- client_handle->restart_marker.type =
+- GLOBUS_FTP_CLIENT_RESTART_STREAM;
+-
+- globus_libc_scan_off_t(
+- (char *) size,
+- &client_handle->restart_marker.stream.offset,
+- GLOBUS_NULL);
+-
+- client_handle->restart_marker.stream.ascii_offset =
+- client_handle->restart_marker.stream.offset;
+- }
+- globus_libc_free(size);
+- }
+-
+- }
+- else if(response->code / 10 == 50)
+- {
+- /* A 500 response means the server doesn't know about SIZE */
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_SIZE,
+- GLOBUS_FTP_CLIENT_FALSE);
+-
+- }
+- else if(response->code == 550 && /* file unavailable */
+- client_handle->dest == target)
+- {
+- /*
+- * The file may not exist on the remote side if we're
+- * restarting.
+- */
+- ;
+- }
+- else
+- {
+- /* Any other response is not good. */
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+- if((!client_handle->err) && (!error))
+- {
+- error = GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
+- }
+- goto connection_error;
+- }
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ char * s;
+
+- skip_size:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_BUFSIZE;
+- goto redo;
++ pbsz = 0;
++ s = strstr((char *) response->response_buffer, "PBSZ=");
++ if(s)
++ {
++ sscanf(s, "PBSZ=%lu", &pbsz);
++ }
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_BUFSIZE:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_BUFSIZE;
+-
+- /*
+- * TODO: compare buffer mode/size properly for all instances
+- * of union components
+- */
+- if(target->attr->buffer.mode == target->tcp_buffer.mode &&
+- target->attr->buffer.fixed.size == target->tcp_buffer.fixed.size)
+- {
+- goto skip_bufsize;
+- }
+- if(!(client_handle->op == GLOBUS_FTP_CLIENT_GET ||
+- client_handle->op == GLOBUS_FTP_CLIENT_PUT ||
+- client_handle->op == GLOBUS_FTP_CLIENT_LIST ||
+- client_handle->op == GLOBUS_FTP_CLIENT_NLST ||
+- client_handle->op == GLOBUS_FTP_CLIENT_MLSD ||
+- client_handle->op == GLOBUS_FTP_CLIENT_MLSR ||
+- client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER))
+- {
+- goto skip_bufsize;
+- }
+-
+- buffer_cmd = globus_l_ftp_client_guess_buffer_command(client_handle,
+- target);
+- if(buffer_cmd == GLOBUS_NULL)
+- {
+- error = GLOBUS_I_FTP_CLIENT_ERROR_UNSUPPORTED_FEATURE(
+- "Adjust socket buffer");
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
+-
+- /* Choose the proper string to pass along with the chosen
+- * buffer size command.
+- */
+- switch(target->attr->buffer.mode)
+- {
+- case GLOBUS_FTP_CONTROL_TCPBUFFER_DEFAULT:
+- target->attr->buffer.fixed.size = 0UL;
+- case GLOBUS_FTP_CONTROL_TCPBUFFER_FIXED:
+- break;
+- case GLOBUS_FTP_CONTROL_TCPBUFFER_AUTOMATIC:
+- error = GLOBUS_I_FTP_CLIENT_ERROR_UNSUPPORTED_FEATURE("ABUF");
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "%s %lu" CRLF,
+- buffer_cmd,
+- target->attr->buffer.fixed.size);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "%s %lu" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- buffer_cmd,
+- target->attr->buffer.fixed.size);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ if(pbsz == 0)
++ {
++ result = globus_ftp_control_get_pbsz(
++ target->control_handle, &pbsz);
++ }
++ else
++ {
++ result = globus_ftp_control_local_pbsz(
++ target->control_handle, pbsz);
++ }
+
+- case GLOBUS_FTP_CLIENT_TARGET_BUFSIZE:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- globus_l_ftp_client_update_buffer_feature(
+- client_handle, target, GLOBUS_FTP_CLIENT_TRUE);
+-
+- target->tcp_buffer = target->attr->buffer;
+-
+- result = globus_ftp_control_local_tcp_buffer(
+- target->control_handle,
+- &target->tcp_buffer);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- }
+- else if(error)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
+- else
+- {
+- globus_l_ftp_client_update_buffer_feature(
+- client_handle, target, GLOBUS_FTP_CLIENT_FALSE);
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_BUFSIZE;
+- goto redo;
+- }
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ target->pbsz = pbsz;
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+
+- skip_bufsize:
+- if(target->mode == GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK &&
+- (client_handle->op == GLOBUS_FTP_CLIENT_GET ||
+- client_handle->op == GLOBUS_FTP_CLIENT_MLSD ||
+- client_handle->op == GLOBUS_FTP_CLIENT_MLSR ||
+- client_handle->op == GLOBUS_FTP_CLIENT_LIST ||
+- client_handle->op == GLOBUS_FTP_CLIENT_NLST ||
+- (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- target == client_handle->source)))
+- {
+- /* Only send OPTS RETR if the source control handle will
+- * be used.
+- */
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_REMOTE_RETR_OPTS;
+- }
+- else if(target->mode == GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK &&
+- client_handle->op == GLOBUS_FTP_CLIENT_PUT)
+- {
+- /* Only do local_layout and local_parallelism if we are
+- * receiving the data (not 3rd party)
+- */
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_LOCAL_RETR_OPTS;
+- }
+- else
+- {
+- goto skip_opts_retr;
+- }
+-
+- goto redo;
++ goto notify_fault;
++ }
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_REMOTE_RETR_OPTS:
++ skip_pbsz:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PROT;
++ goto redo;
+
+- parallelism_opt = globus_l_ftp_client_parallelism_string(target);
+- layout_opt = globus_l_ftp_client_layout_string(target);
+-
+- if((!parallelism_opt) && (!layout_opt))
+- {
+- goto skip_opts_retr;
+- }
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "OPTS RETR %s%s" CRLF,
+- layout_opt ? layout_opt : "",
+- parallelism_opt ? parallelism_opt : "");
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- if(parallelism_opt)
+- {
+- globus_libc_free(parallelism_opt);
+- }
+- if(layout_opt)
+- {
+- globus_libc_free(layout_opt);
+- }
+- break;
+- }
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "OPTS RETR %s%s" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- layout_opt ? layout_opt : "",
+- parallelism_opt ? parallelism_opt : "");
+-
+- if(parallelism_opt)
+- {
+- globus_libc_free(parallelism_opt);
+- }
+- if(layout_opt)
+- {
+- globus_libc_free(layout_opt);
+- }
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_REMOTE_RETR_OPTS;
+- break;
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_PROT:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_PROT;
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_LOCAL_RETR_OPTS:
+-
+- if(target->attr->parallelism.mode == target->parallelism.mode &&
+- (target->parallelism.mode != GLOBUS_FTP_CONTROL_PARALLELISM_FIXED
+- || target->attr->parallelism.fixed.size ==
+- target->parallelism.fixed.size) &&
+- target->attr->layout.mode == target->layout.mode &&
+- (target->layout.mode !=
+- GLOBUS_FTP_CONTROL_STRIPING_BLOCKED_ROUND_ROBIN
+- || target->attr->layout.round_robin.block_size ==
+- target->layout.round_robin.block_size))
++ if(target->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_NONE)
+ {
+- goto skip_opts_retr;
++ goto skip_prot;
+ }
+-
+- result = globus_ftp_control_local_parallelism(
+- target->control_handle,
+- &target->attr->parallelism);
+-
+- if(result)
+- {
+- goto result_fault;
+- }
+- result = globus_ftp_control_local_layout(target->control_handle,
+- &target->attr->layout,
+- 0);
+- if(result)
+- {
+- goto result_fault;
+- }
+-
+- memcpy(&target->parallelism,
+- &target->attr->parallelism,
+- sizeof(globus_ftp_control_parallelism_t));
+-
+- memcpy(&target->parallelism,
+- &target->attr->parallelism,
+- sizeof(globus_ftp_control_parallelism_t));
+-
+- goto skip_opts_retr;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_REMOTE_RETR_OPTS:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION
+- ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- memcpy(&target->parallelism,
+- &target->attr->parallelism,
+- sizeof(globus_ftp_control_parallelism_t));
+- memcpy(&target->layout,
+- &target->attr->layout,
+- sizeof(globus_ftp_control_layout_t));
+- }
+- else if((!error) && response->code / 10 == 50)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_PARALLELISM,
+- GLOBUS_FTP_CLIENT_FALSE);
+-
+- if(target->attr->parallelism.mode
+- == GLOBUS_FTP_CONTROL_PARALLELISM_NONE &&
+- target->attr->layout.mode == GLOBUS_FTP_CONTROL_STRIPING_NONE)
+- {
+- memcpy(&target->parallelism,
+- &target->attr->parallelism,
+- sizeof(globus_ftp_control_parallelism_t));
+- memcpy(&target->layout,
+- &target->attr->layout,
+- sizeof(globus_ftp_control_layout_t));
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto connection_error;
+- }
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
+-
+- skip_opts_retr:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_DCSC;
+- goto redo;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_DCSC:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_DCSC;
+-
+- if(target->attr->dcsc_type == 0 ||
+- (target->attr->dcsc_type == target->dcsc_type &&
+- target->dcsc_blob && target->attr->dcsc_blob &&
+- strcmp(target->attr->dcsc_blob, target->dcsc_blob) == 0))
+- {
+- goto skip_dcsc;
+- }
+-
+- if(globus_i_ftp_client_feature_get(target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_DCSC) != GLOBUS_FTP_CLIENT_TRUE &&
+- target->url.scheme_type == GLOBUS_URL_SCHEME_GSIFTP)
++ if(target->attr->data_prot == target->data_prot)
+ {
+- goto skip_dcsc;
++ goto skip_prot;
+ }
++ /* changing PROT forces us to trash our old data connections [true?] */
++ memset(&target->cached_data_conn,
++ '\0',
++ sizeof(globus_i_ftp_client_data_target_t));
+
+- /* changing DCSC forces us to trash our old data connections */
+- memset(&target->cached_data_conn,
+- '\0',
+- sizeof(globus_i_ftp_client_data_target_t));
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "DCSC %c%s%s" CRLF,
+- (char) target->attr->dcsc_type,
+- target->attr->dcsc_type == 'D' ? "" : " ",
+- target->attr->dcsc_type == 'D' ? "" : target->attr->dcsc_blob);
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "PROT %c" CRLF,
++ (char) target->attr->data_prot);
+
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "DCSC %c%s%s" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- (char) target->attr->dcsc_type,
+- target->attr->dcsc_type == 'D' ? "" : " ",
+- target->attr->dcsc_type == 'D' ? "" : target->attr->dcsc_blob);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- break;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_DCSC:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- target->dcsc_type = target->attr->dcsc_type;
+- if(target->dcsc_blob)
+- {
+- globus_free(target->dcsc_blob);
+- }
+- target->dcsc_blob = globus_libc_strdup(target->attr->dcsc_blob);
+- target->dcsc_p_cred = target->attr->dcsc_p_cred;
+- }
+- else
+- {
+- error = GLOBUS_I_FTP_CLIENT_ERROR_UNSUPPORTED_FEATURE("DCSC");
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++ {
++ break;
++ }
+
+- goto notify_fault;
+- }
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+
+- skip_dcsc:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_DCAU;
+- goto redo;
++ result = globus_ftp_control_send_command(
++ target->control_handle,
++ "PROT %c" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ (char) target->attr->data_prot);
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_DCAU:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_DCAU;
+-
+- if(target->dcsc_p_cred != GSS_C_NO_CREDENTIAL)
++ if(result != GLOBUS_SUCCESS)
+ {
+- target->attr->dcau.mode = GLOBUS_FTP_CONTROL_DCAU_SELF;
++ goto result_fault;
+ }
+- if(target->attr->dcau.mode == target->dcau.mode &&
+- target->dcau.mode != GLOBUS_FTP_CONTROL_DCAU_DEFAULT)
+- {
+- goto skip_dcau;
+- }
+- if(target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT &&
+- globus_i_ftp_client_feature_get(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_DCAU) != GLOBUS_FTP_CLIENT_TRUE)
+- {
+- goto skip_dcau;
+- }
+- if(target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT &&
+- (target->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SELF ||
+- target->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT))
+- {
+- goto finish_dcau;
+- }
+-
+- /* changing DCAU forces us to trash our old data connections */
+- memset(&target->cached_data_conn,
+- '\0',
+- sizeof(globus_i_ftp_client_data_target_t));
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "DCAU %c%s%s" CRLF,
+- (char) target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT
+- ? GLOBUS_FTP_CONTROL_DCAU_SELF : target->attr->dcau.mode,
+- target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SUBJECT
+- ? " " : "",
+- target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SUBJECT
+- ? target->attr->dcau.subject.subject : "");
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "DCAU %c%s%s" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- (char) target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT
+- ? GLOBUS_FTP_CONTROL_DCAU_SELF : target->attr->dcau.mode,
+- target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SUBJECT
+- ? " " : "",
+- target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SUBJECT
+- ? target->attr->dcau.subject.subject : "");
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- break;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_DCAU:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+-
+- if(target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_SUBJECT)
+- {
+- char * tmp_subj;
+- tmp_subj = target->dcau.subject.subject;
+-
+- target->dcau.subject.subject =
+- globus_libc_strdup(target->attr->dcau.subject.subject);
+- if(! target->dcau.subject.subject)
+- {
+- error = GLOBUS_I_FTP_CLIENT_ERROR_OUT_OF_MEMORY();
+- target->dcau.subject.subject = tmp_subj;
+-
+- goto notify_fault;
+- }
+- else if(tmp_subj)
+- {
+- globus_libc_free(tmp_subj);
+- }
+- }
+- finish_dcau:
+- if(target->attr->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_DEFAULT)
+- {
+- if(!globus_i_ftp_client_feature_get(
+- target->features, GLOBUS_FTP_CLIENT_FEATURE_DCAU))
+- {
+- target->dcau.mode = GLOBUS_FTP_CONTROL_DCAU_NONE;
+- }
+- else
+- {
+- target->dcau.mode = GLOBUS_FTP_CONTROL_DCAU_SELF;
+- }
+- }
+- else
+- {
+- target->dcau.mode = target->attr->dcau.mode;
+- }
+-
+- if(target->dcsc_p_cred != GSS_C_NO_CREDENTIAL)
+- {
+- result = globus_ftp_control_local_dcau(
+- target->control_handle,
+- &target->dcau,
+- target->dcsc_p_cred);
+- }
+- else
+- {
+- result = globus_ftp_control_local_dcau(
+- target->control_handle,
+- &target->dcau,
+- target->control_handle->cc_handle.auth_info.credential_handle);
+- }
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+
+- goto notify_fault;
+- }
++ break;
+
+- skip_dcau:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PBSZ;
+- goto redo;
++ case GLOBUS_FTP_CLIENT_TARGET_PROT:
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_PBSZ:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_PBSZ;
+-
+- if(target->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_NONE)
+- {
+- goto skip_pbsz;
+- }
+-
+- result = globus_ftp_control_get_pbsz(
+- target->control_handle,
+- &pbsz);
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- if(target->pbsz == pbsz)
+- {
+- goto skip_pbsz;
+- }
+-
+- /* changing PBSZ forces us to trash our old data connections */
+- memset(&target->cached_data_conn,
+- '\0',
+- sizeof(globus_i_ftp_client_data_target_t));
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "PBSZ %lu" CRLF,
+- pbsz);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "PBSZ %lu" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- pbsz);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- break;
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ target->data_prot = target->attr->data_prot;
+
+- case GLOBUS_FTP_CLIENT_TARGET_PBSZ:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- char * s;
+-
+- pbsz = 0;
+- s = strstr((char *) response->response_buffer, "PBSZ=");
+- if(s)
+- {
+- sscanf(s, "PBSZ=%lu", &pbsz);
+- }
+-
+- if(pbsz == 0)
+- {
+- result = globus_ftp_control_get_pbsz(
+- target->control_handle, &pbsz);
+- }
+- else
+- {
+- result = globus_ftp_control_local_pbsz(
+- target->control_handle, pbsz);
+- }
+-
++ result = globus_ftp_control_local_prot(target->control_handle,
++ target->data_prot);
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+ }
+- target->pbsz = pbsz;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
+-
+- skip_pbsz:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PROT;
+- goto redo;
+-
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_PROT:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_PROT;
+-
+- if(target->dcau.mode == GLOBUS_FTP_CONTROL_DCAU_NONE)
+- {
+- goto skip_prot;
+- }
+- if(target->attr->data_prot == target->data_prot)
+- {
+- goto skip_prot;
+- }
+- /* changing PROT forces us to trash our old data connections [true?] */
+- memset(&target->cached_data_conn,
+- '\0',
+- sizeof(globus_i_ftp_client_data_target_t));
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "PROT %c" CRLF,
+- (char) target->attr->data_prot);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- target->control_handle,
+- "PROT %c" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- (char) target->attr->data_prot);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- break;
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+
+- case GLOBUS_FTP_CLIENT_TARGET_PROT:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- target->data_prot = target->attr->data_prot;
+-
+- result = globus_ftp_control_local_prot(target->control_handle,
+- target->data_prot);
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
++ goto notify_fault;
++ }
+
+ skip_prot:
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+- goto redo;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++ goto redo;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION:
+- /* for operations which don't use a data connection,
+- * skip PASV/PORT */
+- if(client_handle->op == GLOBUS_FTP_CLIENT_CHMOD)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CHMOD;
+- }
++ /* for operations which don't use a data connection,
++ * skip PASV/PORT */
++ if(client_handle->op == GLOBUS_FTP_CLIENT_CHMOD)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CHMOD;
++ }
+ else if(client_handle->op == GLOBUS_FTP_CLIENT_CHGRP)
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CHGRP;
+@@ -2218,39 +2218,39 @@ redo:
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_SYMLINK;
+ }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_DELETE)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_DELETE;
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_MKDIR)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_MKDIR;
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_RMDIR)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_RMDIR;
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_CWD)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CWD;
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_MOVE)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_RNFR;
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_MDTM)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_MDTM;
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_MLST)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_MLST;
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_STAT)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_STAT;
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_DELETE)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_DELETE;
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_MKDIR)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_MKDIR;
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_RMDIR)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_RMDIR;
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_CWD)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CWD;
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_MOVE)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_RNFR;
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_MDTM)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_MDTM;
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_MLST)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_MLST;
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_STAT)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_STAT;
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+ target == client_handle->source && client_handle->dest &&
+ client_handle->dest->state == GLOBUS_FTP_CLIENT_TARGET_SETUP_PASV)
+ {
+@@ -2263,7 +2263,7 @@ redo:
+ }
+
+ /* defaulting to a PASV on the source */
+- else if(client_handle->source_pasv &&
++ else if(client_handle->source_pasv &&
+ target->mode != GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK)
+ {
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION)
+@@ -2272,16 +2272,16 @@ redo:
+ target == client_handle->dest && !client_handle->num_pasv_addresses)
+ {
+ target = client_handle->source;
+-
++
+ error = globus_i_ftp_client_target_activate(
+ client_handle, target, ®istered);
+- if(registered == GLOBUS_FALSE &&
++ if(registered == GLOBUS_FALSE &&
+ client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_ABORT &&
+ client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_RESTART)
+ {
+ goto connection_error;
+ }
+-
++
+ break;
+ }
+ else
+@@ -2289,31 +2289,31 @@ redo:
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PORT;
+ }
+ }
+-
++
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION)
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PASV;
+ }
+ }
+- /* Prefer PASV data connections for stream client/server operations */
++ /* Prefer PASV data connections for stream client/server operations */
+ /* unless asked not to via GLOBUS_FTP_CLIENT_NO_SERVER_PASV env var */
+- else if(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION ||
+- (client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER &&
+- target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM &&
++ else if(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION ||
++ (client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER &&
++ target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM &&
+ !getenv("GLOBUS_FTP_CLIENT_NO_SERVER_PASV")))
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PASV;
+- }
+- /* In extended block mode, we MUST have RETR/LIST in PORT mode */
+- else
+- {
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PORT;
+- }
+-
+- goto redo;
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PASV;
++ }
++ /* In extended block mode, we MUST have RETR/LIST in PORT mode */
++ else
++ {
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PORT;
++ }
++
++ goto redo;
+
+ case GLOBUS_FTP_CLIENT_TARGET_OPTS_PASV_DELAYED:
+ globus_assert(
+@@ -2327,13 +2327,13 @@ redo:
+ {
+ target->delayed_pasv = target->attr->delayed_pasv;
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PASV;
+-
++
+ goto redo;
+ }
+ /* XXX need to ignore error */
+-
++
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+- goto notify_fault;
++ goto notify_fault;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_PASV:
+ if(gridftp2_getput == GLOBUS_TRUE)
+@@ -2341,17 +2341,17 @@ redo:
+ goto skip_pasv;
+ }
+
+- if(globus_i_ftp_client_can_reuse_data_conn(client_handle))
+- {
+- goto skip_pasv;
+- }
+-
+- if(target->delayed_pasv != target->attr->delayed_pasv &&
+- globus_i_ftp_client_feature_get(target->features,
++ if(globus_i_ftp_client_can_reuse_data_conn(client_handle))
++ {
++ goto skip_pasv;
++ }
++
++ if(target->delayed_pasv != target->attr->delayed_pasv &&
++ globus_i_ftp_client_feature_get(target->features,
+ GLOBUS_FTP_CLIENT_FEATURE_DELAYED_PASV) == GLOBUS_FTP_CLIENT_TRUE)
+ {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_OPTS_PASV_DELAYED;
+-
++ target->state = GLOBUS_FTP_CLIENT_TARGET_OPTS_PASV_DELAYED;
++
+ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_PARAMETERS;
+ globus_i_ftp_client_plugin_notify_command(
+ client_handle,
+@@ -2359,7 +2359,7 @@ redo:
+ target->mask,
+ "OPTS PASV AllowDelayed=%c;" CRLF,
+ target->attr->delayed_pasv ? '1' : '0');
+-
++
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+@@ -2371,7 +2371,7 @@ redo:
+ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+ client_handle->state ==
+ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
++
+ result =
+ globus_ftp_control_send_command(
+ target->control_handle,
+@@ -2379,67 +2379,67 @@ redo:
+ globus_i_ftp_client_response_callback,
+ target,
+ target->attr->delayed_pasv ? '1' : '0');
+-
++
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+ }
+-
++
+ break;
+ }
+
+- if((client_handle->op == GLOBUS_FTP_CLIENT_PUT ||
+- client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER) &&
+- (target->attr->layout.mode != GLOBUS_FTP_CONTROL_STRIPING_NONE ||
+- target->attr->force_striped))
+- {
+- if(target->attr->allow_ipv6)
+- {
+- tmpstr = "SPAS 2";
+- }
+- else
+- {
+- tmpstr = "SPAS";
+- }
+- }
+- else if(target->attr->allow_ipv6)
+- {
++ if((client_handle->op == GLOBUS_FTP_CLIENT_PUT ||
++ client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER) &&
++ (target->attr->layout.mode != GLOBUS_FTP_CONTROL_STRIPING_NONE ||
++ target->attr->force_striped))
++ {
++ if(target->attr->allow_ipv6)
++ {
++ tmpstr = "SPAS 2";
++ }
++ else
++ {
++ tmpstr = "SPAS";
++ }
++ }
++ else if(target->attr->allow_ipv6)
++ {
+ /* if ipv6 is enabled, ensure we connected to an ipv6 addressed
+- * source before using EPSV. otherwise, if dest connected on a
+- * v6 interface we won't have a compatible data address to pass
++ * source before using EPSV. otherwise, if dest connected on a
++ * v6 interface we won't have a compatible data address to pass
+ * to the source via eprt/port.
+- */
+- if(client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- client_handle->source && target == client_handle->dest)
++ */
++ if(client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ client_handle->source && target == client_handle->dest)
+ {
+ globus_ftp_control_host_port_t * host_port;
+-
+- /* if source hasn't connected yet, activate it */
+- if(client_handle->source->state == GLOBUS_FTP_CLIENT_TARGET_START ||
++
++ /* if source hasn't connected yet, activate it */
++ if(client_handle->source->state == GLOBUS_FTP_CLIENT_TARGET_START ||
+ client_handle->source->state == GLOBUS_FTP_CLIENT_TARGET_CLOSED)
+ {
+ target = client_handle->source;
+-
++
+ error = globus_i_ftp_client_target_activate(
+ client_handle, target, ®istered);
+- if(registered == GLOBUS_FALSE &&
++ if(registered == GLOBUS_FALSE &&
+ client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_ABORT &&
+ client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_RESTART)
+ {
+ goto connection_error;
+ }
+-
++
+ break;
+ }
+
+ host_port = globus_libc_calloc(
+ 1, sizeof(globus_ftp_control_host_port_t));
+-
++
+ result = globus_ftp_control_client_get_connection_info_ex(
+ client_handle->source->control_handle,
+- GLOBUS_NULL,
++ GLOBUS_NULL,
+ host_port);
+- /* v4mapped addresses can return an error, but we will
++ /* v4mapped addresses can return an error, but we will
+ correctly use PASV in that case */
+ if(result == GLOBUS_SUCCESS && host_port->hostlen == 16)
+ {
+@@ -2455,79 +2455,79 @@ redo:
+ {
+ tmpstr = "EPSV";
+ }
+- }
+- else
+- {
+- tmpstr = "PASV";
+- }
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_PASV;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_DATA_ESTABLISHMENT;
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "%s" CRLF,
+- tmpstr);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- target->control_handle,
+- "%s" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- tmpstr);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- break;
++ }
++ else
++ {
++ tmpstr = "PASV";
++ }
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_PASV;
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_DATA_ESTABLISHMENT;
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "%s" CRLF,
++ tmpstr);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ target->control_handle,
++ "%s" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ tmpstr);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_PORT:
+- if(globus_i_ftp_client_can_reuse_data_conn(client_handle))
+- {
+- goto skip_port;
+- }
+-
+- /* turn off delayed pasv now that we're going to use PORT */
+- target->delayed_pasv = GLOBUS_FALSE;
+-
+- if(client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER)
+- {
+- if(client_handle->pasv_address)
+- {
+- globus_free(client_handle->pasv_address);
+- }
+- client_handle->pasv_address =
+- globus_libc_malloc(sizeof(globus_ftp_control_host_port_t));
+- client_handle->num_pasv_addresses = 1;
+-
+- memset(client_handle->pasv_address, 0,
+- sizeof(globus_ftp_control_host_port_t));
+-
+- result = globus_ftp_control_local_pasv(target->control_handle,
+- client_handle->pasv_address);
++ if(globus_i_ftp_client_can_reuse_data_conn(client_handle))
++ {
++ goto skip_port;
++ }
++
++ /* turn off delayed pasv now that we're going to use PORT */
++ target->delayed_pasv = GLOBUS_FALSE;
++
++ if(client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER)
++ {
++ if(client_handle->pasv_address)
++ {
++ globus_free(client_handle->pasv_address);
++ }
++ client_handle->pasv_address =
++ globus_libc_malloc(sizeof(globus_ftp_control_host_port_t));
++ client_handle->num_pasv_addresses = 1;
++
++ memset(client_handle->pasv_address, 0,
++ sizeof(globus_ftp_control_host_port_t));
++
++ result = globus_ftp_control_local_pasv(target->control_handle,
++ client_handle->pasv_address);
+ if(result == GLOBUS_SUCCESS && !target->attr->allow_ipv6 &&
+ client_handle->pasv_address[0].hostlen == 16)
+ {
+ char * cs;
+ globus_sockaddr_t addr;
+-
++
+ /* control channel was made with ipv6, but we must have
+ * disabled ipv6 since and need an ipv4 address now.
+ * just use localhost
+@@ -2535,7 +2535,7 @@ redo:
+ GlobusLibcSockaddrSetFamily(addr, AF_INET);
+ GlobusLibcSockaddrSetPort(addr,
+ client_handle->pasv_address[0].port);
+-
++
+ result = globus_libc_addr_to_contact_string(
+ &addr,
+ GLOBUS_LIBC_ADDR_LOCAL | GLOBUS_LIBC_ADDR_NUMERIC |
+@@ -2550,75 +2550,75 @@ redo:
+ &client_handle->pasv_address[0].port);
+ }
+ }
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- }
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ }
+
+ if(gridftp2_getput == GLOBUS_TRUE)
+ {
+ goto skip_port;
+ }
+
+- tmpstr = globus_libc_malloc(56 * client_handle->num_pasv_addresses
+- + 7 /*SPOR|PORT|EPRT\r\n\0*/);
+- /* ' |2|<45>|<5>|' == 56 */
+- if(tmpstr == GLOBUS_NULL)
+- {
+- error = GLOBUS_ERROR_NO_INFO;
+-
+- goto notify_fault;
+- }
+- else
+- {
+- rc = oldrc = 0;
+- if(client_handle->num_pasv_addresses == 1)
+- {
+- if(target->attr->allow_ipv6 &&
+- client_handle->pasv_address[0].hostlen == 16)
+- {
+- rc += sprintf(tmpstr, "EPRT");
+- }
+- else
+- {
+- rc += sprintf(tmpstr, "PORT");
+- }
+- }
+- else
+- {
+- rc += sprintf(tmpstr, "SPOR");
+- }
+-
+- if(rc == oldrc)
+- {
+- error = GLOBUS_ERROR_NO_INFO;
+-
+- goto notify_fault;
+- }
+-
+- for(i = 0; i < client_handle->num_pasv_addresses; i++)
+- {
+- oldrc = rc;
+- if(target->attr->allow_ipv6 &&
+- (client_handle->num_pasv_addresses > 1 ||
+- client_handle->pasv_address[0].hostlen == 16))
+- {
+- char buf[50];
+-
+- globus_ftp_control_host_port_get_host(
++ tmpstr = globus_libc_malloc(56 * client_handle->num_pasv_addresses
++ + 7 /*SPOR|PORT|EPRT\r\n\0*/);
++ /* ' |2|<45>|<5>|' == 56 */
++ if(tmpstr == GLOBUS_NULL)
++ {
++ error = GLOBUS_ERROR_NO_INFO;
++
++ goto notify_fault;
++ }
++ else
++ {
++ rc = oldrc = 0;
++ if(client_handle->num_pasv_addresses == 1)
++ {
++ if(target->attr->allow_ipv6 &&
++ client_handle->pasv_address[0].hostlen == 16)
++ {
++ rc += sprintf(tmpstr, "EPRT");
++ }
++ else
++ {
++ rc += sprintf(tmpstr, "PORT");
++ }
++ }
++ else
++ {
++ rc += sprintf(tmpstr, "SPOR");
++ }
++
++ if(rc == oldrc)
++ {
++ error = GLOBUS_ERROR_NO_INFO;
++
++ goto notify_fault;
++ }
++
++ for(i = 0; i < client_handle->num_pasv_addresses; i++)
++ {
++ oldrc = rc;
++ if(target->attr->allow_ipv6 &&
++ (client_handle->num_pasv_addresses > 1 ||
++ client_handle->pasv_address[0].hostlen == 16))
++ {
++ char buf[50];
++
++ globus_ftp_control_host_port_get_host(
+ &client_handle->pasv_address[i], buf);
+-
+- rc += sprintf(&tmpstr[oldrc],
++
++ rc += sprintf(&tmpstr[oldrc],
+ " |%d|%s|%d|",
+ client_handle->pasv_address[i].hostlen == 16
+ ? 2 : 1,
+ buf,
+ (int) client_handle->pasv_address[i].port);
+- }
+- else
+- {
++ }
++ else
++ {
+ rc += sprintf(&tmpstr[oldrc],
+ " %d,%d,%d,%d,%d,%d",
+ client_handle->pasv_address[i].host[0],
+@@ -2635,490 +2635,490 @@ redo:
+
+ goto notify_fault;
+ }
+- }
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_DATA_ESTABLISHMENT;
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "%s" CRLF,
+- tmpstr);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- globus_libc_free(tmpstr);
+- break;
+- }
+- globus_assert( client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_PORT;
+-
+- result =
+- globus_ftp_control_send_command(
+- target->control_handle,
+- "%s" CRLF,
+- globus_i_ftp_client_response_callback,
+- target,
+- tmpstr);
+-
+- globus_libc_free(tmpstr);
+- }
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- break;
++ }
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_DATA_ESTABLISHMENT;
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "%s" CRLF,
++ tmpstr);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ globus_libc_free(tmpstr);
++ break;
++ }
++ globus_assert( client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_PORT;
++
++ result =
++ globus_ftp_control_send_command(
++ target->control_handle,
++ "%s" CRLF,
++ globus_i_ftp_client_response_callback,
++ target,
++ tmpstr);
++
++ globus_libc_free(tmpstr);
++ }
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_PASV:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- if(target->delayed_pasv)
+- {
+- goto skip_pasv;
+- }
+-
+- globus_l_ftp_client_parse_pasv(
+- handle,
+- response,
+- &client_handle->pasv_address,
+- &client_handle->num_pasv_addresses);
+-
+- if(client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER)
+- {
+-
+- if(client_handle->num_pasv_addresses == 1)
+- {
+- result =
+- globus_ftp_control_local_port(
+- handle,
+- client_handle->pasv_address);
+- }
+- else
+- {
+- result =
+- globus_ftp_control_local_spor(
+- handle,
+- client_handle->pasv_address,
+- client_handle->num_pasv_addresses);
+- }
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- }
+-
+- /* Store the current data connection in the cache for
+- * the target associated with this transfer, if the server
+- * will support it.
+- */
+- if(globus_l_ftp_client_can_cache_data_connection(target))
+- {
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ if(target->delayed_pasv)
++ {
++ goto skip_pasv;
++ }
++
++ globus_l_ftp_client_parse_pasv(
++ handle,
++ response,
++ &client_handle->pasv_address,
++ &client_handle->num_pasv_addresses);
++
++ if(client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER)
++ {
++
++ if(client_handle->num_pasv_addresses == 1)
++ {
++ result =
++ globus_ftp_control_local_port(
++ handle,
++ client_handle->pasv_address);
++ }
++ else
++ {
++ result =
++ globus_ftp_control_local_spor(
++ handle,
++ client_handle->pasv_address,
++ client_handle->num_pasv_addresses);
++ }
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ }
++
++ /* Store the current data connection in the cache for
++ * the target associated with this transfer, if the server
++ * will support it.
++ */
++ if(globus_l_ftp_client_can_cache_data_connection(target))
++ {
+ if(client_handle->op == GLOBUS_FTP_CLIENT_LIST ||
+ client_handle->op == GLOBUS_FTP_CLIENT_NLST ||
+ client_handle->op == GLOBUS_FTP_CLIENT_MLSD ||
+ client_handle->op == GLOBUS_FTP_CLIENT_MLSR)
+ {
+- target->cached_data_conn.operation = GLOBUS_FTP_CLIENT_GET;
++ target->cached_data_conn.operation = GLOBUS_FTP_CLIENT_GET;
++ }
++ else
++ {
++ target->cached_data_conn.operation = client_handle->op;
++ }
++
++ target->cached_data_conn.source = client_handle->source;
++ target->cached_data_conn.dest = client_handle->dest;
++ }
++ /* In a 3rd party transfer, we need to clear the peer's
++ * data connection cache if we've called passive on the
++ * destination server.
++ */
++ if(client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER)
++ {
++ memset(&client_handle->source->cached_data_conn,
++ '\0',
++ sizeof(globus_i_ftp_client_data_target_t));
++ }
++
++ skip_pasv:
++ if((client_handle->op == GLOBUS_FTP_CLIENT_PUT ||
++ (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ client_handle->dest == target)) &&
++ target->attr->allocated_size > 0)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_ALLO;
++ }
++ else if(client_handle->restart_marker.type !=
++ GLOBUS_FTP_CLIENT_RESTART_NONE)
++ {
++ if(target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_REST_STREAM;
+ }
+ else
+ {
+- target->cached_data_conn.operation = client_handle->op;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_REST_EB;
+ }
+-
+- target->cached_data_conn.source = client_handle->source;
+- target->cached_data_conn.dest = client_handle->dest;
+- }
+- /* In a 3rd party transfer, we need to clear the peer's
+- * data connection cache if we've called passive on the
+- * destination server.
+- */
+- if(client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER)
+- {
+- memset(&client_handle->source->cached_data_conn,
+- '\0',
+- sizeof(globus_i_ftp_client_data_target_t));
+- }
+-
+- skip_pasv:
+- if((client_handle->op == GLOBUS_FTP_CLIENT_PUT ||
+- (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- client_handle->dest == target)) &&
+- target->attr->allocated_size > 0)
++ }
++ else
+ {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_ALLO;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_OPERATION;
+ }
+- else if(client_handle->restart_marker.type !=
+- GLOBUS_FTP_CLIENT_RESTART_NONE)
+- {
+- if(target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_REST_STREAM;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_REST_EB;
+- }
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_OPERATION;
+- }
+-
+- /* if this was a source pasv, continue setting up the dest */
++
++ /* if this was a source pasv, continue setting up the dest */
+ if(client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+ target == client_handle->source && !target->delayed_pasv)
+ {
+ target = client_handle->dest;
+-
++
+ error = globus_i_ftp_client_target_activate(
+ client_handle, target, ®istered);
+- if(registered == GLOBUS_FALSE &&
++ if(registered == GLOBUS_FALSE &&
+ client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_ABORT &&
+ client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_RESTART)
+ {
+ goto connection_error;
+ }
+-
++
+ break;
+ }
+- }
++ }
+ else if(!error)
+- {
++ {
+ /* try without ipv6 */
+- if(target->attr->allow_ipv6)
+- {
+- target->attr->allow_ipv6 = GLOBUS_FALSE;
+- globus_ftp_control_ipv6_allow(handle, GLOBUS_FALSE);
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PASV;
+- }
++ if(target->attr->allow_ipv6)
++ {
++ target->attr->allow_ipv6 = GLOBUS_FALSE;
++ globus_ftp_control_ipv6_allow(handle, GLOBUS_FALSE);
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PASV;
++ }
+ /* Try doing a PORT for a client/server transfer */
+- else if(client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER &&
+- target->mode != GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK )
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PORT;
+- }
+- /* Try the PASV on the other server for a 3rd party transfer */
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- target->mode != GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK &&
+- !client_handle->tried_both_pasv)
+- {
++ else if(client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER &&
++ target->mode != GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK )
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PORT;
++ }
++ /* Try the PASV on the other server for a 3rd party transfer */
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ target->mode != GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK &&
++ !client_handle->tried_both_pasv)
++ {
+ client_handle->tried_both_pasv = GLOBUS_TRUE;
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+ client_handle->source_pasv = !client_handle->source_pasv;
+- target = (target == client_handle->source) ?
++ target = (target == client_handle->source) ?
+ client_handle->dest : client_handle->source;
+
+ error = globus_i_ftp_client_target_activate(
+ client_handle, target, ®istered);
+- if(registered == GLOBUS_FALSE &&
++ if(registered == GLOBUS_FALSE &&
+ client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_ABORT &&
+ client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_RESTART)
+ {
+ goto connection_error;
+ }
+-
++
+ break;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+- goto notify_fault;
+- }
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+- goto notify_fault;
+- }
+-
+- goto redo;
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++ goto notify_fault;
++ }
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++ goto notify_fault;
++ }
++
++ goto redo;
+
+ case GLOBUS_FTP_CLIENT_TARGET_PORT:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- if(globus_l_ftp_client_can_cache_data_connection(target))
+- {
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ if(globus_l_ftp_client_can_cache_data_connection(target))
++ {
+ if(client_handle->op == GLOBUS_FTP_CLIENT_LIST ||
+ client_handle->op == GLOBUS_FTP_CLIENT_NLST ||
+ client_handle->op == GLOBUS_FTP_CLIENT_MLSD ||
+ client_handle->op == GLOBUS_FTP_CLIENT_MLSR)
+ {
+- target->cached_data_conn.operation = GLOBUS_FTP_CLIENT_GET;
++ target->cached_data_conn.operation = GLOBUS_FTP_CLIENT_GET;
+ }
+ else
+ {
+ target->cached_data_conn.operation = client_handle->op;
+ }
+-
+- target->cached_data_conn.source = client_handle->source;
+- target->cached_data_conn.dest = client_handle->dest;
+- }
+
+- skip_port:
++ target->cached_data_conn.source = client_handle->source;
++ target->cached_data_conn.dest = client_handle->dest;
++ }
++
++ skip_port:
+ if((client_handle->op == GLOBUS_FTP_CLIENT_PUT ||
+- (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- client_handle->dest == target)) &&
++ (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ client_handle->dest == target)) &&
+ target->attr->allocated_size > 0)
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_ALLO;
+ }
+- else if(client_handle->restart_marker.type !=
+- GLOBUS_FTP_CLIENT_RESTART_NONE)
+- {
+- if(target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_REST_STREAM;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_REST_EB;
+- }
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_OPERATION;
+- }
+- }
+- else if(!error && target->attr->allow_ipv6 &&
+- client_handle->op == GLOBUS_FTP_CLIENT_GET)
+- {
+- target->attr->allow_ipv6 = GLOBUS_FALSE;
+- globus_ftp_control_ipv6_allow(handle, GLOBUS_FALSE);
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PORT;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- }
+- goto redo;
++ else if(client_handle->restart_marker.type !=
++ GLOBUS_FTP_CLIENT_RESTART_NONE)
++ {
++ if(target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_REST_STREAM;
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_REST_EB;
++ }
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_OPERATION;
++ }
++ }
++ else if(!error && target->attr->allow_ipv6 &&
++ client_handle->op == GLOBUS_FTP_CLIENT_GET)
++ {
++ target->attr->allow_ipv6 = GLOBUS_FALSE;
++ globus_ftp_control_ipv6_allow(handle, GLOBUS_FALSE);
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PORT;
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ }
++ goto redo;
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_REST_STREAM:
+- /*
+- * REST must be the last thing done on the control connection
+- * before sending the RETR, STOR, ERET, or ESTO command.
+- */
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if(!globus_i_ftp_client_feature_get(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_REST_STREAM))
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto connection_error;
+- }
+- target->state = GLOBUS_FTP_CLIENT_TARGET_REST;
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_MODIFIERS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
++ /*
++ * REST must be the last thing done on the control connection
++ * before sending the RETR, STOR, ERET, or ESTO command.
++ */
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if(!globus_i_ftp_client_feature_get(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_REST_STREAM))
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto connection_error;
++ }
++ target->state = GLOBUS_FTP_CLIENT_TARGET_REST;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_MODIFIERS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
+ target->url_string,
+- target->mask,
+- "REST %" GLOBUS_OFF_T_FORMAT CRLF,
+- target->type == GLOBUS_FTP_CONTROL_TYPE_ASCII
+- ? client_handle->restart_marker.stream.ascii_offset
+- : client_handle->restart_marker.stream.offset);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- handle,
+- "REST %" GLOBUS_OFF_T_FORMAT CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- target->type == GLOBUS_FTP_CONTROL_TYPE_ASCII
+- ? client_handle->restart_marker.stream.ascii_offset
+- : client_handle->restart_marker.stream.offset);
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
+-
++ target->mask,
++ "REST %" GLOBUS_OFF_T_FORMAT CRLF,
++ target->type == GLOBUS_FTP_CONTROL_TYPE_ASCII
++ ? client_handle->restart_marker.stream.ascii_offset
++ : client_handle->restart_marker.stream.offset);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ handle,
++ "REST %" GLOBUS_OFF_T_FORMAT CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ target->type == GLOBUS_FTP_CONTROL_TYPE_ASCII
++ ? client_handle->restart_marker.stream.ascii_offset
++ : client_handle->restart_marker.stream.offset);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
++
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_ALLO:
+- /*
+- * ALLO is sent before a STOR, REST or STOR is next.
+- */
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_ALLO;
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_MODIFIERS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
++ /*
++ * ALLO is sent before a STOR, REST or STOR is next.
++ */
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_ALLO;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_MODIFIERS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
+ target->url_string,
+- target->mask,
+- "ALLO %" GLOBUS_OFF_T_FORMAT CRLF,
+- target->attr->allocated_size);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- handle,
+- "ALLO %" GLOBUS_OFF_T_FORMAT CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- target->attr->allocated_size);
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ target->mask,
++ "ALLO %" GLOBUS_OFF_T_FORMAT CRLF,
++ target->attr->allocated_size);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ handle,
++ "ALLO %" GLOBUS_OFF_T_FORMAT CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ target->attr->allocated_size);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_REST_EB:
+- /*
+- * REST must be the last thing done on the control connection
+- * before sending the RETR, STOR, ERET, or ESTO command.
+- */
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- globus_ftp_client_restart_marker_to_string(
++ /*
++ * REST must be the last thing done on the control connection
++ * before sending the RETR, STOR, ERET, or ESTO command.
++ */
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ globus_ftp_client_restart_marker_to_string(
+ &client_handle->restart_marker,
+ &tmpstr);
+
+- if(tmpstr)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_REST;
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_MODIFIERS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "REST %s" CRLF,
+- tmpstr);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- result = globus_ftp_control_send_command(
+- handle,
+- "REST %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- tmpstr);
+-
+- globus_libc_free(tmpstr);
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_OPERATION;
+- goto redo;
+- }
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ if(tmpstr)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_REST;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_TRANSFER_MODIFIERS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "REST %s" CRLF,
++ tmpstr);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ result = globus_ftp_control_send_command(
++ handle,
++ "REST %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ tmpstr);
++
++ globus_libc_free(tmpstr);
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_OPERATION;
++ goto redo;
++ }
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_REST:
+- globus_assert(
+- client_handle->state ==
++ globus_assert(
++ client_handle->state ==
+ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+ client_handle->state ==
+ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_INTERMEDIATE_REPLY)
+- {
+- if(target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM)
+- {
+- globus_i_ftp_client_feature_set(
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_INTERMEDIATE_REPLY)
++ {
++ if(target->mode == GLOBUS_FTP_CONTROL_MODE_STREAM)
++ {
++ globus_i_ftp_client_feature_set(
+ target->features,
+ GLOBUS_FTP_CLIENT_FEATURE_REST_STREAM,
+ GLOBUS_FTP_CLIENT_TRUE);
+- }
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++ }
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+
+- goto notify_fault;
+- }
++ goto notify_fault;
++ }
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_OPERATION;
+- goto redo;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_OPERATION;
++ goto redo;
+
+ case GLOBUS_FTP_CLIENT_TARGET_ALLO:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- }
+- else
+- {
+- /* Don't think we really care about error response here
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- goto notify_fault;
+- */
+- }
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ }
++ else
++ {
++ /* Don't think we really care about error response here
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ goto notify_fault;
++ */
++ }
+ if(client_handle->restart_marker.type !=
+ GLOBUS_FTP_CLIENT_RESTART_NONE)
+ {
+@@ -3135,16 +3135,16 @@ redo:
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_OPERATION;
+ }
+- goto redo;
++ goto redo;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_OPERATION:
+- switch(client_handle->op)
+- {
+- case GLOBUS_FTP_CLIENT_LIST:
+- case GLOBUS_FTP_CLIENT_NLST:
+- case GLOBUS_FTP_CLIENT_MLSD:
++ switch(client_handle->op)
++ {
++ case GLOBUS_FTP_CLIENT_LIST:
++ case GLOBUS_FTP_CLIENT_NLST:
++ case GLOBUS_FTP_CLIENT_MLSD:
+ case GLOBUS_FTP_CLIENT_MLSR:
+- if(target->attr->cwd_first)
++ if(target->attr->cwd_first)
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_LIST_CWD;
+ }
+@@ -3152,8 +3152,8 @@ redo:
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_LIST;
+ }
+- goto redo;
+- case GLOBUS_FTP_CLIENT_GET:
++ goto redo;
++ case GLOBUS_FTP_CLIENT_GET:
+ if (gridftp2_getput == GLOBUS_TRUE)
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_GETPUT_GET;
+@@ -3163,7 +3163,7 @@ redo:
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_GET;
+ }
+ goto redo;
+- case GLOBUS_FTP_CLIENT_PUT:
++ case GLOBUS_FTP_CLIENT_PUT:
+ if (gridftp2_getput == GLOBUS_TRUE)
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_GETPUT_PUT;
+@@ -3172,67 +3172,67 @@ redo:
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_PUT;
+ }
+- goto redo;
+- case GLOBUS_FTP_CLIENT_TRANSFER:
+- if(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION)
+- {
++ goto redo;
++ case GLOBUS_FTP_CLIENT_TRANSFER:
++ if(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION)
++ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_TRANSFER_DEST;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_TRANSFER_SOURCE;
+- }
+- goto redo;
+- case GLOBUS_FTP_CLIENT_IDLE:
+- globus_assert(client_handle->op != GLOBUS_FTP_CLIENT_IDLE);
+- goto finish;
+-
+- default:/* No other states should occur */
+- globus_assert(0 && "Unexpected state");
+- }
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_TRANSFER_SOURCE;
++ }
++ goto redo;
++ case GLOBUS_FTP_CLIENT_IDLE:
++ globus_assert(client_handle->op != GLOBUS_FTP_CLIENT_IDLE);
++ goto finish;
++
++ default:/* No other states should occur */
++ globus_assert(0 && "Unexpected state");
++ }
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_LIST_CWD:
+- /*
+- * CWD before a listing operation.
+- */
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_LIST;
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
++ /*
++ * CWD before a listing operation.
++ */
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_LIST;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
+ target->url_string,
+- target->mask,
+- "CWD %s" CRLF,
+- pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- result = globus_ftp_control_send_command(
+- handle,
+- "CWD %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- pathname);
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ target->mask,
++ "CWD %s" CRLF,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ result = globus_ftp_control_send_command(
++ handle,
++ "CWD %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ pathname);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_LIST:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+
+ /* if there is a response before this it is probably from a
+ CWD or NOOP */
+@@ -3245,7 +3245,7 @@ redo:
+ else
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
++
+ goto notify_fault;
+ }
+ }
+@@ -3261,188 +3261,188 @@ redo:
+ {
+ result = GLOBUS_SUCCESS;
+ }
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_LIST;
+
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- client_handle->state =
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_LIST;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_LIST;
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ client_handle->state =
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_LIST;
+
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+
+- switch(client_handle->op)
+- {
+- case GLOBUS_FTP_CLIENT_LIST:
+- list_str = "LIST";
+- break;
++ switch(client_handle->op)
++ {
++ case GLOBUS_FTP_CLIENT_LIST:
++ list_str = "LIST";
++ break;
+
+- case GLOBUS_FTP_CLIENT_NLST:
+- list_str = "NLST";
+- break;
++ case GLOBUS_FTP_CLIENT_NLST:
++ list_str = "NLST";
++ break;
+
+- case GLOBUS_FTP_CLIENT_MLSD:
+- list_str = "MLSD";
+- break;
++ case GLOBUS_FTP_CLIENT_MLSD:
++ list_str = "MLSD";
++ break;
+
+ case GLOBUS_FTP_CLIENT_MLSR:
+ list_str = "MLSR";
+ break;
+-
++
+ default:
+ globus_assert(0 && "Unexpected list op");
+ break;
+- }
+-
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "%s %s" CRLF,
+- list_str,
+- target->attr->cwd_first ? "" : pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_LIST);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "%s %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- list_str,
+- target->attr->cwd_first ? "" : pathname);
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ }
++
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "%s %s" CRLF,
++ list_str,
++ target->attr->cwd_first ? "" : pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_LIST);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "%s %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ list_str,
++ target->attr->cwd_first ? "" : pathname);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_MLST:
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "MLST %s" CRLF,
+- pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "MLST %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- pathname);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "MLST %s" CRLF,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "MLST %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ pathname);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_STAT:
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "STAT %s" CRLF,
+- pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "STAT %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- pathname);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "STAT %s" CRLF,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "STAT %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ pathname);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_CHMOD:
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "SITE CHMOD %04o %s" CRLF,
+- client_handle->chmod_file_mode,
+- pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "SITE CHMOD %04o %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- client_handle->chmod_file_mode,
+- pathname);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
+-
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "SITE CHMOD %04o %s" CRLF,
++ client_handle->chmod_file_mode,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "SITE CHMOD %04o %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ client_handle->chmod_file_mode,
++ pathname);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
++
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_CHGRP:
+
+ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+@@ -3538,19 +3538,19 @@ redo:
+ globus_ftp_client_handleattr_t handle_attr;
+ char * encoded_url;
+ int spaces;
+-
++
+ handle_attr = &client_handle->attr;
+-
++
+ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+-
++
+ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
++
+ result = globus_ftp_client_handleattr_get_rfc1738_url(&handle_attr, &rfc1738_url);
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+ }
+-
++
+ if(rfc1738_url==GLOBUS_TRUE)
+ {
+ result = (globus_result_t) globus_url_parse_rfc1738(client_handle->dest_url, &dest_url);
+@@ -3559,17 +3559,17 @@ redo:
+ {
+ result = (globus_result_t) globus_url_parse(client_handle->dest_url, &dest_url);
+ }
+-
++
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+ }
+-
++
+ encoded_url = dest_url.url_path;
+ {
+ char * s;
+ char * d;
+-
++
+ for(s = encoded_url, spaces = 0; *s; ++s)
+ {
+ if(*s == ' ')
+@@ -3577,7 +3577,7 @@ redo:
+ ++spaces;
+ }
+ }
+-
++
+ if(spaces)
+ {
+ encoded_url = (char *) globus_malloc(strlen(dest_url.url_path) + (2 * spaces) + 1);
+@@ -3600,345 +3600,345 @@ redo:
+ *d = '\0';
+ }
+ }
+-
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "SITE SYMLINK %s %s" CRLF,
++ encoded_url,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ globus_url_destroy(&dest_url);
++ if (spaces) globus_free(encoded_url);
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "SITE SYMLINK %s %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ encoded_url,
++ pathname);
++
++ if (spaces) globus_free(encoded_url);
++ globus_url_destroy(&dest_url);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ }
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_DELETE:
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "DELE %s" CRLF,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "DELE %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ pathname);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_RNFR:
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_RNTO;
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "RNFR %s" CRLF,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "RNFR %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ pathname);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
++
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_RNTO:
++ {
++ globus_url_t dest_url;
++ globus_bool_t rfc1738_url;
++ globus_ftp_client_handleattr_t handle_attr;
++
++ handle_attr = &client_handle->attr;
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++
++ result = globus_ftp_client_handleattr_get_rfc1738_url(&handle_attr,
++ &rfc1738_url);
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
++ if(rfc1738_url==GLOBUS_TRUE)
++ {
++ result = (globus_result_t) globus_url_parse_rfc1738(client_handle->dest_url,
++ &dest_url);
++ }
++ else
++ {
++ result = (globus_result_t) globus_url_parse(client_handle->dest_url,
++ &dest_url);
++ }
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++
+ globus_i_ftp_client_plugin_notify_command(
+ client_handle,
+ target->url_string,
+ target->mask,
+- "SITE SYMLINK %s %s" CRLF,
+- encoded_url,
+- pathname);
+-
++ "RNTO %s" CRLF,
++ dest_url.url_path);
++
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+ {
+ globus_url_destroy(&dest_url);
+- if (spaces) globus_free(encoded_url);
+ break;
+ }
+-
++
+ globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "SITE SYMLINK %s %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- encoded_url,
+- pathname);
+-
+- if (spaces) globus_free(encoded_url);
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ {
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "RNTO %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ dest_url.url_path);
++ }
++
+ globus_url_destroy(&dest_url);
+-
++
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+ }
++ break;
+ }
+- break;
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_MKDIR:
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_DELETE:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "DELE %s" CRLF,
+- pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "DELE %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- pathname);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_RNFR:
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "MKD %s" CRLF,
++ pathname);
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_RNTO;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "RNFR %s" CRLF,
+- pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "RNFR %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- pathname);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_RNTO:
+- {
+- globus_url_t dest_url;
+- globus_bool_t rfc1738_url;
+- globus_ftp_client_handleattr_t handle_attr;
+-
+- handle_attr = &client_handle->attr;
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
+- result = globus_ftp_client_handleattr_get_rfc1738_url(&handle_attr,
+- &rfc1738_url);
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- if(rfc1738_url==GLOBUS_TRUE)
+- {
+- result = (globus_result_t) globus_url_parse_rfc1738(client_handle->dest_url,
+- &dest_url);
+- }
+- else
+- {
+- result = (globus_result_t) globus_url_parse(client_handle->dest_url,
+- &dest_url);
+- }
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "MKD %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ pathname);
+
+ if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "RNTO %s" CRLF,
+- dest_url.url_path);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- globus_url_destroy(&dest_url);
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- {
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "RNTO %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- dest_url.url_path);
+- }
++ {
++ goto result_fault;
++ }
++ break;
+
+- globus_url_destroy(&dest_url);
++ case GLOBUS_FTP_CLIENT_TARGET_SETUP_RMDIR:
+
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
+- }
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_MKDIR:
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "MKD %s" CRLF,
+- pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "MKD %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- pathname);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+
+- case GLOBUS_FTP_CLIENT_TARGET_SETUP_RMDIR:
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "RMD %s" CRLF,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "RMD %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ pathname);
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "RMD %s" CRLF,
+- pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "RMD %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- pathname);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_CWD:
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+
+ /*
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "MLST %s" CRLF,
+- pathname);
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "MLST %s" CRLF,
++ pathname);
+ */
+
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "CWD %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- pathname);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "CWD %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ pathname);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_MDTM:
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+-
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "MDTM %s" CRLF,
+- pathname);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+-
+- result =
+- globus_ftp_control_send_command(
+- handle,
+- "MDTM %s" CRLF,
+- globus_i_ftp_client_response_callback,
+- user_arg,
+- pathname);
+-
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
+- break;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "MDTM %s" CRLF,
++ pathname);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++
++ result =
++ globus_ftp_control_send_command(
++ handle,
++ "MDTM %s" CRLF,
++ globus_i_ftp_client_response_callback,
++ user_arg,
++ pathname);
++
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_GET:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+
+ if(!target->delayed_pasv)
+ {
+@@ -3952,46 +3952,46 @@ redo:
+ result = GLOBUS_SUCCESS;
+ }
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_RETR;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_RETR;
+
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
+
+- client_handle->state =
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET;
++ client_handle->state =
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET;
+
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+
+ if(target->attr->module_alg_str != GLOBUS_NULL)
+- {
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "ERET %s %s" CRLF,
++ {
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "ERET %s %s" CRLF,
+ target->attr->module_alg_str,
+- pathname);
+- }
+- else
+- {
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "RETR %s" CRLF,
+- pathname);
+- }
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET);
++ pathname);
++ }
++ else
++ {
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "RETR %s" CRLF,
++ pathname);
++ }
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET);
+
+
+ if(!0)
+@@ -4017,7 +4017,7 @@ redo:
+ user_arg,
+ pathname);
+ }
+-
++
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+@@ -4027,12 +4027,12 @@ redo:
+ if(client_handle->attr.pipeline_callback)
+ {
+ globus_bool_t added = GLOBUS_TRUE;
+-
++
+ while(added)
+ {
+ result = globus_l_ftp_client_pp_src_add(
+ client_handle,
+- handle,
++ handle,
+ target,
+ &added);
+ if(result != GLOBUS_SUCCESS)
+@@ -4044,11 +4044,11 @@ redo:
+ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_PUT:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+
+- if(!target->delayed_pasv)
++ if(!target->delayed_pasv)
+ {
+ result =
+ globus_ftp_control_data_connect_write(target->control_handle,
+@@ -4060,47 +4060,47 @@ redo:
+ result = GLOBUS_SUCCESS;
+ }
+
+- target->state = GLOBUS_FTP_CLIENT_TARGET_STOR;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_STOR;
+
+- if(result != GLOBUS_SUCCESS)
+- {
+- goto result_fault;
+- }
++ if(result != GLOBUS_SUCCESS)
++ {
++ goto result_fault;
++ }
+
+- client_handle->state =
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO;
++ client_handle->state =
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO;
+
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+
+- if(target->attr->module_alg_str != GLOBUS_NULL)
+- {
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "ESTO %s %s" CRLF,
++ if(target->attr->module_alg_str != GLOBUS_NULL)
++ {
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "ESTO %s %s" CRLF,
+ target->attr->module_alg_str,
+- pathname);
+- }
+- else
+- {
+- globus_i_ftp_client_plugin_notify_command(
+- client_handle,
+- target->url_string,
+- target->mask,
+- "%s %s" CRLF,
+- target->attr->append ? "APPE" : "STOR",
+- pathname);
+- }
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO);
++ pathname);
++ }
++ else
++ {
++ globus_i_ftp_client_plugin_notify_command(
++ client_handle,
++ target->url_string,
++ target->mask,
++ "%s %s" CRLF,
++ target->attr->append ? "APPE" : "STOR",
++ pathname);
++ }
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO);
+
+ if(!0)
+ {
+@@ -4144,7 +4144,7 @@ redo:
+ if(client_handle->attr.pipeline_callback)
+ {
+ globus_bool_t added = GLOBUS_TRUE;
+-
++
+ while(added)
+ {
+ result = globus_l_ftp_client_pp_dst_add(
+@@ -4159,36 +4159,36 @@ redo:
+ }
+ }
+
+- break;
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_TRANSFER_DEST:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+
+- /* The destination is prepared first. We send all
+- * of the commands we need to, including the STOR
+- * or ESTO, and then turn our attention to the
+- * source.
+- */
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++ /* The destination is prepared first. We send all
++ * of the commands we need to, including the STOR
++ * or ESTO, and then turn our attention to the
++ * source.
++ */
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+
+ if(gridftp2_getput)
+ {
+- result =
++ result =
+ globus_l_ftp_client_send_put(target, pathname, GLOBUS_TRUE);
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+ }
+-
++
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+ {
+ break;
+ }
+-
++
+ if(globus_i_ftp_client_can_reuse_data_conn(client_handle))
+ {
+ /* In this case we do not expect a 127 reply.
+@@ -4198,7 +4198,7 @@ redo:
+ else
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_GETPUT_PASV_TRANSFER;
+-
++
+ /* In this case we have to wait for the 127 reply
+ * before we can setup the transfer at the source.
+ */
+@@ -4226,19 +4226,19 @@ redo:
+ "STOR %s" CRLF,
+ pathname);
+ }
+-
++
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+ {
+ break;
+ }
+-
++
+ globus_assert(client_handle->state ==
+ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
++
+ target->state = GLOBUS_FTP_CLIENT_TARGET_STOR;
+-
++
+ if(target->attr->module_alg_str != GLOBUS_NULL)
+ {
+ result = globus_ftp_control_send_command(
+@@ -4268,7 +4268,7 @@ redo:
+ int i;
+ globus_bool_t added = GLOBUS_TRUE;
+ globus_i_ftp_client_url_ent_t * url_ent;
+-
++
+ /* add the one we just sent to the response queue */
+ url_ent = globus_malloc(sizeof(globus_i_ftp_client_url_ent_t));
+ url_ent->source_url = NULL;
+@@ -4279,12 +4279,12 @@ redo:
+ client_handle->attr.rfc1738_url);
+ globus_fifo_enqueue(
+ &client_handle->dst_response_pending_queue, url_ent);
+-
++
+ client_handle->no_callback_count++;
+ client_handle->attr.pipeline_done = GLOBUS_FALSE;
+-
++
+ for(
+- i = 0;
++ i = 0;
+ added && i < client_handle->attr.outstanding_commands;
+ i++)
+ {
+@@ -4301,7 +4301,7 @@ redo:
+ }
+ }
+ }
+-
++
+ if(!target->delayed_pasv && !client_handle->source->delayed_pasv)
+ {
+ target = client_handle->source;
+@@ -4322,34 +4322,34 @@ redo:
+ }
+ }
+ }
+- break;
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_TRANSFER_SOURCE:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+
+- client_handle->state =
+- GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER;
++ client_handle->state =
++ GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER;
+
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+
+ if(gridftp2_getput)
+ {
+- result =
++ result =
+ globus_l_ftp_client_send_get(target, pathname, GLOBUS_FALSE);
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+ }
+-
++
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+ {
+ break;
+ }
+-
++
+ target->state = GLOBUS_FTP_CLIENT_TARGET_RETR;
+ }
+ else
+@@ -4373,7 +4373,7 @@ redo:
+ "RETR %s" CRLF,
+ pathname);
+ }
+-
++
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+@@ -4382,9 +4382,9 @@ redo:
+ }
+ globus_assert(client_handle->state ==
+ GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER);
+-
++
+ target->state = GLOBUS_FTP_CLIENT_TARGET_RETR;
+-
++
+ if(target->attr->module_alg_str)
+ {
+ result = globus_ftp_control_send_command(
+@@ -4408,13 +4408,13 @@ redo:
+ {
+ goto result_fault;
+ }
+-
++
+ if(client_handle->attr.pipeline_callback)
+ {
+ int i;
+ globus_bool_t added = GLOBUS_TRUE;
+ globus_i_ftp_client_url_ent_t * url_ent;
+-
++
+ /* add the one we just sent to the response queue */
+ url_ent = globus_malloc(sizeof(globus_i_ftp_client_url_ent_t));
+ url_ent->source_url = globus_libc_strdup(target->url_string);
+@@ -4425,12 +4425,12 @@ redo:
+ client_handle->attr.rfc1738_url);
+ globus_fifo_enqueue(
+ &client_handle->src_response_pending_queue, url_ent);
+-
++
+ client_handle->no_callback_count++;
+ client_handle->attr.pipeline_done = GLOBUS_FALSE;
+-
++
+ for(
+- i = 0;
++ i = 0;
+ added && i < client_handle->attr.outstanding_commands;
+ i++)
+ {
+@@ -4446,17 +4446,17 @@ redo:
+ }
+ }
+ }
+-
++
+ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_GETPUT_GET:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION);
+
+ client_handle->state =
+ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET;
+-
++
+ if(target->mode == GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK ||
+ globus_i_ftp_client_can_reuse_data_conn(client_handle))
+ {
+@@ -4488,21 +4488,21 @@ redo:
+ target->state = GLOBUS_FTP_CLIENT_TARGET_GETPUT_PASV_GET;
+ }
+
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+- if(target->mode == GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK)
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++ if(target->mode == GLOBUS_FTP_CONTROL_MODE_EXTENDED_BLOCK)
+ {
+ /* In extended block mode, we will be the passive
+ * party. GLOBUS_FTP_CLIENT_TARGET_SETUP_PORT has already
+ * filled in client_handle->pasv_address.
+ */
+- result =
++ result =
+ globus_l_ftp_client_send_get(target, pathname, GLOBUS_FALSE);
+ }
+ else
+ {
+ /* In all other cases we prefer to be active.
+ */
+- result =
++ result =
+ globus_l_ftp_client_send_get(target, pathname, GLOBUS_TRUE);
+ }
+ if(result != GLOBUS_SUCCESS)
+@@ -4512,9 +4512,9 @@ redo:
+ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_SETUP_GETPUT_PUT:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+
+ client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO;
+
+@@ -4539,26 +4539,26 @@ redo:
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_GETPUT_PASV_PUT;
+ }
+-
+- target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
++
++ target->mask = GLOBUS_FTP_CLIENT_CMD_MASK_FILE_ACTIONS;
+ result = globus_l_ftp_client_send_put(target, pathname, GLOBUS_TRUE);
+ if(result != GLOBUS_SUCCESS)
+ {
+ goto result_fault;
+- }
++ }
+ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_GETPUT_PASV_GET:
+- if((!error) &&
+- response->code == 127)
++ if((!error) &&
++ response->code == 127)
+ {
+ /* Setup our side of PASV.
+ */
+- globus_l_ftp_client_parse_pasv(
+- handle,
+- response,
+- &client_handle->pasv_address,
+- &client_handle->num_pasv_addresses);
++ globus_l_ftp_client_parse_pasv(
++ handle,
++ response,
++ &client_handle->pasv_address,
++ &client_handle->num_pasv_addresses);
+
+ if(client_handle->num_pasv_addresses == 1)
+ {
+@@ -4579,7 +4579,7 @@ redo:
+ {
+ goto result_fault;
+ }
+-
++
+ /* Create the data connection.
+ */
+ result =
+@@ -4590,8 +4590,8 @@ redo:
+ {
+ goto result_fault;
+ }
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_RETR;
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_RETR;
+ }
+ else
+ {
+@@ -4600,17 +4600,17 @@ redo:
+ }
+ break;
+
+- case GLOBUS_FTP_CLIENT_TARGET_GETPUT_PASV_PUT:
+- if((!error) &&
+- response->code == 127)
++ case GLOBUS_FTP_CLIENT_TARGET_GETPUT_PASV_PUT:
++ if((!error) &&
++ response->code == 127)
+ {
+ /* Setup our side of PASV.
+ */
+- globus_l_ftp_client_parse_pasv(
+- handle,
+- response,
+- &client_handle->pasv_address,
+- &client_handle->num_pasv_addresses);
++ globus_l_ftp_client_parse_pasv(
++ handle,
++ response,
++ &client_handle->pasv_address,
++ &client_handle->num_pasv_addresses);
+
+ if(client_handle->num_pasv_addresses == 1)
+ {
+@@ -4631,7 +4631,7 @@ redo:
+ {
+ goto result_fault;
+ }
+-
++
+ /* Create the data connection.
+ */
+ result =
+@@ -4642,7 +4642,7 @@ redo:
+ {
+ goto result_fault;
+ }
+-
++
+ target->state = GLOBUS_FTP_CLIENT_TARGET_STOR;
+ }
+ else
+@@ -4653,14 +4653,14 @@ redo:
+ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_GETPUT_PASV_TRANSFER:
+- if((!error) &&
+- response->code == 127)
++ if((!error) &&
++ response->code == 127)
+ {
+- globus_l_ftp_client_parse_pasv(
+- handle,
+- response,
+- &client_handle->pasv_address,
+- &client_handle->num_pasv_addresses);
++ globus_l_ftp_client_parse_pasv(
++ handle,
++ response,
++ &client_handle->pasv_address,
++ &client_handle->num_pasv_addresses);
+
+ /* The passive end of a 3rd party transfer is always the
+ * destination.
+@@ -4698,39 +4698,39 @@ redo:
+ case GLOBUS_FTP_CLIENT_TARGET_LIST:
+ case GLOBUS_FTP_CLIENT_TARGET_RETR:
+ case GLOBUS_FTP_CLIENT_TARGET_STOR:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_LIST ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER_ONE_COMPLETE ||
+- (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION) ||
+- (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT) ||
+- (target->delayed_pasv && client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION));
+-
+- if((!error) &&
+- response->response_class == GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY)
+- {
+- if(response->code == 127 || response->code == 129)
+- {
+-/* XXX START copy from GLOBUS_FTP_CLIENT_TARGET_PASV */
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_LIST ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER_ONE_COMPLETE ||
++ (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION) ||
++ (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT) ||
++ (target->delayed_pasv && client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION));
++
++ if((!error) &&
++ response->response_class == GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY)
++ {
++ if(response->code == 127 || response->code == 129)
++ {
++/* XXX START copy from GLOBUS_FTP_CLIENT_TARGET_PASV */
+ globus_l_ftp_client_parse_pasv(
+ handle,
+- response,
+- &client_handle->pasv_address,
++ response,
++ &client_handle->pasv_address,
+ &client_handle->num_pasv_addresses);
+-
++
+ if(client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER)
+ {
+-
++
+ if(client_handle->num_pasv_addresses == 1)
+ {
+ result =
+@@ -4751,7 +4751,7 @@ redo:
+ goto result_fault;
+ }
+ }
+-
++
+ /* Store the current data connection in the cache for
+ * the target associated with this transfer, if the server
+ * will support it.
+@@ -4769,7 +4769,7 @@ redo:
+ {
+ target->cached_data_conn.operation = client_handle->op;
+ }
+-
++
+ target->cached_data_conn.source = client_handle->source;
+ target->cached_data_conn.dest = client_handle->dest;
+ }
+@@ -4782,11 +4782,11 @@ redo:
+ memset(&client_handle->source->cached_data_conn,
+ '\0',
+ sizeof(globus_i_ftp_client_data_target_t));
+- }
+-/* XXX END copy from GLOBUS_FTP_CLIENT_TARGET_PASV */
++ }
++/* XXX END copy from GLOBUS_FTP_CLIENT_TARGET_PASV */
+ }
+
+- if((target->delayed_pasv && response->code == 125) ||
++ if((target->delayed_pasv && response->code == 125) ||
+ response->code == 127 || response->code == 129)
+ {
+ if(client_handle->op != GLOBUS_FTP_CLIENT_TRANSFER)
+@@ -4813,9 +4813,9 @@ redo:
+ }
+ else
+ {
+- target = (target == client_handle->source) ?
++ target = (target == client_handle->source) ?
+ client_handle->dest : client_handle->source;
+-
++
+ error =
+ globus_i_ftp_client_target_activate(client_handle,
+ target,
+@@ -4832,93 +4832,93 @@ redo:
+ goto connection_error;
+ }
+ }
+- }
+- }
+-
+- if(response->code == 127 || response->code == 129)
++ }
++ }
++
++ if(response->code == 127 || response->code == 129)
+ {
+ break;
+ }
+
+- /*
+- * this should be a "connected" or "using existing
+- * data connection" response
+- */
+- if(client_handle->op == GLOBUS_FTP_CLIENT_LIST ||
+- client_handle->op == GLOBUS_FTP_CLIENT_NLST ||
+- client_handle->op == GLOBUS_FTP_CLIENT_MLSD ||
++ /*
++ * this should be a "connected" or "using existing
++ * data connection" response
++ */
++ if(client_handle->op == GLOBUS_FTP_CLIENT_LIST ||
++ client_handle->op == GLOBUS_FTP_CLIENT_NLST ||
++ client_handle->op == GLOBUS_FTP_CLIENT_MLSD ||
+ client_handle->op == GLOBUS_FTP_CLIENT_MLSR ||
+- client_handle->op == GLOBUS_FTP_CLIENT_GET ||
+- client_handle->op == GLOBUS_FTP_CLIENT_PUT)
+- {
+- target->state =
+- GLOBUS_FTP_CLIENT_TARGET_READY_FOR_DATA;
+-
+- error =
+- globus_i_ftp_client_data_dispatch_queue(client_handle);
+-
+- if(error != GLOBUS_SUCCESS)
+- {
+- globus_i_ftp_client_plugin_notify_fault(
+- client_handle,
+- target->url_string,
+- error);
+-
++ client_handle->op == GLOBUS_FTP_CLIENT_GET ||
++ client_handle->op == GLOBUS_FTP_CLIENT_PUT)
++ {
++ target->state =
++ GLOBUS_FTP_CLIENT_TARGET_READY_FOR_DATA;
++
++ error =
++ globus_i_ftp_client_data_dispatch_queue(client_handle);
++
++ if(error != GLOBUS_SUCCESS)
++ {
++ globus_i_ftp_client_plugin_notify_fault(
++ client_handle,
++ target->url_string,
++ error);
++
+ if(client_handle->err)
+ {
+- globus_object_free(error);
++ globus_object_free(error);
+ error = NULL;
+- }
+- else
+- {
+- client_handle->err = error;
+- error = GLOBUS_NULL;
+- }
+-
+- if(client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_LIST ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET);
+-
+- client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
+- target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
+- globus_ftp_control_force_close(
+- target->control_handle,
+- globus_i_ftp_client_force_close_callback,
+- target);
+- }
+- }
+- else
+- {
+- /* performance or restart markers are ok for 3rd party */
+- if(response->code == 111)
+- {
+- globus_l_ftp_client_parse_restart_marker(client_handle,
+- response);
+- }
+- }
+- }
+- else if((!error) &&
+- response->response_class
+- == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
++ }
++ else
++ {
++ client_handle->err = error;
++ error = GLOBUS_NULL;
++ }
++
++ if(client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_LIST ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET);
++
++ client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
++ target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
++ globus_ftp_control_force_close(
++ target->control_handle,
++ globus_i_ftp_client_force_close_callback,
++ target);
++ }
++ }
++ else
++ {
++ /* performance or restart markers are ok for 3rd party */
++ if(response->code == 111)
++ {
++ globus_l_ftp_client_parse_restart_marker(client_handle,
++ response);
++ }
++ }
++ }
++ else if((!error) &&
++ response->response_class
++ == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
+ if(client_handle->attr.pipeline_callback)
+- {
++ {
+ globus_i_ftp_client_url_ent_t * url_ent = NULL;
+ globus_bool_t added = GLOBUS_FALSE;
+-
++
+ client_handle->no_callback_count--;
+ if(target == client_handle->source)
+ {
+@@ -4939,8 +4939,8 @@ redo:
+ client_handle->source_url = url_ent->source_url;
+ globus_url_destroy(&url_ent->src_url);
+ globus_free(url_ent);
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_RETR;
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_RETR;
+ }
+ else if(target == client_handle->dest)
+ {
+@@ -4961,24 +4961,24 @@ redo:
+ client_handle->dest_url = url_ent->dest_url;
+ globus_url_destroy(&url_ent->dst_url);
+ globus_free(url_ent);
+-
++
+ target->state = GLOBUS_FTP_CLIENT_TARGET_STOR;
+ }
+ }
+- if(client_handle->state ==
++ if(client_handle->state ==
+ GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER)
+- {
++ {
+ client_handle->state =
+ GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER_ONE_COMPLETE;
+ }
+- else if(client_handle->state ==
++ else if(client_handle->state ==
+ GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER_ONE_COMPLETE)
+- {
++ {
+ if(client_handle->no_callback_count == 0)
+ {
+- client_handle->source->state =
++ client_handle->source->state =
+ GLOBUS_FTP_CLIENT_TARGET_COMPLETED_OPERATION;
+- client_handle->dest->state =
++ client_handle->dest->state =
+ GLOBUS_FTP_CLIENT_TARGET_COMPLETED_OPERATION;
+
+ globus_i_ftp_client_transfer_complete(client_handle);
+@@ -4989,113 +4989,113 @@ redo:
+ {
+ goto finish;
+ }
+- }
+- else
+- {
+- /* this shouldnt really be possible, but handle it */
+- target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
+- globus_i_ftp_client_data_flush(client_handle);
+- memset(&target->cached_data_conn,
++ }
++ else
++ {
++ /* this shouldnt really be possible, but handle it */
++ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE;
++ globus_i_ftp_client_data_flush(client_handle);
++ memset(&target->cached_data_conn,
+ '\0', sizeof(globus_i_ftp_client_data_target_t));
+ globus_ftp_control_data_force_close(
+- target->control_handle,
+- globus_l_ftp_client_data_force_close_callback,
+- GLOBUS_NULL);
+- goto redo;
+- }
+- }
+- else
+- {
+- if((!client_handle->err) && (!error))
+- {
+- client_handle->err =
+- GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
+-
+- globus_ftp_control_data_force_close(
+- target->control_handle,
+- globus_l_ftp_client_data_force_close_callback,
+- GLOBUS_NULL);
+- }
+- else if(!client_handle->err)
+- {
+- client_handle->err = globus_object_copy(error);
+- }
+- globus_i_ftp_client_plugin_notify_fault(
+- client_handle,
+- target->url_string,
+- client_handle->err);
+-
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+-
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_LIST ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER_ONE_COMPLETE ||
+- (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION) ||
+- (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT) ||
+- (target->delayed_pasv && client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ target->control_handle,
++ globus_l_ftp_client_data_force_close_callback,
++ GLOBUS_NULL);
++ goto redo;
++ }
++ }
++ else
++ {
++ if((!client_handle->err) && (!error))
++ {
++ client_handle->err =
++ GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
++
++ globus_ftp_control_data_force_close(
++ target->control_handle,
++ globus_l_ftp_client_data_force_close_callback,
++ GLOBUS_NULL);
++ }
++ else if(!client_handle->err)
++ {
++ client_handle->err = globus_object_copy(error);
++ }
++ globus_i_ftp_client_plugin_notify_fault(
++ client_handle,
++ target->url_string,
++ client_handle->err);
++
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_LIST ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_RETR_OR_ERET ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_STOR_OR_ESTO ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_THIRD_PARTY_TRANSFER_ONE_COMPLETE ||
++ (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION) ||
++ (client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_CONNECT) ||
++ (target->delayed_pasv && client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER &&
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION));
+-
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
++
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
+ goto connection_error;
+- }
++ }
+
+- break;
++ break;
+ case GLOBUS_FTP_CLIENT_TARGET_READY_FOR_DATA:
+ case GLOBUS_FTP_CLIENT_TARGET_NEED_EMPTY_AND_COMPLETE:
+- /*
+- * We've received the callback for this operation, so now we
+- * just need to wait for the final data callbacks
+- */
+- if(error)
+- {
+- if(client_handle->err == GLOBUS_SUCCESS)
+- {
+- client_handle->err = globus_object_copy(error);
+- }
+- client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
+-
+- goto notify_fault;
+- }
+- else if(response->response_class ==
+- GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY)
+- {
+- if(response->code == 111)
+- {
+- globus_l_ftp_client_parse_restart_marker(client_handle,
+- response);
+- }
+- break;
+- }
++ /*
++ * We've received the callback for this operation, so now we
++ * just need to wait for the final data callbacks
++ */
++ if(error)
++ {
++ if(client_handle->err == GLOBUS_SUCCESS)
++ {
++ client_handle->err = globus_object_copy(error);
++ }
++ client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
++
++ goto notify_fault;
++ }
++ else if(response->response_class ==
++ GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY)
++ {
++ if(response->code == 111)
++ {
++ globus_l_ftp_client_parse_restart_marker(client_handle,
++ response);
++ }
++ break;
++ }
+ else
+ {
+ if(response->response_class != GLOBUS_FTP_POSITIVE_COMPLETION_REPLY
+ && client_handle->err == GLOBUS_SUCCESS)
+ {
+- /* any other response must be a transient error such as
++ /* any other response must be a transient error such as
+ * 426 data timeout
+ */
+- client_handle->err =
++ client_handle->err =
+ GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
+ }
+-
++
+ if(target->state == GLOBUS_FTP_CLIENT_TARGET_NEED_EMPTY_AND_COMPLETE)
+ {
+ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_EMPTY_QUEUE;
+@@ -5105,72 +5105,72 @@ redo:
+ target->state = GLOBUS_FTP_CLIENT_TARGET_NEED_LAST_BLOCK;
+ }
+ }
+-
+- break;
++
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_NEED_COMPLETE:
+- /* Reset the state to setup_connection, so that the url
+- * caching code knows to keep this one around.
+- */
+- if(!error)
+- {
+- if(response->response_class ==
+- GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY)
+- {
+- if(response->code == 111)
+- {
+- globus_l_ftp_client_parse_restart_marker(client_handle,
+- response);
+- }
+- break;
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+-
+- if(response->response_class !=
+- GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
+- {
+- if(client_handle->err == GLOBUS_SUCCESS)
+- {
+- client_handle->err =
+- GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
+- }
+- if(client_handle->op != GLOBUS_FTP_CLIENT_MDTM &&
+- client_handle->op != GLOBUS_FTP_CLIENT_SIZE &&
+- client_handle->op != GLOBUS_FTP_CLIENT_FEAT &&
+- client_handle->op != GLOBUS_FTP_CLIENT_CKSM &&
+- client_handle->op != GLOBUS_FTP_CLIENT_MLST &&
+- client_handle->op != GLOBUS_FTP_CLIENT_CWD &&
+- client_handle->op != GLOBUS_FTP_CLIENT_STAT)
+- {
+- client_handle->state =
+- GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
+- }
+- }
+- if(client_handle->op == GLOBUS_FTP_CLIENT_MDTM &&
+- response->code == 213)
+- {
+- globus_l_ftp_client_parse_mdtm(client_handle,
+- response);
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_SIZE &&
+- response->code == 213)
+- {
+- globus_libc_scan_off_t((char *) response->response_buffer+4,
+- client_handle->size_pointer,
+- GLOBUS_NULL);
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_CKSM &&
+- response->code == 213)
+- {
+- globus_l_ftp_client_parse_cksm(client_handle,
+- response);
+-
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_FEAT)
+- {
+- for(i = 0; i < GLOBUS_FTP_CLIENT_FEATURE_MAX; i++)
++ /* Reset the state to setup_connection, so that the url
++ * caching code knows to keep this one around.
++ */
++ if(!error)
++ {
++ if(response->response_class ==
++ GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY)
++ {
++ if(response->code == 111)
++ {
++ globus_l_ftp_client_parse_restart_marker(client_handle,
++ response);
++ }
++ break;
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++
++ if(response->response_class !=
++ GLOBUS_FTP_POSITIVE_COMPLETION_REPLY)
++ {
++ if(client_handle->err == GLOBUS_SUCCESS)
++ {
++ client_handle->err =
++ GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
++ }
++ if(client_handle->op != GLOBUS_FTP_CLIENT_MDTM &&
++ client_handle->op != GLOBUS_FTP_CLIENT_SIZE &&
++ client_handle->op != GLOBUS_FTP_CLIENT_FEAT &&
++ client_handle->op != GLOBUS_FTP_CLIENT_CKSM &&
++ client_handle->op != GLOBUS_FTP_CLIENT_MLST &&
++ client_handle->op != GLOBUS_FTP_CLIENT_CWD &&
++ client_handle->op != GLOBUS_FTP_CLIENT_STAT)
++ {
++ client_handle->state =
++ GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
++ }
++ }
++ if(client_handle->op == GLOBUS_FTP_CLIENT_MDTM &&
++ response->code == 213)
++ {
++ globus_l_ftp_client_parse_mdtm(client_handle,
++ response);
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_SIZE &&
++ response->code == 213)
++ {
++ globus_libc_scan_off_t((char *) response->response_buffer+4,
++ client_handle->size_pointer,
++ GLOBUS_NULL);
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_CKSM &&
++ response->code == 213)
++ {
++ globus_l_ftp_client_parse_cksm(client_handle,
++ response);
++
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_FEAT)
++ {
++ for(i = 0; i < GLOBUS_FTP_CLIENT_FEATURE_MAX; i++)
+ {
+ globus_i_ftp_client_feature_set(
+ client_handle->features_pointer,
+@@ -5178,159 +5178,159 @@ redo:
+ globus_i_ftp_client_feature_get(
+ target->features, i));
+ }
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_CWD &&
+- response->code == 250)
+- {
+- globus_l_ftp_client_parse_cwd(client_handle,
+- response);
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_MLST &&
+- response->code == 250)
+- {
+- globus_l_ftp_client_parse_mlst(client_handle,
+- response);
+- }
+- else if(client_handle->op == GLOBUS_FTP_CLIENT_STAT)
+- {
+- globus_l_ftp_client_parse_stat(client_handle,
+- response);
+- }
+- }
+- }
+- else
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
+- if(client_handle->err == GLOBUS_SUCCESS)
+- {
+- client_handle->err = globus_object_copy(error);
+- }
+- }
+-
+- globus_i_ftp_client_transfer_complete(client_handle);
+-
+- goto do_return;
+-
+- break;
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_CWD &&
++ response->code == 250)
++ {
++ globus_l_ftp_client_parse_cwd(client_handle,
++ response);
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_MLST &&
++ response->code == 250)
++ {
++ globus_l_ftp_client_parse_mlst(client_handle,
++ response);
++ }
++ else if(client_handle->op == GLOBUS_FTP_CLIENT_STAT)
++ {
++ globus_l_ftp_client_parse_stat(client_handle,
++ response);
++ }
++ }
++ }
++ else
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION;
++ if(client_handle->err == GLOBUS_SUCCESS)
++ {
++ client_handle->err = globus_object_copy(error);
++ }
++ }
++
++ globus_i_ftp_client_transfer_complete(client_handle);
++
++ goto do_return;
++
++ break;
+
+ case GLOBUS_FTP_CLIENT_TARGET_FAULT:
+ case GLOBUS_FTP_CLIENT_TARGET_CLOSED:
+- /*
+- * This state only happens if this is a callback which was a
+- * result of a force_close. We do nothing, and the force_close
+- * callback deals with the failure.
+- */
+- break;
++ /*
++ * This state only happens if this is a callback which was a
++ * result of a force_close. We do nothing, and the force_close
++ * callback deals with the failure.
++ */
++ break;
+ case GLOBUS_FTP_CLIENT_TARGET_NOOP:
+- globus_assert(
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
+- client_handle->state ==
+- GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
+-
++ globus_assert(
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_SOURCE_SETUP_CONNECTION ||
++ client_handle->state ==
++ GLOBUS_FTP_CLIENT_HANDLE_DEST_SETUP_CONNECTION);
++
+ /* response will be NULL if the NOOP was faked */
+- if((!error) && (!response ||
+- response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY))
+- {
+- /* NOOP successful, we can re-use this target */
+- target->state =
+- GLOBUS_FTP_CLIENT_TARGET_SETUP_TYPE;
+- goto redo;
+- }
+- else
+- {
+- globus_i_ftp_client_target_t * new_target;
+- /*
+- * NOOP failed---This means that the cached target went
+- * bad. We'll discard this target, and find a new
+- * one.
+- */
+- globus_assert(client_handle->source == target ||
+- client_handle->dest == target);
+-
+- if(client_handle->source == target)
+- {
+- error =
+- globus_i_ftp_client_target_find(client_handle,
+- client_handle->source_url,
+- target->attr,
+- &new_target);
+- if(error != GLOBUS_SUCCESS)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
+-
+- goto notify_fault;
+- }
+- client_handle->source = new_target;
+- }
+- else if(client_handle->dest == target)
+- {
+- error =
+- globus_i_ftp_client_target_find(client_handle,
+- client_handle->dest_url,
+- target->attr,
+- &new_target);
+-
+- if(error != GLOBUS_SUCCESS)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
+-
+- goto notify_fault;
+- }
+- client_handle->dest = new_target;
+- }
+-
+- /* Mark the old target for destruction... */
+- target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
+- /* And release it */
+- globus_i_ftp_client_target_release(client_handle,
+- target);
+-
+- /* Start this new target off */
+- error = globus_i_ftp_client_target_activate(client_handle,
+- new_target,
+- ®istered);
+-
+- if(registered == GLOBUS_FALSE)
+- {
+- globus_assert(error ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE);
+- /*
+- * A restart or abort happened during activation, before any
+- * callbacks were registered. We must deal with them here.
+- */
+- if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+- client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+- {
+- break;
+- }
+- else if(error != GLOBUS_SUCCESS)
+- {
+- globus_i_ftp_client_plugin_notify_fault(
+- client_handle,
+- target->url_string,
+- error);
+-
+- goto connection_error;
+- }
+- }
+- }
+- break;
++ if((!error) && (!response ||
++ response->response_class == GLOBUS_FTP_POSITIVE_COMPLETION_REPLY))
++ {
++ /* NOOP successful, we can re-use this target */
++ target->state =
++ GLOBUS_FTP_CLIENT_TARGET_SETUP_TYPE;
++ goto redo;
++ }
++ else
++ {
++ globus_i_ftp_client_target_t * new_target;
++ /*
++ * NOOP failed---This means that the cached target went
++ * bad. We'll discard this target, and find a new
++ * one.
++ */
++ globus_assert(client_handle->source == target ||
++ client_handle->dest == target);
++
++ if(client_handle->source == target)
++ {
++ error =
++ globus_i_ftp_client_target_find(client_handle,
++ client_handle->source_url,
++ target->attr,
++ &new_target);
++ if(error != GLOBUS_SUCCESS)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
++
++ goto notify_fault;
++ }
++ client_handle->source = new_target;
++ }
++ else if(client_handle->dest == target)
++ {
++ error =
++ globus_i_ftp_client_target_find(client_handle,
++ client_handle->dest_url,
++ target->attr,
++ &new_target);
++
++ if(error != GLOBUS_SUCCESS)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
++
++ goto notify_fault;
++ }
++ client_handle->dest = new_target;
++ }
++
++ /* Mark the old target for destruction... */
++ target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
++ /* And release it */
++ globus_i_ftp_client_target_release(client_handle,
++ target);
++
++ /* Start this new target off */
++ error = globus_i_ftp_client_target_activate(client_handle,
++ new_target,
++ ®istered);
++
++ if(registered == GLOBUS_FALSE)
++ {
++ globus_assert(error ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE);
++ /*
++ * A restart or abort happened during activation, before any
++ * callbacks were registered. We must deal with them here.
++ */
++ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
++ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
++ {
++ break;
++ }
++ else if(error != GLOBUS_SUCCESS)
++ {
++ globus_i_ftp_client_plugin_notify_fault(
++ client_handle,
++ target->url_string,
++ error);
++
++ goto connection_error;
++ }
++ }
++ }
++ break;
+ default:
+- globus_assert(0 && "Invalid state");
++ globus_assert(0 && "Invalid state");
+ }
+ finish:
+ globus_i_ftp_client_handle_unlock(client_handle);
+- do_return:
+-
++ do_return:
++
+ if(error)
+ {
+ globus_object_free(error);
+ }
+- globus_i_ftp_client_debug_printf(1, (stderr,
++ globus_i_ftp_client_debug_printf(1, (stderr,
+ "globus_i_ftp_client_response_callback() exiting\n"));
+ globus_i_ftp_client_debug_states(2, client_handle);
+
+@@ -5344,17 +5344,17 @@ redo:
+ error = globus_error_get(result);
+ notify_fault:
+ globus_i_ftp_client_plugin_notify_fault(
+- client_handle,
+- target->url_string,
+- error);
++ client_handle,
++ target->url_string,
++ error);
+ connection_error:
+ globus_l_ftp_client_connection_error(client_handle,
+- target,
+- error,
+- response);
+-
++ target,
++ error,
++ response);
++
+ globus_object_free(error);
+- globus_i_ftp_client_debug_printf(1, (stderr,
++ globus_i_ftp_client_debug_printf(1, (stderr,
+ "globus_i_ftp_client_response_callback() exiting with error\n"));
+ globus_i_ftp_client_debug_states(2, client_handle);
+
+@@ -5387,8 +5387,8 @@ redo:
+ static
+ globus_object_t *
+ globus_l_ftp_client_parse_site_help(
+- globus_i_ftp_client_target_t * target,
+- globus_ftp_control_response_t * response)
++ globus_i_ftp_client_target_t * target,
++ globus_ftp_control_response_t * response)
+ {
+ char * p;
+
+@@ -5407,7 +5407,7 @@ globus_l_ftp_client_parse_site_help(
+ GLOBUS_FTP_CLIENT_TRUE);
+ }
+ if(((p = strstr((char *) response->response_buffer, "RBUFSIZ")) != 0) &&
+- !isupper(*(p-1)))
++ !isupper(*(p-1)))
+ {
+ globus_i_ftp_client_feature_set(
+ target->features,
+@@ -5429,7 +5429,7 @@ globus_l_ftp_client_parse_site_help(
+ GLOBUS_FTP_CLIENT_TRUE);
+ }
+ if(((p = strstr((char *) response->response_buffer, "SBUFSIZ")) != 0) &&
+- !isupper(*(p-1)))
++ !isupper(*(p-1)))
+ {
+ globus_i_ftp_client_feature_set(
+ target->features,
+@@ -5437,7 +5437,7 @@ globus_l_ftp_client_parse_site_help(
+ GLOBUS_FTP_CLIENT_TRUE);
+ }
+ if(((p = strstr((char *) response->response_buffer, "BUFSIZE")) != 0) &&
+- !isupper(*(p-1)))
++ !isupper(*(p-1)))
+ {
+ globus_i_ftp_client_feature_set(
+ target->features,
+@@ -5445,7 +5445,7 @@ globus_l_ftp_client_parse_site_help(
+ GLOBUS_FTP_CLIENT_TRUE);
+ }
+ if(((p = strstr((char *) response->response_buffer, "CHMOD")) != 0) &&
+- !isupper(*(p-1)))
++ !isupper(*(p-1)))
+ {
+ globus_i_ftp_client_feature_set(
+ target->features,
+@@ -5459,7 +5459,7 @@ globus_l_ftp_client_parse_site_help(
+ target->features,
+ GLOBUS_FTP_CLIENT_FEATURE_CHGRP,
+ GLOBUS_FTP_CLIENT_TRUE);
+- }
++ }
+ if(((p = strstr((char *) response->response_buffer, "UTIME")) != 0) &&
+ !isupper(*(p-1)))
+ {
+@@ -5467,7 +5467,7 @@ globus_l_ftp_client_parse_site_help(
+ target->features,
+ GLOBUS_FTP_CLIENT_FEATURE_UTIME,
+ GLOBUS_FTP_CLIENT_TRUE);
+- }
++ }
+ if(((p = strstr((char *) response->response_buffer, "SYMLINK")) != 0) &&
+ !isupper(*(p-1)))
+ {
+@@ -5475,8 +5475,8 @@ globus_l_ftp_client_parse_site_help(
+ target->features,
+ GLOBUS_FTP_CLIENT_FEATURE_SYMLINK,
+ GLOBUS_FTP_CLIENT_TRUE);
+- }
+- if(((p = strstr((char *) response->response_buffer, "AUTHZ_ASSERT")) != 0)
++ }
++ if(((p = strstr((char *) response->response_buffer, "AUTHZ_ASSERT")) != 0)
+ && !isupper(*(p-1)))
+ {
+ globus_i_ftp_client_feature_set(
+@@ -5484,7 +5484,7 @@ globus_l_ftp_client_parse_site_help(
+ GLOBUS_FTP_CLIENT_FEATURE_AUTHZ_ASSERT,
+ GLOBUS_FTP_CLIENT_TRUE);
+ }
+- if(((p = strstr((char *) response->response_buffer, "CLIENTINFO")) != 0)
++ if(((p = strstr((char *) response->response_buffer, "CLIENTINFO")) != 0)
+ && !isupper(*(p-1)))
+ {
+ globus_i_ftp_client_feature_set(
+@@ -5492,8 +5492,8 @@ globus_l_ftp_client_parse_site_help(
+ GLOBUS_FTP_CLIENT_FEATURE_CLIENTINFO,
+ GLOBUS_FTP_CLIENT_TRUE);
+ }
+-
+-
++
++
+ return GLOBUS_SUCCESS;
+ }
+ /* globus_l_ftp_client_parse_site_help() */
+@@ -5513,187 +5513,187 @@ globus_l_ftp_client_parse_site_help(
+ static
+ void
+ globus_l_ftp_client_parse_feat(
+- globus_i_ftp_client_target_t * target,
+- globus_ftp_control_response_t * response)
++ globus_i_ftp_client_target_t * target,
++ globus_ftp_control_response_t * response)
+ {
+- char * p;
+- char * pstart;
+- globus_bool_t first = GLOBUS_TRUE;
++ char * p;
++ char * pstart;
++ globus_bool_t first = GLOBUS_TRUE;
++
++ if(response->code != 211)
++ {
++ return;
++ }
++ p = globus_libc_strdup((char *) response->response_buffer);
++ pstart = p;
++ while(1)
++ {
++ char * eol;
++ eol = strstr(p, CRLF);
++ if(eol == 0)
++ {
++ int i;
++ /* Last line should contain "211 End" CRLF ONLY */
++ globus_libc_free(pstart);
++
++ /*
++ * If there are any features which are in the unknown state,
++ * set them to false now.
++ */
++ for(i = GLOBUS_FTP_CLIENT_FIRST_FEAT_FEATURE;
++ i <= GLOBUS_FTP_CLIENT_LAST_FEAT_FEATURE;
++ i++)
++ {
++ if(globus_i_ftp_client_feature_get(
++ target->features, i) == GLOBUS_FTP_CLIENT_MAYBE)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features, i, GLOBUS_FTP_CLIENT_FALSE);
++ }
++ }
++ return;
++ }
++ else if(first)
++ {
++ /* First line contains no feature. */
++ p = eol + 2;
++ first = GLOBUS_FALSE;
++ continue;
++ }
++ else
++ {
++ /* An actual feature! */
++ char * feature_label;
++ char * feature_parms;
++
++ *eol = '\0';
++
++ feature_label = p + 1;
++ feature_parms = feature_label;
++
++ /* VCHAR (%x21-%7E) */
++ while((*feature_parms) >= ((char)0x21) &&
++ (*feature_parms) <= ((char)0x7e))
++ {
++ feature_parms++;
++ }
++ if(strncmp(feature_label, "REST", 4) == 0)
++ {
++ if(strstr(feature_parms, "STREAM"))
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_REST_STREAM,
++ GLOBUS_FTP_CLIENT_TRUE);
++ }
++ }
++ else if(strncmp(feature_label, "PARALLEL", 8) == 0)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_PARALLELISM,
++ GLOBUS_FTP_CLIENT_TRUE);
++ }
++ else if(strncmp(feature_label, "DCAU", 4) == 0)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_DCAU,
++ GLOBUS_FTP_CLIENT_TRUE);
++ /* Per our extensions document, if server publishes
++ * DCAU feature, it must default to DCAU S(elf)
++ * if we used RFC 2228 authentication.
++ *
++ * gsi-wuftpd 0.5 and below are broken in this regard.
++ */
++ if(target->url.scheme_type == GLOBUS_URL_SCHEME_GSIFTP)
++ {
++ target->dcau.mode = GLOBUS_FTP_CONTROL_DCAU_DEFAULT;
++ }
++ }
++ else if(strncmp(feature_label, "DCSC", 4) == 0)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_DCSC,
++ GLOBUS_FTP_CLIENT_TRUE);
++ }
++ else if(strncmp(feature_label, "ESTO", 4) == 0)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_ESTO,
++ GLOBUS_FTP_CLIENT_TRUE);
++ }
++ else if(strncmp(feature_label, "ERET", 4) == 0)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_ERET,
++ GLOBUS_FTP_CLIENT_TRUE);
++ }
++ else if(strncmp(feature_label, "SBUF", 4) == 0)
++ {
++ int i;
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_SBUF,
++ GLOBUS_FTP_CLIENT_TRUE);
++ /* If SBUF is supported, then don't bother with other
++ * buffer size commands
++ */
+
+- if(response->code != 211)
+- {
+- return;
+- }
+- p = globus_libc_strdup((char *) response->response_buffer);
+- pstart = p;
+- while(1)
+- {
+- char * eol;
+- eol = strstr(p, CRLF);
+- if(eol == 0)
+- {
+- int i;
+- /* Last line should contain "211 End" CRLF ONLY */
+- globus_libc_free(pstart);
+-
+- /*
+- * If there are any features which are in the unknown state,
+- * set them to false now.
+- */
+- for(i = GLOBUS_FTP_CLIENT_FIRST_FEAT_FEATURE;
+- i <= GLOBUS_FTP_CLIENT_LAST_FEAT_FEATURE;
+- i++)
+- {
+- if(globus_i_ftp_client_feature_get(
+- target->features, i) == GLOBUS_FTP_CLIENT_MAYBE)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features, i, GLOBUS_FTP_CLIENT_FALSE);
+- }
+- }
+- return;
+- }
+- else if(first)
+- {
+- /* First line contains no feature. */
+- p = eol + 2;
+- first = GLOBUS_FALSE;
+- continue;
+- }
+- else
+- {
+- /* An actual feature! */
+- char * feature_label;
+- char * feature_parms;
+-
+- *eol = '\0';
+-
+- feature_label = p + 1;
+- feature_parms = feature_label;
+-
+- /* VCHAR (%x21-%7E) */
+- while((*feature_parms) >= ((char)0x21) &&
+- (*feature_parms) <= ((char)0x7e))
+- {
+- feature_parms++;
+- }
+- if(strncmp(feature_label, "REST", 4) == 0)
+- {
+- if(strstr(feature_parms, "STREAM"))
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_REST_STREAM,
+- GLOBUS_FTP_CLIENT_TRUE);
+- }
+- }
+- else if(strncmp(feature_label, "PARALLEL", 8) == 0)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_PARALLELISM,
+- GLOBUS_FTP_CLIENT_TRUE);
+- }
+- else if(strncmp(feature_label, "DCAU", 4) == 0)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_DCAU,
+- GLOBUS_FTP_CLIENT_TRUE);
+- /* Per our extensions document, if server publishes
+- * DCAU feature, it must default to DCAU S(elf)
+- * if we used RFC 2228 authentication.
+- *
+- * gsi-wuftpd 0.5 and below are broken in this regard.
+- */
+- if(target->url.scheme_type == GLOBUS_URL_SCHEME_GSIFTP)
+- {
+- target->dcau.mode = GLOBUS_FTP_CONTROL_DCAU_DEFAULT;
+- }
+- }
+- else if(strncmp(feature_label, "DCSC", 4) == 0)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_DCSC,
+- GLOBUS_FTP_CLIENT_TRUE);
+- }
+- else if(strncmp(feature_label, "ESTO", 4) == 0)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_ESTO,
+- GLOBUS_FTP_CLIENT_TRUE);
+- }
+- else if(strncmp(feature_label, "ERET", 4) == 0)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_ERET,
+- GLOBUS_FTP_CLIENT_TRUE);
+- }
+- else if(strncmp(feature_label, "SBUF", 4) == 0)
+- {
+- int i;
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_SBUF,
+- GLOBUS_FTP_CLIENT_TRUE);
+- /* If SBUF is supported, then don't bother with other
+- * buffer size commands
+- */
+-
+- for(i = 0; i < GLOBUS_FTP_CLIENT_FEATURE_SBUF; i++)
+- {
+- if(globus_i_ftp_client_feature_get(
+- target->features, i) == GLOBUS_FTP_CLIENT_MAYBE)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features, i, GLOBUS_FTP_CLIENT_FALSE);
+- }
+- }
+- }
+- else if(strncmp(feature_label, "ABUF", 4) == 0)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_ABUF,
+- GLOBUS_FTP_CLIENT_TRUE);
+- }
+- else if(strncmp(feature_label, "SIZE", 4) == 0)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_SIZE,
+- GLOBUS_FTP_CLIENT_TRUE);
+- }
++ for(i = 0; i < GLOBUS_FTP_CLIENT_FEATURE_SBUF; i++)
++ {
++ if(globus_i_ftp_client_feature_get(
++ target->features, i) == GLOBUS_FTP_CLIENT_MAYBE)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features, i, GLOBUS_FTP_CLIENT_FALSE);
++ }
++ }
++ }
++ else if(strncmp(feature_label, "ABUF", 4) == 0)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_ABUF,
++ GLOBUS_FTP_CLIENT_TRUE);
++ }
++ else if(strncmp(feature_label, "SIZE", 4) == 0)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_SIZE,
++ GLOBUS_FTP_CLIENT_TRUE);
++ }
+ else if(strncmp(feature_label, "GETPUT", 6) == 0)
+ {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_GETPUT,
+- GLOBUS_FTP_CLIENT_TRUE);
+- }
+- else if(strncmp(feature_label, "MLST", 4) == 0)
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_MLST,
+- GLOBUS_FTP_CLIENT_TRUE);
+- }
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_GETPUT,
++ GLOBUS_FTP_CLIENT_TRUE);
++ }
++ else if(strncmp(feature_label, "MLST", 4) == 0)
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_MLST,
++ GLOBUS_FTP_CLIENT_TRUE);
++ }
+ else if(strncmp(feature_label, "PASV", 4) == 0)
+- {
+- if(strstr(feature_parms, "AllowDelayed"))
+- {
+- globus_i_ftp_client_feature_set(
+- target->features,
+- GLOBUS_FTP_CLIENT_FEATURE_DELAYED_PASV,
+- GLOBUS_FTP_CLIENT_TRUE);
+- }
+- }
+- p = eol + 2;
+-
+- }
++ {
++ if(strstr(feature_parms, "AllowDelayed"))
++ {
++ globus_i_ftp_client_feature_set(
++ target->features,
++ GLOBUS_FTP_CLIENT_FEATURE_DELAYED_PASV,
++ GLOBUS_FTP_CLIENT_TRUE);
++ }
++ }
++ p = eol + 2;
++
++ }
+ }
+ }
+ /* globus_l_ftp_client_parse_feat() */
+@@ -5719,18 +5719,18 @@ static
+ void
+ globus_l_ftp_client_parse_pasv(
+ globus_ftp_control_handle_t * handle,
+- globus_ftp_control_response_t * response,
+- globus_ftp_control_host_port_t ** host_port,
+- int * num_pasv_addresses)
++ globus_ftp_control_response_t * response,
++ globus_ftp_control_host_port_t ** host_port,
++ int * num_pasv_addresses)
+ {
+- char * p;
+- int port[2] = {0,0};
+- int rc;
+- int i;
+- int consumed;
++ char * p;
++ int port[2] = {0,0};
++ int rc;
++ int i;
++ int consumed;
+ char delim;
+ char buf[100];
+-
++
+ p = strchr((char *) response->response_buffer, '(');
+ if(response->code == 229)
+ {
+@@ -5738,14 +5738,14 @@ globus_l_ftp_client_parse_pasv(
+ {
+ /* spas */
+ (*num_pasv_addresses) = -2;
+-
++
+ p = (char *) response->response_buffer;
+ while(GLOBUS_NULL != (p = strchr(p, '\n')))
+ {
+ (*num_pasv_addresses)++;
+ p++;
+ }
+-
++
+ /* skip the first line of the 229 response */
+ p = strchr((char *) response->response_buffer, '\n') + 1;
+ while(isspace(*p)) p++;
+@@ -5759,27 +5759,27 @@ globus_l_ftp_client_parse_pasv(
+ }
+ else
+ {
+- (*num_pasv_addresses) = 1;
+-
+- /* skip the initial 227 in the response */
+- if(!p)
+- {
+- p = (char *) response->response_buffer + 3;
+- while(isspace(*p)) p++;
+- }
+- else
+- {
+- p++;
+- }
++ (*num_pasv_addresses) = 1;
++
++ /* skip the initial 227 in the response */
++ if(!p)
++ {
++ p = (char *) response->response_buffer + 3;
++ while(isspace(*p)) p++;
++ }
++ else
++ {
++ p++;
++ }
+ }
+ (*host_port) = globus_libc_calloc((*num_pasv_addresses),
+- sizeof(globus_ftp_control_host_port_t));
++ sizeof(globus_ftp_control_host_port_t));
+
+ if(isdigit(delim = *p))
+ {
+ delim = 0;
+ }
+-
++
+ for(i = 0; i < (*num_pasv_addresses) && *p; i++)
+ {
+ if(delim)
+@@ -5796,23 +5796,23 @@ globus_l_ftp_client_parse_pasv(
+ int j = 0;
+ char * s;
+ char * c;
+-
++
+ p++;
+ c = strchr(p, ':');
+ s = strchr(p, delim);
+-
++
+ if(*p != delim)
+ {
+ if(c && c < s)
+ {
+ buf[j++] = '[';
+ }
+-
++
+ while(j < sizeof(buf) - 1 && p < s)
+ {
+ buf[j++] = *(p++);
+ }
+-
++
+ if(*p == delim && j + 7 < sizeof(buf))
+ {
+ p++;
+@@ -5820,7 +5820,7 @@ globus_l_ftp_client_parse_pasv(
+ {
+ buf[j++] = ']';
+ }
+-
++
+ buf[j++] = ':';
+ while(j < sizeof(buf) - 2 && *p && *p != delim)
+ {
+@@ -5831,9 +5831,9 @@ globus_l_ftp_client_parse_pasv(
+ p++;
+ }
+ }
+-
++
+ buf[j] = 0;
+-
++
+ globus_libc_contact_string_to_ints(buf,
+ (*host_port)[i].host,
+ &(*host_port)[i].hostlen,
+@@ -5852,7 +5852,7 @@ globus_l_ftp_client_parse_pasv(
+ else
+ {
+ while(*p && !isdigit(*p)) p++;
+-
++
+ rc = sscanf(p,
+ "%d,%d,%d,%d,%d,%d%n",
+ &(*host_port)[i].host[0],
+@@ -5890,40 +5890,40 @@ globus_l_ftp_client_parse_pasv(
+ static
+ char *
+ globus_l_ftp_client_layout_string(
+- globus_i_ftp_client_target_t * target)
++ globus_i_ftp_client_target_t * target)
+ {
+- char * ptr = GLOBUS_NULL;
+- globus_size_t length;
++ char * ptr = GLOBUS_NULL;
++ globus_size_t length;
+
+- length = 16; /* " StripeLayout=;\0" */
++ length = 16; /* " StripeLayout=;\0" */
+
+ switch(target->attr->layout.mode)
+ {
+ case GLOBUS_FTP_CONTROL_STRIPING_PARTITIONED:
+- if(target->layout.mode != GLOBUS_FTP_CONTROL_STRIPING_PARTITIONED)
+- {
+- length += 11; /* "Partitioned" */
+- ptr = globus_libc_malloc(length);
+- sprintf(ptr, "StripeLayout=Partitioned;");
+- }
+- break;
++ if(target->layout.mode != GLOBUS_FTP_CONTROL_STRIPING_PARTITIONED)
++ {
++ length += 11; /* "Partitioned" */
++ ptr = globus_libc_malloc(length);
++ sprintf(ptr, "StripeLayout=Partitioned;");
++ }
++ break;
+ case GLOBUS_FTP_CONTROL_STRIPING_BLOCKED_ROUND_ROBIN:
+- if((target->layout.mode !=
+- GLOBUS_FTP_CONTROL_STRIPING_BLOCKED_ROUND_ROBIN) ||
+- (target->attr->layout.round_robin.block_size !=
+- target->layout.round_robin.block_size))
+- {
+- length += 18; /* "Blocked;BlockSize=" */
+- length +=
+- globus_i_ftp_client_count_digits(
+- target->attr->layout.round_robin.block_size);
+- ptr = globus_libc_malloc(length);
+- sprintf(ptr, "StripeLayout=Blocked;BlockSize=%d;",
+- (int) target->attr->layout.round_robin.block_size);
+- }
+- break;
++ if((target->layout.mode !=
++ GLOBUS_FTP_CONTROL_STRIPING_BLOCKED_ROUND_ROBIN) ||
++ (target->attr->layout.round_robin.block_size !=
++ target->layout.round_robin.block_size))
++ {
++ length += 18; /* "Blocked;BlockSize=" */
++ length +=
++ globus_i_ftp_client_count_digits(
++ target->attr->layout.round_robin.block_size);
++ ptr = globus_libc_malloc(length);
++ sprintf(ptr, "StripeLayout=Blocked;BlockSize=%d;",
++ (int) target->attr->layout.round_robin.block_size);
++ }
++ break;
+ case GLOBUS_FTP_CONTROL_STRIPING_NONE:
+- break;
++ break;
+ }
+ return ptr;
+ }
+@@ -5942,39 +5942,39 @@ globus_l_ftp_client_layout_string(
+ static
+ char *
+ globus_l_ftp_client_parallelism_string(
+- globus_i_ftp_client_target_t * target)
++ globus_i_ftp_client_target_t * target)
+ {
+- char * ptr = GLOBUS_NULL;
+- globus_size_t length;
++ char * ptr = GLOBUS_NULL;
++ globus_size_t length;
+
+- length = 17; /* " Parallelism=,,;\0" */
++ length = 17; /* " Parallelism=,,;\0" */
+
+ switch(target->attr->parallelism.mode)
+ {
+ case GLOBUS_FTP_CONTROL_PARALLELISM_FIXED:
+- if((target->parallelism.mode !=
+- GLOBUS_FTP_CONTROL_PARALLELISM_FIXED) ||
+- (target->attr->parallelism.fixed.size !=
+- target->parallelism.fixed.size))
+- {
+- length += 3 *
+- globus_i_ftp_client_count_digits(
+- target->attr->parallelism.fixed.size);
+- ptr = globus_libc_malloc(length);
+- sprintf(ptr, "Parallelism=%d,%d,%d;",
+- (int) target->attr->parallelism.fixed.size,
+- (int) target->attr->parallelism.fixed.size,
+- (int) target->attr->parallelism.fixed.size);
+- }
+- break;
++ if((target->parallelism.mode !=
++ GLOBUS_FTP_CONTROL_PARALLELISM_FIXED) ||
++ (target->attr->parallelism.fixed.size !=
++ target->parallelism.fixed.size))
++ {
++ length += 3 *
++ globus_i_ftp_client_count_digits(
++ target->attr->parallelism.fixed.size);
++ ptr = globus_libc_malloc(length);
++ sprintf(ptr, "Parallelism=%d,%d,%d;",
++ (int) target->attr->parallelism.fixed.size,
++ (int) target->attr->parallelism.fixed.size,
++ (int) target->attr->parallelism.fixed.size);
++ }
++ break;
+ case GLOBUS_FTP_CONTROL_PARALLELISM_NONE:
+ if((target->parallelism.mode !=
+- GLOBUS_FTP_CONTROL_PARALLELISM_NONE) &&
+- (target->parallelism.fixed.size != 1))
+- {
+- ptr = globus_libc_strdup("Parallelism=1,1,1;");
+- }
+- break;
++ GLOBUS_FTP_CONTROL_PARALLELISM_NONE) &&
++ (target->parallelism.fixed.size != 1))
++ {
++ ptr = globus_libc_strdup("Parallelism=1,1,1;");
++ }
++ break;
+ }
+ return ptr;
+ }
+@@ -5988,9 +5988,9 @@ globus_i_ftp_client_faked_force_close_callback(
+ void * user_args)
+ {
+ globus_i_ftp_client_target_t * target;
+-
++
+ target = (globus_i_ftp_client_target_t *) user_args;
+-
++
+ globus_i_ftp_client_force_close_callback(
+ target,
+ target->control_handle,
+@@ -6020,34 +6020,34 @@ globus_i_ftp_client_faked_force_close_callback(
+ static
+ void
+ globus_l_ftp_client_connection_error(
+- globus_i_ftp_client_handle_t * client_handle,
+- globus_i_ftp_client_target_t * target,
+- globus_object_t * error,
+- globus_ftp_control_response_t * response)
++ globus_i_ftp_client_handle_t * client_handle,
++ globus_i_ftp_client_target_t * target,
++ globus_object_t * error,
++ globus_ftp_control_response_t * response)
+ {
+- globus_result_t result;
++ globus_result_t result;
+ GlobusFuncName(globus_l_ftp_client_connection_error);
+-
+- globus_i_ftp_client_debug_printf(1,
++
++ globus_i_ftp_client_debug_printf(1,
+ (stderr, "globus_l_ftp_client_connection_error() entering\n"));
+ globus_i_ftp_client_debug_states(2, client_handle);
+
+ if(client_handle->err == GLOBUS_NULL)
+ {
+- if(error)
+- {
+- client_handle->err = globus_object_copy(error);
+- }
+- else if(response && response->response_buffer)
+- {
+- client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
+- }
+- else
+- {
+- client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_PROTOCOL_ERROR();
+- }
++ if(error)
++ {
++ client_handle->err = globus_object_copy(error);
++ }
++ else if(response && response->response_buffer)
++ {
++ client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_RESPONSE(response);
++ }
++ else
++ {
++ client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_PROTOCOL_ERROR();
++ }
+ }
+-
++
+ /*
+ * Now, let's figure out to cope with this fault. Get/Put are
+ * similar, but 3rd party transfer is rather different
+@@ -6064,77 +6064,77 @@ globus_l_ftp_client_connection_error(
+ /* Mark the target for destruction, since we faulted on it. */
+ target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
+ }
+-
+- /* If we haven't been restarted yet, then we will deal with
+- * the fault here.
+- */
+- if(client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_RESTART)
+- {
+- client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
+-
+- /*
+- * If we're in this function, then whatever buffers the
+- * user has registered will not yet be passed to the
+- * control library. That means we've got to call back for all
+- * of the data buffers which have been registered.
+- *
+- * Because we are in the FAILURE state, the plugins may
+- * *not* do a restart now.
+- */
+- globus_i_ftp_client_data_flush(client_handle);
+-
+- /*
+- * If there are no more blocks registered with the control
+- * library, we're done, otherwise, the callbacks for those
+- * blocks will pick this up and call complete.
+- */
+-
+- if(client_handle->num_active_blocks == 0)
+- {
+- globus_i_ftp_client_transfer_complete(client_handle);
+- globus_i_ftp_client_debug_printf(1,
++
++ /* If we haven't been restarted yet, then we will deal with
++ * the fault here.
++ */
++ if(client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_RESTART)
++ {
++ client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
++
++ /*
++ * If we're in this function, then whatever buffers the
++ * user has registered will not yet be passed to the
++ * control library. That means we've got to call back for all
++ * of the data buffers which have been registered.
++ *
++ * Because we are in the FAILURE state, the plugins may
++ * *not* do a restart now.
++ */
++ globus_i_ftp_client_data_flush(client_handle);
++
++ /*
++ * If there are no more blocks registered with the control
++ * library, we're done, otherwise, the callbacks for those
++ * blocks will pick this up and call complete.
++ */
++
++ if(client_handle->num_active_blocks == 0)
++ {
++ globus_i_ftp_client_transfer_complete(client_handle);
++ globus_i_ftp_client_debug_printf(1,
+ (stderr, "globus_l_ftp_client_connection_error() exiting\n"));
+ globus_i_ftp_client_debug_states(2, client_handle);
+-
+- return;
+- }
+- }
++
++ return;
++ }
++ }
+ }
+ else if(client_handle->op == GLOBUS_FTP_CLIENT_TRANSFER)
+ {
+- if(client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_RESTART)
+- {
+- globus_i_ftp_client_target_t * other_target = 0;
+-
+- client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
+- /* In a third party transfer, this fault can happen on
+- * either the source or destination target's control
+- * handle.
+- */
+- if(client_handle->source == target)
+- {
+- other_target = client_handle->dest;
+- }
+- else if(client_handle->dest == target)
+- {
+- other_target = client_handle->source;
+- }
+- globus_assert(other_target != GLOBUS_NULL);
+-
+- /*
+- * if the other target is in the start or setup_connection
+- * state, then we can release complete w/failure
+- * immediately. Otherwise, we need to either abort the
+- * active command on it, or force it to close.
+- */
+- if(other_target->state == GLOBUS_FTP_CLIENT_TARGET_START ||
+- other_target->state == GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION)
+- {
+- if(target->state != GLOBUS_FTP_CLIENT_TARGET_FAULT &&
+- target->state != GLOBUS_FTP_CLIENT_TARGET_CLOSED)
+- {
+- target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
+-
++ if(client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_RESTART)
++ {
++ globus_i_ftp_client_target_t * other_target = 0;
++
++ client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
++ /* In a third party transfer, this fault can happen on
++ * either the source or destination target's control
++ * handle.
++ */
++ if(client_handle->source == target)
++ {
++ other_target = client_handle->dest;
++ }
++ else if(client_handle->dest == target)
++ {
++ other_target = client_handle->source;
++ }
++ globus_assert(other_target != GLOBUS_NULL);
++
++ /*
++ * if the other target is in the start or setup_connection
++ * state, then we can release complete w/failure
++ * immediately. Otherwise, we need to either abort the
++ * active command on it, or force it to close.
++ */
++ if(other_target->state == GLOBUS_FTP_CLIENT_TARGET_START ||
++ other_target->state == GLOBUS_FTP_CLIENT_TARGET_SETUP_CONNECTION)
++ {
++ if(target->state != GLOBUS_FTP_CLIENT_TARGET_FAULT &&
++ target->state != GLOBUS_FTP_CLIENT_TARGET_CLOSED)
++ {
++ target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
++
+ /*
+ * Kill the current target---the other one is idle
+ */
+@@ -6142,7 +6142,7 @@ globus_l_ftp_client_connection_error(
+ target->control_handle,
+ globus_i_ftp_client_force_close_callback,
+ target);
+-
++
+ if(result != GLOBUS_SUCCESS)
+ {
+ /* Shoot, that didn't work. Fake it. */
+@@ -6153,18 +6153,18 @@ globus_l_ftp_client_connection_error(
+ target);
+ }
+ }
+- }
+- else
+- {
+- if(other_target->state != GLOBUS_FTP_CLIENT_TARGET_FAULT &&
+- other_target->state != GLOBUS_FTP_CLIENT_TARGET_CLOSED)
+- {
++ }
++ else
++ {
++ if(other_target->state != GLOBUS_FTP_CLIENT_TARGET_FAULT &&
++ other_target->state != GLOBUS_FTP_CLIENT_TARGET_CLOSED)
++ {
+ /*
+ * If the target is doing something else, then we will
+ * just kill it.
+ */
+ other_target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
+-
++
+ result = globus_ftp_control_force_close(
+ other_target->control_handle,
+ globus_i_ftp_client_force_close_callback,
+@@ -6179,20 +6179,20 @@ globus_l_ftp_client_connection_error(
+ other_target);
+ }
+ }
+-
++
+ if(target->state != GLOBUS_FTP_CLIENT_TARGET_FAULT &&
+- target->state != GLOBUS_FTP_CLIENT_TARGET_CLOSED)
+- {
+- /*
++ target->state != GLOBUS_FTP_CLIENT_TARGET_CLOSED)
++ {
++ /*
+ * Kill the current target---the other one is idle now.
+ */
+ target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
+-
++
+ result = globus_ftp_control_force_close(
+ target->control_handle,
+ globus_i_ftp_client_force_close_callback,
+ target);
+-
++
+ if(result != GLOBUS_SUCCESS)
+ {
+ /* Shoot, that didn't work. Fake it. */
+@@ -6203,9 +6203,9 @@ globus_l_ftp_client_connection_error(
+ target);
+ }
+ }
+- }
+- }
+- else if(error)
++ }
++ }
++ else if(error)
+ {
+ /* Mark the target for destruction, since we faulted on it. */
+ target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
+@@ -6218,28 +6218,28 @@ globus_l_ftp_client_connection_error(
+ /* Mark the target for destruction, since we faulted on it. */
+ target->state = GLOBUS_FTP_CLIENT_TARGET_FAULT;
+ }
+-
+- /* If we haven't been restarted yet, then we will deal with
+- * the fault here.
+- */
+- if(client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_RESTART)
+- {
+- client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
+- globus_i_ftp_client_transfer_complete(client_handle);
+-
+- globus_i_ftp_client_debug_printf(1,
++
++ /* If we haven't been restarted yet, then we will deal with
++ * the fault here.
++ */
++ if(client_handle->state != GLOBUS_FTP_CLIENT_HANDLE_RESTART)
++ {
++ client_handle->state = GLOBUS_FTP_CLIENT_HANDLE_FAILURE;
++ globus_i_ftp_client_transfer_complete(client_handle);
++
++ globus_i_ftp_client_debug_printf(1,
+ (stderr, "globus_l_ftp_client_connection_error() exiting\n"));
+
+- return;
+- }
++ return;
++ }
+ }
+
+ globus_i_ftp_client_handle_unlock(client_handle);
+-
+- globus_i_ftp_client_debug_printf(1,
++
++ globus_i_ftp_client_debug_printf(1,
+ (stderr, "globus_l_ftp_client_connection_error() exiting\n"));
+ globus_i_ftp_client_debug_states(2, client_handle);
+-
++
+ return;
+ }
+ /* globus_l_ftp_client_connection_error() */
+@@ -6247,12 +6247,12 @@ globus_l_ftp_client_connection_error(
+ static
+ const char *
+ globus_l_ftp_client_guess_buffer_command(
+- globus_i_ftp_client_handle_t * handle,
+- globus_i_ftp_client_target_t * target)
++ globus_i_ftp_client_handle_t * handle,
++ globus_i_ftp_client_target_t * target)
+ {
+- int i;
+- globus_bool_t stor_desired = GLOBUS_FALSE;
+- globus_bool_t retr_desired = GLOBUS_FALSE;
++ int i;
++ globus_bool_t stor_desired = GLOBUS_FALSE;
++ globus_bool_t retr_desired = GLOBUS_FALSE;
+ int first_maybe;
+
+ if(handle->op == GLOBUS_FTP_CLIENT_GET ||
+@@ -6262,41 +6262,41 @@ globus_l_ftp_client_guess_buffer_command(
+ handle->op == GLOBUS_FTP_CLIENT_MLSR ||
+ (handle->op == GLOBUS_FTP_CLIENT_TRANSFER && handle->source == target))
+ {
+- retr_desired = GLOBUS_TRUE;
++ retr_desired = GLOBUS_TRUE;
+ }
+ if(handle->op == GLOBUS_FTP_CLIENT_PUT ||
+ (handle->op == GLOBUS_FTP_CLIENT_TRANSFER && handle->dest == target))
+ {
+- stor_desired = GLOBUS_TRUE;
++ stor_desired = GLOBUS_TRUE;
+ }
+-
++
+ first_maybe = -1;
+ for(i = 0; i < GLOBUS_FTP_CLIENT_LAST_BUFFER_COMMAND; i++)
+ {
+ globus_ftp_client_tristate_t is_supported;
+-
++
+ is_supported = globus_i_ftp_client_feature_get(target->features, i);
+-
+- if(is_supported &&
+- ((globus_l_ftp_client_buffer_cmd_info[i].stor_ok && stor_desired) ||
+- (globus_l_ftp_client_buffer_cmd_info[i].retr_ok && retr_desired)))
+- {
+- if(is_supported == GLOBUS_FTP_CLIENT_TRUE)
+- {
+- return globus_l_ftp_client_buffer_cmd_info[i].string;
+- }
+- else if(first_maybe < 0)
+- {
+- first_maybe = i;
+- }
+- }
++
++ if(is_supported &&
++ ((globus_l_ftp_client_buffer_cmd_info[i].stor_ok && stor_desired) ||
++ (globus_l_ftp_client_buffer_cmd_info[i].retr_ok && retr_desired)))
++ {
++ if(is_supported == GLOBUS_FTP_CLIENT_TRUE)
++ {
++ return globus_l_ftp_client_buffer_cmd_info[i].string;
++ }
++ else if(first_maybe < 0)
++ {
++ first_maybe = i;
++ }
++ }
+ }
+-
++
+ if(first_maybe >= 0)
+ {
+ return globus_l_ftp_client_buffer_cmd_info[first_maybe].string;
+ }
+-
++
+ return NULL;
+ }
+ /* globus_l_ftp_client_guess_buffer_command() */
+@@ -6316,18 +6316,18 @@ globus_l_ftp_client_guess_buffer_command(
+ * The actual ftp target that we sent the command to.
+ * @param ok
+ * If set to GLOBUS_TRUE, then the last ftp buffer command
+- * worked. Otherwise, it failed.
++ * worked. Otherwise, it failed.
+ */
+ static
+ void
+ globus_l_ftp_client_update_buffer_feature(
+- globus_i_ftp_client_handle_t * handle,
+- globus_i_ftp_client_target_t * target,
+- globus_ftp_client_tristate_t ok)
++ globus_i_ftp_client_handle_t * handle,
++ globus_i_ftp_client_target_t * target,
++ globus_ftp_client_tristate_t ok)
+ {
+- int i;
+- globus_bool_t stor_desired = GLOBUS_FALSE;
+- globus_bool_t retr_desired = GLOBUS_FALSE;
++ int i;
++ globus_bool_t stor_desired = GLOBUS_FALSE;
++ globus_bool_t retr_desired = GLOBUS_FALSE;
+
+ if(handle->op == GLOBUS_FTP_CLIENT_GET ||
+ handle->op == GLOBUS_FTP_CLIENT_LIST ||
+@@ -6336,26 +6336,26 @@ globus_l_ftp_client_update_buffer_feature(
+ handle->op == GLOBUS_FTP_CLIENT_MLSR ||
+ (handle->op == GLOBUS_FTP_CLIENT_TRANSFER && handle->source == target))
+ {
+- retr_desired = GLOBUS_TRUE;
++ retr_desired = GLOBUS_TRUE;
+ }
+ if(handle->op == GLOBUS_FTP_CLIENT_PUT ||
+ (handle->op == GLOBUS_FTP_CLIENT_TRANSFER && handle->dest == target))
+ {
+- stor_desired = GLOBUS_TRUE;
++ stor_desired = GLOBUS_TRUE;
+ }
+
+ for(i = 0; i < GLOBUS_FTP_CLIENT_LAST_BUFFER_COMMAND; i++)
+ {
+- if(globus_i_ftp_client_feature_get( target->features, i) &&
+- ((globus_l_ftp_client_buffer_cmd_info[i].stor_ok && stor_desired) ||
+- (globus_l_ftp_client_buffer_cmd_info[i].retr_ok && retr_desired)))
+- {
+- if(globus_i_ftp_client_feature_get(target->features, i) != ok)
+- {
+- globus_i_ftp_client_feature_set(target->features, i, ok);
+- break;
+- }
+- }
++ if(globus_i_ftp_client_feature_get( target->features, i) &&
++ ((globus_l_ftp_client_buffer_cmd_info[i].stor_ok && stor_desired) ||
++ (globus_l_ftp_client_buffer_cmd_info[i].retr_ok && retr_desired)))
++ {
++ if(globus_i_ftp_client_feature_get(target->features, i) != ok)
++ {
++ globus_i_ftp_client_feature_set(target->features, i, ok);
++ break;
++ }
++ }
+ }
+ }
+ /* globus_l_ftp_client_update_buffer_feature() */
+@@ -6375,17 +6375,17 @@ globus_l_ftp_client_update_buffer_feature(
+ static
+ void
+ globus_l_ftp_client_parse_restart_marker(
+- globus_i_ftp_client_handle_t * handle,
+- globus_ftp_control_response_t * response)
++ globus_i_ftp_client_handle_t * handle,
++ globus_ftp_control_response_t * response)
+ {
+- globus_off_t offset, end;
+- char * p;
+- globus_result_t res;
+- int consumed;
++ globus_off_t offset, end;
++ char * p;
++ globus_result_t res;
++ int consumed;
+
+ if(response->code != 111)
+ {
+- return;
++ return;
+ }
+ p = (char *) response->response_buffer;
+
+@@ -6394,28 +6394,28 @@ globus_l_ftp_client_parse_restart_marker(
+ while(!isdigit(*p)) p++;
+
+ while( sscanf(p, "%"GLOBUS_OFF_T_FORMAT"-%"GLOBUS_OFF_T_FORMAT"%n",
+- &offset, &end, &consumed) >= 2)
++ &offset, &end, &consumed) >= 2)
+ {
+- res = globus_ftp_client_restart_marker_insert_range(
+- &handle->restart_marker,
+- offset,
+- end);
+-
+- if(res)
+- {
+- break;
+- }
+-
+- p += consumed;
+-
+- if(*p == ',')
+- {
+- p++;
+- }
+- else
+- {
+- break;
+- }
++ res = globus_ftp_client_restart_marker_insert_range(
++ &handle->restart_marker,
++ offset,
++ end);
++
++ if(res)
++ {
++ break;
++ }
++
++ p += consumed;
++
++ if(*p == ',')
++ {
++ p++;
++ }
++ else
++ {
++ break;
++ }
+ }
+ }
+ /* globus_l_ftp_client_parse_restart_marker() */
+@@ -6448,10 +6448,10 @@ globus_l_ftp_client_parse_cksm(
+ static
+ void
+ globus_l_ftp_client_parse_mdtm(
+- globus_i_ftp_client_handle_t * client_handle,
+- globus_ftp_control_response_t * response)
++ globus_i_ftp_client_handle_t * client_handle,
++ globus_ftp_control_response_t * response)
+ {
+- char * p;
++ char * p;
+ struct tm tm;
+ struct tm gmt_now_tm;
+ struct tm * gmt_now_tm_p;
+@@ -6459,15 +6459,15 @@ globus_l_ftp_client_parse_mdtm(
+ time_t gmt_now;
+ time_t now;
+ time_t file_time;
+- float fraction;
+- unsigned long nsec = 0UL;
+- int rc;
+- int i;
++ float fraction;
++ unsigned long nsec = 0UL;
++ int rc;
++ int i;
+ GlobusFuncName(globus_l_ftp_client_parse_mdtm);
+
+ if(response->code != 213)
+ {
+- return;
++ return;
+ }
+ p = (char *) response->response_buffer;
+
+@@ -6476,12 +6476,12 @@ globus_l_ftp_client_parse_mdtm(
+ while(!isdigit(*p)) p++;
+
+ if(strlen(p) < 14)
+- goto error_exit;
++ goto error_exit;
+
+ for(i = 0; i < 14; i++)
+ {
+- if(!isdigit(*(p+i)))
+- goto error_exit;
++ if(!isdigit(*(p+i)))
++ goto error_exit;
+ }
+ memset(&tm, '\0', sizeof(struct tm));
+
+@@ -6489,7 +6489,7 @@ globus_l_ftp_client_parse_mdtm(
+ rc = sscanf(p, "%04d", &tm.tm_year);
+ if(rc != 1)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+ tm.tm_year -= 1900;
+ p += 4;
+@@ -6498,7 +6498,7 @@ globus_l_ftp_client_parse_mdtm(
+ rc = sscanf(p, "%02d", &tm.tm_mon);
+ if(rc != 1)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+ tm.tm_mon--;
+ p += 2;
+@@ -6507,7 +6507,7 @@ globus_l_ftp_client_parse_mdtm(
+ rc = sscanf(p, "%02d", &tm.tm_mday);
+ if(rc != 1)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+ p += 2;
+
+@@ -6515,7 +6515,7 @@ globus_l_ftp_client_parse_mdtm(
+ rc = sscanf(p, "%02d", &tm.tm_hour);
+ if(rc != 1)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+ p += 2;
+
+@@ -6523,7 +6523,7 @@ globus_l_ftp_client_parse_mdtm(
+ rc = sscanf(p, "%02d", &tm.tm_min);
+ if(rc != 1)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+ p += 2;
+
+@@ -6531,41 +6531,41 @@ globus_l_ftp_client_parse_mdtm(
+ rc = sscanf(p, "%02d", &tm.tm_sec);
+ if(rc != 1)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+ p += 2;
+
+ if(*p == '.')
+ {
+- sscanf(p, "%f", &fraction);
+- nsec = fraction * 1000000000;
++ sscanf(p, "%f", &fraction);
++ nsec = fraction * 1000000000;
+ }
+-
++
+ file_time = mktime(&tm);
+ if(file_time == (time_t) -1)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+-
++
+ now = time(&now);
+ if(now == (time_t) -1)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+-
++
+ memset(&gmt_now_tm, '\0', sizeof(struct tm));
+ gmt_now_tm_p = globus_libc_gmtime_r(&now, &gmt_now_tm);
+ if(gmt_now_tm_p == NULL)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+-
++
+ gmt_now = mktime(&gmt_now_tm);
+ if(gmt_now == (time_t) -1)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+-
++
+ offset = now - gmt_now;
+
+ client_handle->modification_time_pointer->tv_sec = file_time + offset;
+@@ -6576,12 +6576,12 @@ globus_l_ftp_client_parse_mdtm(
+ error_exit:
+ if(client_handle->err == GLOBUS_SUCCESS)
+ {
+- client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_PROTOCOL_ERROR();
++ client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_PROTOCOL_ERROR();
+ }
+ }
+
+ /*
+-We expect the response buffer for MLST to look like this:
++We expect the response buffer for MLST to look like this:
+
+ 250-Begin<CRLF>
+ <SPACE>type=dir;modify=20020101224853;UNIX.mode=0755<SPACE>/pub/kernel/software<CRLF>
+@@ -6589,7 +6589,7 @@ We expect the response buffer for MLST to look like this:
+
+ There may be multiple fact string lines, but the filenames must be the same. If
+ there are multiple fact string lines, we verify that the filenames are the same
+-and concatenate the fact lists into a single fact list. The user will always
++and concatenate the fact lists into a single fact list. The user will always
+ get a single line consisting of "factlist<space>filename".
+
+ If the response buffer doesn't look like that we exit with a protocol error.
+@@ -6597,10 +6597,10 @@ If the response buffer doesn't look like that we exit with a protocol error.
+ static
+ void
+ globus_l_ftp_client_parse_mlst(
+- globus_i_ftp_client_handle_t * client_handle,
+- globus_ftp_control_response_t * response)
++ globus_i_ftp_client_handle_t * client_handle,
++ globus_ftp_control_response_t * response)
+ {
+- char * p;
++ char * p;
+ globus_byte_t * buffer;
+ char * fact_list;
+ char * this_filename;
+@@ -6614,19 +6614,19 @@ globus_l_ftp_client_parse_mlst(
+
+ if(response->code != 250)
+ {
+- return;
++ return;
+ }
+-
++
+ buffer = (globus_byte_t *) globus_malloc(
+ response->response_length * sizeof(globus_byte_t));
+ if(buffer == GLOBUS_NULL)
+ {
+ goto nomem_exit;
+ }
+-
++
+ p = (char *) response->response_buffer;
+
+- /* advancing past the starting control response */
++ /* advancing past the starting control response */
+ while(*p && *p != '\r' && *p != '\n')
+ {
+ p++;
+@@ -6635,24 +6635,24 @@ globus_l_ftp_client_parse_mlst(
+ {
+ p++;
+ }
+-
++
+ /* every fact line starts with a space */
+ while(*p == ' ' && *(++p))
+- {
++ {
+ fact_list = p;
+-
++
+ /* filename starts after the first space
+ no spaces are allowed in the fact list */
+ this_filename = strchr(p, ' ');
+ if(this_filename == GLOBUS_NULL)
+ {
+ goto error_exit;
+- }
++ }
+ fact_list_length = this_filename - p;
+-
+- /* copy current fact list to buffer */
++
++ /* copy current fact list to buffer */
+ memcpy(buffer + total_fact_list_length, fact_list, fact_list_length);
+-
++
+ total_fact_list_length += fact_list_length;
+
+ /* advancing past the end of the filename */
+@@ -6660,7 +6660,7 @@ globus_l_ftp_client_parse_mlst(
+ while(*p && *p != '\r' && *p != '\n')
+ {
+ p++;
+- }
++ }
+
+ /* if we have multiple fact strings for this file, check that the
+ filenames are the same. exit with protocol error if not */
+@@ -6671,42 +6671,42 @@ globus_l_ftp_client_parse_mlst(
+ {
+ goto error_exit;
+ }
+- }
++ }
+ else
+- {
++ {
+ filename_length = p - this_filename;
+ filename = this_filename;
+ }
+-
++
+ /* advancing past the CRLF to the start of the next line */
+ while(*p && (*p == '\r' || *p == '\n'))
+ {
+ p++;
+- }
+- }
+-
++ }
++ }
++
+ if(*p == '\0' || filename_length == 0)
+ {
+ goto error_exit;
+ }
+-
++
+ memcpy(buffer + total_fact_list_length, filename, filename_length);
+-
++
+ data_length = total_fact_list_length + filename_length;
+-
+- /* null terminate the buffer since the user
++
++ /* null terminate the buffer since the user
+ will likely treat it as a string */
+ buffer[data_length] = '\0';
+-
++
+ *client_handle->mlst_buffer_pointer = buffer;
+- *client_handle->mlst_buffer_length_pointer = data_length;
+-
++ *client_handle->mlst_buffer_length_pointer = data_length;
++
+ return;
+
+ error_exit:
+ if(client_handle->err == GLOBUS_SUCCESS)
+ {
+- client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_PROTOCOL_ERROR();
++ client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_PROTOCOL_ERROR();
+ }
+ globus_free(buffer);
+ return;
+@@ -6714,7 +6714,7 @@ error_exit:
+ nomem_exit:
+ if(client_handle->err == GLOBUS_SUCCESS)
+ {
+- client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_OUT_OF_MEMORY();
++ client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_OUT_OF_MEMORY();
+ }
+ return;
+ } /* globus_l_ftp_client_parse_mlst() */
+@@ -6723,8 +6723,8 @@ nomem_exit:
+ static
+ void
+ globus_l_ftp_client_parse_cwd(
+- globus_i_ftp_client_handle_t * client_handle,
+- globus_ftp_control_response_t * response)
++ globus_i_ftp_client_handle_t * client_handle,
++ globus_ftp_control_response_t * response)
+ {
+ globus_byte_t * buffer;
+
+@@ -6732,12 +6732,12 @@ globus_l_ftp_client_parse_cwd(
+
+ if(response->code != 250)
+ {
+- return;
++ return;
+ }
+-
++
+ if ( client_handle->mlst_buffer_pointer == NULL ||
+- client_handle->mlst_buffer_length_pointer == NULL ) {
+- return;
++ client_handle->mlst_buffer_length_pointer == NULL ) {
++ return;
+ }
+
+ buffer = globus_malloc(
+@@ -6750,14 +6750,14 @@ globus_l_ftp_client_parse_cwd(
+ memcpy( buffer, response->response_buffer, response->response_length );
+
+ *client_handle->mlst_buffer_pointer = buffer;
+- *client_handle->mlst_buffer_length_pointer = response->response_length;
++ *client_handle->mlst_buffer_length_pointer = response->response_length;
+
+ return;
+
+ nomem_exit:
+ if(client_handle->err == GLOBUS_SUCCESS)
+ {
+- client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_OUT_OF_MEMORY();
++ client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_OUT_OF_MEMORY();
+ }
+ return;
+ } /* globus_l_ftp_client_parse_cwd() */
+@@ -6765,11 +6765,11 @@ nomem_exit:
+ static
+ void
+ globus_l_ftp_client_parse_stat(
+- globus_i_ftp_client_handle_t * client_handle,
+- globus_ftp_control_response_t * response)
++ globus_i_ftp_client_handle_t * client_handle,
++ globus_ftp_control_response_t * response)
+ {
+- char * p;
+- char * listing_start;
++ char * p;
++ char * listing_start;
+ globus_byte_t * buffer = NULL;
+ int listing_length = 0;
+ char res_code[5];
+@@ -6780,21 +6780,21 @@ globus_l_ftp_client_parse_stat(
+ response->code != 212 &&
+ response->code != 213)
+ {
+- goto error_exit;
++ goto error_exit;
+ }
+-
++
+ snprintf(res_code, 5, "%d ", response->code);
+-
++
+ buffer = (globus_byte_t *) globus_malloc(
+ response->response_length * sizeof(globus_byte_t));
+ if(buffer == GLOBUS_NULL)
+ {
+ goto nomem_exit;
+ }
+-
++
+ p = (char *) response->response_buffer;
+
+- /* advancing past the starting control response */
++ /* advancing past the starting control response */
+ while(*p && *p != '\r' && *p != '\n')
+ {
+ p++;
+@@ -6803,45 +6803,45 @@ globus_l_ftp_client_parse_stat(
+ {
+ p++;
+ }
+-
++
+ listing_start = p;
+
+ /* check for the end control response */
+ while(*p && strncmp(p, res_code, 4) != 0)
+- {
++ {
+ /* advancing to the end of the listing */
+ while(*p && *p != '\r' && *p != '\n')
+ {
+ p++;
+- }
++ }
+ /* advancing past the CRLF to the start of the next line */
+ while(*p && (*p == '\r' || *p == '\n'))
+ {
+ p++;
+- }
+- }
++ }
++ }
+ listing_length = p - listing_start;
+-
++
+ if(*p == '\0' || listing_length == 0)
+ {
+ goto error_exit;
+ }
+-
++
+ memcpy(buffer, listing_start, listing_length);
+-
+- /* null terminate the buffer since the user
++
++ /* null terminate the buffer since the user
+ will likely treat it as a string */
+ buffer[listing_length] = '\0';
+-
++
+ *client_handle->mlst_buffer_pointer = buffer;
+- *client_handle->mlst_buffer_length_pointer = listing_length;
+-
++ *client_handle->mlst_buffer_length_pointer = listing_length;
++
+ return;
+
+ error_exit:
+ if(client_handle->err == GLOBUS_SUCCESS)
+ {
+- client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_PROTOCOL_ERROR();
++ client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_PROTOCOL_ERROR();
+ }
+ if(buffer)
+ {
+@@ -6852,7 +6852,7 @@ error_exit:
+ nomem_exit:
+ if(client_handle->err == GLOBUS_SUCCESS)
+ {
+- client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_OUT_OF_MEMORY();
++ client_handle->err = GLOBUS_I_FTP_CLIENT_ERROR_OUT_OF_MEMORY();
+ }
+ return;
+ } /* globus_l_ftp_client_parse_stat() */
+@@ -6861,7 +6861,7 @@ nomem_exit:
+ static
+ globus_bool_t
+ globus_l_ftp_client_can_cache_data_connection(
+- globus_i_ftp_client_target_t * target)
++ globus_i_ftp_client_target_t * target)
+ {
+ return GLOBUS_TRUE;
+ }
+@@ -6869,9 +6869,9 @@ globus_l_ftp_client_can_cache_data_connection(
+ static
+ void
+ globus_l_ftp_client_data_force_close_callback(
+- void * callback_arg,
+- globus_ftp_control_handle_t * control_handle,
+- globus_object_t * error)
++ void * callback_arg,
++ globus_ftp_control_handle_t * control_handle,
++ globus_object_t * error)
+ {
+ }
+
+@@ -6894,7 +6894,7 @@ globus_l_ftp_client_pp_src_add(
+ &pl_source_url,
+ &pl_dest_url,
+ client_handle->attr.pipeline_arg);
+-
++
+ if(pl_source_url == NULL)
+ {
+ return GLOBUS_SUCCESS;
+@@ -6983,7 +6983,7 @@ globus_l_ftp_client_pp_dst_add(
+ &pl_source_url,
+ &pl_dest_url,
+ client_handle->attr.pipeline_arg);
+-
++
+ if(pl_dest_url == NULL)
+ {
+ return GLOBUS_SUCCESS;
+@@ -7000,7 +7000,7 @@ globus_l_ftp_client_pp_dst_add(
+
+ client_handle->no_callback_count++;
+ globus_fifo_enqueue(&client_handle->dst_response_pending_queue, url_ent);
+-
++
+ if(target->attr->module_alg_str != GLOBUS_NULL)
+ {
+ globus_i_ftp_client_plugin_notify_command(
+@@ -7125,7 +7125,7 @@ globus_l_ftp_client_pp_get_next(
+ memcpy(src_url_ent, url_ent, sizeof(globus_i_ftp_client_url_ent_t));
+ globus_fifo_enqueue(&client_handle->src_op_queue, src_url_ent);
+ }
+-
++
+ return GLOBUS_SUCCESS;
+ }
+
+@@ -7153,7 +7153,7 @@ globus_l_ftp_client_pp_xfer_dst_add(
+ }
+ url_ent = (globus_i_ftp_client_url_ent_t *)
+ globus_fifo_dequeue(&client_handle->dst_op_queue);
+-
++
+ client_handle->no_callback_count++;
+ globus_fifo_enqueue(&client_handle->dst_response_pending_queue, url_ent);
+
+@@ -7283,19 +7283,19 @@ result_fault:
+ static
+ globus_result_t
+ globus_l_ftp_client_use_gridftp2_getput(
+- globus_i_ftp_client_target_t * target,
++ globus_i_ftp_client_target_t * target,
+ globus_bool_t * getput)
+ {
+- globus_i_ftp_client_handle_t * client_handle;
++ globus_i_ftp_client_handle_t * client_handle;
+ globus_ftp_client_handleattr_t handle_attr;
+- globus_result_t result;
++ globus_result_t result;
+
+ client_handle = target->owner;
+ handle_attr = &client_handle->attr;
+
+- /* Does target support GFD.47?
++ /* Does target support GFD.47?
+ */
+- result =
++ result =
+ globus_ftp_client_handleattr_get_gridftp2(&handle_attr, getput);
+ if(result != GLOBUS_SUCCESS || *getput == GLOBUS_FALSE)
+ {
+@@ -7314,7 +7314,7 @@ globus_l_ftp_client_use_gridftp2_getput(
+
+ /* Are GFD.47 extensions enabled?
+ */
+- if (globus_i_ftp_client_feature_get(
++ if (globus_i_ftp_client_feature_get(
+ target->features,
+ GLOBUS_FTP_CLIENT_FEATURE_GETPUT) != GLOBUS_FTP_CLIENT_TRUE)
+ {
+@@ -7358,14 +7358,14 @@ globus_l_ftp_client_use_gridftp2_getput(
+ static
+ globus_result_t
+ globus_l_ftp_client_send_get(
+- globus_i_ftp_client_target_t * target,
++ globus_i_ftp_client_target_t * target,
+ char * pathname,
+ globus_bool_t pasv)
+ {
+- char * tmpstr = GLOBUS_NULL;
+- globus_i_ftp_client_handle_t * client_handle;
+- int rc, oldrc;
+- globus_result_t result;
++ char * tmpstr = GLOBUS_NULL;
++ globus_i_ftp_client_handle_t * client_handle;
++ int rc, oldrc;
++ globus_result_t result;
+
+ client_handle = target->owner;
+
+@@ -7402,7 +7402,7 @@ globus_l_ftp_client_send_get(
+ client_handle->pasv_address[0].port & 0xff);
+ if(rc == oldrc)
+ {
+- globus_libc_free(tmpstr);
++ globus_libc_free(tmpstr);
+ return globus_error_put(GLOBUS_ERROR_NO_INFO);
+ }
+ }
+@@ -7414,7 +7414,7 @@ globus_l_ftp_client_send_get(
+ "GET path=%s;%s" CRLF,
+ pathname,
+ tmpstr);
+-
++
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+@@ -7422,7 +7422,7 @@ globus_l_ftp_client_send_get(
+ globus_libc_free(tmpstr);
+ return GLOBUS_SUCCESS;
+ }
+-
++
+ result =
+ globus_ftp_control_send_command(
+ target->control_handle,
+@@ -7431,7 +7431,7 @@ globus_l_ftp_client_send_get(
+ target,
+ pathname,
+ tmpstr);
+-
++
+ globus_libc_free(tmpstr);
+
+ return result;
+@@ -7443,14 +7443,14 @@ globus_l_ftp_client_send_get(
+ static
+ globus_result_t
+ globus_l_ftp_client_send_put(
+- globus_i_ftp_client_target_t * target,
++ globus_i_ftp_client_target_t * target,
+ char * pathname,
+ globus_bool_t pasv)
+ {
+- char * tmpstr = GLOBUS_NULL;
+- globus_i_ftp_client_handle_t * client_handle;
+- int rc, oldrc;
+- globus_result_t result;
++ char * tmpstr = GLOBUS_NULL;
++ globus_i_ftp_client_handle_t * client_handle;
++ int rc, oldrc;
++ globus_result_t result;
+
+ client_handle = target->owner;
+
+@@ -7487,7 +7487,7 @@ globus_l_ftp_client_send_put(
+ client_handle->pasv_address[0].port & 0xff);
+ if(rc == oldrc)
+ {
+- globus_libc_free(tmpstr);
++ globus_libc_free(tmpstr);
+ return globus_error_put(GLOBUS_ERROR_NO_INFO);
+ }
+ }
+@@ -7499,7 +7499,7 @@ globus_l_ftp_client_send_put(
+ "PUT path=%s;%s" CRLF,
+ pathname,
+ tmpstr);
+-
++
+ if(client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_ABORT ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_RESTART ||
+ client_handle->state == GLOBUS_FTP_CLIENT_HANDLE_FAILURE)
+@@ -7507,7 +7507,7 @@ globus_l_ftp_client_send_put(
+ globus_libc_free(tmpstr);
+ return GLOBUS_SUCCESS;
+ }
+-
++
+ result =
+ globus_ftp_control_send_command(
+ target->control_handle,
+@@ -7516,7 +7516,7 @@ globus_l_ftp_client_send_put(
+ target,
+ pathname,
+ tmpstr);
+-
++
+ globus_libc_free(tmpstr);
+
+ return result;
+diff --git a/gridftp/client/source/test/lingering-get-test.c b/gridftp/client/source/test/lingering-get-test.c
+index 501f4331c..ee68a8f7b 100644
+--- a/gridftp/client/source/test/lingering-get-test.c
++++ b/gridftp/client/source/test/lingering-get-test.c
+@@ -18,7 +18,7 @@
+ * simple authenticated get which is not completed before
+ * deactivation.
+ *
+- * makes sure that the ftp client and control libraries will
++ * makes sure that the ftp client and control libraries will
+ * correctly deal with a handle in a unfinished state before
+ * deactivation.
+ */
+@@ -33,9 +33,9 @@ static int done = 0;
+ static
+ void
+ done_cb(
+- void * user_arg,
+- globus_ftp_client_handle_t * handle,
+- globus_object_t * err)
++ void * user_arg,
++ globus_ftp_client_handle_t * handle,
++ globus_object_t * err)
+ {
+ char * tmpstr;
+
+@@ -47,18 +47,18 @@ done_cb(
+ done = GLOBUS_TRUE;
+ globus_cond_signal(&cond);
+ globus_mutex_unlock(&lock);
+-
++
+ }
+
+ int main(int argc,
+- char *argv[])
++ char *argv[])
+ {
+- globus_ftp_client_handle_t handle;
+- globus_ftp_client_operationattr_t attr;
+- globus_result_t result;
+- char * src;
+- char * dst;
+- globus_ftp_client_handleattr_t handle_attr;
++ globus_ftp_client_handle_t handle;
++ globus_ftp_client_operationattr_t attr;
++ globus_result_t result;
++ char * src;
++ char * dst;
++ globus_ftp_client_handleattr_t handle_attr;
+
+ LTDL_SET_PRELOADED_SYMBOLS();
+ globus_module_activate(GLOBUS_FTP_CLIENT_MODULE);
+@@ -66,12 +66,12 @@ int main(int argc,
+ globus_ftp_client_handleattr_init(&handle_attr);
+ globus_ftp_client_operationattr_init(&attr);
+
+- test_parse_args(argc,
+- argv,
+- &handle_attr,
+- &attr,
+- &src,
+- &dst);
++ test_parse_args(argc,
++ argv,
++ &handle_attr,
++ &attr,
++ &src,
++ &dst);
+
+ globus_mutex_init(&lock, GLOBUS_NULL);
+ globus_cond_init(&cond, GLOBUS_NULL);
+@@ -80,11 +80,11 @@ int main(int argc,
+
+ done = GLOBUS_FALSE;
+ result = globus_ftp_client_get(&handle,
+- src,
+- &attr,
+- GLOBUS_NULL,
+- done_cb,
+- 0);
++ src,
++ &attr,
++ GLOBUS_NULL,
++ done_cb,
++ 0);
+ globus_module_deactivate_all();
+
+ return done;
+diff --git a/gridftp/client/source/test/multiple-block-get-test.c b/gridftp/client/source/test/multiple-block-get-test.c
+index 87172baea..5099839ed 100644
+--- a/gridftp/client/source/test/multiple-block-get-test.c
++++ b/gridftp/client/source/test/multiple-block-get-test.c
+@@ -33,45 +33,45 @@ static globus_bool_t error = GLOBUS_FALSE;
+ static
+ void
+ done_cb(
+- void * user_arg,
+- globus_ftp_client_handle_t * handle,
+- globus_object_t * err)
++ void * user_arg,
++ globus_ftp_client_handle_t * handle,
++ globus_object_t * err)
+ {
+ char * tmpstr;
+
+ if(err) tmpstr = " an";
+ else tmpstr = "out";
+
+- if(err) { printf("done with%s error\n", tmpstr);
++ if(err) { printf("done with%s error\n", tmpstr);
+ error = GLOBUS_TRUE; }
+
+ globus_mutex_lock(&lock);
+ done = GLOBUS_TRUE;
+ globus_cond_signal(&cond);
+ globus_mutex_unlock(&lock);
+-
++
+ }
+
+ static
+ void
+ data_cb(
+- void * user_arg,
+- globus_ftp_client_handle_t * handle,
+- globus_object_t * err,
+- globus_byte_t * buffer,
+- globus_size_t length,
+- globus_off_t offset,
+- globus_bool_t eof)
++ void * user_arg,
++ globus_ftp_client_handle_t * handle,
++ globus_object_t * err,
++ globus_byte_t * buffer,
++ globus_size_t length,
++ globus_off_t offset,
++ globus_bool_t eof)
+ {
+- globus_result_t result;
++ globus_result_t result;
+ fwrite(buffer, 1, length, stdout);
+ if(!eof)
+ {
+- result = globus_ftp_client_register_read(handle,
+- buffer,
+- BUFSIZE,
+- data_cb,
+- 0);
++ result = globus_ftp_client_register_read(handle,
++ buffer,
++ BUFSIZE,
++ data_cb,
++ 0);
+ }
+ else
+ {
+@@ -81,14 +81,14 @@ data_cb(
+
+ int main(int argc, char **argv)
+ {
+- globus_ftp_client_handle_t handle;
+- globus_ftp_client_operationattr_t attr;
+- globus_byte_t * buffer;
+- globus_result_t result;
+- int i;
+- globus_ftp_client_handleattr_t handle_attr;
+- char * src;
+- char * dst;
++ globus_ftp_client_handle_t handle;
++ globus_ftp_client_operationattr_t attr;
++ globus_byte_t * buffer;
++ globus_result_t result;
++ int i;
++ globus_ftp_client_handleattr_t handle_attr;
++ char * src;
++ char * dst;
+
+ LTDL_SET_PRELOADED_SYMBOLS();
+ globus_module_activate(GLOBUS_FTP_CLIENT_MODULE);
+@@ -99,43 +99,43 @@ int main(int argc, char **argv)
+ globus_cond_init(&cond, GLOBUS_NULL);
+
+ test_parse_args(argc,
+- argv,
+- &handle_attr,
+- &attr,
+- &src,
+- &dst);
++ argv,
++ &handle_attr,
++ &attr,
++ &src,
++ &dst);
+
+ globus_ftp_client_handle_init(&handle, &handle_attr);
+
+ done = GLOBUS_FALSE;
+ result = globus_ftp_client_get(&handle,
+- src,
+- &attr,
+- GLOBUS_NULL,
+- done_cb,
+- 0);
++ src,
++ &attr,
++ GLOBUS_NULL,
++ done_cb,
++ 0);
+ if(result != GLOBUS_SUCCESS)
+ {
+- error = GLOBUS_TRUE;
+- done = GLOBUS_TRUE;
++ error = GLOBUS_TRUE;
++ done = GLOBUS_TRUE;
+ }
+ else
+ {
+- for(i = 0; i < 5; i++)
+- {
+- buffer = globus_libc_malloc(BUFSIZE);
+- globus_ftp_client_register_read(
+- &handle,
+- buffer,
+- BUFSIZE,
+- data_cb,
+- 0);
+- }
++ for(i = 0; i < 5; i++)
++ {
++ buffer = globus_libc_malloc(BUFSIZE);
++ globus_ftp_client_register_read(
++ &handle,
++ buffer,
++ BUFSIZE,
++ data_cb,
++ 0);
++ }
+ }
+ globus_mutex_lock(&lock);
+ while(!done)
+ {
+- globus_cond_wait(&cond, &lock);
++ globus_cond_wait(&cond, &lock);
+ }
+ globus_mutex_unlock(&lock);
+
+@@ -144,7 +144,7 @@ int main(int argc, char **argv)
+
+ if(test_abort_count && error)
+ {
+- return 0;
++ return 0;
+ }
+ return error;
+ }
+--
+2.54.0
+
diff --git a/0002-Fix-compiler-and-doxygen-warnings.patch b/0002-Fix-compiler-and-doxygen-warnings.patch
new file mode 100644
index 0000000..6188b57
--- /dev/null
+++ b/0002-Fix-compiler-and-doxygen-warnings.patch
@@ -0,0 +1,115 @@
+From 4ee08d13e2963309e2063dc45dedd067337d3b76 Mon Sep 17 00:00:00 2001
+From: Mattias Ellert <mattias.ellert@physics.uu.se>
+Date: Wed, 20 May 2026 00:15:37 +0200
+Subject: [PATCH 2/2] Fix compiler and doxygen warnings
+
+---
+ gridftp/client/source/globus_ftp_client.h | 6 +++---
+ gridftp/client/source/globus_ftp_client_state.c | 3 +--
+ gridftp/client/source/test/lingering-get-test.c | 13 ++++++-------
+ .../client/source/test/multiple-block-get-test.c | 3 +--
+ 4 files changed, 11 insertions(+), 14 deletions(-)
+
+diff --git a/gridftp/client/source/globus_ftp_client.h b/gridftp/client/source/globus_ftp_client.h
+index 3bef542a2..83cd73af1 100644
+--- a/gridftp/client/source/globus_ftp_client.h
++++ b/gridftp/client/source/globus_ftp_client.h
+@@ -137,7 +137,7 @@ typedef enum
+
+ /**
+ * Restart marker types.
+- * @ingroup globus_ftp_client_restart_markers
++ * @ingroup globus_ftp_client_restart_marker
+ * @internal
+ *
+ * This enum defines the different types of restart markers which may be used
+@@ -153,7 +153,7 @@ globus_ftp_client_restart_type_t;
+
+ /**
+ * @brief Stream mode restart marker
+- * @ingroup globus_ftp_client_restart_markers
++ * @ingroup globus_ftp_client_restart_marker
+ * @internal
+ *
+ * This structure contains all restart marker information from a
+@@ -184,7 +184,7 @@ globus_ftp_client_restart_stream_t;
+
+ /**
+ * @brief Extended block mode restart marker
+- * @ingroup globus_ftp_client_restart_markers
++ * @ingroup globus_ftp_client_restart_marker
+ * @internal
+ *
+ * This structure contains all restart marker information from an
+diff --git a/gridftp/client/source/globus_ftp_client_state.c b/gridftp/client/source/globus_ftp_client_state.c
+index cf62dce0c..ae856ac0a 100644
+--- a/gridftp/client/source/globus_ftp_client_state.c
++++ b/gridftp/client/source/globus_ftp_client_state.c
+@@ -6427,7 +6427,6 @@ globus_l_ftp_client_parse_cksm(
+ globus_ftp_control_response_t * response)
+ {
+ char * p;
+- int rc;
+ GlobusFuncName(globus_l_ftp_client_parse_cksm);
+
+ if(response->code != 213)
+@@ -6440,7 +6439,7 @@ globus_l_ftp_client_parse_cksm(
+ /* skip 213 <SP> */
+ p += 4;
+
+- rc=sscanf(p, "%s", client_handle->checksum);
++ sscanf(p, "%s", client_handle->checksum);
+
+ }
+
+diff --git a/gridftp/client/source/test/lingering-get-test.c b/gridftp/client/source/test/lingering-get-test.c
+index ee68a8f7b..84ea21121 100644
+--- a/gridftp/client/source/test/lingering-get-test.c
++++ b/gridftp/client/source/test/lingering-get-test.c
+@@ -55,7 +55,6 @@ int main(int argc,
+ {
+ globus_ftp_client_handle_t handle;
+ globus_ftp_client_operationattr_t attr;
+- globus_result_t result;
+ char * src;
+ char * dst;
+ globus_ftp_client_handleattr_t handle_attr;
+@@ -79,12 +78,12 @@ int main(int argc,
+ globus_ftp_client_handle_init(&handle, &handle_attr);
+
+ done = GLOBUS_FALSE;
+- result = globus_ftp_client_get(&handle,
+- src,
+- &attr,
+- GLOBUS_NULL,
+- done_cb,
+- 0);
++ globus_ftp_client_get(&handle,
++ src,
++ &attr,
++ GLOBUS_NULL,
++ done_cb,
++ 0);
+ globus_module_deactivate_all();
+
+ return done;
+diff --git a/gridftp/client/source/test/multiple-block-get-test.c b/gridftp/client/source/test/multiple-block-get-test.c
+index 5099839ed..34761a4c3 100644
+--- a/gridftp/client/source/test/multiple-block-get-test.c
++++ b/gridftp/client/source/test/multiple-block-get-test.c
+@@ -63,11 +63,10 @@ data_cb(
+ globus_off_t offset,
+ globus_bool_t eof)
+ {
+- globus_result_t result;
+ fwrite(buffer, 1, length, stdout);
+ if(!eof)
+ {
+- result = globus_ftp_client_register_read(handle,
++ globus_ftp_client_register_read(handle,
+ buffer,
+ BUFSIZE,
+ data_cb,
+--
+2.54.0
+
diff --git a/globus-ftp-client.spec b/globus-ftp-client.spec
index d1bb64b..436e79c 100644
--- a/globus-ftp-client.spec
+++ b/globus-ftp-client.spec
@@ -1,13 +1,15 @@
Name: globus-ftp-client
%global _name %(tr - _ <<< %{name})
Version: 9.9
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Grid Community Toolkit - GridFTP Client Library
License: Apache-2.0
URL: https://github.com/gridcf/gct/
Source: https://repo.gridcf.org/gct6/sources/%{_name}-%{version}.tar.gz
Source8: README
+Patch0: 0001-Untabify-and-remove-trailing-white-space.patch
+Patch1: 0002-Fix-compiler-and-doxygen-warnings.patch
BuildRequires: make
BuildRequires: gcc
@@ -85,6 +87,8 @@ GridFTP Client Library Documentation Files
%prep
%setup -q -n %{_name}-%{version}
+%patch -P0 -p4
+%patch -P1 -p4
%build
# Reduce overlinking
@@ -139,6 +143,9 @@ GLOBUS_HOSTNAME=localhost %make_build check
%license GLOBUS_LICENSE
%changelog
+* Sun Jun 14 2026 Mattias Ellert <mattias.ellert@physics.uu.se> - 9.9-3
+- Fix compiler and doxygen warnings
+
* Fri Jan 16 2026 Fedora Release Engineering <releng@fedoraproject.org> - 9.9-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_44_Mass_Rebuild
reply other threads:[~2026-06-14 8:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178142675628.1.13302290531297924239.rpms-globus-ftp-client-92080bc9890b@fedoraproject.org \
--to=mattias.ellert@physics.uu.se \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox