FNRET(NULL);
action = NULL;
validate_crm_message(xmlNodePtr root_xml_node,		     const char *sys,		     const char *uid,		     const char *msg_type){	const char *from = NULL;	const char *to = NULL;	const char *type = NULL;	const char *crm_msg_reference = NULL;	xmlNodePtr message = NULL, action = NULL;		FNIN();	if (root_xml_node == NULL)		FNRET(NULL);	from = xmlGetProp(root_xml_node,			  XML_MSG_ATTR_SYSFROM);		to = xmlGetProp(root_xml_node,			XML_MSG_ATTR_SYSTO);		type = xmlGetProp(root_xml_node,			  XML_MSG_ATTR_MSGTYPE);		crm_msg_reference = xmlGetProp(root_xml_node,				       XML_MSG_ATTR_REFERENCE);	cl_log(LOG_DEBUG, "Recieved XML message with (version=%s)",	       xmlGetProp(root_xml_node, XML_ATTR_VERSION));	cl_log(LOG_DEBUG, "Recieved XML message with (from=%s)", from);	cl_log(LOG_DEBUG, "Recieved XML message with (to=%s)"  , to);	cl_log(LOG_DEBUG, "Recieved XML message with (type=%s)", type);	cl_log(LOG_DEBUG, "Recieved XML message with (ref=%s)" ,	       crm_msg_reference);	const char *true_sys = sys;	if (uid != NULL) true_sys = generate_hash_key(sys, uid);	if (to == NULL) {		cl_log(LOG_INFO, "No sub-system defined.");		FNRET(NULL);	} else if (true_sys != NULL && strcmp(to, true_sys) != 0) {		cl_log(LOG_DEBUG,		       "The message is not for this sub-system (%s != %s).",		       to,		       true_sys);		FNRET(NULL);	}    	if (type == NULL) {		cl_log(LOG_INFO, "No message type defined.");		FNRET(NULL);	} else if (msg_type != NULL && strcmp(msg_type, type) != 0) {		cl_log(LOG_INFO,		       "Expecting a (%s) message but receieved a (%s).",		       msg_type, type);		FNRET(NULL);	}	if (crm_msg_reference == NULL) {		cl_log(LOG_INFO, "No message crm_msg_reference defined.");		FNRET(NULL);	}    	message = find_xml_node(root_xml_node, type);	if (message == NULL) {		cl_log(LOG_INFO,		       "Malformed XML.  Message type (%s) not found.",		       type);		FNRET(NULL);	}	/* when the msg is a request, the message will contain	 * <dest_sys>_request node.	 * Otherwise it will contain a <src_sys>_response node.	 */	const char *action_sys = from;	if (strcmp("request", type) == 0) {		action_sys = to;	}	int action_len = strlen(action_sys) + strlen(type) + 2;	char *action_target = (char*)ha_malloc(sizeof(char)*(action_len));	sprintf(action_target, "%s_%s", action_sys, type);	action_target[action_len-1] = '\0';    	action = find_xml_node(message, action_target);	if (action == NULL) {		cl_log(LOG_ERR,		       "Malformed XML.  Message action (%s) not found... "		       "discarding message.",		       action_target);		FNRET(NULL);	}    	cl_log(LOG_DEBUG,	       "XML is valid and node with message type (%s) found.",	       type);	cl_log(LOG_DEBUG, "Returning node (%s)", xmlGetNodePath(action));	FNRET(action);}