#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 <unistd.h>#include <crack.h>#include <gcrypt.h>#include <atalk/logger.h>#include <atalk/afp.h>#include <atalk/uam.h>#include <atalk/constant_time.h>Macros | |
| #define | DES_KEY_SZ 8 |
| #define | PASSWDLEN 8 |
| #define | randhash(a) |
| #define | PASSWD_ILLEGAL '*' |
| #define | HEXPASSWDLEN (DES_KEY_SZ * 2) |
Functions | |
| static int | unhex (unsigned char x) |
| static int | randnum_cipher_check (const char *opop, gcry_error_t err) |
| static int | afppasswd_open_keyfile (const char *path, const int pathlen) |
| static int | afppasswd_read_keyfile (int keyfd, uint8_t key[DES_KEY_SZ]) |
| static void | randnum_warn_passwdfile_key (void *obj) |
| static int | afppasswd (const struct passwd *pwd, const char *path, const int pathlen, unsigned char *passwd, int len, const int set) |
| handle /path/afppasswd with a required key file. we're a lot more trusting of this file. | |
| static int | randpass (const struct passwd *pwd, const char *file, unsigned char *passwd, const int len, const int set) |
| this sets the uid. | |
| static int | rand_login (void *obj, char *username, int ulen, struct passwd **uam_pwd, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| static int | randnum_logincont (void *obj, struct passwd **uam_pwd, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| check encrypted reply. | |
| static int | rand2num_logincont (void *obj, struct passwd **uam_pwd, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| static int | randnum_changepw (void *obj, const char *username, struct passwd *pwd, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| change password | |
| static int | randnum_login (void *obj, struct passwd **uam_pwd, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| static int | randnum_login_ext (void *obj, char *uname, struct passwd **uam_pwd, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen) |
| static int | uam_setup (void *obj, const char *path) |
| static void | uam_cleanup (void) |
Variables | |
| static unsigned char | seskey [8] |
| static struct passwd * | randpwd |
| static uint8_t | randbuf [8] |
| UAM_MODULE_EXPORT struct uam_export | uams_randnum |
| #define DES_KEY_SZ 8 |
| #define HEXPASSWDLEN (DES_KEY_SZ * 2) |
| #define PASSWD_ILLEGAL '*' |
| #define PASSWDLEN 8 |
| #define randhash | ( | a | ) |
hash to a 16-bit number. this will generate completely harmless warnings on 64-bit machines.
|
static |
handle /path/afppasswd with a required key file. we're a lot more trusting of this file.
here are the formats:
password is just the hex equivalent of the DES encrypted password.
|
static |
|
static |
|
static |
differences from randnum:
|
static |
randnum sends an 8-byte number and uses the user's password to check against the encrypted reply.
|
static |
change password
|
static |
|
static |
randnum login
|
static |
randnum login ext
|
static |
check encrypted reply.
|
static |
|
static |
this sets the uid.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| UAM_MODULE_EXPORT struct uam_export uams_randnum |