-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgsql.h
42 lines (36 loc) · 1.13 KB
/
pgsql.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// pgsql.h
// encrypt_One
//
// Copyleft (ɔ) 2014 Mailden
// Use of this source code is governed by a GNU AFFERO GENERAL PUBLIC
// license (AGPL) that can be found in the LICENSE file.
#ifndef encrypt_One_pgsql_h
#define encrypt_One_pgsql_h
#include "../include/libpq-fe.h"
#include "chaines.h"
#define CONNEXION_PARAMS pg_connexion("127.0.0.1","mail","pgsql",NULL)
typedef struct {
char *email;
char *password;
char *phrase;
char *rsa_priv;
} user_t;
typedef struct {
char *email;
char *name;
string_t *maildir;
char *passphrase;
string_t *pwd;
char *rsapub;
char *rsapriv_crypt;
char *days;
} newUser_t;
PGconn *pg_connexion(const char *serveur, const char *db, const char *user, const char *pwd);
int pgsql_get_rsaPubKey(char *email, char **rsa_pub_key, char *do_crypt);
int pgsql_get_userKeys(user_t *user);
int pg_creer_utilisateur (newUser_t *user);
int pg_requete_simple (PGconn * pgh, const char *requete);
int pg_creer_alias (char *email);
int pg_update_pass (char *email, char *new_hash, char *new_ciphered_rsa_priv_key, char *prev_ciphered_rsa_priv_key);
#endif