Distributed Hash Table File System for Linux








acl.c File Reference

#include "magma.h"

Defines

#define INCLUDE_FLARE_INTERNALS
#define rate_rule(rule, value)

Functions

int magma_parse_acl_file (const char *filename)
int magma_save_acl_file (const char *filename)
magma_acl_tmagma_get_closest_acl (struct in_addr *s, const char *path, magma_acl_t *aclp, magma_acl_t *best, int prev_match)
int magma_validate_connection (struct in_addr *s, const char *share, const char *path, char optype)

Variables

char * acl_filename
magma_share_tshares
pthread_rwlock_t acl_rwlock

Define Documentation

#define INCLUDE_FLARE_INTERNALS

#define rate_rule ( rule,
value   ) 

Value:

if (rule->operations_allowed == 'n') value = 3;\
        else if (rule->operations_allowed == 'w') value = 2;\
        else value = 1;


Function Documentation

magma_acl_t* magma_get_closest_acl ( struct in_addr *  s,
const char *  path,
magma_acl_t aclp,
magma_acl_t best,
int  prev_match 
)

return best matching ACL for given set of data

Parameters:
s requesting IP address
path path requested
aclp pointer to current parsed ACL
best best matching rule found so far
prev_match depth of previus best match pointed by *best
Note:
Never use this function directly.
See also:
magma_validate_connection

int magma_parse_acl_file ( const char *  filename  ) 

parse a file formatted with ACL syntax and fill *shares list

Parameters:
filename path to ACL file

int magma_save_acl_file ( const char *  filename  ) 

save current ACL from memory to disk

Parameters:
filename the path to the file to save ACL in
Todo:
Still to be coded! (empty function)

int magma_validate_connection ( struct in_addr *  s,
const char *  share,
const char *  path,
char  optype 
)

validate incoming connection using ACLs

Parameters:
s requesting IP address
share the share this request belong to
path subpath requested (relative to *share)
optype operation requested, can be 'r' or 'w'
Returns:
true if valid, false otherwise


Variable Documentation

char* acl_filename

pthread_rwlock_t acl_rwlock

mutex for ACL linked list of shares

linked list head for magma exported shares

This file last modified Wednesday, 09-Jan-2008 20:02:42 CET