gwenhywfar 5.14.1
passwdstore.c File Reference
#include "passwdstore_p.h"
#include "i18n_l.h"
#include <gwenhywfar/gui.h>
#include <gwenhywfar/db.h>
#include <gwenhywfar/directory.h>
#include <gwenhywfar/fslock.h>
#include <gwenhywfar/mdigest.h>
#include <gwenhywfar/text.h>
#include <gwenhywfar/debug.h>
#include <gwenhywfar/smalltresor.h>
#include <errno.h>
Include dependency graph for passwdstore.c:

Go to the source code of this file.

Functions

static int GWEN_PasswordStore__GetPassword (GWEN_PASSWD_STORE *sto, const char *token, char *buffer, int minLen, int maxLen)
static int GWEN_PasswordStore__SetPassword (GWEN_PASSWD_STORE *sto, const char *token, const char *secret)
static int GWEN_PasswordStore_CheckDigest (const uint8_t *t, uint32_t size, const uint8_t *h)
void GWEN_PasswordStore_ClearStoragePasswd (GWEN_PASSWD_STORE *sto)
static int GWEN_PasswordStore_Digest (const uint8_t *t, uint32_t size, GWEN_BUFFER *buf)
static int GWEN_PasswordStore_EncryptWriteFile (GWEN_PASSWD_STORE *sto, const uint8_t *sec, uint32_t len)
void GWEN_PasswordStore_free (GWEN_PASSWD_STORE *sto)
int GWEN_PasswordStore_GetPassword (GWEN_PASSWD_STORE *sto, const char *token, char *buffer, int minLen, int maxLen)
int GWEN_PasswordStore_GetTokenList (GWEN_PASSWD_STORE *sto, GWEN_STRINGLIST *sl)
GWEN_PASSWD_STOREGWEN_PasswordStore_new (const char *fname)
static int GWEN_PasswordStore_ReadDecryptFile (GWEN_PASSWD_STORE *sto, GWEN_BUFFER *secbuf)
static int GWEN_PasswordStore_ReadFile (GWEN_PASSWD_STORE *sto)
static void GWEN_PasswordStore_SafeFreeDb (GWEN_PASSWD_STORE *sto)
int GWEN_PasswordStore_SetPassword (GWEN_PASSWD_STORE *sto, const char *token, const char *secret)
static int GWEN_PasswordStore_WriteFile (GWEN_PASSWD_STORE *sto)
static int readFile (const char *fname, GWEN_BUFFER *dbuf)
static int writeFile (const char *fname, const char *p, int len)
static int writeToFile (FILE *f, const char *p, int len)

Function Documentation

◆ GWEN_PasswordStore__GetPassword()

int GWEN_PasswordStore__GetPassword ( GWEN_PASSWD_STORE * sto,
const char * token,
char * buffer,
int minLen,
int maxLen )
static

Definition at line 589 of file passwdstore.c.

References DBG_ERROR, GWEN_Buffer_free(), GWEN_Buffer_GetStart(), GWEN_Buffer_new(), GWEN_DB_GetCharValue(), GWEN_ERROR_NOT_FOUND, GWEN_LOGDOMAIN, GWEN_Text_EscapeToBufferTolerant(), and NULL.

Referenced by GWEN_PasswordStore_GetPassword().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_PasswordStore__SetPassword()

int GWEN_PasswordStore__SetPassword ( GWEN_PASSWD_STORE * sto,
const char * token,
const char * secret )
static

◆ GWEN_PasswordStore_CheckDigest()

int GWEN_PasswordStore_CheckDigest ( const uint8_t * t,
uint32_t size,
const uint8_t * h )
static

Definition at line 220 of file passwdstore.c.

References DBG_ERROR, GWEN_ERROR_BAD_DATA, GWEN_LOGDOMAIN, GWEN_MDigest_Begin(), GWEN_MDigest_End(), GWEN_MDigest_free(), GWEN_MDigest_GetDigestPtr(), GWEN_MDigest_Rmd160_new(), and GWEN_MDigest_Update().

Referenced by GWEN_PasswordStore_ReadDecryptFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_PasswordStore_ClearStoragePasswd()

void GWEN_PasswordStore_ClearStoragePasswd ( GWEN_PASSWD_STORE * sto)

Definition at line 76 of file passwdstore.c.

References GWEN_DB_Group_free(), GWEN_DB_ModifyBranchFlagsDown(), GWEN_DB_NODE_FLAGS_SAFE, and NULL.

Referenced by GWEN_Gui_Internal_SetPasswordStatus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_PasswordStore_Digest()

int GWEN_PasswordStore_Digest ( const uint8_t * t,
uint32_t size,
GWEN_BUFFER * buf )
static

◆ GWEN_PasswordStore_EncryptWriteFile()

◆ GWEN_PasswordStore_free()

void GWEN_PasswordStore_free ( GWEN_PASSWD_STORE * sto)

Definition at line 60 of file passwdstore.c.

References GWEN_DB_Group_free(), GWEN_DB_ModifyBranchFlagsDown(), GWEN_DB_NODE_FLAGS_SAFE, GWEN_FREE_OBJECT, and NULL.

Referenced by GWEN_Gui_free(), GWEN_Gui_SetPasswdStore(), and showPasswords().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_PasswordStore_GetPassword()

int GWEN_PasswordStore_GetPassword ( GWEN_PASSWD_STORE * sto,
const char * token,
char * buffer,
int minLen,
int maxLen )

◆ GWEN_PasswordStore_GetTokenList()

◆ GWEN_PasswordStore_new()

GWEN_PASSWD_STORE * GWEN_PasswordStore_new ( const char * fname)

Definition at line 46 of file passwdstore.c.

References GWEN_NEW_OBJECT, and NULL.

Referenced by showPasswords(), and test10().

Here is the caller graph for this function:

◆ GWEN_PasswordStore_ReadDecryptFile()

◆ GWEN_PasswordStore_ReadFile()

◆ GWEN_PasswordStore_SafeFreeDb()

void GWEN_PasswordStore_SafeFreeDb ( GWEN_PASSWD_STORE * sto)
static

Definition at line 250 of file passwdstore.c.

References GWEN_DB_Group_free(), GWEN_DB_ModifyBranchFlagsDown(), GWEN_DB_NODE_FLAGS_SAFE, and NULL.

Referenced by GWEN_PasswordStore_GetPassword(), GWEN_PasswordStore_GetTokenList(), GWEN_PasswordStore_ReadFile(), and GWEN_PasswordStore_SetPassword().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GWEN_PasswordStore_SetPassword()

◆ GWEN_PasswordStore_WriteFile()

int GWEN_PasswordStore_WriteFile ( GWEN_PASSWD_STORE * sto)
static

◆ readFile()

int readFile ( const char * fname,
GWEN_BUFFER * dbuf )
static

◆ writeFile()

int writeFile ( const char * fname,
const char * p,
int len )
static

Definition at line 163 of file passwdstore.c.

References DBG_ERROR, GWEN_ERROR_IO, GWEN_LOGDOMAIN, and writeToFile().

Referenced by GWEN_PasswordStore_EncryptWriteFile().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeToFile()

int writeToFile ( FILE * f,
const char * p,
int len )
static

Definition at line 138 of file passwdstore.c.

References DBG_ERROR, GWEN_ERROR_IO, and GWEN_LOGDOMAIN.

Referenced by writeFile().

Here is the caller graph for this function: