~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to bin/trampoline/trampoline.c

  • Committer: David Coles
  • Date: 2009-08-06 06:42:00 UTC
  • Revision ID: coles.david@gmail.com-20090806064200-edo8j1m1ev0ac3nq
Trampoline will now also set the groups of a user as well as the uid and gid.
Fixes lp:409675

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 */
34
34
 
35
35
#define _XOPEN_SOURCE
 
36
#define _BSD_SOURCE
36
37
 
37
38
#include <stdio.h>
38
39
#include <stdlib.h>
44
45
#include <sys/stat.h>
45
46
#include <sys/time.h>
46
47
#include <sys/resource.h>
 
48
#include <grp.h>
47
49
#include <limits.h>
48
50
#include <signal.h>
49
51
 
258
260
    char* prog;
259
261
    char* const * args;
260
262
    int uid;
 
263
    gid_t groups[1];
261
264
    int arg_num = 1;
262
265
    int daemon_mode = 0;
263
266
    int unlimited = 0;
357
360
        perror("could not setgid");
358
361
        exit(1);
359
362
    }
 
363
    
 
364
    groups[0] = uid;
 
365
    if (setgroups(1, groups))
 
366
    {
 
367
        perror("could not setgroups");
 
368
        exit(1);
 
369
    }
360
370
 
361
371
    if (setuid(uid))
362
372
    {