File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ static struct su_initiator su_from = {
52
52
53
53
static struct su_request su_to = {
54
54
.uid = AID_ROOT ,
55
+ .doshell = 1 ,
55
56
.command = DEFAULT_COMMAND ,
56
57
};
57
58
@@ -309,11 +310,11 @@ static void allow(char *shell, mode_t mask)
309
310
LOGD ("%u %s executing %u %s using shell %s : %s" , from -> uid , from -> bin ,
310
311
to -> uid , to -> command , shell , exe );
311
312
argv [argc ++ ] = exe ;
312
- if (strcmp (to -> command , DEFAULT_COMMAND )) {
313
+ if (to -> doshell ) {
314
+ argv [argc ++ ] = "-" ;
315
+ } else {
313
316
argv [argc ++ ] = "-c" ;
314
317
argv [argc ++ ] = to -> command ;
315
- } else {
316
- argv [argc ++ ] = "-" ;
317
318
}
318
319
argv [argc ] = NULL ;
319
320
execv (shell , argv );
@@ -344,6 +345,7 @@ int main(int argc, char *argv[])
344
345
switch (c ) {
345
346
case 'c' :
346
347
su_to .command = optarg ;
348
+ su_to .doshell = 0 ;
347
349
break ;
348
350
case 'h' :
349
351
usage (EXIT_SUCCESS );
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ struct su_initiator {
48
48
49
49
struct su_request {
50
50
unsigned uid ;
51
+ int doshell ;
51
52
char * command ;
52
53
};
53
54
You can’t perform that action at this time.
0 commit comments