/**
 * see section 3.8.3 of TCG TNC IF-IMC Specification 1.3
 */
TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
								  TNC_ConnectionID connection_id)
{
	imc_state_t *state;
	imc_msg_t *out_msg;
	enumerator_t *enumerator;
	void *pointer;
	TNC_UInt32 additional_id;
	TNC_Result result;

	if (!imc_test)
	{
		DBG1(DBG_IMC, "IMC \"%s\" has not been initialized", imc_name);
		return TNC_RESULT_NOT_INITIALIZED;
	}
	if (!imc_test->get_state(imc_test, connection_id, &state))
	{
		return TNC_RESULT_FATAL;
	}

	/* send PA message for primary IMC ID */
	out_msg = imc_msg_create(imc_test, state, connection_id, imc_id,
							 TNC_IMVID_ANY, msg_types[0]);
	result = send_message(state, out_msg);
	out_msg->destroy(out_msg);

	/* Exit if there are no additional IMC IDs */
	if (!imc_test->count_additional_ids(imc_test))
	{
		return result;
	}

	/* Do we have support for transporting multiple IMC IDs? */
	if (!state->has_long(state))
	{
		DBG1(DBG_IMC, "IMC %u \"%s\" did not detect support for transporting "
					  "multiple IMC IDs", imc_id, imc_name);
		return result;
	}

	/* send PA messages for additional IMC IDs */
	enumerator = imc_test->create_id_enumerator(imc_test);
	while (result == TNC_RESULT_SUCCESS &&
		   enumerator->enumerate(enumerator, &pointer))
	{
		/* interpret pointer as scalar value */
		additional_id = (TNC_UInt32)pointer;
		out_msg = imc_msg_create(imc_test, state, connection_id, additional_id,
								 TNC_IMVID_ANY, msg_types[0]);
		result = send_message(state, out_msg);
		out_msg->destroy(out_msg);
	}
	enumerator->destroy(enumerator);

	return result;
}
Example #2
0
/**
 * see section 3.8.3 of TCG TNC IF-IMC Specification 1.3
 */
TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
								  TNC_ConnectionID connection_id)
{
	imc_state_t *state;
	imc_msg_t *out_msg;
	TNC_Result result = TNC_RESULT_SUCCESS;

	if (!imc_os)
	{
		DBG1(DBG_IMC, "IMC \"%s\" has not been initialized", imc_name);
		return TNC_RESULT_NOT_INITIALIZED;
	}
	if (!imc_os->get_state(imc_os, connection_id, &state))
	{
		return TNC_RESULT_FATAL;
	}
	if (lib->settings->get_bool(lib->settings,
								"libimcv.plugins.imc-os.send_info", TRUE))
	{
		out_msg = imc_msg_create(imc_os, state, connection_id, imc_id,
								 TNC_IMVID_ANY, msg_types[0]);
		add_product_info(out_msg);
		add_string_version(out_msg);
		add_op_status(out_msg);
		add_fwd_enabled(out_msg);
		add_default_pwd_enabled(out_msg);

		/* send PA-TNC message with the excl flag not set */
		result = out_msg->send(out_msg, FALSE);
		out_msg->destroy(out_msg);
	}

	return result;
}
Example #3
0
/**
 * see section 3.8.3 of TCG TNC IF-IMC Specification 1.3
 */
TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
								  TNC_ConnectionID connection_id)
{
	imc_state_t *state;
	imc_msg_t *out_msg;
	TNC_Result result = TNC_RESULT_SUCCESS;

	if (!imc_scanner)
	{
		DBG1(DBG_IMC, "IMC \"%s\" has not been initialized", imc_name);
		return TNC_RESULT_NOT_INITIALIZED;
	}
	if (!imc_scanner->get_state(imc_scanner, connection_id, &state))
	{
		return TNC_RESULT_FATAL;
	}
	if (lib->settings->get_bool(lib->settings,
							"%s.plugins.imc-scanner.push_info", TRUE, lib->ns))
	{
		out_msg = imc_msg_create(imc_scanner, state, connection_id, imc_id,
								 TNC_IMVID_ANY, msg_types[0]);
		result = add_port_filter(out_msg);
		if (result == TNC_RESULT_SUCCESS)
		{
			/* send PA-TNC message with the excl flag not set */
			result = out_msg->send(out_msg, FALSE);
		}
		out_msg->destroy(out_msg);
	}

	return result;
}
Example #4
0
/**
 * see section 3.8.3 of TCG TNC IF-IMC Specification 1.3
 */
static TNC_Result tnc_imc_beginhandshake(TNC_IMCID imc_id,
										 TNC_ConnectionID connection_id)
{
	imc_state_t *state;
	imc_msg_t *out_msg;
	TNC_Result result = TNC_RESULT_SUCCESS;

	if (!imc_android)
	{
		DBG1(DBG_IMC, "IMC \"%s\" has not been initialized", imc_name);
		return TNC_RESULT_NOT_INITIALIZED;
	}
	if (!imc_android->get_state(imc_android, connection_id, &state))
	{
		return TNC_RESULT_FATAL;
	}
	if (lib->settings->get_bool(lib->settings,
								"android.imc.send_os_info", TRUE))
	{
		out_msg = imc_msg_create(imc_android, state, connection_id, imc_id,
								 TNC_IMVID_ANY, msg_types[0]);
		add_measurement((pen_type_t){ PEN_IETF, IETF_ATTR_PRODUCT_INFORMATION },
						out_msg, NULL);
		add_measurement((pen_type_t){ PEN_IETF, IETF_ATTR_STRING_VERSION },
						out_msg, NULL);
		add_measurement((pen_type_t){ PEN_ITA, ITA_ATTR_DEVICE_ID },
						out_msg, NULL);
		/* send PA-TNC message with the excl flag not set */
		result = out_msg->send(out_msg, FALSE);
		out_msg->destroy(out_msg);
	}

	return result;
}
/**
 * see section 3.8.3 of TCG TNC IF-IMC Specification 1.3
 */
TNC_Result TNC_IMC_BeginHandshake(TNC_IMCID imc_id,
                                  TNC_ConnectionID connection_id)
{
    imc_state_t *state;
    imc_msg_t *out_msg;
    TNC_Result result;

    if (!imc_scanner)
    {
        DBG1(DBG_IMC, "IMC \"%s\" has not been initialized", imc_name);
        return TNC_RESULT_NOT_INITIALIZED;
    }
    if (!imc_scanner->get_state(imc_scanner, connection_id, &state))
    {
        return TNC_RESULT_FATAL;
    }
    out_msg = imc_msg_create(imc_scanner, state, connection_id, imc_id,
                             TNC_IMVID_ANY, msg_types[0]);
    result = send_message(out_msg);
    out_msg->destroy(out_msg);

    return result;
}