Exemplo n.º 1
0
bool CrpcBase::rpcArray(CXmlNodePtr param, const char *name, CXmlNodePtr& node)
{
	CXmlNodePtr val = param->Clone();

	if(!strcmp(val->GetName(),"param"))
		val->GetChild();
	if(!strcmp(val->GetName(),"array"))
		return false;

	if(!node)
	{
		if(!val->GetChild())
			return false;
		if(!strcmp(val->GetName(),"data"))
			return false;
		node = val->Clone();
		return true;
	}
	else
	{
		if(!node->GetParent()) return false;
		if(!node->GetSibling()) return false;
		if(!strcmp(node->GetName(),"data"))
			return false;
		if(!node->GetChild()) return false;
		return true;
	}
}
Exemplo n.º 2
0
Arquivo: chacl.cpp Projeto: acml/cvsnt
static void set_attrs(CXmlNodePtr acl, const char *type, int deny, int noinherit)
{
	acl->NewNode(type);
	if(deny)
		acl->NewAttribute("deny","1");
	if(noinherit)
		acl->NewAttribute("inherit","0");
	acl->GetParent();
}
Exemplo n.º 3
0
CXmlNodePtr CrpcBase::rpcResponse(CXmlNodePtr result)
{
	// Looks dodgy.. probably broken
	// Not sure what this is actually supposed to do right now - fix later
	CXmlTree *tree = result->GetTree();
	if(!tree->CreateNewTree("methodResponse")) return NULL;
	CXmlNodePtr response = tree->GetRoot();
	response->NewNode("params");
	response->CopySubtree(result);
	response->GetParent();
	return response;
}
Exemplo n.º 4
0
CXmlNodePtr CrpcBase::rpcFault(CXmlTree& tree, int err, const char *error)
{
	if(!tree.CreateNewTree("fault")) return NULL;
	CXmlNodePtr fault = tree.GetRoot();
	fault->NewNode("value", NULL);
	fault->NewNode("struct", NULL);
	addParam(fault,"faultCode",err);
	addParam(fault,"faultString",error);
	fault->GetParent();
	fault->GetParent();
	return fault;
}
Exemplo n.º 5
0
CXmlNodePtr CrpcBase::rpcCall(const char *method, CXmlNodePtr param)
{
	// Looks dodgy.. probably broken
	// Not sure what this is actually supposed to do right now - fix later
	CXmlTree *tree = param->GetTree();
	if(!tree->CreateNewTree("methodCall")) return NULL;
	CXmlNodePtr methodNode = tree->GetRoot();
	methodNode->NewNode("methodName",method,false);
	methodNode->NewNode("params");
	methodNode->CopySubtree(param);
	methodNode->GetParent();
	return methodNode;
}
Exemplo n.º 6
0
Arquivo: chacl.cpp Projeto: acml/cvsnt
static void set_acl(CXmlNodePtr base)
{
	CXmlNodePtr acl, acl_to_set = NULL;
	acl = fileattr_find(base,"acl");

	while(acl)
	{
		const char *user = fileattr_getvalue(acl,"@user");
		const char *branch = fileattr_getvalue(acl,"@branch");
		const char *merge = fileattr_getvalue(acl,"@merge");
		if(((!user && !parms.user) || (user && parms.user && !usercmp(user,parms.user))) &&
		   ((!branch && !parms.branch) || (branch && parms.branch && !strcmp(branch,parms.branch))) &&
		   ((!merge && !parms.merge) || (merge && parms.merge && !strcmp(merge,parms.merge))))
		{
			acl_to_set = acl;
			break;
		}
		acl = fileattr_next(acl);
	}
	if(acl_to_set)
		fileattr_batch_delete(acl_to_set);
		
	if(!parms.del)
	{
		char *parm = xstrdup(parms.access);
		char *acc = parm?strtok(parm,","):NULL;

		base->NewNode("acl");
		fileattr_modified();
		if(parms.user)
			base->NewAttribute("user",parms.user);
		if(parms.branch)
			base->NewAttribute("branch",parms.branch);
		if(parms.merge)
			base->NewAttribute("merge",parms.merge);
		if(parms.priority && atoi(parms.priority))
			base->NewAttribute("priority",parms.priority);
		if(parms.message)
			base->NewNode("message",parms.message,false);
		base->NewNode("modified_by",getcaller(),false);
		base->NewNode("modified_date",current_date,false);
		while(acc)
		{
			int deny=0;
			if(!strncmp(acc,"no",2) && strcmp(acc,"none"))
			{
				deny=1;
				acc+=2;
			}
			if(!strcmp(acc,"all"))
				set_attrs(base,"all",deny,parms.noinherit);
			else if(!strcmp(acc,"none"))
				set_attrs(base,"all",!deny,parms.noinherit);
			else if(!strcmp(acc,"read"))
				set_attrs(base,"read",deny,parms.noinherit);
			else if(!strcmp(acc,"write"))
				set_attrs(base,"write",deny,parms.noinherit);
			else if(!strcmp(acc,"create"))
				set_attrs(base,"create",deny,parms.noinherit);
			else if(!strcmp(acc,"tag"))
				set_attrs(base,"tag",deny,parms.noinherit);
			else if(!strcmp(acc,"control"))
				set_attrs(base,"control",deny,parms.noinherit);
			else
				error(1,0,"Invalid access control attribute '%s'",acc);
			acc = strtok(NULL,",");
		}
		base->GetParent();
		fileattr_prune(base);
		xfree(parm);
	}
	else
	{
		if(acl_to_set)
			fileattr_prune(acl_to_set);
	}
}