CWB
Data Structures | Typedefs | Functions | Variables
auth.c File Reference
#include "auth.h"
#include <arpa/inet.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include "../cl/macros.h"

Data Structures

struct  _Grant
 Internal data structure: name of a corpus to which access is granted. More...
 
struct  _UserEntry
 Internal data structure: a username, the user's password, and the top of a linked list of Grants. More...
 
struct  _HostEntry
 Internal data structure: member of list of IP addresses from which messages are accepted. More...
 

Typedefs

typedef struct _Grant Grant
 Internal data structure: name of a corpus to which access is granted. More...
 
typedef struct _UserEntry UserEntry
 Internal data structure: a username, the user's password, and the top of a linked list of Grants. More...
 
typedef struct _HostEntry HostEntry
 Internal data structure: member of list of IP addresses from which messages are accepted. More...
 

Functions

UserEntryfind_user (char *username)
 Finds an entry the user with the specified username on the global user list. More...
 
void add_user_to_list (char *user, char *passwd)
 
void add_grant_to_last_user (char *corpus)
 
void add_host_to_list (char *ipaddr)
 
void add_hosts_in_subnet_to_list (char *ipsubnet)
 
int check_host (struct in_addr host_addr)
 returns true if host is in list of allowed hosts More...
 
int authenticate_user (char *username, char *passwd)
 returns true if (user, passwd) pair is in list of allowed users More...
 
int check_grant (char *username, char *corpus)
 returns true if user may access corpus More...
 
void show_grants (void)
 for debugging only More...
 

Variables

UserEntryauthorized_users = NULL
 global variable for user list More...
 
HostEntryauthorized_hosts = NULL
 global variable for host list More...
 

Typedef Documentation

typedef struct _Grant Grant

Internal data structure: name of a corpus to which access is granted.

typedef struct _HostEntry HostEntry

Internal data structure: member of list of IP addresses from which messages are accepted.

typedef struct _UserEntry UserEntry

Internal data structure: a username, the user's password, and the top of a linked list of Grants.

Function Documentation

void add_grant_to_last_user ( char *  corpus)
void add_host_to_list ( char *  ipaddr)
void add_hosts_in_subnet_to_list ( char *  ipsubnet)
void add_user_to_list ( char *  user,
char *  passwd 
)

Referenced by main().

int authenticate_user ( char *  username,
char *  passwd 
)

returns true if (user, passwd) pair is in list of allowed users

Referenced by main().

int check_grant ( char *  username,
char *  corpus 
)

returns true if user may access corpus

Referenced by main().

int check_host ( struct in_addr  host_addr)

returns true if host is in list of allowed hosts

Referenced by accept_connection().

UserEntry* find_user ( char *  username)

Finds an entry the user with the specified username on the global user list.

See also
authorized_users

References authorized_users, _UserEntry::name, _UserEntry::next, and user.

Referenced by add_user_to_list(), authenticate_user(), and check_grant().

void show_grants ( void  )

for debugging only

Variable Documentation

HostEntry* authorized_hosts = NULL

global variable for host list

Referenced by add_host_to_list().

UserEntry* authorized_users = NULL

global variable for user list

Referenced by add_user_to_list(), and find_user().