Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 261071 Details for
Bug 351712
sys-apps/openrc symlinks prevent selinux from assigning proper contexts to utils such as rc-update
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for replacing openrc symlinks with wrapper scripts
openrc-0.7.0-selinux.patch (text/plain), 3.87 KB, created by
Chris Richards
on 2011-01-30 05:32:37 UTC
(
hide
)
Description:
patch for replacing openrc symlinks with wrapper scripts
Filename:
MIME Type:
Creator:
Chris Richards
Created:
2011-01-30 05:32:37 UTC
Size:
3.87 KB
patch
obsolete
>diff -drup openrc-0.7.0/work/openrc-0.7.0/src/rc/Makefile openrc-0.7.0-r1/work/openrc-0.7.0/src/rc/Makefile >--- openrc-0.7.0/work/openrc-0.7.0/src/rc/Makefile 2011-01-12 20:14:17.000000000 -0600 >+++ openrc-0.7.0-r1/work/openrc-0.7.0/src/rc/Makefile 2011-01-28 23:15:06.396999898 -0600 >@@ -47,6 +47,21 @@ include ${MK}/${MKPAM}.mk > > ${SRCS}: version.h > >+#create symlinks to rc if not an SELINUX system, otherwise create a wrapper >+#script to call rc with the proper name of the applet to execute. >+#$1 is the path+name of the target to link to (usually 'rc' or '/sbin/rc') >+#$2 contains the path+name of the link >+define make-links >+ for x in $1; do \ >+ if test -n "${SELINUX}"; then \ >+ printf '#!/bin/sh\nexec $2 --applet %s "$$@"\n' $$x >$3$$x; \ >+ chmod a+rx $3$$x; \ >+ else \ >+ ln -sf $2 $3$$x; \ >+ fi; \ >+ done; >+endef >+ > .PHONY: version.h.tmp > version.h.tmp: > echo "#define VERSION \"${VERSION}${GITVER}\"" >$@ >@@ -61,13 +76,13 @@ install: all > ${INSTALL} -d ${DESTDIR}${SBINDIR} > ${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${SBINDIR} > ${INSTALL} -d ${DESTDIR}${BINDIR} >- for x in ${BINLINKS}; do ln -fs ${SBINDIR}/${PROG} ${DESTDIR}${BINDIR}/$$x; done >+ $(call make-links,${BINLINKS},${SBINDIR}/${PROG},${DESTDIR}${BINDIR}/) > ${INSTALL} -d ${DESTDIR}${SBINDIR} >- for x in ${SBINLINKS}; do ln -fs ${PROG} ${DESTDIR}${SBINDIR}/$$x; done >+ $(call make-links,${SBINLINKS},${PROG},${DESTDIR}${SBINDIR}/) > ${INSTALL} -d ${DESTDIR}${LINKDIR}/bin >- for x in $(RC_BINLINKS); do ln -fs ${SBINDIR}/${PROG} ${DESTDIR}${LINKDIR}/bin/$$x; done >+ $(call make-links,${RC_BINLINKS},${SBINDIR}/${PROG},${DESTDIR}${LINKDIR}/bin/) > ${INSTALL} -d ${DESTDIR}${LINKDIR}/sbin >- for x in ${RC_SBINLINKS}; do ln -fs ${SBINDIR}/${PROG} ${DESTDIR}${LINKDIR}/sbin/$$x; done >+ $(call make-links,${RC_SBINLINKS},${SBINDIR/${PROG},${DESTDIR}${LINKDIR}/sbin/) > if test "${MKPAM}" = pam; then \ > ${INSTALL} -d ${DESTDIR}${PAMDIR}; \ > ${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \ >diff -drup openrc-0.7.0/work/openrc-0.7.0/src/rc/rc.c openrc-0.7.0-r1/work/openrc-0.7.0/src/rc/rc.c >--- openrc-0.7.0/work/openrc-0.7.0/src/rc/rc.c 2011-01-12 20:14:17.000000000 -0600 >+++ openrc-0.7.0-r1/work/openrc-0.7.0/src/rc/rc.c 2011-01-28 22:53:50.078999994 -0600 >@@ -773,11 +773,12 @@ handle_bad_signal(int sig) > #endif > > #include "_usage.h" >-#define getoptstring "o:s:S" getoptstring_COMMON >+#define getoptstring "o:s:S:a" getoptstring_COMMON > static const struct option longopts[] = { > { "override", 1, NULL, 'o' }, > { "service", 1, NULL, 's' }, > { "sys", 0, NULL, 'S' }, >+ { "applet", 1, NULL, 'a' }, > longopts_COMMON > }; > static const char * const longopts_help[] = { >@@ -785,6 +786,7 @@ static const char * const longopts_help[ > "when leaving single user or boot runlevels", > "runs the service specified with the rest\nof the arguments", > "output the RC system type, if any", >+ "runs the applet specified by the next argument", > longopts_help_COMMON > }; > #include "_usage.c" >@@ -835,7 +837,24 @@ main(int argc, char **argv) > } > > /* Run our built in applets. If we ran one, we don't return. */ >- run_applets(argc, argv); >+ { >+ //make these local vars >+ int localargc = argc; >+ char **localargv = argv; >+ if(-1 != (opt = getopt_long(argc, argv, getoptstring, longopts, >+ (int *)0))) { >+ if(opt == 'a' && argc >= 3) { >+ //pass modified argc,argv, because the applets >+ //expect their arguments starting at argv[1] >+ localargv = argv + 2; >+ localargc = argc - 2; >+ applet = argv[2]; >+ } >+ } >+ >+ optind = 0; //reset getopt_long >+ run_applets(localargc, localargv); >+ } > > argc--; > argv++; >@@ -890,8 +909,11 @@ main(int argc, char **argv) > } > exit(EXIT_SUCCESS); > /* NOTREACHED */ >- case_RC_COMMON_GETOPT >- } >+ case 'a': >+ /* Do nothing, actual logic in run_applets, this >+ is a placeholder */ >+ case_RC_COMMON_GETOPT >+ } > } > > newlevel = argv[optind++];
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 351712
:
261047
|
261049
|
261071
|
261125
|
261140
|
262605