--- embedaddon/dhcp/common/comapi.c 2012/02/21 22:30:18 1.1 +++ embedaddon/dhcp/common/comapi.c 2012/10/09 09:06:54 1.1.1.1 @@ -3,6 +3,7 @@ OMAPI object interfaces for the DHCP server. */ /* + * Copyright (c) 2012 Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007,2009 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1999-2003 by Internet Software Consortium * @@ -435,7 +436,7 @@ isc_result_t dhcp_group_remove (omapi_object_t *lp, status = dhcp_group_destroy ((omapi_object_t *)group, MDL); - return ISC_R_SUCCESS; + return status; } isc_result_t dhcp_control_set_value (omapi_object_t *h, @@ -511,12 +512,11 @@ isc_result_t dhcp_control_destroy (omapi_object_t *h, isc_result_t dhcp_control_signal_handler (omapi_object_t *h, const char *name, va_list ap) { - dhcp_control_object_t *control; + /* In this function h should be a (dhcp_control_object_t *) */ isc_result_t status; if (h -> type != dhcp_type_control) return ISC_R_INVALIDARG; - control = (dhcp_control_object_t *)h; /* Try to find some inner object that can take the value. */ if (h -> inner && h -> inner -> type -> get_value) { @@ -572,11 +572,11 @@ isc_result_t dhcp_control_lookup (omapi_object_t **lp, status = omapi_get_value_str (ref, id, "handle", &tv); if (status == ISC_R_SUCCESS) { status = omapi_handle_td_lookup (lp, tv -> value); - + omapi_value_dereference (&tv, MDL); if (status != ISC_R_SUCCESS) return status; - + /* Don't return the object if the type is wrong. */ if ((*lp) -> type != dhcp_type_control) { omapi_object_dereference (lp, MDL); @@ -612,12 +612,11 @@ isc_result_t dhcp_subnet_set_value (omapi_object_t *h omapi_data_string_t *name, omapi_typed_data_t *value) { - struct subnet *subnet; + /* In this function h should be a (struct subnet *) */ isc_result_t status; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; - subnet = (struct subnet *)h; /* No values to set yet. */ @@ -628,7 +627,7 @@ isc_result_t dhcp_subnet_set_value (omapi_object_t *h if (status == ISC_R_SUCCESS || status == ISC_R_UNCHANGED) return status; } - + return ISC_R_NOTFOUND; } @@ -637,12 +636,11 @@ isc_result_t dhcp_subnet_get_value (omapi_object_t *h, omapi_data_string_t *name, omapi_value_t **value) { - struct subnet *subnet; + /* In this function h should be a (struct subnet *) */ isc_result_t status; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; - subnet = (struct subnet *)h; /* No values to get yet. */ @@ -658,14 +656,14 @@ isc_result_t dhcp_subnet_get_value (omapi_object_t *h, isc_result_t dhcp_subnet_destroy (omapi_object_t *h, const char *file, int line) { - struct subnet *subnet; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; - subnet = (struct subnet *)h; #if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + struct subnet *subnet = (struct subnet *)h; + if (subnet -> next_subnet) subnet_dereference (&subnet -> next_subnet, file, line); if (subnet -> next_sibling) @@ -685,13 +683,12 @@ isc_result_t dhcp_subnet_destroy (omapi_object_t *h, c isc_result_t dhcp_subnet_signal_handler (omapi_object_t *h, const char *name, va_list ap) { - struct subnet *subnet; + /* In this function h should be a (struct subnet *) */ isc_result_t status; int updatep = 0; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; - subnet = (struct subnet *)h; /* Can't write subnets yet. */ @@ -711,12 +708,11 @@ isc_result_t dhcp_subnet_stuff_values (omapi_object_t omapi_object_t *id, omapi_object_t *h) { - struct subnet *subnet; + /* In this function h should be a (struct subnet *) */ isc_result_t status; if (h -> type != dhcp_type_subnet) return ISC_R_INVALIDARG; - subnet = (struct subnet *)h; /* Can't stuff subnet values yet. */ @@ -761,12 +757,11 @@ isc_result_t dhcp_shared_network_set_value (omapi_obj omapi_data_string_t *name, omapi_typed_data_t *value) { - struct shared_network *shared_network; + /* In this function h should be a (struct shared_network *) */ isc_result_t status; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; - shared_network = (struct shared_network *)h; /* No values to set yet. */ @@ -777,7 +772,7 @@ isc_result_t dhcp_shared_network_set_value (omapi_obj if (status == ISC_R_SUCCESS || status == ISC_R_UNCHANGED) return status; } - + return ISC_R_NOTFOUND; } @@ -787,12 +782,11 @@ isc_result_t dhcp_shared_network_get_value (omapi_obje omapi_data_string_t *name, omapi_value_t **value) { - struct shared_network *shared_network; + /* In this function h should be a (struct shared_network *) */ isc_result_t status; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; - shared_network = (struct shared_network *)h; /* No values to get yet. */ @@ -809,14 +803,14 @@ isc_result_t dhcp_shared_network_get_value (omapi_obje isc_result_t dhcp_shared_network_destroy (omapi_object_t *h, const char *file, int line) { - struct shared_network *shared_network; + /* In this function h should be a (struct shared_network *) */ if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; - shared_network = (struct shared_network *)h; #if defined (DEBUG_MEMORY_LEAKAGE) || \ defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT) + struct shared_network *shared_network = (struct shared_network *)h; if (shared_network -> next) shared_network_dereference (&shared_network -> next, file, line); @@ -849,13 +843,12 @@ isc_result_t dhcp_shared_network_signal_handler (omapi const char *name, va_list ap) { - struct shared_network *shared_network; + /* In this function h should be a (struct shared_network *) */ isc_result_t status; int updatep = 0; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; - shared_network = (struct shared_network *)h; /* Can't write shared_networks yet. */ @@ -875,12 +868,11 @@ isc_result_t dhcp_shared_network_stuff_values (omapi_o omapi_object_t *id, omapi_object_t *h) { - struct shared_network *shared_network; + /* In this function h should be a (struct shared_network *) */ isc_result_t status; if (h -> type != dhcp_type_shared_network) return ISC_R_INVALIDARG; - shared_network = (struct shared_network *)h; /* Can't stuff shared_network values yet. */