rgw: remove dead code. rebuild_policy exists elsewhere; the acl needs no main()

This commit is contained in:
Greg Farnum 2010-03-29 10:03:29 -07:00
parent 7030731bd8
commit 66c5af2cca
2 changed files with 0 additions and 90 deletions

View File

@ -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

View File

@ -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);