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 = {
5252
5353static struct su_request su_to = {
5454 .uid = AID_ROOT ,
55+ .doshell = 1 ,
5556 .command = DEFAULT_COMMAND ,
5657};
5758
@@ -309,11 +310,11 @@ static void allow(char *shell, mode_t mask)
309310 LOGD ("%u %s executing %u %s using shell %s : %s" , from -> uid , from -> bin ,
310311 to -> uid , to -> command , shell , exe );
311312 argv [argc ++ ] = exe ;
312- if (strcmp (to -> command , DEFAULT_COMMAND )) {
313+ if (to -> doshell ) {
314+ argv [argc ++ ] = "-" ;
315+ } else {
313316 argv [argc ++ ] = "-c" ;
314317 argv [argc ++ ] = to -> command ;
315- } else {
316- argv [argc ++ ] = "-" ;
317318 }
318319 argv [argc ] = NULL ;
319320 execv (shell , argv );
@@ -344,6 +345,7 @@ int main(int argc, char *argv[])
344345 switch (c ) {
345346 case 'c' :
346347 su_to .command = optarg ;
348+ su_to .doshell = 0 ;
347349 break ;
348350 case 'h' :
349351 usage (EXIT_SUCCESS );
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ struct su_initiator {
4848
4949struct su_request {
5050 unsigned uid ;
51+ int doshell ;
5152 char * command ;
5253};
5354
You can’t perform that action at this time.
0 commit comments