-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add additional-gids for lxc-attach #4243
base: main
Are you sure you want to change the base?
Conversation
This pull request didn't trigger Jenkins as its author isn't in the allow list. An organization member must perform one of the following:
Those commands are simple Github comments of the format: "jenkins: COMMAND" |
jenkins: ok to test |
jenkins: test this please |
|
Signed-off-by: zhangxiaoyu <zhangxiaoyu58@huawei.com>
fixed |
jenkins: test this please |
@brauner @mihalicyn can one of you please review? |
Testsuite passed |
it would be awesome if this was integrated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
I have added a few small suggestions, but none of them are critical. Code looks fully correct and safe to me.
@@ -128,6 +131,9 @@ Options :\n\ | |||
Load configuration file FILE\n\ | |||
-u, --uid=UID Execute COMMAND with UID inside the container\n\ | |||
-g, --gid=GID Execute COMMAND with GID inside the container\n\ | |||
--additional-gids\n\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--additional-gids=GIDS_LIST
unsigned int readvalue; | ||
size_t i, len; | ||
const size_t max_gids = 32; | ||
gid_t *g = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__do_free gid_t *g = NULL;
g[i] = readvalue; | ||
} | ||
|
||
gids->list = g; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gids->list = move_ptr(g);
for (i = 0; i < len; i++) { | ||
if (lxc_safe_uint(gids_str[i], &readvalue) != 0) { | ||
ERROR("Invalid gid value %s", gids_str[i]); | ||
free(g); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
free(g);
won't be needed if you add __do_free
@@ -258,6 +270,51 @@ static bool stdfd_is_pty(void) | |||
return false; | |||
} | |||
|
|||
static int get_additional_gids(const char *add_gids, lxc_groups_t *gids) | |||
{ | |||
unsigned int readvalue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can place this variable inside the loop
add additional-gids for lxc-attach
#4235
Signed-off-by: zhangxiaoyu zhangxiaoyu58@huawei.com