Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
DISCONTINUED:openSUSE:11.2
PolicyKit-doc
PolicyKit-0.9-pidconstraint.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File PolicyKit-0.9-pidconstraint.diff of Package PolicyKit-doc
Don't resolve pid->exe unless the exe resolve helper is setuid root. Otherwise pid constraints might get added to obtained privileges although unprivileged programs can't ever verify them. Index: PolicyKit-0.9/src/polkit/polkit-authorization-constraint.c =================================================================== --- PolicyKit-0.9.orig/src/polkit/polkit-authorization-constraint.c +++ PolicyKit-0.9/src/polkit/polkit-authorization-constraint.c @@ -545,6 +545,23 @@ out: return ret; } + +/* check whether binary is setuid root and executable for anyone */ +static polkit_bool_t +_check_setuid_root(const char* path) +{ + struct stat stb; + + if(stat(path, &stb) == 0 + && S_ISREG(stb.st_mode) + && (stb.st_mode & 04111) == 04111 + && stb.st_uid == 0) { + return TRUE; + } + + return FALSE; +} + /** * polkit_authorization_constraint_get_from_caller: * @caller: caller @@ -621,7 +638,18 @@ polkit_authorization_constraint_get_from * * An example of this is pulseaudio... */ - n = polkit_sysdeps_get_exe_for_pid_with_helper (pid, path, sizeof (path)); + + /* HOWEVER don't set pid contraints if the exe helper isn't + * setuid root to ensure that unprivileged programs will + * actually be able to check such constraints later. + * XXX: should be a sysdeps function. Upstream disagrees with + * me about that feature anyways so let's live with the hack + */ + n = -1; + if(_check_setuid_root(PACKAGE_LIBEXEC_DIR "/polkit-resolve-exe-helper")) { + n = polkit_sysdeps_get_exe_for_pid_with_helper (pid, path, sizeof (path)); + } + if (n != -1 && n < (int) sizeof (path)) { PolKitAuthorizationConstraint *c;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor