[gvfs] afp: better error handling when server doesn't support anonymous login
- From: Christian Kellner <gicmo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs] afp: better error handling when server doesn't support anonymous login
- Date: Thu, 25 Aug 2011 19:27:10 +0000 (UTC)
commit 4158b740c9425c1b15be951ea460e93a629cbf23
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date: Sat Jul 23 22:18:42 2011 +0200
afp: better error handling when server doesn't support anonymous login
daemon/gvfsafpconnection.h | 1 +
daemon/gvfsafpserver.c | 28 ++++++++++++++++------------
2 files changed, 17 insertions(+), 12 deletions(-)
---
diff --git a/daemon/gvfsafpconnection.h b/daemon/gvfsafpconnection.h
index 586d14b..8ccf430 100644
--- a/daemon/gvfsafpconnection.h
+++ b/daemon/gvfsafpconnection.h
@@ -203,6 +203,7 @@ typedef enum
AFP_RESULT_NO_MORE_SESSIONS = -1068,
AFP_RESULT_ACCESS_DENIED = -5000,
AFP_RESULT_AUTH_CONTINUE = -5001,
+ AFP_RESULT_BAD_UAM = -5002,
AFP_RESULT_DIR_NOT_EMPTY = -5007,
AFP_RESULT_DISK_FULL = -5008,
AFP_RESULT_EOF_ERR = -5009,
diff --git a/daemon/gvfsafpserver.c b/daemon/gvfsafpserver.c
index 35dc552..acafb87 100644
--- a/daemon/gvfsafpserver.c
+++ b/daemon/gvfsafpserver.c
@@ -678,7 +678,7 @@ do_login (GVfsAfpServer *afp_serv,
if (!g_slist_find_custom (afp_serv->uams, AFP_UAM_NO_USER, g_str_equal))
{
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("AFP server %s doesn't support anonymous login"),
afp_serv->server_name);
return FALSE;
@@ -703,19 +703,23 @@ do_login (GVfsAfpServer *afp_serv,
if (res_code != AFP_RESULT_NO_ERROR)
{
- if (res_code == AFP_RESULT_USER_NOT_AUTH)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_PERMISSION_DENIED,
- _("AFP server %s declined anonymous login"),
- afp_serv->server_name);
- return FALSE;
- }
- else
+ switch (res_code)
{
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- _("Anonymous login to AFP server %s failed"), afp_serv->server_name);
- return FALSE;
+ case AFP_RESULT_USER_NOT_AUTH:
+ case AFP_RESULT_BAD_UAM:
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ _("AFP server %s doesn't support anonymous login"),
+ afp_serv->server_name);
+ break;
+
+ default:
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ _("Anonymous login to AFP server %s failed, got error code: %d"),
+ afp_serv->server_name, res_code);
+ break;
}
+
+ return FALSE;
}
return TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]