From: Colin Patrick McCabe Date: Thu, 5 May 2011 00:23:44 +0000 (-0700) Subject: rgw: don't output optional DisplayName if not set X-Git-Tag: v0.28~92 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d6347392634678b93f510f98d3d42407d05a956c;p=ceph.git rgw: don't output optional DisplayName if not set Don't output optional DisplayName if not set. Be a little more explicit about zeroing other optional fields during xml parsing. Signed-off-by: Colin McCabe --- diff --git a/src/rgw/rgw_acl.cc b/src/rgw/rgw_acl.cc index 634de67963a..f95e55f34a0 100644 --- a/src/rgw/rgw_acl.cc +++ b/src/rgw/rgw_acl.cc @@ -81,6 +81,8 @@ bool ACLOwner::xml_end(const char *el) { // DisplayName is optional if (acl_name) display_name = acl_name->get_data(); + else + display_name = ""; return true; } @@ -105,6 +107,11 @@ bool ACLGrant::xml_end(const char *el) { return false; permission = *acl_permission; + id.clear(); + name.clear(); + uri.clear(); + email.clear(); + switch (type.get_type()) { case ACL_TYPE_CANON_USER: acl_id = (ACLID *)acl_grantee->find_first("ID"); diff --git a/src/rgw/rgw_acl.h b/src/rgw/rgw_acl.h index d2c5c40f243..1ae6e558d62 100644 --- a/src/rgw/rgw_acl.h +++ b/src/rgw/rgw_acl.h @@ -367,10 +367,10 @@ public: void to_xml(ostream& out) { if (id.empty()) return; - out << "" << - "" << id << "" << - "" << display_name << "" << - ""; + out << "" << "" << id << ""; + if (!display_name.empty()) + out << "" << display_name << ""; + out << ""; } void set_id(string& _id) { id = _id; } void set_name(string& name) { display_name = name; }