rwrap: Use our own rwrap_randomid()
authorAndreas Schneider <asn@samba.org>
Wed, 3 Nov 2021 14:09:56 +0000 (15:09 +0100)
committerAndreas Schneider <asn@samba.org>
Wed, 3 Nov 2021 14:09:56 +0000 (15:09 +0100)
This is what glibc does, but the function is marked as deprecated now.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
src/resolv_wrapper.c

index b69a55a80e0c437e1ed2b2e7c5c6480a64d57bf6..899f4ccc7a97ce55ad9dcc00f75ac480db85f3ae 100644 (file)
@@ -434,6 +434,8 @@ static int rwrap_create_fake_ptr_rr(const char *key,
        return 0;
 }
 
+#define rwrap_randomid() 0xffff & getpid()
+
 /* Prepares a fake header with a single response. Advances header_blob */
 static ssize_t rwrap_fake_header(uint8_t **header_blob, size_t remaining,
                                 size_t ancount, size_t arcount)
@@ -451,7 +453,7 @@ static ssize_t rwrap_fake_header(uint8_t **header_blob, size_t remaining,
        h.blob = *header_blob;
        memset(h.blob, 0, NS_HFIXEDSZ);
 
-       h.header->id = res_randomid();          /* random query ID */
+       h.header->id = rwrap_randomid();        /* random query ID */
        h.header->qr = 1;                       /* response flag */
        h.header->rd = 1;                       /* recursion desired */
        h.header->ra = 1;                       /* recursion available */