if(list_add->num_items == 1 || description == NULL ||  id == NULL || subtype == NULL || num_resources != 1) return NULL; 
CRM_DEBUG3("Creating new %s (%s) object", section_name, subtype); if(list_add->num_items == 1 || description == NULL ||  id == NULL || num_resources != 1) return NULL; 
handleCreate(void){    if(subtype == NULL) return NULL;// error    xmlNodePtr root, new_xml_node;    const char *section_name = NULL;        if(strcmp("node", obj_type) == 0)    {	section_name = XML_CIB_TAG_NODES;	if(id == NULL || subtype == NULL || description == NULL) return NULL;	new_xml_node = newHaNode(id, subtype);	if(description != NULL) xmlSetProp(new_xml_node, XML_ATTR_DESC, description);    }    else if(strcmp("resource", obj_type) == 0)    {	section_name = XML_CIB_TAG_RESOURCES;	if(id == NULL || subtype == NULL || description == NULL) return NULL;	new_xml_node = newResource(id, subtype, description, max_instances);	if(priority    != NULL) xmlSetProp(new_xml_node, XML_CIB_ATTR_PRIORITY   , priority);	if(res_timeout  != NULL) xmlSetProp(new_xml_node, XML_CIB_ATTR_RESTIMEOUT , res_timeout);		// add Nodes To Resources	if(list_add->num_items > 0)	{	    str_list_t *iter = list_add;	    while(list_add != list_add_last)	    {		char *name  = NULL;		char *value = NULL;		if(decodeNVpair(iter->value, '=', &name, &value))		{		    xmlNodePtr node_entry = xmlNewNode(NULL, XML_CIB_ATTR_NODEREF);					    xmlSetProp(node_entry, XML_ATTR_ID, name);		    xmlSetProp(node_entry, XML_CIB_ATTR_WEIGHT, value);		    xmlSetProp(node_entry, XML_ATTR_TSTAMP, getNow());		    xmlSetProp(node_entry, XML_CIB_ATTR_ACTION, "add");		    xmlAddChild(new_xml_node, node_entry);		}		iter = iter->next;	    }	}    }    // move somewhere else... this could get big    else if(strcmp("constraint", obj_type) == 0)    {	section_name = XML_CIB_TAG_CONSTRAINTS;	if(strcmp(CIB_VAL_CONTYPE_BLOCK, subtype) == 0)	{	    if(clear == NULL || description == NULL || resource[0] == NULL || id == NULL) return NULL;	    id = (char*)ha_malloc(256*(sizeof(char)));	    sprintf(id, "failed-%s-%s-%s", node, resource[0], instance);	    new_xml_node = newConstraint(id);	    xmlSetProp(new_xml_node, XML_CIB_ATTR_CONTYPE, CIB_VAL_CONTYPE_BLOCK);	    xmlSetProp(new_xml_node, XML_CIB_ATTR_RESID1, resource[0]);	    xmlSetProp(new_xml_node, XML_CIB_ATTR_CLEAR, clear);	    	    xmlNodePtr node_entry = xmlNewNode(NULL, XML_CIB_TAG_NVPAIR);				    xmlSetProp(node_entry, XML_ATTR_ID, "blockHost");//			xmlSetProp(node_entry, XML_CIB_ATTR_VARTYPE, subtype);	    xmlSetProp(node_entry, XML_CIB_ATTR_VARVALUE, node);	    xmlSetProp(node_entry, XML_CIB_ATTR_ACTION, "add");	    xmlAddChild(new_xml_node, node_entry);	}	else if(strcmp(CIB_VAL_CONTYPE_VAR, subtype) == 0)	{	    if(list_add->num_items == 1 || description == NULL ||  id == NULL || subtype == NULL || num_resources != 1) return NULL;	    new_xml_node = newConstraint(id);	    xmlSetProp(new_xml_node, XML_CIB_ATTR_CONTYPE, subtype);	    xmlSetProp(new_xml_node, XML_CIB_ATTR_RESID1, resource[0]);	    	    // add Name Value pairs To constraint s	    if(list_add->num_items > 0)	    {		str_list_t *iter = list_add;		while(list_add != list_add_last)		{		    char *name  = NULL;		    char *value = NULL;		    if(decodeNVpair(iter->value, '=', &name, &value))		    {			xmlNodePtr node_entry = xmlNewNode(NULL, XML_CIB_TAG_NVPAIR);						xmlSetProp(node_entry, XML_ATTR_ID, name);//			xmlSetProp(node_entry, XML_CIB_ATTR_VARTYPE, subtype);			xmlSetProp(node_entry, XML_CIB_ATTR_VARVALUE, value);			xmlSetProp(node_entry, XML_CIB_ATTR_ACTION, "add");			xmlAddChild(new_xml_node, node_entry);		    }		    iter = iter->next;		}	    }	}	else	{	    if(id == NULL || description == NULL || subtype == NULL ||  num_resources != 2) return NULL;	    new_xml_node = newConstraint(id);	    xmlSetProp(new_xml_node, XML_CIB_ATTR_CONTYPE, subtype);	    xmlSetProp(new_xml_node, XML_CIB_ATTR_RESID1, resource[0]);	    xmlSetProp(new_xml_node, XML_CIB_ATTR_RESID2, resource[1]);	}	if(description != NULL) xmlSetProp(new_xml_node, XML_ATTR_DESC, description);    }    else    {	cl_log(LOG_INFO, "Object Type (%s) not supported", obj_type);	return NULL;    }        // create the cib request    root = wrapUpdate(new_xml_node, section_name);    return root;    }
8182	/local/tlutelli/issta_data/temp/c/2005_temp/2005/8182/ea49e927cf7a87359e44d087341624427b4dacc8/adminmain.c/buggy/crm/admin/adminmain.c