pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/57888 (pkg_create fails ungracefully if uid or gid on file doesn't have name)



The following reply was made to PR pkg/57888; it has been noted by GNATS.

From: Sunil Nimmagadda <sunil%nimmagadda.net@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: pkg/57888 (pkg_create fails ungracefully if uid or gid on file
 doesn't have name)
Date: Fri, 02 Feb 2024 09:58:27 +0530

 jkoshy%NetBSD.org@localhost writes:
 
 > Synopsis: pkg_create fails ungracefully if uid or gid on file doesn't have name
 >
 > State-Changed-From-To: open->analyzed
 > State-Changed-By: jkoshy%NetBSD.org@localhost
 > State-Changed-When: Fri, 02 Feb 2024 14:37:19 +0000
 > State-Changed-Why:
 > A potential fix is now available.
 
 Updated diff to include uid/gid in the error message...
 diff --git a/external/bsd/pkg_install/dist/create/util.c b/external/bsd/pkg_install/dist/create/util.c
 --- a/external/bsd/pkg_install/dist/create/util.c
 +++ b/external/bsd/pkg_install/dist/create/util.c
 @@ -58,14 +58,19 @@
  static void
  update_ids(struct memory_file *file)
  {
 +	const char *s;
 +
  	if (file->owner != NULL) {
  		uid_t uid;
  
  		if (uid_from_user(file->owner, &uid) == -1)
  			errx(2, "user %s unknown", file->owner);
  		file->st.st_uid = uid;
 -	} else {
 -		file->owner = xstrdup(user_from_uid(file->st.st_uid, 1));
 +        } else {
 +		if ((s = user_from_uid(file->st.st_uid, 1)) == NULL)
 +			errx(2, "unknown user name for uid %u",
 +			    file->st.st_uid);
 +		file->owner = xstrdup(s);
  	}
  
  	if (file->group != NULL) {
 @@ -75,7 +80,10 @@
  			errx(2, "group %s unknown", file->group);
  		file->st.st_gid = gid;
  	} else {
 -		file->group = xstrdup(group_from_gid(file->st.st_gid, 1));
 +		if ((s = group_from_gid(file->st.st_gid, 1)) == NULL)
 +			errx(2, "unknown group name for gid %u",
 +			    file->st.st_gid);
 +		file->group = xstrdup(s);
  	}
  }
  
 


Home | Main Index | Thread Index | Old Index