netatalk  4.4.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
afppasswd.c File Reference

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 PASSWD_ILLEGAL   '*'
#define FORMAT   ":****************:****************:********\n"
#define FORMAT_LEN   44
#define OPTIONS   "cafnu:p:w:"
#define UID_START   100
#define HEXPASSWDLEN   16
#define PASSWDLEN   8
#define unhex(x)

Functions

static void convert_passwd (char *buf, char *newpwd, const int keyfd)
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)
int main (int argc, char **argv)

Variables

static char buf [MAXPATHLEN+1]

Detailed Description

AFP user password utility.

format of the password file:

name:****************:****************:********
password last login date failed usage count
static void usage(char *)
Definition aecho.c:282
static int login(AFPObj *obj, struct passwd *pwd, void(*logout)(void), int expired)
Definition afpd/auth.c:263

***'s are illegal. they're just place holders for hex values. hex values that represent actual numbers are in network byte order.

last login date is currently a 4-byte number representing seconds since 1970 (UTC). there's enough space to extend it to 8 bytes.

the last two fields aren't currently used by the randnum uams.

root syntax: afppasswd [-c] [-a] [-p path] [-f] [username]
user syntax: afppasswd
Definition include/atalk/directory.h:81
static gcry_mpi_t p
Definition uams_dhx2_pam.c:39
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 an optional key file. we're a lot more trusting of this file.
Definition uams_randnum.c:134

Macro Definition Documentation

◆ DES_KEY_SZ

#define DES_KEY_SZ   8

◆ FORMAT

#define FORMAT   ":****************:****************:********\n"

◆ FORMAT_LEN

#define FORMAT_LEN   44

◆ HEXPASSWDLEN

#define HEXPASSWDLEN   16

◆ OPT_ADDUSER

#define OPT_ADDUSER   (1 << 3)

◆ OPT_CREATE

#define OPT_CREATE   (1 << 1)

◆ OPT_FORCE

#define OPT_FORCE   (1 << 2)

◆ OPT_ISROOT

#define OPT_ISROOT   (1 << 0)

◆ OPT_NOCRACK

#define OPT_NOCRACK   (1 << 4)

◆ OPTIONS

#define OPTIONS   "cafnu:p:w:"

◆ PASSWD_ILLEGAL

#define PASSWD_ILLEGAL   '*'

◆ PASSWDLEN

#define PASSWDLEN   8

◆ UID_START

#define UID_START   100

◆ unhex

#define unhex ( x)
Value:
(isdigit(x) ? (x) - '0' : toupper(x) + 10 - 'A')

Function Documentation

◆ convert_passwd()

void convert_passwd ( char * buf,
char * newpwd,
const int keyfd )
static

◆ create_file()

int create_file ( const char * path,
uid_t minuid )
static

◆ main()

int main ( int argc,
char ** argv )

◆ update_passwd()

int update_passwd ( const char * path,
const char * name,
int flags,
const char * pass )
static

Variable Documentation

◆ buf

char buf[MAXPATHLEN+1]
static