Date: Fri, 8 Apr 2005 17:26:37 GMT From: Jim Kuhn <jkuhn@sandvine.com> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/79690: [patch] mdmfs does not accept numeric uid/gid with -w Message-ID: <200504081726.j38HQbnU058586@www.freebsd.org> Resent-Message-ID: <200504081730.j38HU8va043994@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 79690
>Category: bin
>Synopsis: [patch] mdmfs does not accept numeric uid/gid with -w
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Apr 08 17:30:08 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Jim Kuhn
>Release: 5.3.0
>Organization:
Sandvine Incorporated
>Environment:
FreeBSD TPC-D4-39.sandvine.com 5.31.0003 FreeBSD 5.31.0003 #0: Tue Mar 1 18:12:17 UTC 2005 i386 7.20.0003
>Description:
While mdfs correctly processes a numeric uid:gid combination, it fails to set the appropriate mi_have_* flags, which causes an assertion that both uid and gid to fail.
>How-To-Repeat:
>Fix:
--- mdmfs.c@@/main/sandvine_gluon/0 2005-04-08 11:18:47.000000000 -0400
+++ mdmfs.c 2005-04-08 13:23:43.000000000 -0400
@@ -518,27 +518,27 @@
/* Derive uid. */
*uid = strtoul(user, &p, 10);
- if (*uid == (uid_t)ULONG_MAX)
+ if (*user == '\0' || *uid == (uid_t)ULONG_MAX)
usage();
if (*p != '\0') {
pw = getpwnam(user);
if (pw == NULL)
errx(1, "invalid user: %s", user);
*uid = pw->pw_uid;
- mip->mi_have_uid = true;
}
+ mip->mi_have_uid = true;
/* Derive gid. */
*gid = strtoul(group, &p, 10);
- if (*gid == (gid_t)ULONG_MAX)
+ if (*group == '\0' || *gid == (gid_t)ULONG_MAX)
usage();
if (*p != '\0') {
gr = getgrnam(group);
if (gr == NULL)
errx(1, "invalid group: %s", group);
*gid = gr->gr_gid;
- mip->mi_have_gid = true;
}
+ mip->mi_have_gid = true;
free(ug);
/*
>Release-Note:
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200504081726.j38HQbnU058586>
