home *** CD-ROM | disk | FTP | other *** search
/ Hacks & Cracks / Hacks_and_Cracks.iso / hackersclub / km / downloads / c_scripts / shadow.c < prev    next >
C/C++ Source or Header  |  1998-03-25  |  2KB  |  87 lines

  1.  /*  This source will/should print out SHADOWPW passwd files.   */
  2.  
  3.  struct  SHADOWPW {                 /* see getpwent(3) */
  4.       char *pw_name;
  5.       char *pw_passwd;
  6.       int  pw_uid;
  7.       int  pw_gid;
  8.       int  pw_quota;
  9.       char *pw_comment;
  10.       char *pw_gecos;
  11.       char *pw_dir;
  12.       char *pw_shell;
  13.  };
  14.  struct passwd *getpwent(), *getpwuid(), *getpwnam();
  15.  
  16.  #ifdef   elxsis?
  17.  
  18.  /* Name of the shadow password file. Contains password and aging info */
  19.  
  20.  #define  SHADOWPW "/etc/shadowpw"
  21.  #define  SHADOWPW_PAG "/etc/shadowpw.pag"
  22.  #define  SHADOWPW_DIR "/etc/shadowpw.dir"
  23.  /*
  24.   *  Shadow password file pwd->pw_gecos field contains:
  25.   *
  26.   *  <type>,<period>,<last_time>,<old_time>,<old_password>
  27.   *
  28.   *  <type>     = Type of password criteria to enforce (type int).
  29.   *        BSD_CRIT (0), normal BSD.
  30.   *        STR_CRIT (1), strong passwords.
  31.   *  <period>  = Password aging period (type long).
  32.   *        0, no aging.
  33.   *        else, number of seconds in aging period.
  34.   *  <last_time>     = Time (seconds from epoch) of the last password
  35.   *        change (type long).
  36.   *        0, never changed.n
  37.   *  <old_time>     = Time (seconds from epoch) that the current password
  38.   *        was made the <old_password> (type long).
  39.   *        0, never changed.ewromsinm
  40.   *  <old_password> = Password (encrypted) saved for an aging <period> to
  41.   *        prevent reuse during that period (type char [20]).
  42.   *        "*******", no <old_password>.
  43.   */
  44.  
  45.  /* number of tries to change an aged password */
  46.  
  47.  #define  CHANGE_TRIES 3
  48.  
  49.  /* program to execute to change passwords */
  50.  
  51.  #define  PASSWD_PROG "/bin/passwd"
  52.  
  53.  /* Name of the password aging exempt user names and max number of entires */
  54.  
  55.  #define  EXEMPTPW "/etc/exemptpw"
  56.  #define MAX_EXEMPT 100
  57.  
  58.  /* Password criteria to enforce */
  59.  
  60.  #define BSD_CRIT 0    /* Normal BSD password criteria */
  61.  #define STR_CRIT 1     /* Strong password criteria */
  62.  #define MAX_CRIT 1
  63.  #endif   elxsi
  64.  #define NULL 0
  65.  main()
  66.  {
  67.     struct passwd *p;
  68.     int i;
  69.     for (;1;) {;
  70.       p=getpwent();
  71.       if (p==NULL) return;
  72.       printpw(p);
  73.     }
  74.  }
  75.  
  76.  printpw(a)
  77.  struct SHADOWPW *a;
  78.  {
  79.     printf("%s:%s:%d:%d:%s:%s:%s\n",
  80.        a->pw_name,a->pw_passwd,a->pw_uid,a->pw_gid,
  81.        a->pw_gecos,a->pw_dir,a->pw_shell);
  82.  }
  83.  
  84.  /* SunOS 5.0        /etc/shadow */
  85.  /* SunOS4.1+c2     /etc/security/passwd.adjunct */
  86.  
  87.