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

Manage the AppleDesktop folder and its contents. More...

#include <arpa/inet.h>
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <netatalk/at.h>
#include <bstrlib.h>
#include <atalk/adouble.h>
#include <atalk/afp.h>
#include <atalk/atp.h>
#include <atalk/asp.h>
#include <atalk/dsi.h>
#include <atalk/errchk.h>
#include <atalk/globals.h>
#include <atalk/logger.h>
#include <atalk/netatalk_conf.h>
#include <atalk/server_ipc.h>
#include <atalk/unix.h>
#include <atalk/util.h>
#include "ad_cache.h"
#include "desktop.h"
#include "dircache.h"
#include "directory.h"
#include "fork.h"
#include "mangle.h"
#include "volume.h"

Macros

#define EXEC_MODE   (S_IXGRP | S_IXUSR | S_IXOTH)
 
#define min(a, b)   ((a)<(b)?(a):(b))
 

Functions

int setdeskmode (const struct vol *vol, const mode_t mode)
 
int setdeskowner (const struct vol *vol, uid_t uid, gid_t gid)
 
static void create_appledesktop_folder (const struct vol *vol)
 
int afp_opendt (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_closedt (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
static char * icon_dtfile (struct vol *vol, uint8_t creator[4])
 
static int iconopen (struct vol *vol, uint8_t creator[4], int flags, int mode)
 
int afp_addicon (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_geticoninfo (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
int afp_geticon (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
char * dtfile (const struct vol *vol, uint8_t creator[], char *ext)
 
char * mtoupath (const struct vol *vol, char *mpath, cnid_t did, int utf8)
 
char * utompath (const struct vol *vol, char *upath, cnid_t id, int utf8)
 
static int ad_addcomment (const AFPObj *obj, struct vol *vol, struct path *path, char *ibuf)
 
int afp_addcomment (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
static int ad_getcomment (struct vol *vol, struct path *path, char *rbuf, size_t *rbuflen)
 
int afp_getcomment (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 
static int ad_rmvcomment (const AFPObj *obj, struct vol *vol, struct path *path)
 
int afp_rmvcomment (AFPObj *obj, char *ibuf, size_t ibuflen, char *rbuf, size_t *rbuflen)
 

Variables

static struct savedt si = { { 0, 0, 0, 0 }, -1, 0, 0 }
 
static const uint8_t utag [] = { 0, 0, 0, 0 }
 
static const uint8_t ucreator [] = { 0, 0, 0, 0 }
 
static const uint8_t utype [] = { 0, 0, 0, 0 }
 
static const short usize = 256
 
static const char hexdig [] = "0123456789abcdef"
 

Detailed Description

Manage the AppleDesktop folder and its contents.

Bug:
afp_XXXcomment are (the only) functions able to open a resource fork when there's no data fork, e.g. after it was removed with samba.

Macro Definition Documentation

◆ EXEC_MODE

#define EXEC_MODE   (S_IXGRP | S_IXUSR | S_IXOTH)

◆ min

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

Function Documentation

◆ ad_addcomment()

static int ad_addcomment ( const AFPObj obj,
struct vol vol,
struct path path,
char *  ibuf 
)
static

◆ ad_getcomment()

static int ad_getcomment ( struct vol vol,
struct path path,
char *  rbuf,
size_t *  rbuflen 
)
static

◆ ad_rmvcomment()

static int ad_rmvcomment ( const AFPObj obj,
struct vol vol,
struct path path 
)
static

◆ afp_addcomment()

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

◆ afp_addicon()

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

◆ afp_closedt()

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

◆ afp_getcomment()

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

◆ afp_geticon()

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

◆ afp_geticoninfo()

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

◆ afp_opendt()

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

◆ afp_rmvcomment()

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

◆ create_appledesktop_folder()

static void create_appledesktop_folder ( const struct vol vol)
static

◆ dtfile()

char * dtfile ( const struct vol vol,
uint8_t  creator[],
char *  ext 
)

◆ icon_dtfile()

static char * icon_dtfile ( struct vol vol,
uint8_t  creator[4] 
)
static

◆ iconopen()

static int iconopen ( struct vol vol,
uint8_t  creator[4],
int  flags,
int  mode 
)
static

◆ mtoupath()

char * mtoupath ( const struct vol vol,
char *  mpath,
cnid_t  did,
int  utf8 
)

◆ setdeskmode()

int setdeskmode ( const struct vol vol,
const mode_t  mode 
)

◆ setdeskowner()

int setdeskowner ( const struct vol vol,
uid_t  uid,
gid_t  gid 
)

◆ utompath()

char * utompath ( const struct vol vol,
char *  upath,
cnid_t  id,
int  utf8 
)

Variable Documentation

◆ hexdig

const char hexdig[] = "0123456789abcdef"
static

◆ si

struct savedt si = { { 0, 0, 0, 0 }, -1, 0, 0 }
static

◆ ucreator

const uint8_t ucreator[] = { 0, 0, 0, 0 }
static

◆ usize

const short usize = 256
static

◆ utag

const uint8_t utag[] = { 0, 0, 0, 0 }
static

◆ utype

const uint8_t utype[] = { 0, 0, 0, 0 }
static