netatalk  4.6.1
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
test.c File Reference
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
#include <atalk/adouble.h>
#include <atalk/cnid.h>
#include <atalk/directory.h>
#include <atalk/dsi.h>
#include <atalk/globals.h>
#include <atalk/logger.h>
#include <atalk/netatalk_conf.h>
#include <atalk/queue.h>
#include <atalk/unicode.h>
#include <atalk/util.h>
#include <atalk/volume.h>
#include <talloc.h>
#include <atalk/dalloc.h>
#include <atalk/spotlight.h>
#include "etc/spotlight/spotlight_private.h"
#include "afp_config.h"
#include "afpfunc_helpers.h"
#include "dircache.h"
#include "directory.h"
#include "file.h"
#include "filedir.h"
#include "fork.h"
#include "hash.h"
#include "subtests.h"
#include "subtests_cnid.h"
#include "subtests_conf.h"
#include "subtests_lock.h"
#include "subtests_pfd.h"
#include "subtests_veto.h"
#include "subtests_atp.h"
#include "test.h"
#include "test_capabilities.h"
#include "volume.h"

Data Structures

struct  guarded_adouble
 

Functions

static int utest_decompose_reserves_terminator (void)
 
static int utest_fork_range_rejects_wrapped_read (void)
 
static int utest_ad_copy_header_valid_finderinfo (void)
 
static int utest_ad_copy_header_bounds_finderinfo (void)
 
static int utest_ad_copy_header_rejects_before_writing (void)
 A rejected entry leaves every earlier entry of the destination intact.
 
static int utest_ad_copy_header_skips_dfork (void)
 
static uint64_t spotlight_test_get_le64 (const char *buf, size_t offset)
 
static int utest_spotlight_rejects_empty_long_cnids (void)
 
static int utest_spotlight_cnid_array_types (void)
 
static void dsi_test_header (uint8_t *block, uint8_t command, uint16_t request_id, uint32_t code_or_doff, uint32_t len)
 
static int dsi_test_receive (uint8_t command, uint32_t code_or_doff, uint32_t len, const uint8_t *payload, size_t payload_len, uint32_t quantum, DSI *dsi)
 
static void dsi_test_cleanup (DSI *dsi)
 
static int utest_dsi_receive_accepts_full_quantum_write (uint32_t doff)
 
static int utest_dsi_receive_rejects_overquantum_write (uint32_t doff)
 
static int utest_dsi_receive_validates_doff (void)
 
static int utest_dsi_align_quantum (void)
 
static int utest_readbuf_clamp (void)
 
static int utest_dsi_writeinit_no_duplicate_copy (void)
 
static int utest_dsi_receive_rejects_overquantum_cmd (void)
 
static int utest_dsi_receive_rejects_zero_length_cmd (void)
 
static int utest_dsi_receive_valid_cmd (void)
 
static int utest_dsi_receive_rejects_oversized_payload (void)
 
static int utest_dsi_receive_rejects_write_offset_past_payload (void)
 
int main (int argc, char *argv[])
 

Variables

unsigned char nologin = 0
 
static AFPObj obj
 
static AFPObj aspobj
 
static char confpath [MAXPATHLEN+1]
 
static char * args [] = {"test", "-F", confpath}
 
int test_output_tap = 0
 
int test_case_num = 0
 
FILE * test_report_stream = NULL
 

Function Documentation

◆ dsi_test_cleanup()

static void dsi_test_cleanup ( DSI *  dsi)
static

◆ dsi_test_header()

static void dsi_test_header ( uint8_t *  block,
uint8_t  command,
uint16_t  request_id,
uint32_t  code_or_doff,
uint32_t  len 
)
static

◆ dsi_test_receive()

static int dsi_test_receive ( uint8_t  command,
uint32_t  code_or_doff,
uint32_t  len,
const uint8_t *  payload,
size_t  payload_len,
uint32_t  quantum,
DSI *  dsi 
)
static

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ spotlight_test_get_le64()

static uint64_t spotlight_test_get_le64 ( const char *  buf,
size_t  offset 
)
static

◆ utest_ad_copy_header_bounds_finderinfo()

static int utest_ad_copy_header_bounds_finderinfo ( void  )
static

◆ utest_ad_copy_header_rejects_before_writing()

static int utest_ad_copy_header_rejects_before_writing ( void  )
static

A rejected entry leaves every earlier entry of the destination intact.

ADEID_NAME precedes ADEID_FINDERI, so the name is what a per-entry copy would already have committed when the oversized FinderInfo is refused.

◆ utest_ad_copy_header_skips_dfork()

static int utest_ad_copy_header_skips_dfork ( void  )
static

◆ utest_ad_copy_header_valid_finderinfo()

static int utest_ad_copy_header_valid_finderinfo ( void  )
static

◆ utest_decompose_reserves_terminator()

static int utest_decompose_reserves_terminator ( void  )
static

◆ utest_dsi_align_quantum()

static int utest_dsi_align_quantum ( void  )
static

◆ utest_dsi_receive_accepts_full_quantum_write()

static int utest_dsi_receive_accepts_full_quantum_write ( uint32_t  doff)
static

◆ utest_dsi_receive_rejects_overquantum_cmd()

static int utest_dsi_receive_rejects_overquantum_cmd ( void  )
static

◆ utest_dsi_receive_rejects_overquantum_write()

static int utest_dsi_receive_rejects_overquantum_write ( uint32_t  doff)
static

◆ utest_dsi_receive_rejects_oversized_payload()

static int utest_dsi_receive_rejects_oversized_payload ( void  )
static

◆ utest_dsi_receive_rejects_write_offset_past_payload()

static int utest_dsi_receive_rejects_write_offset_past_payload ( void  )
static

◆ utest_dsi_receive_rejects_zero_length_cmd()

static int utest_dsi_receive_rejects_zero_length_cmd ( void  )
static

◆ utest_dsi_receive_valid_cmd()

static int utest_dsi_receive_valid_cmd ( void  )
static

◆ utest_dsi_receive_validates_doff()

static int utest_dsi_receive_validates_doff ( void  )
static

◆ utest_dsi_writeinit_no_duplicate_copy()

static int utest_dsi_writeinit_no_duplicate_copy ( void  )
static

◆ utest_fork_range_rejects_wrapped_read()

static int utest_fork_range_rejects_wrapped_read ( void  )
static

◆ utest_readbuf_clamp()

static int utest_readbuf_clamp ( void  )
static

◆ utest_spotlight_cnid_array_types()

static int utest_spotlight_cnid_array_types ( void  )
static

◆ utest_spotlight_rejects_empty_long_cnids()

static int utest_spotlight_rejects_empty_long_cnids ( void  )
static

Variable Documentation

◆ args

char* args[] = {"test", "-F", confpath}
static

◆ aspobj

AFPObj aspobj
static

◆ confpath

char confpath[MAXPATHLEN+1]
static

◆ nologin

unsigned char nologin = 0

◆ obj

AFPObj obj
static

◆ test_case_num

int test_case_num = 0

◆ test_output_tap

int test_output_tap = 0

◆ test_report_stream

FILE* test_report_stream = NULL