AFP user password utility. More...
#include <arpa/inet.h>#include <ctype.h>#include <errno.h>#include <fcntl.h>#include <pwd.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/param.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>#include <gcrypt.h>#include <atalk/compat.h>#include <crack.h>Macros | |
| #define | DES_KEY_SZ 8 |
| #define | OPT_ISROOT (1 << 0) |
| #define | OPT_CREATE (1 << 1) |
| #define | OPT_FORCE (1 << 2) |
| #define | OPT_ADDUSER (1 << 3) |
| #define | OPT_NOCRACK (1 << 4) |
| #define | OPT_RANDNUM (1 << 5) |
| #define | PASSWD_ILLEGAL '*' |
| #define | FORMAT ":****************:****************:********\n" |
| #define | FORMAT_LEN 44 |
| #define | SRP_SALT_LEN 16 |
| #define | SRP_NBYTES 192 /* 1536-bit prime */ |
| #define | SRP_HEX_SALT_LEN (SRP_SALT_LEN * 2) |
| #define | SRP_HEX_V_LEN (SRP_NBYTES * 2) |
| #define | SRP_FORMAT_LEN (1 + SRP_HEX_SALT_LEN + 1 + SRP_HEX_V_LEN + 1) |
| #define | SRP_SHA1_LEN 20 |
| #define | SRP_PASSWDLEN 255 |
| #define | USERNAME_MAX_LEN 255 |
| #define | UID_START 100 |
| #define | HEXPASSWDLEN 16 |
| #define | PASSWDLEN 8 |
Functions | |
| static int | unhex (unsigned char x) |
| static int | randnum_make_keypath (const char *path, char *keypath, size_t keypath_size) |
| static int | randnum_read_keyfd (int keyfd, uint8_t key[DES_KEY_SZ], const char *keypath) |
| static int | randnum_open_keyfile (const char *path, int *keyfd_out) |
| static int | randnum_write_keyfile (const char *keypath) |
| static int | randnum_ensure_keyfile (const char *path, int flags) |
| static int | convert_passwd (char *passwd_buf, char *newpwd, const int keyfd) |
| static int | srp_compute_verifier (const char *username, const char *password, const unsigned char *salt, unsigned char *v_out) |
| static void | srp_encode_hex (char *out_hex, const unsigned char *salt, const unsigned char *verifier) |
| static int | update_srp_passwd (const char *path, const char *name, int flags, const char *pass) |
| static int | create_srp_file (const char *path, uid_t minuid) |
| static int | update_passwd (const char *path, const char *name, int flags, const char *pass) |
| static int | create_file (const char *path, uid_t minuid) |
| static void | print_usage (void) |
| int | main (int argc, char **argv) |
Variables | |
| static const unsigned char | srp_N_bytes [SRP_NBYTES] |
| static char | buf [MAXPATHLEN+1] |
| static const unsigned char | hextable [] = "0123456789ABCDEF" |
AFP user password utility.
Supports two modes:
SRP mode (default): Manages SRP verifier file for use with the SRP UAM. Format: username:hex_salt(32):hex_verifier(384)
RandNum mode (-r flag): Manages legacy password file for use with the RandNum UAM. Format: username:hex_password(16):last_login(16):fail_count(8)
| #define DES_KEY_SZ 8 |
| #define FORMAT ":****************:****************:********\n" |
| #define FORMAT_LEN 44 |
| #define HEXPASSWDLEN 16 |
| #define OPT_ADDUSER (1 << 3) |
| #define OPT_CREATE (1 << 1) |
| #define OPT_FORCE (1 << 2) |
| #define OPT_ISROOT (1 << 0) |
| #define OPT_NOCRACK (1 << 4) |
| #define OPT_RANDNUM (1 << 5) |
| #define PASSWD_ILLEGAL '*' |
| #define PASSWDLEN 8 |
| #define SRP_FORMAT_LEN (1 + SRP_HEX_SALT_LEN + 1 + SRP_HEX_V_LEN + 1) |
| #define SRP_HEX_SALT_LEN (SRP_SALT_LEN * 2) |
| #define SRP_HEX_V_LEN (SRP_NBYTES * 2) |
| #define SRP_NBYTES 192 /* 1536-bit prime */ |
| #define SRP_PASSWDLEN 255 |
| #define SRP_SALT_LEN 16 |
| #define SRP_SHA1_LEN 20 |
| #define UID_START 100 |
| #define USERNAME_MAX_LEN 255 |
|
static |
|
static |
|
static |
| int main | ( | int | argc, |
| char ** | argv ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |