Blame files-pwd.c

Packit 231c70
/* User file parser in nss_files module.
Packit 231c70
   Copyright (C) 1996-2013 Free Software Foundation, Inc.
Packit 231c70
   This file is part of the GNU C Library.
Packit 231c70
Packit 231c70
   The GNU C Library is free software; you can redistribute it and/or
Packit 231c70
   modify it under the terms of the GNU Lesser General Public
Packit 231c70
   License as published by the Free Software Foundation; either
Packit 231c70
   version 2.1 of the License, or (at your option) any later version.
Packit 231c70
Packit 231c70
   The GNU C Library is distributed in the hope that it will be useful,
Packit 231c70
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 231c70
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 231c70
   Lesser General Public License for more details.
Packit 231c70
Packit 231c70
   You should have received a copy of the GNU Lesser General Public
Packit 231c70
   License along with the GNU C Library; if not, see
Packit 231c70
   <http://www.gnu.org/licenses/>.  */
Packit 231c70
Packit 231c70
#include <pwd.h>
Packit 231c70
Packit 231c70
#define STRUCTURE	passwd
Packit 231c70
#define ENTNAME		pwent
Packit 231c70
#define DATABASE	"passwd"
Packit 231c70
struct pwent_data {};
Packit 231c70
Packit 231c70
/* Our parser function is already defined in fgetpwent_r.c, so use that
Packit 231c70
   to parse lines from the database file.  */
Packit 231c70
#define EXTERN_PARSER
Packit 231c70
#include "files-parse.c"
Packit 231c70
#include GENERIC
Packit 231c70
Packit 231c70
DB_LOOKUP (pwnam, '.', 0, ("%s", name),
Packit 231c70
	   {
Packit 231c70
	     if (name[0] != '+' && name[0] != '-'
Packit 231c70
		 && ! strcmp (name, result->pw_name))
Packit 231c70
	       break;
Packit 231c70
	   }, const char *name)
Packit 231c70
Packit 231c70
DB_LOOKUP (pwuid, '=', 20, ("%lu", (unsigned long int) uid),
Packit 231c70
	   {
Packit 231c70
	     if (result->pw_uid == uid && result->pw_name[0] != '+'
Packit 231c70
		 && result->pw_name[0] != '-')
Packit 231c70
	       break;
Packit 231c70
	   }, uid_t uid)