On Tue, 2020-01-14 at 14:25 +0100, Krauß, Peter (SCC) via evolution-
list wrote:
> So basically it boiled down to
> e_webdav_session_extract_privilege_simple only returning a single
> privilege and not the whole set which I think was the bug. Maybe the
> for loop in e_webdav_session_current_user_privilege_set_cb was
> supposed to deal with this...?
Hi,
aha, I see. I understood from RFC 3744 [1] that the <D:provilege>
element can contain only single node, not multiple, and the servers I
connect to conform to this expectation, but I didn't find any explicit
mention of it in the RFC (just briefly searching through it).
> I can send you a diff.
That would surely help, at least to know exactly which parts you
touched. Was it anything like the attached patch, please? Could you
give it a try, please? It works here, but it the unpatched code worked
here as well.
By the way, having a reference in a form of a bug report filled at [2]
is appreciated. Such changes do need references, places where to look
for 'what & why' and eventually report regressions with them. Would you
mind to file one, please?
Thanks and bye,
Milan
[1] https://tools.ietf.org/html/rfc3744
[2] https://gitlab.gnome.org/GNOME/evolution-data-server/issues/new
diff --git a/src/libedataserver/e-webdav-session.c b/src/libedataserver/e-webdav-session.c
index a25fe938d..afb8ef4d7 100644
--- a/src/libedataserver/e-webdav-session.c
+++ b/src/libedataserver/e-webdav-session.c
@@ -288,7 +288,7 @@ e_webdav_property_change_free (gpointer ptr)
* Describes one privilege entry. The @hint can be %E_WEBDAV_PRIVILEGE_HINT_UNKNOWN
* for privileges which are not known to the #EWebDAVSession. It's possible, because
* the servers can define their own privileges. The hint is also tried to pair with
- * known hnts when it's %E_WEBDAV_PRIVILEGE_HINT_UNKNOWN.
+ * known hints when it's %E_WEBDAV_PRIVILEGE_HINT_UNKNOWN.
*
* The @ns_uri and @name can be %NULL only if the @hint is one of the known
* privileges. Otherwise it's an error to pass either of the two as %NULL.
@@ -4097,32 +4097,28 @@ e_webdav_session_traverse_privilege_level (xmlXPathContextPtr xpath_ctx,
if (node->type == XML_ELEMENT_NODE &&
node->name && *(node->name) &&
node->ns && node->ns->href && *(node->ns->href)) {
- break;
+ GNode *child;
+ gchar *description;
+ EWebDAVPrivilegeKind kind = E_WEBDAV_PRIVILEGE_KIND_COMMON;
+ EWebDAVPrivilegeHint hint = E_WEBDAV_PRIVILEGE_HINT_UNKNOWN;
+ EWebDAVPrivilege *privilege;
+
+ if (e_xml_xpath_eval_exists (xpath_ctx, "%s/D:abstract", prefix))
+ kind = E_WEBDAV_PRIVILEGE_KIND_ABSTRACT;
+ else if (e_xml_xpath_eval_exists (xpath_ctx, "%s/D:aggregate", prefix))
+ kind = E_WEBDAV_PRIVILEGE_KIND_AGGREGATE;
+
+ description = e_xml_xpath_eval_as_string (xpath_ctx, "%s/D:description", prefix);
+ privilege = e_webdav_privilege_new ((const gchar *) node->ns->href, (const gchar *) node->name, description, kind, hint);
+ child = g_node_new (privilege);
+ g_node_append (parent, child);
+
+ g_free (description);
+
+ if (e_xml_xpath_eval_exists (xpath_ctx, "%s/D:supported-privilege", prefix))
+ e_webdav_session_traverse_privilege_level (xpath_ctx, prefix, child);
}
}
-
- if (node) {
- GNode *child;
- gchar *description;
- EWebDAVPrivilegeKind kind = E_WEBDAV_PRIVILEGE_KIND_COMMON;
- EWebDAVPrivilegeHint hint = E_WEBDAV_PRIVILEGE_HINT_UNKNOWN;
- EWebDAVPrivilege *privilege;
-
- if (e_xml_xpath_eval_exists (xpath_ctx, "%s/D:abstract", prefix))
- kind = E_WEBDAV_PRIVILEGE_KIND_ABSTRACT;
- else if (e_xml_xpath_eval_exists (xpath_ctx, "%s/D:aggregate", prefix))
- kind = E_WEBDAV_PRIVILEGE_KIND_AGGREGATE;
-
- description = e_xml_xpath_eval_as_string (xpath_ctx, "%s/D:description", prefix);
- privilege = e_webdav_privilege_new ((const gchar *) node->ns->href, (const gchar *) node->name, description, kind, hint);
- child = g_node_new (privilege);
- g_node_append (parent, child);
-
- g_free (description);
-
- if (e_xml_xpath_eval_exists (xpath_ctx, "%s/D:supported-privilege", prefix))
- e_webdav_session_traverse_privilege_level (xpath_ctx, prefix, child);
- }
}
if (xpath_obj_privilege)
@@ -4292,11 +4288,10 @@ e_webdav_session_get_supported_privilege_set_sync (EWebDAVSession *webdav,
return success;
}
-static EWebDAVPrivilege *
-e_webdav_session_extract_privilege_simple (xmlXPathObjectPtr xpath_obj_privilege)
+static void
+e_webdav_session_extract_privilege_simple (xmlXPathObjectPtr xpath_obj_privilege,
+ GSList **out_privileges)
{
- EWebDAVPrivilege *privilege = NULL;
-
if (xpath_obj_privilege &&
xpath_obj_privilege->type == XPATH_NODESET &&
xpath_obj_privilege->nodesetval &&
@@ -4310,17 +4305,16 @@ e_webdav_session_extract_privilege_simple (xmlXPathObjectPtr xpath_obj_privilege
if (node->type == XML_ELEMENT_NODE &&
node->name && *(node->name) &&
node->ns && node->ns->href && *(node->ns->href)) {
- break;
- }
- }
+ EWebDAVPrivilege *privilege;
- if (node) {
- privilege = e_webdav_privilege_new ((const gchar *) node->ns->href, (const gchar *) node->name,
- NULL, E_WEBDAV_PRIVILEGE_KIND_COMMON, E_WEBDAV_PRIVILEGE_HINT_UNKNOWN);
+ privilege = e_webdav_privilege_new ((const gchar *) node->ns->href, (const gchar *) node->name,
+ NULL, E_WEBDAV_PRIVILEGE_KIND_COMMON, E_WEBDAV_PRIVILEGE_HINT_UNKNOWN);
+
+ if (privilege)
+ *out_privileges = g_slist_prepend (*out_privileges, privilege);
+ }
}
}
-
- return privilege;
}
typedef struct _PrivilegeSetData {
@@ -4365,11 +4359,7 @@ e_webdav_session_current_user_privilege_set_cb (EWebDAVSession *webdav,
xpath_obj_privilege = e_xml_xpath_eval (xpath_ctx, "%s/D:current-user-privilege-set/D:privilege[%d]", xpath_prop_prefix, ii + 1);
if (xpath_obj_privilege) {
- EWebDAVPrivilege *privilege;
-
- privilege = e_webdav_session_extract_privilege_simple (xpath_obj_privilege);
- if (privilege)
- *(psd->out_privileges) = g_slist_prepend (*(psd->out_privileges), privilege);
+ e_webdav_session_extract_privilege_simple (xpath_obj_privilege, psd->out_privileges);
xmlXPathFreeObject (xpath_obj_privilege);
}
@@ -4640,11 +4630,7 @@ e_webdav_session_acl_cb (EWebDAVSession *webdav,
xpath_obj_privilege = e_xml_xpath_eval (xpath_ctx, "%s[%d]", privilege_prefix, ii + 1);
if (xpath_obj_privilege) {
- EWebDAVPrivilege *privilege;
-
- privilege = e_webdav_session_extract_privilege_simple (xpath_obj_privilege);
- if (privilege)
- ace->privileges = g_slist_prepend (ace->privileges, privilege);
+ e_webdav_session_extract_privilege_simple (xpath_obj_privilege, &ace->privileges);
xmlXPathFreeObject (xpath_obj_privilege);
}
_______________________________________________
evolution-list mailing list
[email protected]
To change your list options or unsubscribe, visit ...
https://mail.gnome.org/mailman/listinfo/evolution-list