int _has_system_group_static_(uid_t uid) {
- struct passwd *userinfo = NULL;
- struct group *systemgroupinfo = NULL;
+ struct passwd pwd, *userinfo = NULL;
+ struct group grp, *systemgroupinfo = NULL;
const char *sysgrpname = NULL;
+ char buf[1024];
uid_t myuid = 0;
gid_t system_gid = 0;
gid_t *groups = NULL;
fprintf( stderr, "isadmin ERROR: variable TZ_SYS_ADMIN_GROUP is NULL");
return -1;
}
- systemgroupinfo = getgrnam(sysgrpname);
+ getgrnam_r(sysgrpname, &grp, buf, sizeof(buf), &systemgroupinfo);
if(systemgroupinfo == NULL) {
fprintf( stderr, "isadmin ERROR: cannot find group named \"%s\"\n", sysgrpname);
return -1;
/* Get all the gid of the given uid */
- userinfo = getpwuid(myuid);
+ getpwuid(myuid, &pwd, buf, sizeof(buf), &userinfo);
/* Need to call this function now to get the number of group to make the
malloc correctly sized */
int all = 0, not = 0, query = 0, export = 0, space = 0, list = 0, cont = 0;
int i, n, *sel, p;
enum tzplatform_variable id;
- struct passwd *spw;
+ struct passwd pwd, *spw;
+ char buf[1024];
/* parse args */
while(*argv && **argv=='-') {
if (user) {
for (i=0 ; '0' <= user[i] && user[i] <= '9' ; i++);
if (user[i])
- spw = getpwnam(user);
+ getpwnam_r(user, &pwd, buf, sizeof(buf), &spw);
else
- spw = getpwuid((uid_t)atoi(user));
+ getpwuid_r(user, &pwd, buf, sizeof(buf), &spw);
if (!spw) {
fprintf( stderr, "error! %s isn't standing for a valid user.\n", user);
if (!cont)