~ubuntu-branches/ubuntu/quantal/udisks2/quantal-security

« back to all changes in this revision

Viewing changes to src/udiskslinuxswapspace.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt
  • Date: 2012-07-28 13:35:04 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20120728133504-jmxgy789jegi5vmo
Tags: 1.99.0-1
* New upstream release (LP: #1030268)
  - Support Realtek rts5229 SD/MMC card readers. (LP: #1022497)
* Drop 00git_no_polkit_fallback.patch, upstream now.
* Drop debian/local/integration-test, shipped in upstream tarball now.
* debian/tests/upstream-system: Run test suite from upstream source.
* debian/tests/control: Simplify Depends: line using "@".
* debian/tests/control: Drop undefined "no-build-needed" feature.

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
  UDisksBaseJob *job;
161
161
  GError *error;
162
162
  gchar *escaped_device = NULL;
 
163
  uid_t caller_uid;
 
164
  gid_t caller_gid;
163
165
 
164
166
  error = NULL;
165
167
  object = udisks_daemon_util_dup_object (swapspace, &error);
172
174
  daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
173
175
  block = udisks_object_peek_block (object);
174
176
 
 
177
  error = NULL;
 
178
  if (!udisks_daemon_util_get_caller_uid_sync (daemon,
 
179
                                               invocation,
 
180
                                               NULL /* GCancellable */,
 
181
                                               &caller_uid,
 
182
                                               &caller_gid,
 
183
                                               NULL,
 
184
                                               &error))
 
185
    {
 
186
      g_dbus_method_invocation_return_gerror (invocation, error);
 
187
      g_error_free (error);
 
188
      goto out;
 
189
    }
 
190
 
175
191
  if (!udisks_daemon_util_check_authorization_sync (daemon,
176
192
                                                    object,
177
193
                                                    "org.freedesktop.udisks2.manage-swapspace",
190
206
 
191
207
  job = udisks_daemon_launch_spawned_job (daemon,
192
208
                                          object,
 
209
                                          "swapspace-start", caller_uid,
193
210
                                          NULL, /* cancellable */
194
211
                                          0,    /* uid_t run_as_uid */
195
212
                                          0,    /* uid_t run_as_euid */
235
252
  UDisksDaemon *daemon;
236
253
  UDisksBlock *block;
237
254
  UDisksBaseJob *job;
 
255
  uid_t caller_uid;
 
256
  gid_t caller_gid;
238
257
  gchar *escaped_device = NULL;
 
258
  GError *error = NULL;
239
259
 
240
260
  object = UDISKS_OBJECT (g_dbus_interface_get_object (G_DBUS_INTERFACE (swapspace)));
241
261
  daemon = udisks_linux_block_object_get_daemon (UDISKS_LINUX_BLOCK_OBJECT (object));
242
262
  block = udisks_object_peek_block (object);
243
263
 
 
264
  error = NULL;
 
265
  if (!udisks_daemon_util_get_caller_uid_sync (daemon,
 
266
                                               invocation,
 
267
                                               NULL /* GCancellable */,
 
268
                                               &caller_uid,
 
269
                                               &caller_gid,
 
270
                                               NULL,
 
271
                                               &error))
 
272
    {
 
273
      g_dbus_method_invocation_return_gerror (invocation, error);
 
274
      g_error_free (error);
 
275
      goto out;
 
276
    }
 
277
 
244
278
  /* Now, check that the user is actually authorized to stop the swap space.
245
279
   *
246
280
   * TODO: want nicer authentication message + special treatment if the
264
298
 
265
299
  job = udisks_daemon_launch_spawned_job (daemon,
266
300
                                          object,
 
301
                                          "swapspace-stop", caller_uid,
267
302
                                          NULL, /* cancellable */
268
303
                                          0,    /* uid_t run_as_uid */
269
304
                                          0,    /* uid_t run_as_euid */