shadow(3) Library Calls shadow(3)

НАЗВА

shadow, getspnam - підпрограми для файла зашифрованих паролів

СИНТАКСИС

#include <shadow.h>

struct spwd *getspent();

struct spwd *getspnam(char *name);

void setspent();

void endspent();

struct spwd *fgetspent(FILE *fp);

struct spwd *sgetspent(char *cp);

int putspent(struct spwd *p, FILE *fp);

int lckpwdf();

int ulckpwdf();

ОПИС

shadow manipulates the contents of the shadow password file, /etc/shadow. The structure in the #include file is:

struct spwd { char *sp_namp; /* ім'я користувача для входу */ char *sp_pwdp; /* зашифрований пароль */ long int sp_lstchg; /* остання зміна пароля */ long int sp_min; /* дні, протягом яких можлива зміна пароля. */ long int sp_max; /* дні до вимоги зміни пароля */ long int sp_warn; /* дні для попередження щодо завершення строку дії */ long int sp_inact; /* дні до неактивності облікового запису */ long int sp_expire; /* дата, коли завершиться строк дії облікового запису */ unsigned long int sp_flag; /* зарезервовано для використання у майбутньому */ }

Призначення кожного з полів:

•sp_namp - вказівник на ім'я користувача із кінцевим нуль-символом
•sp_pwdp - вказівник на пароль із кінцевим нуль-символом
•sp_lstchg - час у днях з 1 січня 1970 року, коли пароль було востаннє змінено
•sp_min - кількість днів з останньої зміни, коли пароль не може бути змінено
•sp_max - кількість днів з останньої зміни, після яких пароль має бути змінено
•sp_warn - дні від моменту, коли строк дії пароля буде вичерпано, коли користувач отримуватиме попередження щодо майбутнього завершення строку дії пароля
•sp_inact - кількість днів між завершенням строку дії і вимиканням облікового запису
•sp_expire - кількість днів з 1 січня 1970 року, яка визначає момент вимикання облікового запису
•sp_flag - зарезервовано для використання у майбутньому

ОПИС

getspent, getspname, fgetspent, and sgetspent each return a pointer to a struct spwd. getspent returns the next entry from the file, and fgetspent returns the next entry from the given stream, which is assumed to be a file of the proper format. sgetspent returns a pointer to a struct spwd using the provided string as input. getspnam searches from the current position in the file for an entry matching name.

setspent and endspent may be used to begin and end, respectively, access to the shadow password file.

The lckpwdf and ulckpwdf routines should be used to insure exclusive access to the /etc/shadow file. lckpwdf attempts to acquire a lock using pw_lock for up to 15 seconds. It continues by attempting to acquire a second lock using spw_lock for the remainder of the initial 15 seconds. Should either attempt fail after a total of 15 seconds, lckpwdf returns -1. When both locks are acquired 0 is returned.

ДІАГНОСТИКА

Routines return NULL if no more entries are available or if an error occurs during processing. Routines which have int as the return value return 0 for success and -1 for failure.

ЗАСТЕРЕЖЕННЯ

Цими підпрограмами може користуватися лише надкористувач, оскільки доступ до файла прихованих паролів обмежено.

ФАЙЛИ

/etc/shadow

Відомості щодо захищених облікових записів користувачів.

ДИВ. ТАКОЖ

getpwent(3), shadow(5).

26/03/2024 shadow-utils 4.15.1