test dev mysql et script compile
This commit is contained in:
Executable
+2
@@ -0,0 +1,2 @@
|
|||||||
|
/home/jlcyr/apache2/bin/apxs -lpam -lpam_misc -c -i mod_absec.c
|
||||||
|
/home/jlcyr/apache2/bin/apachectl restart
|
||||||
@@ -142,6 +142,10 @@ static int absec_handler_first(request_rec *r)
|
|||||||
struct stat fperm;
|
struct stat fperm;
|
||||||
int status;
|
int status;
|
||||||
status = stat(r->filename, &fperm);
|
status = stat(r->filename, &fperm);
|
||||||
|
if (status==-1) {
|
||||||
|
ap_rprintf(r, "stat erreur %d", errno);
|
||||||
|
return (OK);
|
||||||
|
}
|
||||||
//ap_rprintf(r, "File perms %o, owner %d, group %d (status %d)<br/>\r\n", fperm.st_mode, fperm.st_uid, fperm.st_gid, status);
|
//ap_rprintf(r, "File perms %o, owner %d, group %d (status %d)<br/>\r\n", fperm.st_mode, fperm.st_uid, fperm.st_gid, status);
|
||||||
|
|
||||||
/* check if any permission (ogw) match method (get r, put/post w, delete x) */
|
/* check if any permission (ogw) match method (get r, put/post w, delete x) */
|
||||||
@@ -297,6 +301,10 @@ static void absec_register_hooks(apr_pool_t *p)
|
|||||||
//ap_hook_handler(absec_handler, NULL, NULL, APR_HOOK_MIDDLE);
|
//ap_hook_handler(absec_handler, NULL, NULL, APR_HOOK_MIDDLE);
|
||||||
ap_hook_handler(absec_handler_last, NULL, NULL, APR_HOOK_LAST);
|
ap_hook_handler(absec_handler_last, NULL, NULL, APR_HOOK_LAST);
|
||||||
ap_hook_handler(absec_handler_first, NULL, NULL, APR_HOOK_FIRST);
|
ap_hook_handler(absec_handler_first, NULL, NULL, APR_HOOK_FIRST);
|
||||||
|
|
||||||
|
// should use HOOK FIXUP
|
||||||
|
|
||||||
|
// should use FILTER
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
#include <mysql.h>
|
||||||
|
#include <stdio.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";
|
||||||
|
|
||||||
|
conn = mysql_init(NULL);
|
||||||
|
|
||||||
|
/* Connect to database */
|
||||||
|
if (!mysql_real_connect(conn, server,
|
||||||
|
user, password, database, 0, NULL, 0)) {
|
||||||
|
fprintf(stderr, "%s\n", mysql_error(conn));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* send SQL query */
|
||||||
|
if (mysql_query(conn, "show tables")) {
|
||||||
|
fprintf(stderr, "%s\n", mysql_error(conn));
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
res = mysql_use_result(conn);
|
||||||
|
|
||||||
|
/* output table name */
|
||||||
|
printf("MySQL Tables in mysql database:\n");
|
||||||
|
while ((row = mysql_fetch_row(res)) != NULL)
|
||||||
|
printf("%s \n", row[0]);
|
||||||
|
|
||||||
|
/* close connection */
|
||||||
|
mysql_free_result(res);
|
||||||
|
mysql_close(conn);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user