libs: s3 and s4: make our dns lookup code signal-safe.
[sfrench/samba-autobuild/.git] / lib / addns / dnsutils.c
index 5a63c61f149cb1bd3ef27189f53dc1a47d936f6e..3eeb6ab9e21f7adf2b59899cb2c3274d6f77a9cd 100644 (file)
   License along with this library; if not, see <http://www.gnu.org/licenses/>.
 */
 
+#include "includes.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+
 #include "dns.h"
 #include <ctype.h>
 
-#ifdef HAVE_SYS_UUID_H
-#include <sys/uuid.h>
-#endif
 
 static DNS_ERROR LabelList( TALLOC_CTX *mem_ctx,
                            const char *name,
@@ -137,17 +138,10 @@ char *dns_generate_keyname( TALLOC_CTX *mem_ctx )
        char *result = NULL;
 #if defined(WITH_DNS_UPDATES)
 
-       uuid_t uuid;
-
-       /*
-        * uuid_unparse gives 36 bytes plus '\0'
-        */
-       if (!(result = talloc_array(mem_ctx, char, 37))) {
-               return NULL;
-       }
+       struct GUID guid;
 
-       uuid_generate( uuid );
-       uuid_unparse( uuid, result );
+       guid = GUID_random();
+       result = GUID_string(mem_ctx, &guid);
 
 #endif