2017-07-06 11:41:06 +00:00
|
|
|
#ifndef SHAPITO_PASSWORD_H
|
|
|
|
#define SHAPITO_PASSWORD_H
|
2017-01-25 08:55:04 +00:00
|
|
|
|
|
|
|
/*
|
2017-07-06 11:44:19 +00:00
|
|
|
* Shapito.
|
2017-01-25 08:55:04 +00:00
|
|
|
*
|
|
|
|
* Protocol-level PostgreSQL client library.
|
|
|
|
*/
|
|
|
|
|
2017-06-28 12:19:24 +00:00
|
|
|
typedef struct so_password so_password_t;
|
2017-01-25 08:55:04 +00:00
|
|
|
|
2017-06-28 12:19:24 +00:00
|
|
|
struct so_password
|
|
|
|
{
|
2017-01-25 08:55:04 +00:00
|
|
|
char *password;
|
|
|
|
int password_len;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
so_password_init(so_password_t *pw)
|
|
|
|
{
|
|
|
|
pw->password = NULL;
|
|
|
|
pw->password_len = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
so_password_free(so_password_t *pw)
|
|
|
|
{
|
|
|
|
if (pw->password)
|
|
|
|
free(pw->password);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int
|
|
|
|
so_password_compare(so_password_t *a, so_password_t *b)
|
|
|
|
{
|
|
|
|
return (a->password_len == b->password_len) &&
|
|
|
|
(memcmp(a->password, b->password, a->password_len) == 0);
|
|
|
|
}
|
|
|
|
|
2017-01-25 10:30:20 +00:00
|
|
|
uint32_t so_password_salt(so_key_t*);
|
|
|
|
int so_password_md5(so_password_t*, char*, int, char*, int,
|
2017-07-04 12:54:33 +00:00
|
|
|
char[4]);
|
2017-01-25 10:17:34 +00:00
|
|
|
|
2017-07-06 11:41:06 +00:00
|
|
|
#endif /* SHAPITO_PASSWORD_H */
|