-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ksmbd: add support for supplementary groups
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent
fd01fc4
commit c69e41c
Showing
5 changed files
with
48 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,6 +131,8 @@ struct ksmbd_login_request { | |
__u32 reserved[16]; /* Reserved room */ | ||
}; | ||
|
||
#define KSMBD_MAX_NGROUPS 128 | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
/* | ||
* IPC user login response. | ||
*/ | ||
|
@@ -143,6 +145,8 @@ struct ksmbd_login_response { | |
__u16 hash_sz; /* hash size */ | ||
__s8 hash[KSMBD_REQ_MAX_HASH_SZ]; /* password hash */ | ||
__u32 reserved[16]; /* Reserved room */ | ||
This comment has been minimized.
Sorry, something went wrong.
atheik
Contributor
|
||
__u32 ngroups; /* supplementary group count */ | ||
__u32 sgid[KSMBD_MAX_NGROUPS]; /* supplementary group id */ | ||
}; | ||
|
||
/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,12 @@ struct ksmbd_user *ksmbd_alloc_user(struct ksmbd_login_response *resp) | |
{ | ||
struct ksmbd_user *user = NULL; | ||
|
||
if (resp->ngroups > KSMBD_MAX_NGROUPS) { | ||
pr_err("ngroups(%u) from login response exceed NGROUPS_MAX\n", | ||
This comment has been minimized.
Sorry, something went wrong.
atheik
Contributor
|
||
resp->ngroups); | ||
return NULL; | ||
} | ||
|
||
user = kmalloc(sizeof(struct ksmbd_user), GFP_KERNEL); | ||
if (!user) | ||
return NULL; | ||
|
@@ -50,6 +56,12 @@ struct ksmbd_user *ksmbd_alloc_user(struct ksmbd_login_response *resp) | |
kfree(user); | ||
user = NULL; | ||
} | ||
|
||
user->sgid = kmemdup(resp->sgid, resp->ngroups * sizeof(__u32), | ||
GFP_KERNEL); | ||
if (user->sgid) | ||
user->ngroups = resp->ngroups; | ||
|
||
return user; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Inconsistent name. Cf.
KSMBD_MAX_GROUPS
in ksmbd-tools.