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

Re: Can I refuse commits containing virus infected files on the server?

From: Paul Koning <pkoning_at_equallogic.com>
Date: 2006-01-18 16:17:14 CET

>>>>> "Tim" == Tim Bruijnzeels <tim.bruijnzeels@int.greenpeace.org> writes:

 Tim> Paul Koning wrote:
>>>>>>> "Tim" == Tim Bruijnzeels <tim.bruijnzeels@int.greenpeace.org>
>>>>>>> writes:
>>
 Tim> Hi all, Before I go into any background, details and my own
 Tim> ideas about this, my basic question is:
>>
 Tim> Is it possible to refuse commits to a subversion repository
 Tim> based on the content of files that are being committed? And if
 Tim> so, how?
>> Sure. In the pre-commit script, in the list of changes (svnlook
>> changed) find the paths that are added or modified. Pick up each
>> file (svnlook cat) and scan it. If you find bad stuff, have the
>> script exit with error status.
>>

 Tim> Ahh, I assumed this would lead you to the old, active if you
 Tim> will, copies instead of the new files. I'll give it a
 Tim> go. Thanks,

It can do either, depending on the arguments you give to svnlook.
svnlook has a -t argument, which takes a transaction ID. That is
handed to you as one of the arguments of pre-commit and
pre-revprop-change hooks, and you use that to retrieve from the
repository the new state in the pending transaction. If your hook
says "ok" then that transaction becomes a new revision; if your hook
says "error" then the transaction is discarded and the change doesn't
happen.

This should be reasonably clear if you look at some of the existing
sample hooks.

       paul

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Wed Jan 18 20:12:27 2006

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

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