Mercurial > gftp.yaz
annotate lib/local.c @ 521:739afd9df73c
2004-7-27 Brian Masney <masneyb@gftp.org>
* lib/rfc959.c src/gtk/misc-gtk.c src/gtk/view_dialog.c - fixed more
comparsions between signed and unsigned integers
* lib/sshv2.c (sshv2_buffer_get_int32) - allow an expected response
value of 0. If it does not match, call sshv2_wrong_response().
SSH_FX_OK is set to 0, so this value was not being checked
* src/gtk/gtkui.c src/text/textui.c src/uicommon/gftpui.h - renamed the
clear_cache argument of gftpui_refresh() to clear_cache_entry. There is
already a function named clear_cache()
author | masneyb |
---|---|
date | Wed, 28 Jul 2004 02:47:25 +0000 |
parents | e67a52327b24 |
children | b2b4f5fa8fc7 |
rev | line source |
---|---|
1 | 1 /*****************************************************************************/ |
2 /* local.c - functions that will use the local system */ | |
122 | 3 /* Copyright (C) 1998-2003 Brian Masney <masneyb@gftp.org> */ |
1 | 4 /* */ |
5 /* This program is free software; you can redistribute it and/or modify */ | |
6 /* it under the terms of the GNU General Public License as published by */ | |
7 /* the Free Software Foundation; either version 2 of the License, or */ | |
8 /* (at your option) any later version. */ | |
9 /* */ | |
10 /* This program is distributed in the hope that it will be useful, */ | |
11 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ | |
12 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ | |
13 /* GNU General Public License for more details. */ | |
14 /* */ | |
15 /* You should have received a copy of the GNU General Public License */ | |
16 /* along with this program; if not, write to the Free Software */ | |
17 /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA */ | |
18 /*****************************************************************************/ | |
19 | |
20 #include "gftp.h" | |
33 | 21 static const char cvsid[] = "$Id$"; |
1 | 22 |
23 typedef struct local_protocol_data_tag | |
24 { | |
25 DIR *dir; | |
26 GHashTable *userhash, *grouphash; | |
27 } local_protocol_data; | |
28 | |
29 | |
48 | 30 static void |
31 local_remove_key (gpointer key, gpointer value, gpointer user_data) | |
1 | 32 { |
48 | 33 g_free (value); |
1 | 34 } |
35 | |
36 | |
37 static void | |
38 local_destroy (gftp_request * request) | |
39 { | |
40 local_protocol_data * lpd; | |
41 | |
42 g_return_if_fail (request != NULL); | |
43 g_return_if_fail (request->protonum == GFTP_LOCAL_NUM); | |
44 | |
45 lpd = request->protocol_data; | |
46 g_hash_table_foreach (lpd->userhash, local_remove_key, NULL); | |
47 g_hash_table_destroy (lpd->userhash); | |
48 g_hash_table_foreach (lpd->grouphash, local_remove_key, NULL); | |
49 g_hash_table_destroy (lpd->grouphash); | |
50 lpd->userhash = lpd->grouphash = NULL; | |
51 } | |
52 | |
53 | |
54 static int | |
55 local_connect (gftp_request * request) | |
56 { | |
57 char tempstr[PATH_MAX]; | |
58 | |
84 | 59 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
60 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
1 | 61 |
510 | 62 if (request->directory != NULL) |
1 | 63 { |
510 | 64 if (getcwd (tempstr, sizeof (tempstr)) != NULL && |
65 strcmp (tempstr, request->directory) == 0) | |
66 return (0); | |
67 | |
1 | 68 if (chdir (request->directory) != 0) |
69 { | |
186 | 70 request->logging_function (gftp_logging_error, request, |
1 | 71 _("Could not change local directory to %s: %s\n"), |
72 request->directory, g_strerror (errno)); | |
73 } | |
74 g_free (request->directory); | |
75 request->directory = NULL; | |
76 } | |
77 | |
78 if (getcwd (tempstr, sizeof (tempstr)) != NULL) | |
79 { | |
80 tempstr[sizeof (tempstr) - 1] = '\0'; | |
87 | 81 request->directory = g_strdup (tempstr); |
1 | 82 } |
83 else | |
186 | 84 request->logging_function (gftp_logging_error, request, |
1 | 85 _("Could not get current working directory: %s\n"), |
86 g_strerror (errno)); | |
87 | |
88 return (0); | |
89 } | |
90 | |
91 | |
92 static void | |
93 local_disconnect (gftp_request * request) | |
94 { | |
95 g_return_if_fail (request != NULL); | |
96 g_return_if_fail (request->protonum == GFTP_LOCAL_NUM); | |
97 | |
58 | 98 if (request->datafd != -1) |
1 | 99 { |
87 | 100 if (close (request->datafd) == -1) |
186 | 101 request->logging_function (gftp_logging_error, request, |
1 | 102 _("Error closing file descriptor: %s\n"), |
103 g_strerror (errno)); | |
58 | 104 request->datafd = -1; |
1 | 105 } |
106 } | |
107 | |
108 | |
58 | 109 static off_t |
110 local_get_file (gftp_request * request, const char *filename, int fd, | |
1 | 111 off_t startsize) |
112 { | |
58 | 113 off_t size; |
114 int flags; | |
1 | 115 |
84 | 116 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
117 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
118 g_return_val_if_fail (filename != NULL, GFTP_EFATAL); | |
1 | 119 |
66 | 120 if (fd <= 0) |
1 | 121 { |
7 | 122 flags = O_RDONLY; |
434 | 123 #if defined (_LARGEFILE_SOURCE) && defined (O_LARGEFILE) |
7 | 124 flags |= O_LARGEFILE; |
125 #endif | |
126 | |
182 | 127 if ((request->datafd = gftp_fd_open (request, filename, flags, 0)) == -1) |
128 return (GFTP_ERETRYABLE); | |
1 | 129 } |
130 else | |
131 request->datafd = fd; | |
132 | |
87 | 133 if ((size = lseek (request->datafd, 0, SEEK_END)) == -1) |
1 | 134 { |
186 | 135 request->logging_function (gftp_logging_error, request, |
1 | 136 _("Error: Cannot seek on file %s: %s\n"), |
137 filename, g_strerror (errno)); | |
58 | 138 gftp_disconnect (request); |
84 | 139 return (GFTP_ERETRYABLE); |
1 | 140 } |
141 | |
87 | 142 if (lseek (request->datafd, startsize, SEEK_SET) == -1) |
1 | 143 { |
186 | 144 request->logging_function (gftp_logging_error, request, |
1 | 145 _("Error: Cannot seek on file %s: %s\n"), |
146 filename, g_strerror (errno)); | |
58 | 147 gftp_disconnect (request); |
84 | 148 return (GFTP_ERETRYABLE); |
1 | 149 } |
150 | |
151 return (size); | |
152 } | |
153 | |
154 | |
155 static int | |
58 | 156 local_put_file (gftp_request * request, const char *filename, int fd, |
1 | 157 off_t startsize, off_t totalsize) |
158 { | |
58 | 159 int flags; |
1 | 160 |
84 | 161 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
162 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
163 g_return_val_if_fail (filename != NULL, GFTP_EFATAL); | |
1 | 164 |
66 | 165 if (fd <= 0) |
1 | 166 { |
7 | 167 flags = O_WRONLY | O_CREAT; |
168 if (startsize > 0) | |
169 flags |= O_APPEND; | |
434 | 170 #if defined (_LARGEFILE_SOURCE) && defined (O_LARGEFILE) |
7 | 171 flags |= O_LARGEFILE; |
172 #endif | |
173 | |
244 | 174 if ((request->datafd = gftp_fd_open (request, filename, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) == -1) |
182 | 175 return (GFTP_ERETRYABLE); |
1 | 176 } |
177 else | |
178 request->datafd = fd; | |
179 | |
87 | 180 if (ftruncate (request->datafd, startsize) == -1) |
1 | 181 { |
186 | 182 request->logging_function (gftp_logging_error, request, |
1 | 183 _("Error: Cannot truncate local file %s: %s\n"), |
184 filename, g_strerror (errno)); | |
58 | 185 gftp_disconnect (request); |
84 | 186 return (GFTP_ERETRYABLE); |
1 | 187 } |
188 | |
87 | 189 if (lseek (request->datafd, startsize, SEEK_SET) == -1) |
1 | 190 { |
186 | 191 request->logging_function (gftp_logging_error, request, |
1 | 192 _("Error: Cannot seek on file %s: %s\n"), |
193 filename, g_strerror (errno)); | |
58 | 194 gftp_disconnect (request); |
84 | 195 return (GFTP_ERETRYABLE); |
1 | 196 } |
197 return (0); | |
198 } | |
199 | |
200 | |
201 static int | |
202 local_end_transfer (gftp_request * request) | |
203 { | |
204 local_protocol_data * lpd; | |
205 | |
206 lpd = request->protocol_data; | |
207 if (lpd->dir) | |
208 { | |
209 closedir (lpd->dir); | |
210 lpd->dir = NULL; | |
211 } | |
212 | |
58 | 213 if (request->datafd > 0) |
1 | 214 { |
87 | 215 if (close (request->datafd) == -1) |
186 | 216 request->logging_function (gftp_logging_error, request, |
1 | 217 _("Error closing file descriptor: %s\n"), |
218 g_strerror (errno)); | |
219 | |
58 | 220 request->datafd = -1; |
1 | 221 } |
222 | |
223 return (0); | |
224 } | |
225 | |
226 | |
520 | 227 static int |
228 local_stat_filename (gftp_request * request, const char *filename, | |
229 mode_t * mode) | |
500 | 230 { |
231 struct stat st; | |
232 | |
233 if (stat (filename, &st) != 0) | |
234 return (GFTP_ERETRYABLE); | |
235 | |
520 | 236 *mode = st.st_mode; |
237 return (0); | |
500 | 238 } |
239 | |
240 | |
1 | 241 static int |
58 | 242 local_get_next_file (gftp_request * request, gftp_file * fle, int fd) |
1 | 243 { |
244 local_protocol_data * lpd; | |
255 | 245 struct stat st, fst; |
1 | 246 struct dirent *dirp; |
247 char *user, *group; | |
248 struct passwd *pw; | |
249 struct group *gr; | |
250 | |
251 /* the struct passwd and struct group are not thread safe. But, | |
252 we're ok here because I have threading turned off for the local | |
341 | 253 protocol (see use_threads in gftp_protocols in options.h) */ |
84 | 254 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
255 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
256 g_return_val_if_fail (fle != NULL, GFTP_EFATAL); | |
1 | 257 |
258 lpd = request->protocol_data; | |
87 | 259 |
260 g_return_val_if_fail (lpd != NULL, GFTP_EFATAL); | |
261 | |
1 | 262 memset (fle, 0, sizeof (*fle)); |
263 | |
264 if ((dirp = readdir (lpd->dir)) == NULL) | |
265 { | |
266 closedir (lpd->dir); | |
267 lpd->dir = NULL; | |
274 | 268 return (GFTP_EFATAL); |
1 | 269 } |
270 | |
87 | 271 fle->file = g_strdup (dirp->d_name); |
1 | 272 if (lstat (fle->file, &st) != 0) |
274 | 273 return (GFTP_ERETRYABLE); |
1 | 274 |
255 | 275 if (stat (fle->file, &fst) != 0) |
274 | 276 return (GFTP_ERETRYABLE); |
255 | 277 |
1 | 278 if ((user = g_hash_table_lookup (lpd->userhash, |
279 GUINT_TO_POINTER(st.st_uid))) != NULL) | |
87 | 280 fle->user = g_strdup (user); |
1 | 281 else |
282 { | |
283 if ((pw = getpwuid (st.st_uid)) == NULL) | |
284 fle->user = g_strdup_printf ("%u", st.st_uid); | |
285 else | |
87 | 286 fle->user = g_strdup (pw->pw_name); |
1 | 287 |
87 | 288 user = g_strdup (fle->user); |
1 | 289 g_hash_table_insert (lpd->userhash, GUINT_TO_POINTER (st.st_uid), user); |
290 } | |
291 | |
292 if ((group = g_hash_table_lookup (lpd->grouphash, | |
293 GUINT_TO_POINTER(st.st_gid))) != NULL) | |
87 | 294 fle->group = g_strdup (group); |
1 | 295 else |
296 { | |
297 if ((gr = getgrgid (st.st_gid)) == NULL) | |
298 fle->group = g_strdup_printf ("%u", st.st_gid); | |
299 else | |
87 | 300 fle->group = g_strdup (gr->gr_name); |
1 | 301 |
87 | 302 group = g_strdup (fle->group); |
1 | 303 g_hash_table_insert (lpd->grouphash, GUINT_TO_POINTER (st.st_gid), group); |
304 } | |
305 | |
499 | 306 fle->st_mode = fst.st_mode; |
1 | 307 fle->datetime = st.st_mtime; |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
308 |
499 | 309 if (GFTP_IS_SPECIAL_DEVICE (fle->st_mode)) |
48 | 310 fle->size = (off_t) st.st_rdev; |
14
83090328581e
* More largefile support. Hopefully all that is left is the configure stuff
masneyb
parents:
7
diff
changeset
|
311 else |
294 | 312 fle->size = fst.st_size; |
1 | 313 |
314 return (1); | |
315 } | |
316 | |
317 | |
318 static int | |
319 local_list_files (gftp_request * request) | |
320 { | |
321 local_protocol_data *lpd; | |
322 char *tempstr; | |
87 | 323 int freeit; |
1 | 324 |
84 | 325 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
87 | 326 g_return_val_if_fail (request->directory != NULL, GFTP_EFATAL); |
84 | 327 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); |
87 | 328 |
1 | 329 lpd = request->protocol_data; |
330 | |
87 | 331 g_return_val_if_fail (lpd != NULL, GFTP_EFATAL); |
332 | |
333 if (request->directory[strlen (request->directory) - 1] != '/') | |
334 { | |
335 tempstr = g_strconcat (request->directory, "/", NULL); | |
336 freeit = 1; | |
337 } | |
338 else | |
339 { | |
340 tempstr = request->directory; | |
341 freeit = 0; | |
342 } | |
1 | 343 |
344 if ((lpd->dir = opendir (tempstr)) == NULL) | |
345 { | |
186 | 346 request->logging_function (gftp_logging_error, request, |
1 | 347 _("Could not get local directory listing %s: %s\n"), |
348 tempstr, g_strerror (errno)); | |
87 | 349 if (freeit) |
350 g_free (tempstr); | |
84 | 351 return (GFTP_ERETRYABLE); |
1 | 352 } |
353 | |
87 | 354 if (freeit) |
355 g_free (tempstr); | |
356 | |
1 | 357 return (0); |
358 } | |
359 | |
360 | |
361 static off_t | |
362 local_get_file_size (gftp_request * request, const char *filename) | |
363 { | |
364 struct stat st; | |
365 | |
87 | 366 if (stat (filename, &st) == -1) |
84 | 367 return (GFTP_ERETRYABLE); |
1 | 368 return (st.st_size); |
369 } | |
370 | |
371 | |
372 static int | |
373 local_chdir (gftp_request * request, const char *directory) | |
374 { | |
375 char tempstr[255]; | |
376 | |
84 | 377 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
378 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
379 g_return_val_if_fail (directory != NULL, GFTP_EFATAL); | |
1 | 380 |
381 if (chdir (directory) == 0) | |
382 { | |
186 | 383 request->logging_function (gftp_logging_misc, request, |
1 | 384 _("Successfully changed local directory to %s\n"), |
385 directory); | |
136 | 386 |
253 | 387 if (request->directory != directory) |
1 | 388 { |
253 | 389 if (getcwd (tempstr, sizeof (tempstr)) == NULL) |
390 { | |
391 request->logging_function (gftp_logging_error, request, | |
392 _("Could not get current working directory: %s\n"), | |
393 g_strerror (errno)); | |
394 return (GFTP_ERETRYABLE); | |
395 } | |
396 | |
397 if (request->directory) | |
398 g_free (request->directory); | |
399 request->directory = g_strdup (tempstr); | |
136 | 400 } |
87 | 401 |
1 | 402 return (0); |
403 } | |
87 | 404 else |
405 { | |
186 | 406 request->logging_function (gftp_logging_error, request, |
87 | 407 _("Could not change local directory to %s: %s\n"), |
408 directory, g_strerror (errno)); | |
409 return (GFTP_ERETRYABLE); | |
410 } | |
1 | 411 } |
412 | |
413 | |
414 static int | |
415 local_rmdir (gftp_request * request, const char *directory) | |
416 { | |
84 | 417 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
418 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
419 g_return_val_if_fail (directory != NULL, GFTP_EFATAL); | |
1 | 420 |
421 if (rmdir (directory) == 0) | |
422 { | |
186 | 423 request->logging_function (gftp_logging_misc, request, |
1 | 424 _("Successfully removed %s\n"), directory); |
425 return (0); | |
426 } | |
427 else | |
428 { | |
186 | 429 request->logging_function (gftp_logging_error, request, |
1 | 430 _("Error: Could not remove directory %s: %s\n"), |
431 directory, g_strerror (errno)); | |
84 | 432 return (GFTP_ERETRYABLE); |
1 | 433 } |
434 } | |
435 | |
436 | |
437 static int | |
438 local_rmfile (gftp_request * request, const char *file) | |
439 { | |
84 | 440 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
441 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
442 g_return_val_if_fail (file != NULL, GFTP_EFATAL); | |
1 | 443 |
444 if (unlink (file) == 0) | |
445 { | |
186 | 446 request->logging_function (gftp_logging_misc, request, |
1 | 447 _("Successfully removed %s\n"), file); |
448 return (0); | |
449 } | |
450 else | |
451 { | |
186 | 452 request->logging_function (gftp_logging_error, request, |
1 | 453 _("Error: Could not remove file %s: %s\n"), |
454 file, g_strerror (errno)); | |
84 | 455 return (GFTP_ERETRYABLE); |
1 | 456 } |
457 } | |
458 | |
459 | |
460 static int | |
461 local_mkdir (gftp_request * request, const char *directory) | |
462 { | |
84 | 463 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
464 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
465 g_return_val_if_fail (directory != NULL, GFTP_EFATAL); | |
1 | 466 |
467 if (mkdir (directory, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0) | |
468 { | |
186 | 469 request->logging_function (gftp_logging_misc, request, |
1 | 470 _("Successfully made directory %s\n"), |
471 directory); | |
472 return (0); | |
473 } | |
474 else | |
475 { | |
186 | 476 request->logging_function (gftp_logging_error, request, |
1 | 477 _("Error: Could not make directory %s: %s\n"), |
478 directory, g_strerror (errno)); | |
84 | 479 return (GFTP_ERETRYABLE); |
1 | 480 } |
481 } | |
482 | |
483 | |
484 static int | |
485 local_rename (gftp_request * request, const char *oldname, | |
486 const char *newname) | |
487 { | |
84 | 488 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
489 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
490 g_return_val_if_fail (oldname != NULL, GFTP_EFATAL); | |
491 g_return_val_if_fail (newname != NULL, GFTP_EFATAL); | |
1 | 492 |
493 if (rename (oldname, newname) == 0) | |
494 { | |
186 | 495 request->logging_function (gftp_logging_misc, request, |
1 | 496 _("Successfully renamed %s to %s\n"), |
497 oldname, newname); | |
498 return (0); | |
499 } | |
500 else | |
501 { | |
186 | 502 request->logging_function (gftp_logging_error, request, |
1 | 503 _("Error: Could not rename %s to %s: %s\n"), |
504 oldname, newname, g_strerror (errno)); | |
84 | 505 return (GFTP_ERETRYABLE); |
1 | 506 } |
507 } | |
508 | |
509 | |
510 static int | |
499 | 511 local_chmod (gftp_request * request, const char *file, mode_t mode) |
1 | 512 { |
84 | 513 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
514 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
515 g_return_val_if_fail (file != NULL, GFTP_EFATAL); | |
1 | 516 |
504 | 517 if (chmod (file, mode) == 0) |
1 | 518 { |
186 | 519 request->logging_function (gftp_logging_misc, request, |
504 | 520 _("Successfully changed mode of %s to %o\n"), |
1 | 521 file, mode); |
522 return (0); | |
523 } | |
524 else | |
525 { | |
186 | 526 request->logging_function (gftp_logging_error, request, |
504 | 527 _("Error: Could not change mode of %s to %o: %s\n"), |
1 | 528 file, mode, g_strerror (errno)); |
84 | 529 return (GFTP_ERETRYABLE); |
1 | 530 } |
531 } | |
532 | |
533 | |
534 static int | |
535 local_set_file_time (gftp_request * request, const char *file, | |
536 time_t datetime) | |
537 { | |
538 struct utimbuf time_buf; | |
539 | |
84 | 540 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
541 g_return_val_if_fail (request->protonum == GFTP_LOCAL_NUM, GFTP_EFATAL); | |
542 g_return_val_if_fail (file != NULL, GFTP_EFATAL); | |
1 | 543 |
516 | 544 time_buf.modtime = datetime; |
545 time_buf.actime = datetime; | |
84 | 546 return (utime (file, &time_buf) == 0 ? 0 : GFTP_ERETRYABLE); |
1 | 547 } |
548 | |
549 | |
550 static gint | |
551 hash_compare (gconstpointer path1, gconstpointer path2) | |
552 { | |
553 return (GPOINTER_TO_UINT (path1) == GPOINTER_TO_UINT (path2)); | |
554 } | |
555 | |
556 | |
557 static guint | |
558 hash_function (gconstpointer key) | |
559 { | |
560 return (GPOINTER_TO_UINT (key)); | |
561 } | |
562 | |
48 | 563 |
122 | 564 void |
565 local_register_module (void) | |
566 { | |
567 } | |
568 | |
569 | |
173 | 570 int |
48 | 571 local_init (gftp_request * request) |
572 { | |
573 local_protocol_data *lpd; | |
574 | |
173 | 575 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
48 | 576 |
577 request->protonum = GFTP_LOCAL_NUM; | |
578 request->init = local_init; | |
309 | 579 request->copy_param_options = NULL; |
48 | 580 request->destroy = local_destroy; |
168 | 581 request->read_function = gftp_fd_read; |
582 request->write_function = gftp_fd_write; | |
48 | 583 request->connect = local_connect; |
168 | 584 request->post_connect = NULL; |
48 | 585 request->disconnect = local_disconnect; |
586 request->get_file = local_get_file; | |
587 request->put_file = local_put_file; | |
588 request->transfer_file = NULL; | |
589 request->get_next_file_chunk = NULL; | |
590 request->put_next_file_chunk = NULL; | |
591 request->end_transfer = local_end_transfer; | |
592 request->abort_transfer = local_end_transfer; /* NOTE: uses end_transfer */ | |
500 | 593 request->stat_filename = local_stat_filename; |
48 | 594 request->list_files = local_list_files; |
595 request->get_next_file = local_get_next_file; | |
485 | 596 request->get_next_dirlist_line = NULL; |
48 | 597 request->get_file_size = local_get_file_size; |
598 request->chdir = local_chdir; | |
599 request->rmdir = local_rmdir; | |
600 request->rmfile = local_rmfile; | |
601 request->mkdir = local_mkdir; | |
602 request->rename = local_rename; | |
603 request->chmod = local_chmod; | |
604 request->set_file_time = local_set_file_time; | |
605 request->site = NULL; | |
606 request->parse_url = NULL; | |
58 | 607 request->set_config_options = NULL; |
63 | 608 request->swap_socks = NULL; |
48 | 609 request->url_prefix = "file"; |
610 request->need_hostport = 0; | |
611 request->need_userpass = 0; | |
612 request->use_cache = 0; | |
613 request->always_connected = 1; | |
614 | |
615 lpd = g_malloc0 (sizeof (*lpd)); | |
616 request->protocol_data = lpd; | |
617 lpd->userhash = g_hash_table_new (hash_function, hash_compare); | |
618 lpd->grouphash = g_hash_table_new (hash_function, hash_compare); | |
66 | 619 |
620 if (request->hostname != NULL) | |
621 g_free (request->hostname); | |
622 request->hostname = g_strdup (_("local filesystem")); | |
173 | 623 |
177 | 624 return (gftp_set_config_options (request)); |
48 | 625 } |
626 |