netatalk  4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
enumerate.c File Reference
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/file.h>
#include <sys/param.h>
#include <bstrlib.h>
#include <atalk/adouble.h>
#include <atalk/afp.h>
#include <atalk/cnid.h>
#include <atalk/globals.h>
#include <atalk/logger.h>
#include <atalk/netatalk_conf.h>
#include <atalk/util.h>
#include <atalk/vfs.h>
#include "desktop.h"
#include "dircache.h"
#include "directory.h"
#include "file.h"
#include "filedir.h"
#include "fork.h"
#include "virtual_icon.h"
#include "volume.h"

Data Structures

struct  savedir
 Struct to save directory reading context in. More...
 

Macros

#define min(a, b)   ((a)<(b)?(a):(b))
 
#define SDBUFBRK   2048
 
#define REPLY_PARAM_MAXLEN   (4 + 104 + 1 + MACFILELEN + 4 + 2 + UTF8FILELEN_EARLY + 1)
 

Functions

static int enumerate_loop (struct dirent *de, char *mname, void *data)
 
char * check_dirent (const struct vol *vol, char *name)
 
int for_each_dirent (const struct vol *vol, char *name, dir_loop fn, void *data)
 
static int enumerate (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen, int ext)
 
int afp_enumerate (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_enumerate_ext (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_enumerate_ext2 (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 

Macro Definition Documentation

◆ min

#define min (   a,
 
)    ((a)<(b)?(a):(b))

◆ REPLY_PARAM_MAXLEN

#define REPLY_PARAM_MAXLEN   (4 + 104 + 1 + MACFILELEN + 4 + 2 + UTF8FILELEN_EARLY + 1)

This is the maximal length of a single entry for a file/dir in the reply block if all bits in the file/dir bitmap are set: header(4) + params(104) + macnamelength(1) + macname(31) + utf8(4) + utf8namelen(2) + utf8name(255) + oddpadding(1)

◆ SDBUFBRK

#define SDBUFBRK   2048

Function Documentation

◆ afp_enumerate()

int afp_enumerate ( AFPObj obj,
char *  ibuf,
size_t  ibuflen,
char *  rbuf,
size_t *  rbuflen 
)

◆ afp_enumerate_ext()

int afp_enumerate_ext ( AFPObj obj,
char *  ibuf,
size_t  ibuflen,
char *  rbuf,
size_t *  rbuflen 
)

◆ afp_enumerate_ext2()

int afp_enumerate_ext2 ( AFPObj obj,
char *  ibuf,
size_t  ibuflen,
char *  rbuf,
size_t *  rbuflen 
)

◆ check_dirent()

char * check_dirent ( const struct vol vol,
char *  name 
)
Bug:
Doesn't work with dangling symlink i.e.:
  • Move a folder with a dangling symlink in the trash
  • empty the trash

afp_enumerate return an empty listing but offspring count != 0 in afp_getdirparams and the client doesn't try to call afp_delete!

See also
https://sourceforge.net/p/netatalk/bugs/97/

◆ enumerate()

static int enumerate ( AFPObj obj,
char *  ibuf,
size_t  ibuflen,
char *  rbuf,
size_t *  rbuflen,
int  ext 
)
static

◆ enumerate_loop()

static int enumerate_loop ( struct dirent *  de,
char *  mname,
void *  data 
)
static

◆ for_each_dirent()

int for_each_dirent ( const struct vol vol,
char *  name,
dir_loop  fn,
void *  data 
)