~ubuntu-branches/ubuntu/trusty/policykit-1/trusty

« back to all changes in this revision

Viewing changes to src/polkit/polkitidentity.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2012-01-06 12:28:54 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20120106122854-ib9s0ej8akqiy0lb
Tags: 0.104-1
* New upstream release.
  - Add support for netgroups. (LP: #724052)
* debian/rules: Disable systemd support, continue to work with ConsokeKit.
* 05_revert-admin-identities-unix-group-wheel.patch: Refresh to apply
  cleanly.
* debian/libpolkit-gobject-1-0.symbols: Add new symbols from this new
  release.
* debian/rules: Do not let test failures fail the build. The new test suite
  also runs a test against the system D-BUS/ConsoleKit, which can't work on
  buildds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include "polkitidentity.h"
29
29
#include "polkitunixuser.h"
30
30
#include "polkitunixgroup.h"
 
31
#include "polkitunixnetgroup.h"
31
32
#include "polkiterror.h"
32
33
#include "polkitprivate.h"
33
34
 
177
178
        identity = polkit_unix_group_new_for_name (str + sizeof "unix-group:" - 1,
178
179
                                                  error);
179
180
    }
 
181
  else if (g_str_has_prefix (str, "unix-netgroup:"))
 
182
    {
 
183
      identity = polkit_unix_netgroup_new (str + sizeof "unix-netgroup:" - 1);
 
184
    }
180
185
 
181
186
  if (identity == NULL && (error != NULL && *error == NULL))
182
187
    {
214
219
      g_variant_builder_add (&builder, "{sv}", "gid",
215
220
                             g_variant_new_uint32 (polkit_unix_group_get_gid (POLKIT_UNIX_GROUP (identity))));
216
221
    }
 
222
  else if (POLKIT_IS_UNIX_NETGROUP (identity))
 
223
    {
 
224
      kind = "unix-netgroup";
 
225
      g_variant_builder_add (&builder, "{sv}", "name",
 
226
                             g_variant_new_string (polkit_unix_netgroup_get_name (POLKIT_UNIX_NETGROUP (identity))));
 
227
    }
217
228
  else
218
229
    {
219
230
      g_warning ("Unknown class %s implementing PolkitIdentity", g_type_name (G_TYPE_FROM_INSTANCE (identity)));
326
337
 
327
338
      ret = polkit_unix_group_new (gid);
328
339
    }
 
340
  else if (g_strcmp0 (kind, "unix-netgroup") == 0)
 
341
    {
 
342
      GVariant *v;
 
343
      const char *name;
 
344
 
 
345
      v = lookup_asv (details_gvariant, "name", G_VARIANT_TYPE_STRING, error);
 
346
      if (v == NULL)
 
347
        {
 
348
          g_prefix_error (error, "Error parsing net identity: ");
 
349
          goto out;
 
350
        }
 
351
      name = g_variant_get_string (v, NULL);
 
352
      ret = polkit_unix_netgroup_new (name);
 
353
      g_variant_unref (v);
 
354
    }
329
355
  else
330
356
    {
331
357
      g_set_error (error,