Blame shadow/shadow.h

Packit 6c4009
/* Copyright (C) 1996-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/* Declaration of types and functions for "shadow" storage of hashed
Packit 6c4009
   passphrases.  The shadow database is like the user database, but is
Packit 6c4009
   only accessible with special privileges, so that malicious users
Packit 6c4009
   cannot retrieve everyone else's hashed passphrase to brute-force at
Packit 6c4009
   their convenience.  */
Packit 6c4009
Packit 6c4009
#ifndef _SHADOW_H
Packit 6c4009
#define _SHADOW_H	1
Packit 6c4009
Packit 6c4009
#include <features.h>
Packit 6c4009
Packit 6c4009
#include <paths.h>
Packit 6c4009
Packit 6c4009
#define __need_size_t
Packit 6c4009
#include <stddef.h>
Packit 6c4009
Packit 6c4009
#include <bits/types/FILE.h>
Packit 6c4009
Packit 6c4009
/* Paths to the user database files.  */
Packit 6c4009
#define	SHADOW _PATH_SHADOW
Packit 6c4009
Packit 6c4009
Packit 6c4009
__BEGIN_DECLS
Packit 6c4009
Packit 6c4009
/* A record in the shadow database.  */
Packit 6c4009
struct spwd
Packit 6c4009
  {
Packit 6c4009
    char *sp_namp;		/* Login name.  */
Packit 6c4009
    char *sp_pwdp;		/* Hashed passphrase.  */
Packit 6c4009
    long int sp_lstchg;		/* Date of last change.  */
Packit 6c4009
    long int sp_min;		/* Minimum number of days between changes.  */
Packit 6c4009
    long int sp_max;		/* Maximum number of days between changes.  */
Packit 6c4009
    long int sp_warn;		/* Number of days to warn user to change
Packit 6c4009
				   the password.  */
Packit 6c4009
    long int sp_inact;		/* Number of days the account may be
Packit 6c4009
				   inactive.  */
Packit 6c4009
    long int sp_expire;		/* Number of days since 1970-01-01 until
Packit 6c4009
				   account expires.  */
Packit 6c4009
    unsigned long int sp_flag;	/* Reserved.  */
Packit 6c4009
  };
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Open database for reading.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern void setspent (void);
Packit 6c4009
Packit 6c4009
/* Close database.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern void endspent (void);
Packit 6c4009
Packit 6c4009
/* Get next entry from database, perhaps after opening the file.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern struct spwd *getspent (void);
Packit 6c4009
Packit 6c4009
/* Get shadow entry matching NAME.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern struct spwd *getspnam (const char *__name);
Packit 6c4009
Packit 6c4009
/* Read shadow entry from STRING.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern struct spwd *sgetspent (const char *__string);
Packit 6c4009
Packit 6c4009
/* Read next shadow entry from STREAM.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern struct spwd *fgetspent (FILE *__stream);
Packit 6c4009
Packit 6c4009
/* Write line containing shadow entry to stream.
Packit 6c4009
Packit 6c4009
   This function is not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation it is a cancellation point and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern int putspent (const struct spwd *__p, FILE *__stream);
Packit 6c4009
Packit 6c4009
Packit 6c4009
#ifdef __USE_MISC
Packit 6c4009
/* Reentrant versions of some of the functions above.
Packit 6c4009
Packit 6c4009
   These functions are not part of POSIX and therefore no official
Packit 6c4009
   cancellation point.  But due to similarity with an POSIX interface
Packit 6c4009
   or due to the implementation they are cancellation points and
Packit 6c4009
   therefore not marked with __THROW.  */
Packit 6c4009
extern int getspent_r (struct spwd *__result_buf, char *__buffer,
Packit 6c4009
		       size_t __buflen, struct spwd **__result);
Packit 6c4009
Packit 6c4009
extern int getspnam_r (const char *__name, struct spwd *__result_buf,
Packit 6c4009
		       char *__buffer, size_t __buflen,
Packit 6c4009
		       struct spwd **__result);
Packit 6c4009
Packit 6c4009
extern int sgetspent_r (const char *__string, struct spwd *__result_buf,
Packit 6c4009
			char *__buffer, size_t __buflen,
Packit 6c4009
			struct spwd **__result);
Packit 6c4009
Packit 6c4009
extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
Packit 6c4009
			char *__buffer, size_t __buflen,
Packit 6c4009
			struct spwd **__result);
Packit 6c4009
#endif	/* misc */
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* The simple locking functionality provided here is not suitable for
Packit 6c4009
   multi-threaded applications.  */
Packit 6c4009
Packit 6c4009
/* Request exclusive access to /etc/passwd and /etc/shadow.  */
Packit 6c4009
extern int lckpwdf (void) __THROW;
Packit 6c4009
Packit 6c4009
/* Release exclusive access to /etc/passwd and /etc/shadow.  */
Packit 6c4009
extern int ulckpwdf (void) __THROW;
Packit 6c4009
Packit 6c4009
__END_DECLS
Packit 6c4009
Packit 6c4009
#endif /* shadow.h */