apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject RE: cvs commit: apr/include apr_file_info.h apr_file_io.h
Date Sat, 20 Jan 2001 22:28:07 GMT
Sorry, it shouldn't have slipped in.  I'll back it out now.
apr_get_filename_case was a predecessor to the component-oriented
apr_stat ... and if we are hitting the filesystem, do it with a
single atomic call, apr_stat.

On nlinks, yes, I think that any apr app that is providing 'security'
needs to know that the file they think they are deleting isn't really
being deleted.

Bill

> -----Original Message-----
> From: rbb@apache.org [mailto:rbb@apache.org]
> Sent: Saturday, January 20, 2001 4:19 PM
> To: apr-cvs@apache.org
> Subject: cvs commit: apr/include apr_file_info.h apr_file_io.h
> 
> 
> rbb         01/01/20 14:18:58
> 
>   Modified:    file_io/unix filestat.c
>                include  apr_file_info.h apr_file_io.h
>   Log:
>   Get APR building on Unix again.  This just updates APR for the new
>   apr_stat API.  Bill, could you please document get_filename_case?
>   
>   Revision  Changes    Path
>   1.35      +16 -10    apr/file_io/unix/filestat.c
>   
>   Index: filestat.c
>   ===================================================================
>   RCS file: /home/cvs/apr/file_io/unix/filestat.c,v
>   retrieving revision 1.34
>   retrieving revision 1.35
>   diff -u -r1.34 -r1.35
>   --- filestat.c	2001/01/20 21:39:03	1.34
>   +++ filestat.c	2001/01/20 22:18:52	1.35
>   @@ -96,17 +96,20 @@
>            finfo->size = info.st_size;
>            finfo->inode = info.st_ino;
>            finfo->device = info.st_dev;
>   -        finfo->nlinks = info.st_nlink;
>   +
>   +/* We don't have nlinks in the finfo structure.  Are we 
> going to add it? RBB*/
>   +/*        finfo->nlinks = info.st_nlink;  */

I say yes - if we care that the file we think we are 'purging' for
security reasons actually exists in more than one place.

>   +
>            apr_ansi_time_to_apr_time(&finfo->atime, info.st_atime);
>            apr_ansi_time_to_apr_time(&finfo->mtime, info.st_mtime);
>            apr_ansi_time_to_apr_time(&finfo->ctime, info.st_ctime);
>   -        finfo->filepath = thefile->fname;
>   +        finfo->fname = thefile->fname;
>            if (wanted & APR_FINFO_CSIZE) {
>                finfo->csize = info.st_blocks * 512;
>                finfo->valid |= APR_FINFO_CSIZE;
>            }
>   -        if (finfo->filetype = APR_LNK)
>   -            finfo->valid |= APR_FINFO_LINK
>   +        if (finfo->filetype == APR_LNK) {
>   +            finfo->valid |= APR_FINFO_LINK;
>            }
>            return APR_SUCCESS;
>        }
>   @@ -133,7 +136,7 @@
>        if (wanted & APR_FINFO_LINK)
>            srv = lstat(fname, &info);
>        else
>   -        srv = stat(fname,info);
>   +        srv = stat(fname, &info);
>    
>        if (srv == 0) {
>            finfo->cntxt = cont;
>   @@ -145,17 +148,20 @@
>            finfo->size = info.st_size;
>            finfo->inode = info.st_ino;
>            finfo->device = info.st_dev;
>   -        finfo->nlinks = info.st_nlink;
>   +
>   +/* We don't have nlinks in the finfo structure.  Are we 
> going to add it? RBB*/
>   +/*        finfo->nlinks = info.st_nlink;  */
>   +
>            apr_ansi_time_to_apr_time(&finfo->atime, info.st_atime);
>            apr_ansi_time_to_apr_time(&finfo->mtime, info.st_mtime);
>            apr_ansi_time_to_apr_time(&finfo->ctime, info.st_ctime);
>   -        finfo->filepath = fname;
>   +        finfo->fname = fname;
>            if (wanted & APR_FINFO_CSIZE) {
>                finfo->csize = info.st_blocks * 512;
>                finfo->valid |= APR_FINFO_CSIZE;
>            }
>   -        if (finfo->filetype = APR_LNK)
>   -            finfo->valid |= APR_FINFO_LINK
>   +        if (finfo->filetype == APR_LNK) {
>   +            finfo->valid |= APR_FINFO_LINK;
>            }
>            return APR_SUCCESS;
>        }

This is the bad code that is reversed out (or simply made private for
apr_stat's consumption):

>   @@ -206,7 +212,7 @@
>     * Unfortuantely, I don't have a clue about tweaking this 
> code for unix,
>     * other than the basic stratagy of stat, then walk 
> dirread for dev/inode.
>     */
>   -APR_DECLARE(apr_status_t) apr_get_filename_case(char **fname,
>   +APR_DECLARE(apr_status_t) apr_get_filename_case(const char **fname,
>                                                    const char *fspec,
>                                                    apr_pool_t *cont)
>    {



>   1.4       +1 -1      apr/include/apr_file_info.h
>   
>   Index: apr_file_info.h
>   ===================================================================
>   RCS file: /home/cvs/apr/include/apr_file_info.h,v
>   retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- apr_file_info.h	2001/01/20 21:58:03	1.3
>   +++ apr_file_info.h	2001/01/20 22:18:55	1.4
>   @@ -197,7 +197,7 @@
>        /** The time the file was last changed */
>        apr_time_t ctime;
>        /** The full pathname of the file */
>   -    char *fname;
>   +    const char *fname;
>        /** The file's name alone, in filesystem case */
>        char *fcase;
>        /** The file's handle, if accessed (can be submitted 
> to apr_duphandle) */
>   
>   
>   
>   1.90      +4 -0      apr/include/apr_file_io.h
>   
>   Index: apr_file_io.h
>   ===================================================================
>   RCS file: /home/cvs/apr/include/apr_file_io.h,v
>   retrieving revision 1.89
>   retrieving revision 1.90
>   diff -u -r1.89 -r1.90
>   --- apr_file_io.h	2001/01/20 21:38:03	1.89
>   +++ apr_file_io.h	2001/01/20 22:18:55	1.90
>   @@ -527,6 +527,10 @@
>                                              apr_int32_t wanted,
>                                              apr_file_t *thefile);
>    
>   +APR_DECLARE(apr_status_t) apr_get_filename_case(const char **fname,
>   +                                                const char *fspec,
>   +                                                apr_pool_t *cont);
>   +
>    #ifdef __cplusplus
>    }
>    #endif
>   
>   
>   
> 

Mime
View raw message