]> granicus.if.org Git - php/commitdiff
Fixed bug #17466
authorIlia Alshanetsky <iliaa@php.net>
Mon, 23 Sep 2002 18:51:34 +0000 (18:51 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Mon, 23 Sep 2002 18:51:34 +0000 (18:51 +0000)
sapi/apache2filter/php_apache.h
sapi/apache2filter/sapi_apache2.c

index d65bc6de3cc5b84b90ecaac918115a0c45eeee18..0fde7c515e8251bd9da59f342df0cdbad776103f 100644 (file)
@@ -38,6 +38,8 @@ typedef struct php_struct {
        int post_len;
        /* Index for reading from buffer */
        int post_idx;
+       /* stat structure of the current file */        
+       struct stat finfo;
        /* Buffer for request body filter */
        char *post_data;
        /* Whether or not we've processed PHP in the output filters yet. */
index db396ace0cf00e90ffd223f51b3ffbc6aa87c53a..33bc5a42423c1c2d87e7eaffcbc9364c110e806b 100644 (file)
@@ -149,6 +149,23 @@ php_apache_sapi_read_post(char *buf, uint count_bytes TSRMLS_DC)
        return n;
 }
 
+static struct stat*
+php_apache_sapi_get_stat(TSRMLS_D)
+{
+       php_struct *ctx = SG(server_context);
+
+       ctx->finfo.st_uid = ctx->r->finfo.user;
+       ctx->finfo.st_gid = ctx->r->finfo.group;
+       ctx->finfo.st_ino = ctx->r->finfo.inode;
+       ctx->finfo.st_atime = ctx->r->finfo.atime/1000000;
+       ctx->finfo.st_mtime = ctx->r->finfo.mtime/1000000;
+       ctx->finfo.st_ctime = ctx->r->finfo.ctime/1000000;
+       ctx->finfo.st_size = ctx->r->finfo.size;
+       ctx->finfo.st_nlink = ctx->r->finfo.nlink;
+
+       return &ctx->finfo;
+}
+
 static char *
 php_apache_sapi_read_cookies(TSRMLS_D)
 {
@@ -264,7 +281,7 @@ static sapi_module_struct apache2_sapi_module = {
 
        php_apache_sapi_ub_write,                               /* unbuffered write */
        php_apache_sapi_flush,                                  /* flush */
-       NULL,                                                                   /* get uid */
+       php_apache_sapi_get_stat,                                               /* get uid */
        php_apache_sapi_getenv,                                 /* getenv */
 
        php_error,                                                              /* error handler */