From 792f8e2151c120ec51b50a4098e4f9642409cbec Mon Sep 17 00:00:00 2001
From: Marta Rybczynska <rybczynska@gmail.com>
Date: Fri, 29 Jul 2022 11:52:59 +0200
Subject: [PATCH] Make netgroup support optional

This patch adds a fragment of the netgroup patch to apply on the duktape-related
code. This change is needed to compile with duktape+musl.

Upstream-Status: Backport [https://gitlab.freedesktop.org/polkit/polkit/-/commit/b57deee8178190a7ecc75290fa13cf7daabc2c66]
Signed-off-by: Marta Rybczynska <martarybczynska@huawei.com>
---
 src/polkitbackend/polkitbackendduktapeauthority.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/polkitbackend/polkitbackendduktapeauthority.c b/src/polkitbackend/polkitbackendduktapeauthority.c
index c89dbcf..58a5936 100644
--- a/src/polkitbackend/polkitbackendduktapeauthority.c
+++ b/src/polkitbackend/polkitbackendduktapeauthority.c
@@ -1036,6 +1036,7 @@ js_polkit_user_is_in_netgroup (duk_context *cx)
   user = duk_require_string (cx, 0);
   netgroup = duk_require_string (cx, 1);
 
+#ifdef HAVE_SETNETGRENT
   if (innetgr (netgroup,
                NULL,  /* host */
                user,
@@ -1043,6 +1044,7 @@ js_polkit_user_is_in_netgroup (duk_context *cx)
     {
       is_in_netgroup = TRUE;
     }
+#endif
 
   duk_push_boolean (cx, is_in_netgroup);
   return 1;
