Ejemplo n.º 1
0
static int
netstring2string(const void* value, size_t vlen, void** retvalue, size_t* ret_vlen)
{
	char* dupvalue;
	
	if (value == NULL && vlen == 0){
		*retvalue = NULL;
		*ret_vlen = 0;
		return HA_OK;
	}

	if ( !value || !retvalue || !ret_vlen){
		cl_log(LOG_ERR, " netstring2string:"
		       "invalid input arguments");
		return HA_FAIL;
	}
	
	dupvalue = binary_dup(value, vlen);
	if (!dupvalue){
		cl_log(LOG_ERR, "netstring2string:"
		       "duplicating value failed");
		return HA_FAIL;
	}
	
	*retvalue = dupvalue;
	*ret_vlen = vlen;
	
	return HA_OK;
}
Ejemplo n.º 2
0
/* Add one item to our list of auth items. */
static void
add_auth_item (Xauth *auth)
{
    addr_list *a = malloc (sizeof (addr_list));
	
    a->auth.family = auth->family;
    a->auth.address_length = auth->address_length;
    a->auth.address = binary_dup (auth->address, auth->address_length);
    a->auth.number_length = auth->number_length;
    a->auth.number = binary_dup (auth->number, auth->number_length);
    a->auth.name_length = auth->name_length;
    a->auth.name = binary_dup (auth->name, auth->name_length);
    a->auth.data_length = auth->data_length;
    a->auth.data = binary_dup (auth->data, auth->data_length);
	
    a->next = addresses;
    addresses = a;
}
Ejemplo n.º 3
0
static void*
string_dup(const void* value, size_t len)
{
	return binary_dup(value, len);
}