linuxでshadowのパスワードを取得

2886 ワード

man shadowで調べられる情報
SHADOW(3)                                                                                                            SHADOW(3)



 
       shadow, getspnam -           

SYNTAX
       #include 

       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    shadow      /etc/shadow    。#include        :

           struct spwd {
                 char          *sp_namp; /* user login name */
                 char          *sp_pwdp; /* encrypted password */
                 long int      sp_lstchg; /* last password change */
                 long int      sp_min; /* days until change allowed. */
                 long int      sp_max; /* days before change required */
                 long int      sp_warn; /* days warning for expiration */
                 long int      sp_inact; /* days before account inactive */
                 long int      sp_expire; /* date when account expires */
                 unsigned long int  sp_flag; /* reserved for future use */
           }


               :

       ·   sp_namp -     null          

       ·   sp_pwdp -    null         

       ·   sp_lstchg -          (        1970 1 1      )

       ·   sp_min - days before which password may not be changed

       ·   sp_max - days after which password must be changed

       ·   sp_warn - days before password is to expire that user is warned of pending password expiration

       ·   sp_inact - days after password expires that account is considered inactive and disabled

       ·   sp_expire - days since Jan 1, 1970 when account will be disabled

       ·   sp_flag - reserved for future use

 
       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   endspent                    。

            lckpwdf   ulckpwdf        /etc/shadow        。lckpwdf    pw_lock          15
          ,       spw_lock           15             。   15    ,      ,lckpwdf    
       -1。         ,   0。

DIAGNOSTICS
                       ,      NULL。   int            0     ,-1     。

CAVEATS
                    ,                。

 
       /etc/shadow
                   。

 
       getpwent(3), shadow(5).


                                                  SHADOW(3)