ESAPI-C 1.0
The OWASP Enterprise Security API for C
|
An Access Reference Map module implementation. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "access_ref.h"
Go to the source code of this file.
Functions | |
bool | _unique_keys (const char *k, const char *v) |
char * | esapi_get_indirect_reference (const char *direct) |
Returns the indirect object reference for the given direct object reference. | |
char * | esapi_get_direct_reference (const char *indirect) |
Returns the direct object reference (original value) for the given indirect object reference. | |
bool | esapi_remove_indirect_reference (const char *indirect) |
Removes the indirect object reference from the map. | |
bool | esapi_remove_direct_reference (const char *direct) |
Removes the direct object reference from the map. | |
bool | esapi_put_reference (const char *k, const char *v) |
Adds an entry to the map. | |
char * | esapi_get_unique_reference () |
Return a unique token string suitable for use as an indirect reference. | |
Variables | |
map_t * | v_map = NULL |
Value-to-key map. | |
map_t * | k_map = NULL |
Key-to-value map. | |
map_t * | s |
map_t * | f |
An Access Reference Map module implementation.
The reference implementation is based on 2 uthash hashmaps to support two-way lookups (direct-to-indirect and indirect-to-direct). The indirect reference generator produces random keys. A custom implementation might alternatively provide a generator for incrementing integer keys.
Definition in file access_ref.c.
char* esapi_get_direct_reference | ( | const char * | ) |
Returns the direct object reference (original value) for the given indirect object reference.
A | character array containing an indirect object reference |
Definition at line 64 of file access_ref.c.
char* esapi_get_indirect_reference | ( | const char * | ) |
Returns the indirect object reference for the given direct object reference.
A | character array containing a direct object reference |
Definition at line 50 of file access_ref.c.
char* esapi_get_unique_reference | ( | ) |
Return a unique token string suitable for use as an indirect reference.
Definition at line 131 of file access_ref.c.
References esapi_fill_random_token(), and KEY_LEN.
bool esapi_put_reference | ( | const char * | , |
const char * | |||
) |
Adds an entry to the map.
The indirect reference should be obtained by calling esapi_get_unique_reference().
A | character array containing an indirect object reference |
A | character array containing a direct object reference |
Definition at line 110 of file access_ref.c.
bool esapi_remove_direct_reference | ( | const char * | ) |
Removes the direct object reference from the map.
A | character array containing a direct object reference |
Definition at line 95 of file access_ref.c.
bool esapi_remove_indirect_reference | ( | const char * | ) |
Removes the indirect object reference from the map.
A | character array containing an indirect object reference |
Definition at line 78 of file access_ref.c.