/* Deep copy clone */
int sepol_iface_clone(
	sepol_handle_t* handle,
	const sepol_iface_t* iface, 
	sepol_iface_t** iface_ptr) {

	sepol_iface_t* new_iface = NULL;
	if (sepol_iface_create(handle, &new_iface) < 0)
		goto err;

	if (sepol_iface_set_name(handle, new_iface, iface->name) < 0)
		goto err;

	if (iface->netif_con && 
	   (sepol_context_clone(handle, iface->netif_con, &new_iface->netif_con) < 0))
		goto err;	

	if (iface->netmsg_con &&
	   (sepol_context_clone(handle, iface->netmsg_con, &new_iface->netmsg_con) < 0))
		goto err;

	*iface_ptr = new_iface;
	return STATUS_SUCCESS;

	err:
	ERR(handle, "could not clone interface record");
	sepol_iface_free(new_iface);
	return STATUS_ERR;
}
Exemple #2
0
/* Create/Clone/Destroy */
int semanage_iface_create(semanage_handle_t * handle,
			  semanage_iface_t ** iface_ptr)
{

	return sepol_iface_create(handle->sepolh, iface_ptr);
}