[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] issue #532 read-only admin area

From: Branko Čibej <brane_at_xbc.nu>
Date: 2002-01-28 20:41:37 CET

Philip Martin wrote:

>+
>+
>+/*** Permissions and modes. ***/
>+
>+svn_error_t *
>+svn_io_set_file_read_only (const char *fname, apr_pool_t *pool)
>+{
>+ apr_status_t apr_err;
>+ apr_finfo_t finfo;
>+
>+ apr_err = apr_stat (&finfo, fname, APR_FINFO_PROT, pool);
>+ if (! APR_STATUS_IS_SUCCESS (apr_err))
>+ return svn_error_createf
>+ (apr_err, 0, NULL, pool,
>+ "svn_io_set_file_read_only: problem stat'ing \"%s\"", fname);
>+
>+ finfo.protection &= ~APR_UWRITE;
>+ finfo.protection &= ~APR_GWRITE;
>+ finfo.protection &= ~APR_WWRITE;
>+
>+ apr_err = apr_file_perms_set (fname, finfo.protection);
>+ if (! APR_STATUS_IS_SUCCESS (apr_err)
>+ /* These two kinds of errors are okay, it just means the OS
>+ doesn't support everything we're trying to do. */
>+ && ! APR_STATUS_IS_INCOMPLETE (apr_err)
>+ && ! APR_STATUS_IS_ENOTIMPL (apr_err))
>+ return svn_error_createf
>+ (apr_err, 0, NULL, pool,
>+ "svn_io_set_file_read_only: problem setting \"%s\" read only", fname);
>+
>+ return SVN_NO_ERROR;
>+}
>+
>+
>
--1

I've said before, and I'll say again: Making a file read-only *is not
the same* as removing write permission bits from the file. This will
only work on Unix (unless you're using ACLs there, too).

The last time this came up I suggested a new set of APR functions that
deal with write-protection, executableness, archive bits, etc. I still
think this would be the right thing to do.

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:37:00 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.