Return-Path: Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Delivered-To: mailing list dev@apr.apache.org Received: (qmail 12425 invoked from network); 20 Jan 2001 22:27:54 -0000 Received: from valiant.concentric.net (HELO valiant.cnchost.com) (207.155.252.9) by h31.sny.collab.net with SMTP; 20 Jan 2001 22:27:54 -0000 Received: from www1 (www1.rowe-clan.net [208.176.192.146] (may be forged)) by valiant.cnchost.com id RAA28386; Sat, 20 Jan 2001 17:27:59 -0500 (EST) [ConcentricHost SMTP Relay 1.10] Errors-To: From: "William A. Rowe, Jr." To: Subject: RE: cvs commit: apr/include apr_file_info.h apr_file_io.h Date: Sat, 20 Jan 2001 16:28:07 -0600 Message-ID: <003801c08330$4319ff60$92c0b0d0@roweclan.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 In-Reply-To: <20010120221859.8928.qmail@apache.org> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N 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 > > > >