From cffb2c41bbc91d1a70440ad9fab5ee9593d84f67 Mon Sep 17 00:00:00 2001 From: samisa Date: Tue, 30 Aug 2011 13:32:20 +0000 Subject: added the patch gievn in AXIS2C-1439 to fix UUID when MAC addr is null git-svn-id: http://svn.apache.org/repos/asf/axis/axis2/c/core/trunk@1163204 13f79535-47bb-0310-9956-ffa450edef68 --- util/src/platforms/unix/uuid_gen_unix.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'util') diff --git a/util/src/platforms/unix/uuid_gen_unix.c b/util/src/platforms/unix/uuid_gen_unix.c index 1941207..467a051 100644 --- a/util/src/platforms/unix/uuid_gen_unix.c +++ b/util/src/platforms/unix/uuid_gen_unix.c @@ -51,6 +51,11 @@ #include #include +#ifdef AXIS2_SSL_ENABLED +#include +#endif + + /* We need these static variables to track throughout the program execution */ static axis2_bool_t axutil_uuid_gen_is_first = AXIS2_TRUE; static struct axutil_uuid_st axutil_uuid_static; @@ -69,10 +74,19 @@ axutil_uuid_gen_v1() if(AXIS2_TRUE == axutil_uuid_gen_is_first) { char *mac_addr = axutil_uuid_get_mac_addr(); - memcpy(axutil_uuid_static.mac, mac_addr, 6); + if (mac_addr) { + memcpy(axutil_uuid_static.mac, mac_addr, 6); + free(mac_addr); + } else { + /* Default value, not expected to go there */ +#ifdef AXIS2_SSL_ENABLED + RAND_bytes(axutil_uuid_static.mac, 6); +#else + memset(axutil_uuid_static.mac, 0, 6); +#endif + } axutil_uuid_static.time_seq = 0; axutil_uuid_static.clock = 0; - free(mac_addr); axutil_uuid_gen_is_first = AXIS2_FALSE; } /* -- cgit v1.1-32-gdbae