You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Added user and group checks. Auto create socket dir.
Parsec must be run as user `parsec` and `parsec` must be member of group `parsec-client`.
This is disabled if feature `testing` is specified.
Also auto created `/tmp/parsec` if it does not already exist.
Signed-off-by: Samuel Bailey <[email protected]>
// Although `parsec` has to be part of the `parsec_clients` group, it may not be the primary group. Therefore force group ownership to `parsec_clients`
101
+
ifunsafe{
102
+
let parent_dir_cstr = CString::new(parent_dir_str)
103
+
.expect("Failed to convert socket path parent to cstring");
104
+
{
105
+
libc::chown(
106
+
parent_dir_cstr.as_ptr(),
107
+
users::get_current_uid(),// To get to this point, user has to be `parsec`
108
+
users::get_group_by_name(PARSEC_GROUPNAME).unwrap().gid(),// `parsec_clients` exists by this point so should be safe
109
+
)
110
+
}
111
+
} != 0
112
+
{
113
+
error!(
114
+
"Changing ownership of {} to user {} and group {} failed.",
115
+
parent_dir_str,PARSEC_USERNAME,PARSEC_GROUPNAME
116
+
);
117
+
returnErr(Error::new(
118
+
ErrorKind::Other,
119
+
"Changing ownership of socket directory failed",
120
+
));
121
+
}
122
+
}else{
123
+
error!(
124
+
"Error converting {} parent directory to string.",
0 commit comments