]>
Commit | Line | Data |
---|---|---|
761092ab | 1 | =================================================================== |
2 | RCS file: /cvs/gnome/gnome-vfs/modules/ftp-method.c,v | |
3 | retrieving revision 1.123 | |
4 | retrieving revision 1.123.2.1 | |
5 | diff -u -r1.123 -r1.123.2.1 | |
6 | --- ftp-method.c 2006/03/20 19:33:35 1.123 | |
7 | +++ gnome-vfs/modules/ftp-method.c 2006/04/25 11:33:16 1.123.2.1 | |
8 | @@ -857,6 +857,13 @@ | |
9 | g_free (in_args.uri); | |
10 | } | |
11 | ||
12 | +/* | |
13 | + * Returns FALSE if callback was not handled (*aborted | |
14 | + * will be FALSE, user will be "anonymous") | |
15 | + * | |
16 | + * Returns TRUE if callback invocation succeeded, *aborted | |
17 | + * will be set to TRUE only if the user didn't cancel | |
18 | + */ | |
19 | static gboolean | |
20 | query_user_for_authn_info (GnomeVFSURI *uri, | |
21 | char **user, char **pass, char **keyring, | |
22 | @@ -867,7 +874,7 @@ | |
23 | GnomeVFSModuleCallbackFullAuthenticationOut out_args; | |
24 | gboolean ret; | |
25 | ||
26 | - ret = FALSE; | |
27 | + ret = *aborted = FALSE; | |
28 | ||
29 | memset (&in_args, 0, sizeof (in_args)); | |
30 | memset (&out_args, 0, sizeof (out_args)); | |
31 | @@ -895,7 +902,6 @@ | |
32 | &out_args, sizeof (out_args)); | |
33 | ||
34 | if (!ret) { | |
35 | - ret = TRUE; | |
36 | /* No callback, try anon login */ | |
37 | *user = g_strdup ("anonymous"); | |
38 | *pass = g_strdup ("nobody@gnome.org"); | |
39 | @@ -934,7 +940,7 @@ | |
40 | g_free (out_args.password); | |
41 | g_free (out_args.keyring); | |
42 | ||
43 | - return ret && !out_args.abort_auth; | |
44 | + return ret; | |
45 | } | |
46 | ||
47 | static gboolean | |
48 | @@ -1390,7 +1396,7 @@ | |
49 | &aborted, !uri_has_username); | |
50 | G_LOCK (connection_pools); | |
51 | pool->num_connections--; | |
52 | - if (!ret) { | |
53 | + if (aborted) { | |
54 | gnome_vfs_uri_unref (conn->uri); | |
55 | g_string_free (conn->response_buffer, TRUE); | |
56 | g_free (conn); | |
57 | @@ -1398,11 +1404,7 @@ | |
58 | g_free (pass); | |
59 | g_free (keyring); | |
60 | ||
61 | - if (aborted) { | |
62 | - return GNOME_VFS_ERROR_CANCELLED; | |
63 | - } else { | |
64 | - return GNOME_VFS_ERROR_LOGIN_FAILED; | |
65 | - } | |
66 | + return GNOME_VFS_ERROR_CANCELLED; | |
67 | } | |
68 | g_string_free (conn->response_buffer, TRUE); | |
69 | conn->response_buffer = g_string_new (""); | |
70 | @@ -1412,7 +1414,9 @@ | |
71 | if (result == GNOME_VFS_OK) { | |
72 | break; | |
73 | } | |
74 | - if (result != GNOME_VFS_ERROR_LOGIN_FAILED) { | |
75 | + if (result != GNOME_VFS_ERROR_LOGIN_FAILED || | |
76 | + !ret /* if callback was not handled, and anonymous | |
77 | + login failed, don't run into endless loop */) { | |
78 | gnome_vfs_uri_unref (conn->uri); | |
79 | g_string_free (conn->response_buffer, TRUE); | |
80 | g_free (conn); |