netatalk  4.4.0dev
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
acls.c File Reference
#include <errno.h>
#include <grp.h>
#include <pwd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <bstrlib.h>
#include <atalk/acl.h>
#include <atalk/adouble.h>
#include <atalk/afp.h>
#include <atalk/cnid.h>
#include <atalk/errchk.h>
#include <atalk/logger.h>
#include <atalk/netatalk_conf.h>
#include <atalk/unix.h>
#include <atalk/util.h>
#include <atalk/uuid.h>
#include <atalk/vfs.h>
#include "acl_mappings.h"
#include "acls.h"
#include "auth.h"
#include "desktop.h"
#include "directory.h"
#include "fork.h"
#include "unix.h"
#include "volume.h"

Macros

#define SOLARIS_2_DARWIN   1
#define DARWIN_2_SOLARIS   2
#define POSIX_DEFAULT_2_DARWIN   3
#define POSIX_ACCESS_2_DARWIN   4
#define DARWIN_2_POSIX_DEFAULT   5
#define DARWIN_2_POSIX_ACCESS   6
#define MAP_MASK   31
#define IS_DIR   32
#define HAS_DEFAULT_ACL   0x01
#define HAS_EXT_DEFAULT_ACL   0x02

Functions

static int map_acl (int type, void *acl, darwin_ace_t *buf, int ace_count)
static int get_and_map_acl (char *name, char *rbuf, size_t *rbuflen)
static int remove_acl (const struct vol *vol, const char *path, int dir)
static int check_acl_access (const AFPObj *obj, const struct vol *vol, struct dir *dir, const char *path, const uuidp_t uuid, uint32_t requested_rights)
int afp_access (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
int afp_getacl (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
int afp_setacl (AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf _U_, size_t *rbuflen)
int acltoownermode (const AFPObj *obj, const struct vol *vol, char *path, struct stat *st, struct maccess *ma)

Macro Definition Documentation

◆ DARWIN_2_POSIX_ACCESS

#define DARWIN_2_POSIX_ACCESS   6

◆ DARWIN_2_POSIX_DEFAULT

#define DARWIN_2_POSIX_DEFAULT   5

◆ DARWIN_2_SOLARIS

#define DARWIN_2_SOLARIS   2

◆ HAS_DEFAULT_ACL

#define HAS_DEFAULT_ACL   0x01

◆ HAS_EXT_DEFAULT_ACL

#define HAS_EXT_DEFAULT_ACL   0x02

◆ IS_DIR

#define IS_DIR   32

◆ MAP_MASK

#define MAP_MASK   31

◆ POSIX_ACCESS_2_DARWIN

#define POSIX_ACCESS_2_DARWIN   4

◆ POSIX_DEFAULT_2_DARWIN

#define POSIX_DEFAULT_2_DARWIN   3

◆ SOLARIS_2_DARWIN

#define SOLARIS_2_DARWIN   1

Function Documentation

◆ acltoownermode()

int acltoownermode ( const AFPObj * obj,
const struct vol * vol,
char * path,
struct stat * st,
struct maccess * ma )

map ACL to user maccess

This is the magic function that makes ACLs usable by calculating the access granted by ACEs to the logged in user.

◆ afp_access()

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

◆ afp_getacl()

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

◆ afp_setacl()

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

◆ check_acl_access()

int check_acl_access ( const AFPObj * obj,
const struct vol * vol,
struct dir * dir,
const char * path,
const uuidp_t uuid,
uint32_t requested_rights )
static

Checks if a given UUID has requested_rights(type darwin_ace_rights) for path.

Note: this gets called frequently and is a good place for optimizations !

Parameters
obj(r) AFP object
vol(r) volume
dir(rw) directory
path(r) path to filesystem object
uuid(r) UUID of user
requested_rights(r) requested Darwin ACE
Returns
AFP result code

◆ get_and_map_acl()

int get_and_map_acl ( char * name,
char * rbuf,
size_t * rbuflen )
static

◆ map_acl()

int map_acl ( int type,
void * acl,
darwin_ace_t * buf,
int ace_count )
static

◆ remove_acl()

int remove_acl ( const struct vol * vol,
const char * path,
int dir )
static