summaryrefslogtreecommitdiffstats
path: root/util/src/platforms/unix
diff options
context:
space:
mode:
authorGravatar samisa2011-08-30 13:32:20 +0000
committerGravatar samisa2011-08-30 13:32:20 +0000
commitcffb2c41bbc91d1a70440ad9fab5ee9593d84f67 (patch)
tree9aa9aa21a68feea5623b104594cf0919e1ac66d5 /util/src/platforms/unix
parentabac46c5b94546ce1186d36c798b5395cd2d21cd (diff)
downloadaxis2c-cffb2c41bbc91d1a70440ad9fab5ee9593d84f67.tar.gz
axis2c-cffb2c41bbc91d1a70440ad9fab5ee9593d84f67.tar.bz2
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
Diffstat (limited to 'util/src/platforms/unix')
-rw-r--r--util/src/platforms/unix/uuid_gen_unix.c18
1 files changed, 16 insertions, 2 deletions
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 <platforms/unix/axutil_uuid_gen_unix.h>
#include <platforms/axutil_platform_auto_sense.h>
+#ifdef AXIS2_SSL_ENABLED
+#include <openssl/rand.h>
+#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;
}
/*