diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-10-06 19:30:10 +0200 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2008-10-06 19:30:10 +0200 |
| commit | d7f3e7e44eb7ccb2026da7006c254e5c4c60c3ce (patch) | |
| tree | 3dacf5790d217fe697d732b81f1a1a68dc63571e | |
| parent | bfe9d91c2aa2ff3cea7754c1cd8ac36e5227edad (diff) | |
| download | tuxcmd-modules-d7f3e7e44eb7ccb2026da7006c254e5c4c60c3ce.tar.xz | |
GVFS: Supply proper user/pass for anonymous FTP login
| -rw-r--r-- | gvfs/Makefile | 2 | ||||
| -rw-r--r-- | gvfs/gvfs.c | 24 |
2 files changed, 21 insertions, 5 deletions
diff --git a/gvfs/Makefile b/gvfs/Makefile index 896fec2..7542c7e 100644 --- a/gvfs/Makefile +++ b/gvfs/Makefile @@ -8,7 +8,7 @@ CC = gcc CPP = g++ CFLAGS =-I. -I/usr/include \ -Wall -fPIC -O2 -g \ - -DG_DISABLE_DEPRECATED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE + -DG_DISABLE_DEPRECATED -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE LIB_SUFFIX=`if test \`uname -m\` = x86_64; then echo 64; fi` diff --git a/gvfs/gvfs.c b/gvfs/gvfs.c index 3f0ccd5..8ffa70e 100644 --- a/gvfs/gvfs.c +++ b/gvfs/gvfs.c @@ -31,9 +31,10 @@ -#define VERSION "0.1.0" -#define BUILD_DATE "2008-10-05" +#define VERSION "0.1.1" +#define BUILD_DATE "2008-10-06" #define DEFAULT_BLOCK_SIZE 0x10000 /* 64kB */ +#define ANON_FTP_PASS "ftpuser@tuxcmd.net" #define CONST_DEFAULT_QUERY_INFO_ATTRIBUTES G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME "," \ G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME "," G_FILE_ATTRIBUTE_STANDARD_SIZE "," \ @@ -50,6 +51,7 @@ struct TVFSGlobs { GMainLoop *mount_main_loop; TVFSResult mount_result; gchar *mount_password; + gboolean ftp_anonymous; gboolean break_get_dir_size; guint32 block_size; @@ -126,18 +128,23 @@ ask_password_cb (GMountOperation *op, g_assert (globs != NULL); g_print ("(WW) ask_password_cb: message = '%s'\n", message); + if (globs->ftp_anonymous) + g_print ("(II) Trying anonymous FTP login...\n"); if (flags & G_ASK_PASSWORD_NEED_USERNAME) { g_print (" need username...\n"); -/* FIXME: need proper API and spawn callback + if (globs->ftp_anonymous) + g_mount_operation_set_username (op, "anonymous"); + +/* FIXME: need proper API to spawn a callback g_mount_operation_set_username (op, s); */ } if (flags & G_ASK_PASSWORD_NEED_DOMAIN) { g_print (" need domain...\n"); -/* FIXME: need proper API and spawn callback +/* FIXME: need proper API to spawn a callback g_mount_operation_set_domain (op, s); */ } @@ -146,6 +153,9 @@ ask_password_cb (GMountOperation *op, g_print (" need password...\n"); if (globs->mount_password) g_mount_operation_set_password (op, globs->mount_password); + else + if (globs->ftp_anonymous) + g_mount_operation_set_password (op, ANON_FTP_PASS); } g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED); @@ -290,6 +300,7 @@ VFSOpen (struct TVFSGlobs *globs, char *sName) globs->file = NULL; globs->mount_password = NULL; + globs->ftp_anonymous = FALSE; uri = NULL; /* Rip out password as GVFS URIs should contain only username (and domain). */ @@ -341,6 +352,11 @@ VFSOpen (struct TVFSGlobs *globs, char *sName) if (uri_service) free (uri_service); } + else + { + /* should be anonymous */ + globs->ftp_anonymous = strcasestr (sName, "ftp://") == sName; + } g_print ("(II) VFSOpen: opening URI '%s'\n", uri ? uri : sName); |
