/////
//
// File : test_auto.c
// Author : Jean-Luc Cyr
// Date : 2018-10
//
// Description: autorisation method test file
//

#include "absec_auto.h"
#include <stdio.h>
#include <sys/stat.h>
#include "httpd.h"

////////////////////////////////////////////////////////////////
int main() {

   struct request_rec r;
   struct stat fperm;

   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);

	printf("ABSEC auto perms for file %s or uri %s\r\n", r.filename, r.uri);

   perms_lookup(&r, &fperm);

   printf("Perms: %o\r\n", fperm.st_mode);

	printf("Test completed\r\n");

   return 0;

}
/*
	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");
*/
