shadow

Autres langues

Langue: it

Version: 24/07/2009 (fedora - 01/12/10)

Autres sections - même nom

Section: 3 (Bibliothèques de fonctions)

NOME

shadow, getspnam - gestione del file delle password cifrate

SINTASSI

#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();

DESCRIZIONE

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

 struct spwd {
       char              *sp_namp; /* login dell'utente */      char             *sp_pwdp; /* password cifrata */      long intsp_lstchg; /* ultimo cambio della password */      long intsp_min; /* giorni minimi tra i cambi */      long intsp_max; /* giorni massimi tra i cambi */      long intsp_warn; /* giorni di preavviso */      long intsp_inact; /* giorni di inattivit`a */      long intsp_expire; /* data di scadenza dell'account */      unsigned long intsp_flag; /* riservato per uso futuro */}
     
 

Ciascun campo significa:

* sp_namp - puntatore a una stringa null-terminated che contiene il nome utente.
* sp_pwdp - puntatore a una stringa null-terminated che contiene la password.
* sp_lstchg - giorni a partire dal 1 gennaio 1970 in cui la password `e stata cambiata l'ultima volta.
* sp_min - giorni prima dei quali la password non pu`o essere cambiata.
* sp_max - giorni dopo i quali la password deve essere cambiata.
* sp_warn - giorni prima della scadenza della password in cui l'utente viene avvertito.
* sp_inact - giorni dopo la scadenza della password in cui l'account viene considerato inattivo e disabilitato.
* sp_expire - giorni a partire dal 1 gennaio 1970 dopo i quali l'account viene disabilitato.
* sp_flag - riservato per uso futuro.

DESCRIZIONE

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 e endspent sono usate rispettivamente per iniziare e terminare l'accesso al file delle shadow password.

Le funzioni lckpwdf e ulckpwdf si usano per garantire l'accesso esclusivo al file /etc/shadow. lckpwdf prova ad acquisire il lock tramite pw_lock per un massimo di 15 secondi, dopodich'e tenta di ottenere un secondo lock usando spw_lock per il tempo che rimane dei 15 secondi iniziali. Se anche uno solo dei due tentativi fallisce dopo un totale di 15 secondi, lckpwdf restituisce -1, mentre restituisce 0 se riesce ad acquisire entrambi i lock.

DIAGNOSTICA

Le funzioni restituiscono NULL se non ci sono altre voci disponibili o se si verifica un errore durante l'elaborazione. Le funzioni di tipo int restituiscono 0 in caso di successo e -1 in caso di errore.

AVVISI/CAVEAT

These routines may only be used by the superuser as access to the shadow password file is restricted.

FILE

/etc/shadow

Informazioni sicure sugli account di utenti.

VEDERE ANCHE

getpwent(3), shadow(5).