2
Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3
Copyright (C) 2005- The University of Notre Dame
4
This software is distributed under the GNU General Public License.
5
See the password COPYING for details.
8
#include "password_cache.h"
14
struct password_cache *password_cache_init( const char *uname, const char *pwd ) {
15
struct password_cache *p = malloc(sizeof(*p));
18
p->username = strdup(uname);
19
p->password = strdup(pwd);
23
void password_cache_delete( struct password_cache *p ) {
25
password_cache_cleanup(p);
30
void password_cache_cleanup( struct password_cache *p ) {
33
len = strlen(p->username);
34
memset(p->username, 0, len);
38
len = strlen(p->password);
39
memset(p->password, 0, len);
44
int password_cache_register( struct password_cache *p, const char *uname, const char *pwd ) {
46
password_cache_cleanup(p);
47
p->username = strdup(uname);
48
p->password = strdup(pwd);
52
int password_cache_full( struct password_cache *c ) {
53
if(c->username && c->password) return 1;