/[hurd]/hurd/utils/fakeauth.c
ViewVC logotype

Diff of /hurd/utils/fakeauth.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by roland, Fri May 3 22:56:33 2002 UTC revision 1.2 by roland, Sat May 4 23:31:18 2002 UTC
# Line 327  main (int argc, char **argv) Line 327  main (int argc, char **argv)
327    auth_t authport;    auth_t authport;
328    pid_t child;    pid_t child;
329    int status;    int status;
330      int argi;
331    
332    struct argp argp = { 0, 0, 0, "Hurd standard authentication server." };    struct argp argp = { 0, 0, "COMMAND...", "\
333    Run COMMAND with a fake authentication handle that claims to be root or \
334    any arbitrary identity derived from that handle, but in fact is always just \
335    a proxy for your real authentication handle.  This means that all processes \
336    created by the COMMAND will have your privileges, even though it may \
337    believe it has restricted them to different identities or no identity at all.\
338    " };
339    
340    argp_parse (&argp, argc, argv, 0, 0, 0);    argp_parse (&argp, argc, argv, 0, &argi, 0);
341    
342    auth_bucket = ports_create_bucket ();    auth_bucket = ports_create_bucket ();
343    authhandle_portclass = ports_create_class (&destroy_authhandle, 0);    authhandle_portclass = ports_create_class (&destroy_authhandle, 0);
# Line 365  main (int argc, char **argv) Line 372  main (int argc, char **argv)
372      error (2, errno, "Cannot switch to fake auth handle");      error (2, errno, "Cannot switch to fake auth handle");
373    mach_port_deallocate (mach_task_self (), authport);    mach_port_deallocate (mach_task_self (), authport);
374    
375    if (posix_spawnp (&child, argv[1], NULL, NULL, &argv[1], environ))    if (posix_spawnp (&child, argv[argi], NULL, NULL, &argv[argi], environ))
376      error (3, errno, "cannot run %s", argv[1]);      error (3, errno, "cannot run %s", argv[1]);
377    
378    if (waitpid (child, &status, 0) != child)    if (waitpid (child, &status, 0) != child)
379      error (4, errno, "waitpid");      error (4, errno, "waitpid on %d", child);
380    
381    if (WIFSIGNALED (status))    if (WIFSIGNALED (status))
382      error (WTERMSIG (status) + 128, 0,      error (WTERMSIG (status) + 128, 0,

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26