/* userspec.c -- Parse a user and group string.
- Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2009 Free Software
+ Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2010 Free Software
Foundation, Inc.
This program is free software: you can redistribute it and/or modify
{
unsigned long int tmp;
if (xstrtoul (u, NULL, 10, &tmp, "") == LONGINT_OK
- && tmp <= MAXUID)
+ && tmp <= MAXUID && (uid_t) tmp != (uid_t) -1)
unum = tmp;
else
error_msg = E_invalid_user;
if (grp == NULL)
{
unsigned long int tmp;
- if (xstrtoul (g, NULL, 10, &tmp, "") == LONGINT_OK && tmp <= MAXGID)
+ if (xstrtoul (g, NULL, 10, &tmp, "") == LONGINT_OK
+ && tmp <= MAXGID && (gid_t) tmp != (gid_t) -1)
gnum = tmp;
else
error_msg = E_invalid_group;