diff options
| author | Jelmer Vernooij <jelmer@samba.org> | 2005-12-08 15:37:39 +0100 | 
|---|---|---|
| committer | Jelmer Vernooij <jelmer@samba.org> | 2005-12-08 15:37:39 +0100 | 
| commit | 7989fcf34257201f54538f289cce1c651341e142 (patch) | |
| tree | 852c57b842878efdbf311f7e2bb713745963141f | |
| parent | a1f17d45fae99428c8024168b55b4279c59ac867 (diff) | |
Add check_pass function
| -rw-r--r-- | storage.h | 2 | ||||
| -rw-r--r-- | storage_text.c | 15 | 
2 files changed, 16 insertions, 1 deletions
| @@ -42,6 +42,8 @@ typedef struct {  	/* May be set to NULL if not required */  	void (*init) (void); +	storage_status_t (*check_pass) (const char *nick, const char *password); +  	storage_status_t (*load) (const char *nick, const char *password, irc_t * irc);  	storage_status_t (*save) (irc_t *irc, int overwrite);  	storage_status_t (*remove) (const char *nick, const char *password); diff --git a/storage_text.c b/storage_text.c index a244aed5..49a44fbe 100644 --- a/storage_text.c +++ b/storage_text.c @@ -263,7 +263,7 @@ static storage_status_t text_save( irc_t *irc, int overwrite )  	return STORAGE_OK;  } -static storage_status_t text_remove( const char *nick, const char *password ) +static storage_status_t text_check_pass( const char *nick, const char *password )  {  	char s[512];  	FILE *fp; @@ -278,6 +278,18 @@ static storage_status_t text_remove( const char *nick, const char *password )  	/*FIXME Test if password is correct */ +	return STORAGE_OK; +} + +static storage_status_t text_remove( const char *nick, const char *password ) +{ +	char s[512]; +	storage_status_t status; + +	status = text_check_pass( nick, password ); +	if (status != STORAGE_OK) +		return status; +  	g_snprintf( s, 511, "%s%s%s", global.conf->configdir, nick, ".accounts" );  	if (unlink( s ) == -1)  		return STORAGE_OTHER_ERROR; @@ -292,6 +304,7 @@ static storage_status_t text_remove( const char *nick, const char *password )  storage_t storage_text = {  	.name = "text",  	.init = text_init, +	.check_pass = text_check_pass,  	.remove = text_remove,  	.load = text_load,  	.save = text_save | 
