Skip to content

Commit

Permalink
Info: make builddir add owner write permissions to all files
Browse files Browse the repository at this point in the history
Since bcfg2-info isn't normally run as root, it can remove write
permissions from itself in certain situations.  This patch ensures
that owner write is added to the mode for all files written by
builddir.

For example, suppose a bundle specifies a file /etc/foo/private
with mode 0444.  The POSIX tool will create /etc/foo with mode
0555.  Any subsequent files that are specified to exist in
/etc/foo will not be created because bcfg2-info will hit a
permission denied error.
  • Loading branch information
fennm committed Jun 29, 2013
1 parent b5d2421 commit ab62481
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/sbin/bcfg2-info
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import fnmatch
import logging
import lxml.etree
import traceback
import stat
from code import InteractiveConsole
import Bcfg2.Logger
import Bcfg2.Options
Expand Down Expand Up @@ -280,6 +281,9 @@ Bcfg2 client itself.""")
for entry in struct:
if entry.tag == 'Path':
entry.set('name', odir + '/' + entry.get('name'))
if entry.get('mode') != None:
entry.set('mode', \
oct(int(entry.get('mode'), 8)|stat.S_IWUSR))

posix = Bcfg2.Client.Tools.POSIX.POSIX(MockLog(),
self.setup,
Expand Down

0 comments on commit ab62481

Please sign in to comment.