aruu

[MIRROR] Actual replacement for Busybox | suckless
git clone https://git.daat.foo/aruu.git
Log | Files | Refs | README | LICENSE

passwd.h (1034B)


      1 /* see LICENSE file for copyright and license details */
      2 #ifndef ARUU_PASSWD_H
      3 #define ARUU_PASSWD_H
      4 
      5 #include <pwd.h>
      6 #include <sys/types.h>
      7 
      8 struct pwdb_entry {
      9   char *name;
     10   char *hash;
     11   uid_t uid;
     12   gid_t gid;
     13 };
     14 
     15 int pw_init(void);
     16 int pw_check(const struct passwd *pw, const char *pass);
     17 int pwdb_lookup(struct pwdb_entry *ent, const char *name);
     18 
     19 #define PW_SALT_MAX 64
     20 int pw_gensalt(char *salt, size_t salt_sz);
     21 int pw_gensalt_cipher(char *salt, size_t salt_sz, const char *prefix, size_t rand_len);
     22 int pwdb_update(const char *name, const char *newhash);
     23 int pw_update_file(const char *path, const char *name, const char *newhash);
     24 int pw_update_master(const char *name, const char *newhash);
     25 
     26 /* a backend per system: where the hash is when the passwd entry holds x.
     27  * pw_shadow_hash returns null with errno 0 when there is no entry;
     28  * pw_shadow_update returns 1 when the hash belongs in the passwd file */
     29 char *pw_shadow_hash(const char *name);
     30 int   pw_shadow_update(const char *name, const char *newhash);
     31 
     32 #endif