annotate lib/fsp.c @ 661:2e718fba351e

2005-1-16 Brian Masney <masneyb@gftp.org> * lib/fsp.c lib/options.h lib/gftp.h - added support for the FSP protocol (from Radim Kolar <hsn@netmag.cz>). Note, I need to update the build system for gftp to compile properly
author masneyb
date Sun, 16 Jan 2005 15:48:24 +0000
parents
children 2d3ea4db3106
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
661
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
1 /*****************************************************************************/
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
2 /* fsp.c - functions interfacing with FSP v2 protocol library */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
4 /* Copyright (C) 2004 Radim Kolar <hsn@netmag.cz> */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
5 /* */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
6 /* This program is free software; you can redistribute it and/or modify */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
7 /* it under the terms of the GNU General Public License as published by */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
8 /* the Free Software Foundation; either version 2 of the License, or */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
9 /* (at your option) any later version. */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
10 /* */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
11 /* This program is distributed in the hope that it will be useful, */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
12 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
13 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
14 /* GNU General Public License for more details. */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
15 /* */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
16 /* You should have received a copy of the GNU General Public License */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
17 /* along with this program; if not, write to the Free Software */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
18 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
19 /*****************************************************************************/
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
20
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
21 #include "gftp.h"
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
22 /* include fsplibrary directly, because FSPLIB it not intergrated to build system yet. */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
23 #define FSP_USE_SHAREMEM_AND_SEMOP 1
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
24 #include "fsplib.c"
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
25 #include "lock.c"
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
26
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
27 static const char cvsid[] = "$Id$";
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
28
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
29 typedef struct fsp_protocol_data_tag
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
30 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
31 FSP_SESSION *fsp;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
32 FSP_DIR *dir;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
33 FSP_FILE *file;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
34 } fsp_protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
35
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
36 static void
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
37 fsp_destroy (gftp_request * request)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
38 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
39 g_return_if_fail (request != NULL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
40 g_return_if_fail (request->protonum == GFTP_FSP_NUM);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
41 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
42
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
43 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
44 fsp_connect (gftp_request * request)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
45 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
46 fsp_protocol_data * lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
47 intptr_t network_timeout;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
48
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
49 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
50 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
51
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
52 if(! request->port)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
53 request->port = gftp_protocol_default_port (request);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
54
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
55 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
56 lpd->fsp=fsp_open_session(request->hostname, request->port, request->password);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
57
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
58 if(lpd->fsp == NULL)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
59 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
60 /* set up network timeout */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
61 gftp_lookup_request_option (request, "network_timeout", &network_timeout);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
62 lpd->fsp->timeout=1000*network_timeout;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
63
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
64 if (!request->directory)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
65 request->directory = g_strdup ("/");
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
66
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
67 request->datafd = lpd->fsp->fd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
68 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
69 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
70
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
71 static void
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
72 fsp_disconnect (gftp_request * request)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
73 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
74 fsp_protocol_data * lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
75
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
76 g_return_if_fail (request != NULL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
77 g_return_if_fail (request->protonum == GFTP_FSP_NUM);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
78
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
79 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
80 g_return_if_fail (lpd != NULL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
81
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
82 if(lpd->file)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
83 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
84 fsp_fclose(lpd->file);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
85 lpd->file=NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
86 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
87 fsp_close_session(lpd->fsp);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
88 lpd->fsp=NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
89 request->datafd = -1;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
90 if(lpd->dir)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
91 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
92 fsp_closedir(lpd->dir);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
93 lpd->dir=NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
94 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
95 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
96
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
97 static off_t
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
98 fsp_get_file (gftp_request * request, const char *filename, int fd,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
99 off_t startsize)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
100 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
101 fsp_protocol_data * lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
102 off_t size;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
103 struct stat sb;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
104
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
105 g_return_val_if_fail (request != NULL,GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
106 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM,GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
107 g_return_val_if_fail (filename != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
108
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
109 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
110 g_return_val_if_fail (lpd != NULL,GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
111 g_return_val_if_fail (lpd->fsp != NULL,GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
112
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
113 /* CHECK: close prev. opened file, is this needed? */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
114 if(lpd->file != NULL)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
115 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
116 fsp_fclose(lpd->file);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
117 lpd->file=NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
118 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
119
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
120 if(fsp_stat(lpd->fsp,filename,&sb))
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
121 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
122 if(!S_ISREG(sb.st_mode))
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
123 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
124 lpd->file=fsp_fopen(lpd->fsp,filename,"rb");
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
125
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
126 if (fsp_fseek (lpd->file, startsize, SEEK_SET) == -1)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
127 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
128 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
129 _("Error: Cannot seek on file %s: %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
130 filename, g_strerror (errno));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
131 gftp_disconnect (request);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
132 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
133 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
134
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
135 return (sb.st_size);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
136 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
137
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
138 static ssize_t fsp_read_function(gftp_request *request, void *buf, size_t size,int fd)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
139 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
140 fsp_protocol_data * lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
141
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
142 g_return_val_if_fail (request != NULL, -1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
143 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, -1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
144 g_return_val_if_fail (buf != NULL, -1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
145
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
146 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
147 g_return_val_if_fail (lpd != NULL, -1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
148 g_return_val_if_fail (lpd->file != NULL, -1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
149
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
150 return fsp_fread(buf,1,size,lpd->file);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
151 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
152
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
153 static ssize_t fsp_write_function(gftp_request *request, const char *buf, size_t size,int fd)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
154 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
155 fsp_protocol_data * lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
156
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
157 g_return_val_if_fail (request != NULL, -1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
158 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, -1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
159 g_return_val_if_fail (buf != NULL, -1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
160
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
161 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
162 g_return_val_if_fail (lpd != NULL, -1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
163 g_return_val_if_fail (lpd->file != NULL, -1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
164
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
165 return fsp_fwrite(buf,1,size,lpd->file);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
166 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
167
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
168 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
169 fsp_put_file (gftp_request * request, const char *filename, int fd,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
170 off_t startsize, off_t totalsize)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
171 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
172 fsp_protocol_data * lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
173 off_t size;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
174 struct stat sb;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
175
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
176 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
177 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
178 g_return_val_if_fail (filename != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
179
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
180 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
181 g_return_val_if_fail (lpd != NULL,GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
182 g_return_val_if_fail (lpd->fsp != NULL,GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
183
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
184 if(lpd->file != NULL)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
185 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
186 fsp_fclose(lpd->file);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
187 lpd->file=NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
188 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
189
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
190 if(fsp_canupload(lpd->fsp,filename))
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
191 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
192 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
193 _("Error: Cannot upload file %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
194 filename );
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
195 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
196 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
197
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
198
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
199 lpd->file=fsp_fopen(lpd->fsp,filename, "wb");
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
200 if(lpd->file == NULL)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
201 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
202 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
203 _("Error: Cannot write to file %s: %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
204 filename, g_strerror (errno));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
205 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
206 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
207
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
208 if (fsp_fseek (lpd->file, startsize, SEEK_SET) == -1)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
209 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
210 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
211 _("Error: Cannot seek on file %s: %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
212 filename, g_strerror (errno));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
213 gftp_disconnect (request);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
214 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
215 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
216 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
217 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
218
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
219 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
220 fsp_end_transfer (gftp_request * request)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
221 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
222 fsp_protocol_data * lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
223
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
224 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
225 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
226
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
227 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
228 g_return_val_if_fail (lpd->fsp != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
229
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
230 if (lpd->dir)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
231 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
232 fsp_closedir (lpd->dir);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
233 lpd->dir = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
234 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
235 if (lpd ->file)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
236 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
237 if(fsp_fclose(lpd->file))
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
238 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
239 lpd -> file = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
240 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
241 _("Error: Error closing file: %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
242 g_strerror (errno));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
243 return GFTP_EFATAL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
244 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
245 lpd->file=NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
246 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
247
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
248 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
249 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
250
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
251 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
252 fsp_abort_transfer (gftp_request * request)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
253 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
254 fsp_protocol_data * lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
255
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
256 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
257 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
258
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
259 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
260 g_return_val_if_fail (lpd->fsp != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
261
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
262 if (lpd->dir)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
263 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
264 fsp_closedir (lpd->dir);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
265 lpd->dir = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
266 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
267 if (lpd ->file)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
268 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
269 if(lpd->file->writing && lpd->file->pos>0)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
270 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
271 /* need to cancel upload in progress */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
272 lpd->file->writing=0;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
273 fsp_install(lpd->fsp,"",0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
274 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
275 /* we can safely ignore file close error on abort */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
276 fsp_fclose(lpd->file);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
277 lpd->file=NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
278 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
279
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
280 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
281 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
282
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
283 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
284 fsp_stat_filename (gftp_request * request, const char *filename,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
285 mode_t * mode)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
286 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
287 struct stat st;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
288 fsp_protocol_data * lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
289
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
290 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
291 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
292 g_return_val_if_fail (filename != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
293
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
294 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
295 g_return_val_if_fail (lpd->fsp != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
296
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
297 if (fsp_stat (lpd->fsp,filename, &st) != 0)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
298 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
299
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
300 *mode = st.st_mode;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
301 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
302 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
303
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
304 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
305 fsp_get_next_file (gftp_request * request, gftp_file * fle, int fd)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
306 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
307 fsp_protocol_data *lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
308 struct FSP_RDENTRY dirent;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
309 struct FSP_RDENTRY *result;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
310 char *symlink;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
311
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
312 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
313 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
314 g_return_val_if_fail (fle != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
315
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
316 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
317
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
318 g_return_val_if_fail (lpd != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
319
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
320 memset (fle, 0, sizeof (*fle));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
321
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
322 result=&dirent;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
323
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
324 if ( fsp_readdir_native (lpd->dir,&dirent,&result))
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
325 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
326 fsp_closedir (lpd->dir);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
327 lpd->dir = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
328 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
329 _("Corrupted file listing from FSP server %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
330 request->directory );
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
331 return (GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
332 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
333
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
334 if ( result == NULL)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
335 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
336 fsp_closedir (lpd->dir);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
337 lpd->dir = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
338 return 0;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
339 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
340
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
341 fle->user = g_strdup (_("unknown"));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
342 fle->group = g_strdup (_("unknown"));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
343
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
344 /* turn FSP symlink into normal file */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
345 symlink=strchr(dirent.name,'\n');
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
346 if (symlink)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
347 *symlink='\0';
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
348 fle->file = g_strdup (dirent.name);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
349 if (dirent.type==FSP_RDTYPE_DIR)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
350 fle->st_mode = S_IFDIR | 0755;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
351 else
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
352 fle->st_mode = S_IFREG | 0644;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
353 fle->datetime = dirent.lastmod;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
354 fle->size = dirent.size;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
355 return (1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
356 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
357
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
358 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
359 fsp_list_files (gftp_request * request)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
360 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
361 fsp_protocol_data *lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
362
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
363 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
364 g_return_val_if_fail (request->directory != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
365 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
366
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
367 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
368
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
369 g_return_val_if_fail (lpd != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
370
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
371 if (request->directory == NULL)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
372 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
373 request->directory = g_strdup("/");
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
374 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
375
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
376 if ((lpd->dir = fsp_opendir (lpd->fsp,request->directory)) == NULL)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
377 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
378 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
379 _("Could not get FSP directory listing %s: %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
380 request->directory, g_strerror (errno));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
381 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
382 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
383
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
384 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
385 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
386
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
387
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
388 static off_t
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
389 fsp_get_file_size (gftp_request * request, const char *filename)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
390 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
391 struct stat st;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
392 fsp_protocol_data * lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
393
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
394 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
395 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
396 g_return_val_if_fail (filename != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
397
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
398 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
399 g_return_val_if_fail (lpd->fsp != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
400
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
401 if (fsp_stat (lpd->fsp,filename, &st) != 0)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
402 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
403
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
404 return (st.st_size);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
405 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
406
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
407 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
408 fsp_chdir (gftp_request * request, const char *directory)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
409 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
410 fsp_protocol_data *lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
411 char *tempstr, *olddir;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
412
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
413 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
414 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
415 g_return_val_if_fail (directory != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
416
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
417 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
418
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
419 g_return_val_if_fail (lpd != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
420 g_return_val_if_fail (lpd->fsp != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
421
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
422 olddir=NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
423 /* build new directory string */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
424 if (request->directory != directory)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
425 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
426 olddir = request->directory;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
427
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
428 if (*directory != '/' && request->directory != NULL)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
429 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
430 tempstr = g_strconcat (request->directory, "/", directory, NULL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
431 request->directory = gftp_expand_path (request, tempstr);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
432 g_free (tempstr);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
433 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
434 else
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
435 request->directory = gftp_expand_path (request, directory);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
436 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
437
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
438 if (fsp_getpro (lpd->fsp,request->directory,NULL) == 0)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
439 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
440 request->logging_function (gftp_logging_misc, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
441 _("Successfully changed directory to %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
442 directory);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
443
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
444 if (olddir != NULL)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
445 g_free (olddir);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
446 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
447 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
448 else
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
449 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
450 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
451 _("Could not change directory to %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
452 directory);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
453 g_free (request->directory);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
454 request->directory = olddir;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
455 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
456 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
457 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
458
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
459 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
460 fsp_removedir (gftp_request * request, const char *directory)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
461 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
462 fsp_protocol_data *lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
463
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
464 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
465 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
466 g_return_val_if_fail (directory != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
467
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
468 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
469
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
470 g_return_val_if_fail (lpd != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
471 g_return_val_if_fail (lpd->fsp != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
472
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
473 if (fsp_rmdir (lpd->fsp,directory) == 0)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
474 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
475 request->logging_function (gftp_logging_misc, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
476 _("Successfully removed %s\n"), directory);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
477 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
478 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
479 else
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
480 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
481 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
482 _("Error: Could not remove directory %s: %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
483 directory, g_strerror (errno));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
484 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
485 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
486 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
487
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
488
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
489 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
490 fsp_rmfile (gftp_request * request, const char *file)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
491 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
492 fsp_protocol_data *lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
493
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
494 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
495 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
496 g_return_val_if_fail (file != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
497
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
498 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
499 g_return_val_if_fail (lpd != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
500 g_return_val_if_fail (lpd->fsp != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
501
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
502 if (fsp_unlink (lpd->fsp,file) == 0)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
503 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
504 request->logging_function (gftp_logging_misc, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
505 _("Successfully removed %s\n"), file);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
506 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
507 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
508 else
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
509 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
510 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
511 _("Error: Could not remove file %s: %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
512 file, g_strerror (errno));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
513 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
514 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
515 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
516
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
517 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
518 fsp_makedir (gftp_request * request, const char *directory)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
519 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
520 fsp_protocol_data *lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
521
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
522 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
523 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
524 g_return_val_if_fail (directory != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
525
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
526 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
527 g_return_val_if_fail (lpd != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
528 g_return_val_if_fail (lpd->fsp != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
529
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
530 if (fsp_mkdir (lpd->fsp,directory) == 0)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
531 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
532 request->logging_function (gftp_logging_misc, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
533 _("Successfully made directory %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
534 directory);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
535 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
536 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
537 else
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
538 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
539 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
540 _("Error: Could not make directory %s: %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
541 directory, g_strerror (errno));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
542 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
543 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
544 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
545
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
546 static int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
547 fsp_ren (gftp_request * request, const char *oldname,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
548 const char *newname)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
549 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
550 char *newname1,*newname2;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
551 fsp_protocol_data *lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
552
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
553 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
554 g_return_val_if_fail (request->protonum == GFTP_FSP_NUM, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
555 g_return_val_if_fail (oldname != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
556 g_return_val_if_fail (newname != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
557
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
558 lpd = request->protocol_data;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
559 g_return_val_if_fail (lpd != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
560 g_return_val_if_fail (lpd->fsp != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
561
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
562 newname1= g_strconcat (request->directory, "/", oldname, NULL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
563 newname2= g_strconcat (request->directory, "/", newname, NULL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
564
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
565 if (fsp_rename (lpd->fsp,newname1, newname2) == 0)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
566 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
567 request->logging_function (gftp_logging_misc, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
568 _("Successfully renamed %s to %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
569 oldname, newname);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
570 g_free(newname1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
571 g_free(newname2);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
572 return (0);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
573 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
574 else
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
575 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
576 g_free(newname1);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
577 g_free(newname2);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
578
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
579 request->logging_function (gftp_logging_error, request,
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
580 _("Error: Could not rename %s to %s: %s\n"),
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
581 oldname, newname, g_strerror (errno));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
582 return (GFTP_ERETRYABLE);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
583 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
584 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
585
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
586 /* TODO: FSP needs to know file last modification time while starting
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
587 upload. It can not change last mod time of existing files on server.
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
588 */
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
589
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
590 void
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
591 fsp_register_module (void)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
592 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
593 }
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
594
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
595 int
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
596 fsp_init (gftp_request * request)
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
597 {
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
598 fsp_protocol_data *lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
599
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
600 g_return_val_if_fail (request != NULL, GFTP_EFATAL);
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
601
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
602 request->protonum = GFTP_FSP_NUM;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
603 request->init = fsp_init;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
604 request->copy_param_options = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
605 request->destroy = fsp_destroy;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
606 request->read_function = fsp_read_function;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
607 request->write_function = fsp_write_function;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
608 request->connect = fsp_connect;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
609 request->post_connect = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
610 request->disconnect = fsp_disconnect;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
611 request->get_file = fsp_get_file;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
612 request->put_file = fsp_put_file;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
613 request->transfer_file = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
614 request->get_next_file_chunk = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
615 request->put_next_file_chunk = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
616 request->end_transfer = fsp_end_transfer;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
617 request->abort_transfer = fsp_abort_transfer;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
618 request->stat_filename = fsp_stat_filename;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
619 request->list_files = fsp_list_files;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
620 request->get_next_file = fsp_get_next_file;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
621 request->get_next_dirlist_line = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
622 request->get_file_size = fsp_get_file_size;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
623 request->chdir = fsp_chdir;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
624 request->rmdir = fsp_removedir;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
625 request->rmfile = fsp_rmfile;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
626 request->mkdir = fsp_makedir;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
627 request->rename = fsp_ren;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
628 request->chmod = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
629 request->set_file_time = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
630 request->site = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
631 request->parse_url = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
632 request->set_config_options = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
633 request->swap_socks = NULL;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
634 request->url_prefix = "fsp";
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
635 request->need_hostport = 1;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
636 request->need_username = 0;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
637 request->need_password = 0;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
638 request->use_cache = 1;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
639 request->always_connected = 0;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
640
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
641 lpd = g_malloc0 (sizeof (*lpd));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
642 request->protocol_data = lpd;
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
643
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
644 return (gftp_set_config_options (request));
2e718fba351e 2005-1-16 Brian Masney <masneyb@gftp.org>
masneyb
parents:
diff changeset
645 }