netatalk  4.6.1
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
test_afppasswd.c File Reference
#include <fcntl.h>
#include <pwd.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "../../bin/afppasswd/afppasswd.c"

Macros

#define fstat   test_fstat
 
#define fchown   test_fchown
 
#define fchmod   test_fchmod
 
#define fcntl   test_fcntl
 
#define fsync   test_fsync
 
#define setpwent   test_setpwent
 
#define getpwent   test_getpwent
 
#define endpwent   test_endpwent
 
#define main   afppasswd_program_main
 

Functions

const char * tmpdir (void)
 Find a suitable temporary directory for Netatalk.
 
static int test_fstat (int fd, struct stat *st)
 
static int test_fchown (int fd, uid_t owner, gid_t group)
 
static int test_fchmod (int fd, mode_t mode)
 
static int test_fcntl (int fd, int cmd,...)
 
static int test_fsync (int fd)
 
static void test_setpwent (void)
 
static struct passwd * test_getpwent (void)
 
static void test_endpwent (void)
 
static int is_mock_verifier (int fd)
 
static void report (int passed, const char *name)
 
static int write_file (const char *path, const char *contents)
 
static int make_case (char directory[MAXPATHLEN+1])
 
static void test_rejected_verifier_does_not_change_metadata (void)
 
static void test_verifier_permissions (void)
 
static void test_single_record_updates (void)
 
static void test_enrollment_ownership (void)
 
static void test_unenrolled_user_message (void)
 
static void test_shared_srp_validation (void)
 
static void test_minimum_uid_parser (void)
 
static void test_disable_option_argument (void)
 

Variables

static struct stat verifier_directory
 
static int mock_directory_owner
 
static const char * mock_verifier_path
 
static uid_t mock_verifier_owner
 
static int fail_verifier_sync
 
static int fail_verifier_chown
 
static int fail_verifier_chmod
 
static int fail_verifier_lock
 
static int verifier_syncs
 
static int enrollment_before_sync
 
static struct passwd * mock_passwd
 
static int passwd_returned
 
static int tests_run
 
static int tests_failed
 

Macro Definition Documentation

◆ endpwent

#define endpwent   test_endpwent

◆ fchmod

#define fchmod   test_fchmod

◆ fchown

#define fchown   test_fchown

◆ fcntl

#define fcntl   test_fcntl

◆ fstat

#define fstat   test_fstat

◆ fsync

#define fsync   test_fsync

◆ getpwent

#define getpwent   test_getpwent

◆ main

int main (   void)    afppasswd_program_main

◆ setpwent

#define setpwent   test_setpwent

Function Documentation

◆ is_mock_verifier()

static int is_mock_verifier ( int  fd)
static

◆ make_case()

static int make_case ( char  directory[MAXPATHLEN+1])
static

◆ report()

static void report ( int  passed,
const char *  name 
)
static

◆ test_disable_option_argument()

static void test_disable_option_argument ( void  )
static

◆ test_endpwent()

static void test_endpwent ( void  )
static

◆ test_enrollment_ownership()

static void test_enrollment_ownership ( void  )
static

◆ test_fchmod()

static int test_fchmod ( int  fd,
mode_t  mode 
)
static

◆ test_fchown()

static int test_fchown ( int  fd,
uid_t  owner,
gid_t  group 
)
static

◆ test_fcntl()

static int test_fcntl ( int  fd,
int  cmd,
  ... 
)
static

◆ test_fstat()

static int test_fstat ( int  fd,
struct stat *  st 
)
static

◆ test_fsync()

static int test_fsync ( int  fd)
static

◆ test_getpwent()

static struct passwd * test_getpwent ( void  )
static

◆ test_minimum_uid_parser()

static void test_minimum_uid_parser ( void  )
static

◆ test_rejected_verifier_does_not_change_metadata()

static void test_rejected_verifier_does_not_change_metadata ( void  )
static

◆ test_setpwent()

static void test_setpwent ( void  )
static

◆ test_shared_srp_validation()

static void test_shared_srp_validation ( void  )
static

◆ test_single_record_updates()

static void test_single_record_updates ( void  )
static

◆ test_unenrolled_user_message()

static void test_unenrolled_user_message ( void  )
static

◆ test_verifier_permissions()

static void test_verifier_permissions ( void  )
static

◆ tmpdir()

const char * tmpdir ( void  )
extern

Find a suitable temporary directory for Netatalk.

Creates a subdirectory for current gid if it doesn't exist. The result should be copied immediately as it may be overwritten by a subsequent call.

◆ write_file()

static int write_file ( const char *  path,
const char *  contents 
)
static

Variable Documentation

◆ enrollment_before_sync

int enrollment_before_sync
static

◆ fail_verifier_chmod

int fail_verifier_chmod
static

◆ fail_verifier_chown

int fail_verifier_chown
static

◆ fail_verifier_lock

int fail_verifier_lock
static

◆ fail_verifier_sync

int fail_verifier_sync
static

◆ mock_directory_owner

int mock_directory_owner
static

◆ mock_passwd

struct passwd* mock_passwd
static

◆ mock_verifier_owner

uid_t mock_verifier_owner
static

◆ mock_verifier_path

const char* mock_verifier_path
static

◆ passwd_returned

int passwd_returned
static

◆ tests_failed

int tests_failed
static

◆ tests_run

int tests_run
static

◆ verifier_directory

struct stat verifier_directory
static

◆ verifier_syncs

int verifier_syncs
static