mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
s3/service: convert lp_force_group() to const
set_conn_force_user_group() and change_to_user_internal() leak onto the callers' talloc stackframe. Drop the unnecessary heap allocations. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
ce6c77d63a
commit
c53646bccd
@ -1,6 +1,7 @@
|
||||
<samba:parameter name="force group"
|
||||
context="S"
|
||||
type="string"
|
||||
constant="1"
|
||||
xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
|
||||
<synonym>group</synonym>
|
||||
<description>
|
||||
|
@ -243,23 +243,18 @@ static NTSTATUS find_forced_group(bool force_user,
|
||||
TALLOC_CTX *frame = talloc_stackframe();
|
||||
struct dom_sid group_sid;
|
||||
enum lsa_SidType type;
|
||||
const char *force_group;
|
||||
char *groupname;
|
||||
bool user_must_be_member = False;
|
||||
gid_t gid;
|
||||
|
||||
groupname = lp_force_group(talloc_tos(), snum);
|
||||
if (groupname == NULL) {
|
||||
DEBUG(1, ("talloc_strdup failed\n"));
|
||||
result = NT_STATUS_NO_MEMORY;
|
||||
goto done;
|
||||
force_group = lp_force_group(snum);
|
||||
if (force_group[0] == '+') {
|
||||
user_must_be_member = true;
|
||||
force_group += 1;
|
||||
}
|
||||
|
||||
if (groupname[0] == '+') {
|
||||
user_must_be_member = True;
|
||||
groupname += 1;
|
||||
}
|
||||
|
||||
groupname = talloc_string_sub(talloc_tos(), groupname,
|
||||
groupname = talloc_string_sub(talloc_tos(), force_group,
|
||||
"%S", lp_const_servicename(snum));
|
||||
if (groupname == NULL) {
|
||||
DEBUG(1, ("talloc_string_sub failed\n"));
|
||||
@ -427,7 +422,7 @@ NTSTATUS set_conn_force_user_group(connection_struct *conn, int snum)
|
||||
* any groupid stored for the connecting user.
|
||||
*/
|
||||
|
||||
if (*lp_force_group(talloc_tos(), snum)) {
|
||||
if (*lp_force_group(snum)) {
|
||||
|
||||
status = find_forced_group(
|
||||
conn->force_user, snum, conn->session_info->unix_info->unix_name,
|
||||
|
@ -335,7 +335,8 @@ static bool change_to_user_internal(connection_struct *conn,
|
||||
* See if we should force group for this service. If so this overrides
|
||||
* any group set in the force user code.
|
||||
*/
|
||||
if((group_c = *lp_force_group(talloc_tos(), snum))) {
|
||||
group_c = *lp_force_group(snum);
|
||||
if (group_c != '\0') {
|
||||
|
||||
SMB_ASSERT(conn->force_group_gid != (gid_t)-1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user