-
Notifications
You must be signed in to change notification settings - Fork 0
/
aimrelay.c
66 lines (48 loc) · 1.86 KB
/
aimrelay.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* wrapper2.c
jms1@jms1.net 1997-11-20
setuid wrapper for a fixed command
header files etc. written for linux, compiles ok on solaris 2.6
set program and parameters (if any) in my_args[]
the my_args[] array must have a NULL at the end of the list.
compile with a command like this:
gcc -o blah wrapper2.c
then set the resulting binary so it's owned by root and has the
"setuid" bit turned on.
any parameters passed on the command line of the resulting binary
will be ignored, the parameters in the ma[] array will be passed
to the final command instead.
any environment variables will be passed to the final command as-is.
if you wish to "clear" the environment as a safety measure, run the
final binary as "env - blah" instead of just "blah".
---------------------------------------------------------------------
Copyright (C) 1997,2007 John Simpson.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 3, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <sys/types.h>
#include <unistd.h>
/* you MUST set the command information in this next line */
char *my_args[] = { "/http/clearimage/private/apps/livetalk/aimrelay.pl" , NULL } ;
int main ( int argc , char *argv[] , char *envp[] )
{
if ( setuid ( 500 ) )
{
perror ( "setuid" ) ;
return 1 ;
}
if ( seteuid ( 500 ) )
{
perror ( "seteuid" ) ;
return 1 ;
}
execve ( my_args[0] , my_args , envp ) ;
perror ( "execv" ) ;
return 1 ;
}