shadow: FTBFS on hurd-i386 (for review)
Source: shadow
Version: 4.2-2
Severity: important
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd
Hi,
Currently shadow fails to build from source due to a usage of PATH_MAX,
which is not defined on GNU/Hurd. The attached patch solved this problem
by dynamically allocating space for the string proc_dir_name in files
src/procuidmap.c and src/procgidmap.c and freeing it when not needed any
longer.
Question:
This feature seems to be new:
The new{u,g]idmap sets /proc/[pid]/{u,g}id_map based on it's command
line arguments and the {u,g}ids allowed in /etc/sub{u,g}id.
I can see these entries on GNU/Linux. Will this work on Hurd too or
should the build/installation of them be disabled?
Index: shadow-4.2/src/newuidmap.c
===================================================================
--- shadow-4.2.orig/src/newuidmap.c
+++ shadow-4.2/src/newuidmap.c
@@ -94,7 +94,7 @@ void usage(void)
*/
int main(int argc, char **argv)
{
- char proc_dir_name[PATH_MAX];
+ char *proc_dir_name = NULL;
char *target_str;
pid_t target, parent;
int proc_dir_fd;
@@ -103,6 +103,7 @@ int main(int argc, char **argv)
struct stat st;
struct passwd *pw;
int written;
+ size_t len;
Prog = Basename (argv[0]);
@@ -120,14 +121,23 @@ int main(int argc, char **argv)
if (!get_pid(target_str, &target))
usage();
- written = snprintf(proc_dir_name, sizeof(proc_dir_name), "/proc/%u/",
+ len = 6 + 10 + 1 + 1;
+ proc_dir_name = malloc(len);
+ if (proc_dir_name == NULL)
+ {
+ fprintf(stderr, "%s: malloc failed: %s\n",
+ Prog, strerror(errno));
+ return EXIT_FAILURE;
+ }
+ written = snprintf(proc_dir_name, len, "/proc/%u/",
target);
- if ((written <= 0) || (written >= sizeof(proc_dir_name))) {
+ if ((written <= 0) || (written >= len)) {
fprintf(stderr, "%s: snprintf of proc path failed: %s\n",
Prog, strerror(errno));
}
proc_dir_fd = open(proc_dir_name, O_DIRECTORY);
+ free (proc_dir_name);
if (proc_dir_fd < 0) {
fprintf(stderr, _("%s: Could not open proc directory for target %u\n"),
Prog, target);
Reply to: