paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Functions
acl.c File Reference

Access control lists for paraslash senders. More...

#include <netinet/in.h>
#include <sys/socket.h>
#include <regex.h>
#include <arpa/inet.h>
#include <sys/un.h>
#include <netdb.h>
#include "para.h"
#include "error.h"
#include "string.h"
#include "list.h"
#include "net.h"
#include "acl.h"

Functions

void acl_add_entry (struct list_head *acl, char *addr, int netmask)
 Add an entry to an access control list. More...
 
char * acl_get_contents (struct list_head *acl)
 Compute a string containing the contents of an acl. More...
 
int acl_check_access (int fd, struct list_head *acl, int default_deny)
 Check whether the peer name of a given fd is allowed by an acl. More...
 
void acl_allow (char *addr, int netmask, struct list_head *acl, int default_deny)
 Permit access for a range of IP addresses. More...
 
void acl_deny (char *addr, int netmask, struct list_head *acl, int default_deny)
 Deny access for a range of IP addresses. More...
 

Detailed Description

Access control lists for paraslash senders.

Function Documentation

◆ acl_add_entry()

void acl_add_entry ( struct list_head acl,
char *  addr,
int  netmask 
)

Add an entry to an access control list.

Parameters
aclThe access control list.
addrThe address to add.
netmaskThe netmask to use for this entry.

References alloc(), and PARA_INFO_LOG.

Referenced by acl_allow().

◆ acl_get_contents()

char* acl_get_contents ( struct list_head acl)

Compute a string containing the contents of an acl.

Parameters
aclThe access control list.
Returns
A string containing the contents of acl, or NULL if acl is empty.

References list_for_each_entry_safe, and make_message().

Referenced by generic_sender_status().

◆ acl_check_access()

int acl_check_access ( int  fd,
struct list_head acl,
int  default_deny 
)

Check whether the peer name of a given fd is allowed by an acl.

Parameters
fdFile descriptor.
aclThe access control list.
default_denyWhether acl is a whitelist.
Returns
Positive if the peer of fd is permitted by acl, -E_ACL_PERM otherwise.

Referenced by accept_sender_client().

◆ acl_allow()

void acl_allow ( char *  addr,
int  netmask,
struct list_head acl,
int  default_deny 
)

Permit access for a range of IP addresses.

Parameters
addrThe address to permit.
netmaskThe netmask of the entry to be permitted.
aclThe access control list.
default_denyWhether acl is a whitelist.

References acl_add_entry().

Referenced by acl_deny(), generic_acl_deplete(), and generic_com_allow().

◆ acl_deny()

void acl_deny ( char *  addr,
int  netmask,
struct list_head acl,
int  default_deny 
)

Deny access for a range of IP addresses.

Parameters
addrThe address to deny.
netmaskThe netmask of the entry to be denied.
aclThe access control list.
default_denyWhether acl is a whitelist.

References acl_allow().

Referenced by generic_com_deny().