[users@httpd] File i/o permission question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Hello, I would appreciate a point in the right direction concerning
file access within an apache module. I come from a win32
development background and this is my first attempt writing an apache
module. Using examples found around the net and studying the
various filters I have been able to write an 'empty filter'.
Before commencing 'fitlering' work I'm attempting to add logging
functionalilty to better track behavior within the module. I have
successfully passed initialization information via the http.conf file
to the module, however upon calling apr_file_open the
server is reporting a 'permission denied' error and not allowing me to
create/write to the log file. I have researched this basically
all of today, looking through google and through some of the other
filters to observer there logging code and I believe that I'm following
the same path, however obviously something eludes me. Here are a
few points to consider -
1 ) Filter is working. Although I cannot create my own log file, I am able to dump the error the the error log
2 ) The file path appears correct. Based on the dump to the error
log heres how the path looks - /usr/local/apache2/logs/filter_log
3 ) I actually created a file called filter_log and changed the permissions to owner: apache, group: apache. No dice
If someone could be so kind to point out the err of my ways or perhaps
point me to the right documentation i would trully appreciate it.
Thxs in advance.
Here's a sample of the code ( I have included the permissions passed as well )...
static int xfer_flags = (APR_WRITE | APR_APPEND | APR_LARGEFILE);
static apr_fileperms_t xfer_perms = ( APR_UREAD | APR_UWRITE |
APR_GREAD | APR_WREAD
);
// I ALSO TRIED APR_OS_DEFAULT
static apr_status_t test_filter_in(ap_filter_t *f, apr_bucket_brigade *b,
ap_input_mode_t mode, apr_read_type_e block,
apr_off_t readbytes)
{
apr_bucket *e;
apr_file_t *fd = NULL;
apr_status_t status;
apr_status_t rv;
status = ap_get_brigade(f->next, b, mode, block, readbytes);
// Get the first bucket on our brigade
e = APR_BRIGADE_FIRST(b);
// If the first bucket is empty, we have an empty brigade. Exit the function
if (e->type == NULL) {
return status;
}
conn_rec *c = f->c;
pt_filter_conf_t *s_cfg = ap_get_module_config(
c->base_server->module_config,
&test_module);
const char *fname = s_cfg->strLogFilePath;
rv = apr_file_open(&fd, fname, xfer_flags, xfer_perms, f->c->pool);
if ( APR_SUCCESS != rv ) {
ap_log_error(APLOG_MARK, APLOG_ERR, rv, c->base_server,
"could not create filter log at path %s", fname);
return status;
}
...
}
[Index of Archives]
[Open SSH Users]
[Linux ACPI]
[Linux Kernel]
[Linux Laptop]
[Kernel Newbies]
[Security]
[Netfilter]
[Bugtraq]
[Squid]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Samba]
[Video 4 Linux]
[Device Mapper]