goto on_error;
}
- if (!lxc_setgroups(0, NULL) && errno != EPERM)
+ if (!lxc_drop_groups() && errno != EPERM)
goto on_error;
if (options->namespaces & CLONE_NEWUSER)
gid_t nsgid = (arg->conf->root_nsgid_map != NULL) ? 0 : arg->conf->init_gid;
int ret;
- if (!lxc_setgroups(0, NULL) && errno != EPERM)
+ if (!lxc_drop_groups() && errno != EPERM)
return log_error_errno(-1, errno, "Failed to setgroups(0, NULL)");
ret = setresgid(nsgid, nsgid, nsgid);
uid_t nsuid = (arg->conf->root_nsuid_map != NULL) ? 0 : arg->conf->init_uid;
gid_t nsgid = (arg->conf->root_nsgid_map != NULL) ? 0 : arg->conf->init_gid;
- if (!lxc_setgroups(0, NULL) && errno != EPERM)
+ if (!lxc_drop_groups() && errno != EPERM)
return log_error_errno(-1, errno, "Failed to setgroups(0, NULL)");
ret = setresgid(nsgid, nsgid, nsgid);
int ret;
char **argv = (char **)vargv;
- if (!lxc_setgroups(0, NULL) && errno != EPERM)
+ if (!lxc_drop_groups() && errno != EPERM)
return -1;
/* Assume we want to become root */
close_prot_errno_disarm(sock_fds[0]);
- if (!lxc_setgroups(0, NULL) && errno != EPERM)
+ if (!lxc_drop_groups() && errno != EPERM)
_exit(EXIT_FAILURE);
ret = setresgid(resgid, resgid, resgid);
if (!lxc_switch_uid_gid(0, 0))
_exit(EXIT_FAILURE);
- if (!lxc_setgroups(0, NULL))
+ if (!lxc_drop_groups())
_exit(EXIT_FAILURE);
ret = fchown(target_fd, 0, st.st_gid);
/* update hostname in rootfs */
/* we're going to mount, so run in a clean namespace to simplify cleanup */
- (void)lxc_setgroups(0, NULL);
+ (void)lxc_drop_groups();
if (setgid(0) < 0) {
ERROR("Failed to setgid to 0");
/* Drop groups only after we switched to a valid gid in the new
* user namespace.
*/
- if (!lxc_setgroups(0, NULL) &&
+ if (!lxc_drop_groups() &&
(handler->am_root || errno != EPERM))
goto out_warn_father;
#if HAVE_LIBCAP
if (lxc_proc_cap_is_set(CAP_SETGID, CAP_EFFECTIVE))
#endif
- if (!lxc_setgroups(0, NULL))
+ if (!lxc_drop_groups())
goto out_warn_father;
if (!lxc_switch_uid_gid(new_uid, new_gid))
const char *src;
struct rsync_data_char *arg = data;
- (void)lxc_setgroups(0, NULL);
+ (void)lxc_drop_groups();
if (setgid(0) < 0) {
ERROR("Failed to setgid to 0");
if (!lxc_switch_uid_gid(0, 0))
return -1;
- if (!lxc_setgroups(0, NULL))
+ if (!lxc_drop_groups())
return -1;
return lxc_rsync_exec(args->src, args->dest);
if (!lxc_switch_uid_gid(0, 0))
return -1;
- if (!lxc_setgroups(0, NULL))
+ if (!lxc_drop_groups())
return -1;
src = lxc_storage_get_path(orig->dest, orig->type);
{
struct lxc_conf *conf = data;
- (void)lxc_setgroups(0, NULL);
+ (void)lxc_drop_groups();
if (setgid(0) < 0) {
SYSERROR("Failed to setgid to 0");