axis-c-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r1163204 - /axis/axis2/c/core/trunk/util/src/platforms/unix/uuid_gen_unix.c
Date Tue, 30 Aug 2011 13:32:20 GMT
Author: samisa
Date: Tue Aug 30 13:32:20 2011
New Revision: 1163204

URL: http://svn.apache.org/viewvc?rev=1163204&view=rev
Log:
added the patch gievn in AXIS2C-1439 to fix UUID when MAC addr is null

Modified:
    axis/axis2/c/core/trunk/util/src/platforms/unix/uuid_gen_unix.c

Modified: axis/axis2/c/core/trunk/util/src/platforms/unix/uuid_gen_unix.c
URL: http://svn.apache.org/viewvc/axis/axis2/c/core/trunk/util/src/platforms/unix/uuid_gen_unix.c?rev=1163204&r1=1163203&r2=1163204&view=diff
==============================================================================
--- axis/axis2/c/core/trunk/util/src/platforms/unix/uuid_gen_unix.c (original)
+++ axis/axis2/c/core/trunk/util/src/platforms/unix/uuid_gen_unix.c Tue Aug 30 13:32:20 2011
@@ -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;
     }
     /*



Mime
View raw message