X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fuserspec.c;h=501fa3496159b903bf10aeb22f673b45b4b3ea53;hb=0600c3a06dc7495a7649234fe6e1ff813abeac02;hp=fd2c941f81d9b3d3ffbe05ad0d1265c532028462;hpb=5f531596a92e1205a700218dedfe7a525eef21c8;p=gnulib.git diff --git a/lib/userspec.c b/lib/userspec.c index fd2c941f8..501fa3496 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -1,11 +1,11 @@ /* userspec.c -- Parse a user and group string. - Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2006 Free Software + Copyright (C) 1989-1992, 1997-1998, 2000, 2002-2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -13,14 +13,11 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* Written by David MacKenzie . */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Specification. */ #include "userspec.h" @@ -43,7 +40,6 @@ #include "intprops.h" #include "inttostr.h" -#include "strdup.h" #include "xalloc.h" #include "xstrtol.h" @@ -158,7 +154,8 @@ parse_with_separator (char const *spec, char const *separator, if (u != NULL) { - pwd = getpwnam (u); + /* If it starts with "+", skip the look-up. */ + pwd = (*u == '+' ? NULL : getpwnam (u)); if (pwd == NULL) { bool use_login_group = (separator != NULL && g == NULL); @@ -198,7 +195,8 @@ parse_with_separator (char const *spec, char const *separator, if (g != NULL && error_msg == NULL) { /* Explicit group. */ - grp = getgrnam (g); + /* If it starts with "+", skip the look-up. */ + grp = (*g == '+' ? NULL : getgrnam (g)); if (grp == NULL) { unsigned long int tmp;