55 |
static void |
static void |
56 |
release_data (struct secret_data_s * data) |
release_data (struct secret_data_s * data) |
57 |
{ |
{ |
58 |
free( data ); |
free (data); |
59 |
} |
} |
60 |
|
|
61 |
|
|
62 |
static void |
static void |
63 |
wipe_data (void * data, size_t dlen) |
wipe_data (void * data, size_t dlen) |
64 |
{ |
{ |
65 |
memset( data, 0xff, dlen ); |
memset (data, 0xff, dlen); |
66 |
memset( data, 0xaa, dlen ); |
memset (data, 0xaa, dlen); |
67 |
memset( data, 0x55, dlen ); |
memset (data, 0x55, dlen); |
68 |
memset( data, 0x00, dlen ); |
memset (data, 0x00, dlen); |
69 |
} |
} |
70 |
|
|
71 |
|
|
72 |
static struct secret_data_s * |
static struct secret_data_s * |
73 |
new_data( const void * data, size_t length ) |
new_data (const void * data, size_t length) |
74 |
{ |
{ |
75 |
struct secret_data_s * d; |
struct secret_data_s * d; |
76 |
int total; |
int total; |
148 |
|
|
149 |
|
|
150 |
void |
void |
151 |
agent_flush_cache( void ) |
agent_flush_cache (void) |
152 |
{ |
{ |
153 |
ITEM r; |
ITEM r; |
154 |
|
|
155 |
for( r=thecache; r; r = r->next ) { |
for (r=thecache; r; r = r->next) { |
156 |
if( !r->lockcount && r->pw ) { |
if( !r->lockcount && r->pw ) { |
157 |
wipe_data( r->pw, r->pwlen ); |
wipe_data (r->pw, r->pwlen); |
158 |
release_data( r->pw ); |
release_data (r->pw); |
159 |
r->pw = NULL; |
r->pw = NULL; |
160 |
r->accessed = 0; |
r->accessed = 0; |
161 |
} |
} |
162 |
else if( r->lockcount && r->pw ) { |
else if (r->lockcount && r->pw) { |
163 |
r->accessed = 0; |
r->accessed = 0; |
164 |
r->ttl = 0; |
r->ttl = 0; |
165 |
} |
} |
245 |
|
|
246 |
/* Try to find an item in the cache */ |
/* Try to find an item in the cache */ |
247 |
const char * |
const char * |
248 |
agent_get_cache( const char * key, void ** cache_id ) |
agent_get_cache (const char *key, void **cache_id) |
249 |
{ |
{ |
250 |
ITEM r; |
ITEM r; |
251 |
|
|