finalisation decoupage options

This commit is contained in:
2019-01-09 12:08:25 -05:00
parent 950e76d6e8
commit d18504ce2a
6 changed files with 40 additions and 95 deletions
+26 -32
View File
@@ -1,8 +1,3 @@
#include "absec_auto.h"
#include <mysql.h>
#include <stdio.h>
/////
//
// File : test_auto.c
@@ -12,39 +7,38 @@
// Description: autorisation method test file
//
#include "absec_auto.h"
#include <stdio.h>
#include <sys/stat.h>
#include "httpd.h"
////////////////////////////////////////////////////////////////
int main() {
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
char *server = "localhost";
char *user = "jlcyr";
char *password = "password"; /* set me first */
char *database = "absec";
struct request_rec r;
struct stat fperm;
conn = mysql_init(NULL);
char* filename = "/var/www/html/absec/test.php";
r.filename=malloc(strlen(filename));
strcpy(r.filename, filename);
char* uri = "/absec/test.php";
r.uri=malloc(strlen(uri));
strcpy(r.uri, uri);
/* Connect to database */
if (!mysql_real_connect(conn, server,
user, password, database, 0, NULL, 0)) {
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
printf("ABSEC auto perms for file %s or uri %s\r\n", r.filename, r.uri);
/* send SQL query */
if (mysql_query(conn, "show tables")) {
fprintf(stderr, "%s\n", mysql_error(conn));
exit(1);
}
perms_lookup(&r, &fperm);
res = mysql_use_result(conn);
printf("Perms: %o\r\n", fperm.st_mode);
/* output table name */
printf("MySQL Tables in mysql database:\n");
while ((row = mysql_fetch_row(res)) != NULL)
printf("%s \n", row[0]);
printf("Test completed\r\n");
return 0;
/* close connection */
mysql_free_result(res);
mysql_close(conn);
}
/*
printf("Retval: %d\r\n", retval);
if (retval == PAM_ERROR_START) printf("Error at start\r\n");
if (retval == PAM_ERROR_INVALID_CRED) printf("Invalid user/pass\r\n");
if (retval == PAM_OK) printf("OK\r\n");
*/