diff options
Diffstat (limited to 'gvfs')
| -rw-r--r-- | gvfs/gvfs.c | 79 |
1 files changed, 7 insertions, 72 deletions
diff --git a/gvfs/gvfs.c b/gvfs/gvfs.c index 5baef7d..af85a8a 100644 --- a/gvfs/gvfs.c +++ b/gvfs/gvfs.c @@ -31,8 +31,8 @@ -#define VERSION "0.1.2" -#define BUILD_DATE "2008-10-11" +#define VERSION "0.1.3" +#define BUILD_DATE "2008-10-12" #define DEFAULT_BLOCK_SIZE 0x10000 /* 64kB */ #define CONST_DEFAULT_QUERY_INFO_ATTRIBUTES G_FILE_ATTRIBUTE_STANDARD_TYPE "," G_FILE_ATTRIBUTE_STANDARD_NAME "," \ @@ -49,7 +49,6 @@ struct TVFSGlobs { GMainLoop *mount_main_loop; TVFSResult mount_result; - gchar *mount_password; int mount_try; gboolean ftp_anonymous; @@ -139,14 +138,8 @@ ask_password_cb (GMountOperation *op, g_assert (globs != NULL); globs->mount_try++; - /* First pass, we have a password to supply */ + /* First pass, look if we have a password to supply */ if (globs->mount_try == 1) { - if ((flags & G_ASK_PASSWORD_NEED_PASSWORD) && globs->mount_password) { - printf ("(WW) ask_password_cb: mount_try = %d, setting password extracted from URI...\n", globs->mount_try); - g_mount_operation_set_password (op, globs->mount_password); - g_mount_operation_reply (op, G_MOUNT_OPERATION_HANDLED); - return; - } else if ((flags & G_ASK_PASSWORD_ANONYMOUS_SUPPORTED) && globs->ftp_anonymous) { printf ("(WW) ask_password_cb: mount_try = %d, trying FTP anonymous login...\n", globs->mount_try); g_mount_operation_set_anonymous (op, TRUE); @@ -379,75 +372,17 @@ VFSOpen (struct TVFSGlobs *globs, char *sName) GFileInfo *info; GError *error; TVFSResult res; - gchar **uri_matched; - char *uri_schema, *uri_username, *uri_password, *uri_service; - gchar *uri; - int i, seg; 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). */ - /* Password will be used in GMountOperation later */ - /* FIXME: this just temporary solution until we got new VFS API */ - /* (this is really ugly code) */ - if (strstr (sName, "@") != NULL) { - uri_schema = NULL; - uri_username = NULL; - uri_password = NULL; - uri_service = NULL; - - uri_matched = g_regex_split_simple ("^(.*)://(.*):(.*)@(.*)", sName, G_REGEX_CASELESS | G_REGEX_UNGREEDY | G_REGEX_ANCHORED, G_REGEX_MATCH_ANCHORED); - if (uri_matched) { - seg = 0; - for (i = 0; uri_matched[i] != NULL; i++) - if (strlen (uri_matched[i]) > 0) { - seg++; - switch (seg) { - case 1: - uri_schema = g_strdup (uri_matched[i]); - break; - case 2: - uri_username = g_strdup (uri_matched[i]); - break; - case 3: - uri_password = g_strdup (uri_matched[i]); - break; - case 4: - uri_service = g_strdup (uri_matched[i]); - break; - } - } - g_strfreev (uri_matched); - - globs->mount_password = g_strdup (uri_password); - if (seg == 4 && uri_schema && uri_username && uri_password && uri_service) - uri = g_strdup_printf ("%s://%s@%s", uri_schema, uri_username, uri_service); - } -// g_print ("uri_schema = '%s', uri_username = '%s', uri_password = '%s', uri_service = '%s'\n", uri_schema, uri_username, uri_password, uri_service); -// g_print ("uri = '%s'\n", uri); - if (uri_schema) - free (uri_schema); - if (uri_username) - free (uri_username); - if (uri_password) - free (uri_password); - if (uri_service) - free (uri_service); - } - else - { - /* should be anonymous */ + if (strstr (sName, "@") == NULL) { + /* test for FTP protocol (we only enable anonymous here) */ globs->ftp_anonymous = strcasestr (sName, "ftp://") == sName; } - g_print ("(II) VFSOpen: opening URI '%s'\n", uri ? uri : sName); - f = g_file_new_for_commandline_arg (uri ? uri : sName); - if (uri) - g_free (uri); + g_print ("(II) VFSOpen: opening URI '%s'\n", sName); + f = g_file_new_for_commandline_arg (sName); while (1) { error = NULL; |
