annotate defaults/hg-wrapper.c @ 8:7b9d471fc1d3

create C wrapper and move bashrc to profile.
author Robert McIntyre <rlm@mit.edu>
date Tue, 08 Jan 2013 18:13:48 +0000
parents defaults/suid-wrapper.c@ab4011ea1463
children
rev   line source
rlm@7 1 #include <unistd.h>
rlm@7 2 #include <errno.h>
rlm@7 3
rlm@7 4 main( int argc, char ** argv, char ** envp )
rlm@7 5 {
rlm@7 6 if( setgid(getegid()) ) perror( "setgid" );
rlm@7 7 if( setuid(geteuid()) ) perror( "setuid" );
rlm@7 8 envp = 0; /* blocks IFS attack on non-bash shells */
rlm@7 9 system( "/usr/bin/hg", argv, envp );
rlm@7 10 perror( argv[0] );
rlm@7 11 return errno;
rlm@7 12 }