#ifndef lint
static char copyright[] =
-"$Id: omapi.c,v 1.33 2000/07/06 22:37:53 mellon Exp $ Copyright (c) 1999-2000 The Internet Software Consortium. All rights reserved.\n";
+"$Id: omapi.c,v 1.34 2000/08/14 21:58:04 neild Exp $ Copyright (c) 1999-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
((omapi_object_t *)lease -> billing_class),
MDL);
return ISC_R_NOTFOUND;
- } else if (!omapi_ds_strcmp (name, "hardware-address"))
- return omapi_make_const_value
- (value, name, &lease -> hardware_addr.hbuf [1],
- (unsigned)(lease -> hardware_addr.hlen - 1), MDL);
- else if (!omapi_ds_strcmp (name, "hardware-type"))
- return omapi_make_int_value (value, name,
- lease -> hardware_addr.hbuf [0],
- MDL);
+ } else if (!omapi_ds_strcmp (name, "hardware-address")) {
+ if (lease -> hardware_addr.hlen)
+ return omapi_make_const_value
+ (value, name, &lease -> hardware_addr.hbuf [1],
+ (unsigned)(lease -> hardware_addr.hlen - 1),
+ MDL);
+ return ISC_R_NOTFOUND;
+ } else if (!omapi_ds_strcmp (name, "hardware-type")) {
+ if (lease -> hardware_addr.hlen)
+ return omapi_make_int_value
+ (value, name, lease -> hardware_addr.hbuf [0],
+ MDL);
+ return ISC_R_NOTFOUND;
+ }
/* Try to find some inner object that can take the value. */
if (h -> inner && h -> inner -> type -> get_value) {
if (status != ISC_R_SUCCESS)
return status;
- status = omapi_connection_put_name (c, "hardware-address");
- if (status != ISC_R_SUCCESS)
- return status;
- status = (omapi_connection_put_uint32
- (c, (unsigned long)(lease -> hardware_addr.hlen - 1)));
- if (status != ISC_R_SUCCESS)
- return status;
- status = (omapi_connection_copyin
- (c, &lease -> hardware_addr.hbuf [1],
- (unsigned long)(lease -> hardware_addr.hlen - 1)));
-
- if (status != ISC_R_SUCCESS)
- return status;
+ if (lease -> hardware_addr.hlen) {
+ status = omapi_connection_put_name (c, "hardware-address");
+ if (status != ISC_R_SUCCESS)
+ return status;
+ status = (omapi_connection_put_uint32
+ (c,
+ (unsigned long)(lease -> hardware_addr.hlen - 1)));
+ if (status != ISC_R_SUCCESS)
+ return status;
+ status = (omapi_connection_copyin
+ (c, &lease -> hardware_addr.hbuf [1],
+ (unsigned long)(lease -> hardware_addr.hlen - 1)));
- status = omapi_connection_put_name (c, "hardware-type");
- if (status != ISC_R_SUCCESS)
- return status;
- status = omapi_connection_put_uint32 (c, sizeof (int));
- if (status != ISC_R_SUCCESS)
- return status;
- status = omapi_connection_put_uint32 (c,
- lease -> hardware_addr.hbuf [0]);
- if (status != ISC_R_SUCCESS)
- return status;
+ if (status != ISC_R_SUCCESS)
+ return status;
+
+ status = omapi_connection_put_name (c, "hardware-type");
+ if (status != ISC_R_SUCCESS)
+ return status;
+ status = omapi_connection_put_uint32 (c, sizeof (int));
+ if (status != ISC_R_SUCCESS)
+ return status;
+ status = omapi_connection_put_uint32
+ (c, lease -> hardware_addr.hbuf [0]);
+ if (status != ISC_R_SUCCESS)
+ return status;
+ }
status = omapi_connection_put_name (c, "ends");