crm_debug("Checking client version number"); 
crm_devel("Checking client version number"); 
crmd_authorize_message(ha_msg_input_t *client_msg, crmd_client_t *curr_client){	/* check the best case first */	const char *sys_from = cl_get_string(client_msg->msg, F_CRM_SYS_FROM);	char *uuid = NULL;	char *client_name = NULL;	char *major_version = NULL;	char *minor_version = NULL;	const char *filtered_from;	gpointer table_key = NULL;	gboolean auth_result = FALSE;	struct crm_subsystem_s *the_subsystem = NULL;	gboolean can_reply = FALSE; /* no-one has registered with this id */	const char *op = cl_get_string(client_msg->msg, F_CRM_TASK);	if (safe_str_neq(CRM_OP_HELLO, op)) {			if(sys_from == NULL) {			crm_warn("Message [%s] was had no value for %s... discarding",				 cl_get_string(client_msg->msg, XML_ATTR_REFERENCE),				 F_CRM_SYS_FROM);			return FALSE;		}				filtered_from = sys_from;		/* The CIB can have two names on the DC */		if(strcmp(sys_from, CRM_SYSTEM_DCIB) == 0)			filtered_from = CRM_SYSTEM_CIB;				if (g_hash_table_lookup (ipc_clients, filtered_from) != NULL) {			can_reply = TRUE;  /* reply can be routed */		}				crm_verbose("Message reply can%s be routed from %s.",			   can_reply?"":" not", sys_from);		if(can_reply == FALSE) {			crm_warn("Message [%s] not authorized",				 cl_get_string(client_msg->msg, XML_ATTR_REFERENCE));		}		#if 0		if(ha_msg_value(msg, XML_ATTR_REFERENCE) == NULL) {			ha_msg_add(new_input->msg, XML_ATTR_REFERENCE, seq);		}#endif		register_fsa_input(C_IPC_MESSAGE, I_ROUTER, client_msg);		s_crmd_fsa(C_IPC_MESSAGE);				return can_reply;	}		crm_debug("received client join msg");	crm_log_message(LOG_MSG, client_msg->msg);	auth_result = process_hello_message(		client_msg->xml, &uuid, &client_name,		&major_version, &minor_version);	if (auth_result == TRUE) {		if(client_name == NULL || uuid == NULL) {			crm_err("Bad client details (client_name=%s, uuid=%s)",				crm_str(client_name), crm_str(uuid));			auth_result = FALSE;		}	}	if (auth_result == TRUE) {		/* check version */		int mav = atoi(major_version);		int miv = atoi(minor_version);		crm_debug("Checking client version number");		if (mav < 0 || miv < 0) {			crm_err("Client version (%d:%d) is not acceptable",				mav, miv);			auth_result = FALSE;		}		crm_free(major_version);		crm_free(minor_version);	}	if (auth_result == TRUE) {		/* if we already have one of those clients		 * only applies to te, pe etc.  not admin clients		 */		if (strcmp(CRM_SYSTEM_PENGINE, client_name) == 0) {			the_subsystem = pe_subsystem;					} else if (strcmp(CRM_SYSTEM_TENGINE, client_name) == 0) {			the_subsystem = te_subsystem;		}		if (the_subsystem != NULL) {			/* do we already have one? */			crm_debug("Checking if %s is required/already connected",				  client_name);						if(is_set(fsa_input_register,				  the_subsystem->flag_connected)) {				auth_result = FALSE;				crm_err("Bit\t%.16llx set in %.16llx",					  the_subsystem->flag_connected,					  fsa_input_register);				crm_err("Client %s is already connected",					client_name);			} else if(FALSE == is_set(fsa_input_register,					 the_subsystem->flag_required)) {				auth_result = FALSE;				crm_err("Bit\t%.16llx not set in %.16llx",					  the_subsystem->flag_connected,					  fsa_input_register);				crm_err("Client %s joined without us asking",					client_name);			} else {				the_subsystem->ipc =					curr_client->client_channel;			}		} else {			table_key = (gpointer)				generate_hash_key(client_name, uuid);		}	}		if (auth_result == TRUE) {		if(table_key == NULL) {			table_key = (gpointer)crm_strdup(client_name);		}		crm_info("Accepted client %s", crm_str(table_key));		curr_client->table_key = table_key;		curr_client->sub_sys = crm_strdup(client_name);		curr_client->uuid = crm_strdup(uuid);			g_hash_table_insert (ipc_clients,				     table_key,				     curr_client->client_channel);		send_hello_message(curr_client->client_channel,				   "n/a", CRM_SYSTEM_CRMD,				   "0", "1");		crm_debug("Updated client list with %s", crm_str(table_key));				if(the_subsystem != NULL) {			set_bit_inplace(				fsa_input_register, the_subsystem->flag_connected);		}		s_crmd_fsa(C_SUBSYSTEM_CONNECT);	} else {		crm_err("Rejected client logon request");		curr_client->client_channel->ch_status = IPC_DISC_PENDING;	}		if(uuid != NULL) crm_free(uuid);	if(minor_version != NULL) crm_free(minor_version);	if(major_version != NULL) crm_free(major_version);	if(client_name != NULL) crm_free(client_name);	/* hello messages should never be processed further */	return FALSE;}
8182	/local/tlutelli/issta_data/temp/c/2005_temp/2005/8182/48b78052477f9b639ae5a6ff443adc158dda43d4/messages.c/buggy/crm/crmd/messages.c