La connection à la base de donnée par cgit-config-gen fonctionne.
This commit is contained in:
parent
dbfdab99e6
commit
5edb145822
2
cgit
2
cgit
@ -1 +1 @@
|
|||||||
Subproject commit e2e71777189800ad5e31c49f080d42ac3b792610
|
Subproject commit 79e81e35ca472d6d0767eacce2520efce55fbd9d
|
||||||
@ -8,6 +8,8 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <dirent.h>
|
||||||
|
|
||||||
#define BDD_PASS_FILE "/srv/bdd/pipi-system.pass"
|
#define BDD_PASS_FILE "/srv/bdd/pipi-system.pass"
|
||||||
#define BDD_CONN_LENGTH 255
|
#define BDD_CONN_LENGTH 255
|
||||||
|
|
||||||
@ -16,7 +18,7 @@
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
char connInfo[BDD_CONN_LENGTH] = "dbname='pipi' user=pipisys password='";
|
char connInfo[BDD_CONN_LENGTH] = "host='/var/run/postgresql' dbname='pipi' user=pipisys password='";
|
||||||
FILE *dbPassFile;
|
FILE *dbPassFile;
|
||||||
char ch;
|
char ch;
|
||||||
int pos = strlen(connInfo);
|
int pos = strlen(connInfo);
|
||||||
@ -25,6 +27,21 @@ main(int argc, char **argv)
|
|||||||
PGresult *res;
|
PGresult *res;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
// Euhhhhhhhhhh
|
||||||
|
/*
|
||||||
|
DIR *dp;
|
||||||
|
struct dirent *ep;
|
||||||
|
|
||||||
|
dp = opendir ("/var/run/postgresql/");
|
||||||
|
if (dp != NULL)
|
||||||
|
{
|
||||||
|
while (ep = readdir (dp))
|
||||||
|
fprintf(stderr,"|->%s\n",ep->d_name);
|
||||||
|
(void) closedir (dp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
perror ("Couldn't open the directory");
|
||||||
|
*/
|
||||||
// Affichage de la première partie du rc
|
// Affichage de la première partie du rc
|
||||||
FILE* fd = fopen(CGITRC_BASE_FILE, "rb");
|
FILE* fd = fopen(CGITRC_BASE_FILE, "rb");
|
||||||
if (fd == NULL) {
|
if (fd == NULL) {
|
||||||
@ -55,6 +72,8 @@ main(int argc, char **argv)
|
|||||||
fclose(dbPassFile);
|
fclose(dbPassFile);
|
||||||
connInfo[pos] = '\'';
|
connInfo[pos] = '\'';
|
||||||
|
|
||||||
|
fprintf(stderr,"On va tenter de se connecter à la bdd en tant que %d\n",geteuid());
|
||||||
|
|
||||||
// Connecte à la BDD
|
// Connecte à la BDD
|
||||||
conn = PQconnectdb(connInfo);
|
conn = PQconnectdb(connInfo);
|
||||||
if (PQstatus(conn) != CONNECTION_OK)
|
if (PQstatus(conn) != CONNECTION_OK)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user