From: Kurt Zeilenga Date: Fri, 2 Mar 2007 07:36:23 +0000 (+0000) Subject: Add support for uuid_generate/uuid_unparse X-Git-Tag: OPENLDAP_REL_ENG_2_4_MP~635 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0a1301bc6bc7e5504a978db7c5070719f9d2d5fc;p=openldap Add support for uuid_generate/uuid_unparse --- diff --git a/configure.in b/configure.in index b013b04f73..c5ade0133e 100644 --- a/configure.in +++ b/configure.in @@ -1000,6 +1000,15 @@ if test $ac_cv_header_sys_uuid_h = yes ; then fi fi +dnl Look for uuid_generate +if test $have_uuid = no ; then + AC_CHECK_HEADERS(uuid/uuid.h) + if test $ac_cv_header_uuid_uuid_h = yes ; then + AC_CHECK_FUNCS( uuid_generate ) + have_uuid=$ac_cv_func_uuid_generate + fi +fi + dnl For windows, check for the need of RPCRT for UUID function support if test $have_uuid = no ; then AC_MSG_CHECKING(to see if -lrpcrt4 is needed for win32 UUID support) diff --git a/libraries/liblutil/uuid.c b/libraries/liblutil/uuid.c index e2bbe74ad6..7b9f13e3fa 100644 --- a/libraries/liblutil/uuid.c +++ b/libraries/liblutil/uuid.c @@ -41,6 +41,8 @@ #ifdef HAVE_UUID_TO_STR # include +#elif defined( HAVE_UUID_GENERATE ) +# include #elif defined( _WIN32 ) # include #else @@ -56,7 +58,7 @@ #include /* not needed for Windows */ -#if !defined(HAVE_UUID_TO_STR) && !defined(_WIN32) +#if !defined(HAVE_UUID_TO_STR) && !defined(HAVE_UUID_GENERATE) && !defined(_WIN32) static unsigned char * lutil_eaddr( void ) { @@ -251,7 +253,7 @@ mul64ll(unsigned long i1, unsigned long i2) #endif /* ULONG_MAX >= 64 bits || HAVE_LONG_LONG */ -#endif /* !HAVE_UUID_TO_STR && !_WIN32 */ +#endif /* !HAVE_UUID_TO_STR && !HAVE_UUID_GENERATE && !_WIN32 */ /* ** All we really care about is an ISO UUID string. The format of a UUID is: @@ -298,6 +300,13 @@ lutil_uuidstr( char *buf, size_t len ) return l; +#elif defined( HAVE_UUID_GENERATE ) + uuid_t uu; + + uuid_generate( uu ); + uuid_unparse_lower( uu, buf ); + return strlen( buf ); + #elif defined( _WIN32 ) UUID uuid; unsigned char *uuidstr;