Esempio n. 1
0
static void
polkit_unix_netgroup_get_property (GObject    *object,
                                guint       prop_id,
                                GValue     *value,
                                GParamSpec *pspec)
{
  PolkitUnixNetgroup *net_group = POLKIT_UNIX_NETGROUP (object);

  switch (prop_id)
    {
    case PROP_NAME:
      g_value_set_string (value, polkit_unix_netgroup_get_name (net_group));
      break;

    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
    }
}
@@ -23,7 +23,12 @@
 #include <errno.h>
 #include <pwd.h>
 #include <grp.h>
+#if defined(__NetBSD__)
+#include <netgroup.h>
+#define BSD_NETGROUP
+#else
 #include <netdb.h>
+#endif
 #include <string.h>
 #include <glib/gstdio.h>
 #include <locale.h>
@@ -2113,15 +2118,23 @@ get_users_in_net_group (PolkitIdentity  
   ret = NULL;
   name = polkit_unix_netgroup_get_name (POLKIT_UNIX_NETGROUP (group));
 
+#ifdef BSD_NETGROUP
+  setnetgrent (name);
+#else
   if (setnetgrent (name) == 0)
     {
       g_warning ("Error looking up net group with name %s: %s", name, g_strerror (errno));
       goto out;
     }
+#endif
 
   for (;;)
     {
+#ifdef BSD_NETGROUP
+      const char *hostname, *username, *domainname;