hi all
i have been trying to work at this all day but no cigar
the file does not seem to open
i have used the following function so if the file has root privileges it will open up another file
Code:
int file_permission(int fd)
{
struct stat stat_struct;
if(fstat(fd, &stat_struct) == -1)
return(1);
return (int)stat_struct.st_uid;
}
the above is the function i used for the code below which will open the file
Code:
if( (fdtest = file_permission(fd1)) == 0 )
{
printf("403 error\n");
printf("fdtest is %d\n", fdtest);
fdtest = open("/home/me/errors/403.html",O_RDONLY,0);
printf("fdtest is %d\n", fdtest);
}
the file is located in the directory. One thing i noticed was fdtest had changed from 0 to 6 after the open() i am not sure if this is meant to happen!
i am now beginning to believe its a problem with the file_permission function but then again when i use the following code instead it all works fine!
Code:
if( (fdtest = file_permission(fd1)) == 0 )
{
printf("403 error\n");
send_new(fd,"HTTP/1.0 403 Not Found\r\n");
send_new(fd,"<html><head><title>403 no permission!! :( </head></title>");
send_new(fd,"<body><h1>No permission to view</h1><br><p>Sorry user the url you were searching for is permitted!!</p></body></html>");
}
all help would be much appreciated... who knew an open statement would be such a headache
Kind regards