run_init and chdir()
Would it make sense to have run_init do "chdir /" before executing it's program?
It's annoying when you accidentally execute a daemon with a current directory that it can't read...
Signature · 9 lines
If you send email to me or to a mailing list that I use which has >4 lines of legalistic junk at the end then you are specifically authorizing me to do whatever I wish with the message and all other messages from your domain, by posting the message you agree that your long legalistic sig is void. -- You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 2 lines · Russell Coker
Would it make sense to have
run_initdo "chdir /" before executing it's program?
Probably. We could have it call daemon(0,1) prior to the execvp_secure call.
--
Stephen D. Smalley, NAI Labs
[email protected]
--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 5 lines · Russell Coker
Would it make sense to have
run_initdo "chdir /" before executing it's program?It's annoying when you accidentally execute a daemon with a current directory that it can't read...
Patch attached, and committed to the sourceforge CVS tree.
--
Stephen D. Smalley, NAI Labs
[email protected]
Index: utils/run_init/run_init.c
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux/utils/run_init/run_init.c,v retrieving revision 1.1.1.2
retrieving revision 1.3
run_init/run_init.c +5 -0
@@ -381,6 +381,11 @@* Step 4: Run the command in the correct context. */ +if (chdir ("/" )) { +perror ("chdir" ); +exit (-1 ); + } +if (execvp_secure (argv[1 ], sid, argv +1 ) ) {perror ("execvp_secure" );exit (-1 );