mirror of
https://github.com/samba-team/samba.git
synced 2025-09-04 09:44:20 +03:00
fixed a uid_wrapper bug that caused a segv in the RAW-ACLS test
This commit is contained in:
@@ -42,6 +42,10 @@ static void uwrap_init(void)
|
|||||||
uwrap.initialised = true;
|
uwrap.initialised = true;
|
||||||
if (getenv("UID_WRAPPER")) {
|
if (getenv("UID_WRAPPER")) {
|
||||||
uwrap.enabled = true;
|
uwrap.enabled = true;
|
||||||
|
/* put us in one group */
|
||||||
|
uwrap.ngroups = 1;
|
||||||
|
uwrap.groups = talloc_array(talloc_autofree_context(), gid_t, 1);
|
||||||
|
uwrap.groups[0] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +105,9 @@ _PUBLIC_ int uwrap_setgroups(size_t size, const gid_t *list)
|
|||||||
|
|
||||||
talloc_free(uwrap.groups);
|
talloc_free(uwrap.groups);
|
||||||
uwrap.ngroups = 0;
|
uwrap.ngroups = 0;
|
||||||
|
uwrap.groups = NULL;
|
||||||
|
|
||||||
|
if (size != 0) {
|
||||||
uwrap.groups = talloc_array(talloc_autofree_context(), gid_t, size);
|
uwrap.groups = talloc_array(talloc_autofree_context(), gid_t, size);
|
||||||
if (uwrap.groups == NULL) {
|
if (uwrap.groups == NULL) {
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
@@ -109,6 +115,7 @@ _PUBLIC_ int uwrap_setgroups(size_t size, const gid_t *list)
|
|||||||
}
|
}
|
||||||
memcpy(uwrap.groups, list, size*sizeof(gid_t));
|
memcpy(uwrap.groups, list, size*sizeof(gid_t));
|
||||||
uwrap.ngroups = size;
|
uwrap.ngroups = size;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +137,7 @@ _PUBLIC_ int uwrap_getgroups(int size, gid_t *list)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memcpy(list, uwrap.groups, size*sizeof(gid_t));
|
memcpy(list, uwrap.groups, size*sizeof(gid_t));
|
||||||
return 0;
|
return uwrap.ngroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
_PUBLIC_ uid_t uwrap_getuid(void)
|
_PUBLIC_ uid_t uwrap_getuid(void)
|
||||||
|
Reference in New Issue
Block a user