struct passwd *list_pw;
int long_list;
uid_t timestamp_uid;
+gid_t timestamp_gid;
#ifdef HAVE_BSD_AUTH_H
char *login_style;
#endif /* HAVE_BSD_AUTH_H */
pw = sudo_getpwnam(def_timestampowner);
if (pw != NULL) {
timestamp_uid = pw->pw_uid;
+ timestamp_gid = pw->pw_gid;
sudo_pw_delref(pw);
} else {
log_warningx(SLOG_SEND_MAIL,
N_("timestamp owner (%s): No such user"), def_timestampowner);
timestamp_uid = ROOT_UID;
+ timestamp_gid = ROOT_GID;
}
}
/*
- * Copyright (c) 2014-2016 Todd C. Miller <Todd.Miller@courtesan.com>
+ * Copyright (c) 2014-2017 Todd C. Miller <Todd.Miller@courtesan.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* Returns false on failure and displays a warning to stderr.
*/
static bool
-ts_mkdirs(char *path, uid_t owner, mode_t mode, mode_t parent_mode, bool quiet)
+ts_mkdirs(char *path, uid_t owner, gid_t group, mode_t mode,
+ mode_t parent_mode, bool quiet)
{
- gid_t parent_gid = (gid_t)-1;
bool ret;
debug_decl(ts_mkdirs, SUDOERS_DEBUG_AUTH)
- ret = sudo_mkdir_parents(path, owner, &parent_gid, parent_mode, quiet);
+ ret = sudo_mkdir_parents(path, owner, &group, parent_mode, quiet);
if (ret) {
/* Create final path component. */
sudo_debug_printf(SUDO_DEBUG_DEBUG|SUDO_DEBUG_LINENO,
"mkdir %s, mode 0%o, uid %d, gid %d", path, (int)mode,
- (int)owner, (int)parent_gid);
+ (int)owner, (int)group);
if (mkdir(path, mode) != 0 && errno != EEXIST) {
if (!quiet)
sudo_warn(U_("unable to mkdir %s"), path);
ret = false;
} else {
- ignore_result(chown(path, owner, parent_gid));
+ ignore_result(chown(path, owner, group));
}
}
debug_return_bool(ret);
ret = true;
break;
case SUDO_PATH_MISSING:
- if (make_it && ts_mkdirs(path, timestamp_uid, S_IRWXU,
+ if (make_it && ts_mkdirs(path, timestamp_uid, timestamp_gid, S_IRWXU,
S_IRWXU|S_IXGRP|S_IXOTH, quiet)) {
ret = true;
break;