From 66c5af2ccab9afdc172efe6b06b5258d635ba466 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Mon, 29 Mar 2010 10:03:29 -0700 Subject: [PATCH] rgw: remove dead code. rebuild_policy exists elsewhere; the acl needs no main() --- src/rgw/rgw_acl.cc | 49 -------------------------------------------- src/rgw/rgw_admin.cc | 41 ------------------------------------ 2 files changed, 90 deletions(-) diff --git a/src/rgw/rgw_acl.cc b/src/rgw/rgw_acl.cc index 6bd82cb15f1c6..65cac5342f526 100644 --- a/src/rgw/rgw_acl.cc +++ b/src/rgw/rgw_acl.cc @@ -330,52 +330,3 @@ bool RGWXMLParser::parse(const char *_buf, int len, int done) } return true; } - - -#if 0 -int main(int argc, char **argv) { - RGWXMLParser parser; - - if (!parser.init()) - exit(1); - - char buf[1024]; - - for (;;) { - int done; - int len; - - len = fread(buf, 1, sizeof(buf), stdin); - if (ferror(stdin)) { - fprintf(stderr, "Read error\n"); - exit(-1); - } - done = feof(stdin); - - parser.parse(buf, len, done); - - if (done) - break; - } - - RGWAccessControlPolicy *policy = (RGWAccessControlPolicy *)parser.find_first("AccessControlPolicy"); - - if (policy) { - string id="79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be"; - cout << hex << policy->get_perm(id, RGW_PERM_ALL) << dec << endl; - policy->to_xml(cout); - } - - cout << parser.get_xml() << endl; - - RGWAccessControlPolicy def; - string id="thisistheid!"; - string name="foobar"; - def.create_default(id, name); - - def.to_xml(cout); - - exit(0); -} -#endif - diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index d379ba7e507a6..fd29c02a1a0f0 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -75,47 +75,6 @@ int gen_rand_alphanumeric(char *dest, int size) /* size should be the required s return 0; } -#if 0 -static int rebuild_policy(RGWAccessControlPolicy& src, RGWAccessControlPolicy& dest) -{ - ACLOwner *owner = (ACLOwner *)src.find_first("Owner"); - if (!owner) - return -EINVAL; - - RGWUserInfo owner_info; - if (rgw_get_user_info(owner->get_id(), owner_info) < 0) { - cerr << "owner info does not exist" << std::endl; - return -EINVAL; - } - ACLOwner& new_owner = dest.get_owner(); - new_owner.set_id(owner->get_id()); - new_owner.set_name(owner_info.display_name); - - RGWAccessControlList& src_acl = src.get_acl(); - RGWAccessControlList& acl = dest.get_acl(); - - XMLObjIter iter = src_acl.find("Grant"); - ACLGrant *src_grant = (ACLGrant *)iter.get_next(); - while (src_grant) { - string id = src_grant->get_id(); - - RGWUserInfo grant_user; - if (rgw_get_user_info(id, grant_user) < 0) { - cerr << "grant user does not exist:" << id << std::endl; - } else { - ACLGrant new_grant; - ACLPermission& perm = src_grant->get_permission(); - new_grant.set_canon(id, grant_user.display_name, perm.get_permissions()); - cerr << "new grant: " << id << ":" << grant_user.display_name << std::endl; - acl.add_grant(&new_grant); - } - src_grant = (ACLGrant *)iter.get_next(); - } - - return 0; -} -#endif - int main(int argc, char **argv) { DEFINE_CONF_VARS(usage); -- 2.39.5