Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Commit

Permalink
Fix permissions of config file to allow updating of access token when…
Browse files Browse the repository at this point in the history
… printing
  • Loading branch information
simoncadman committed Jan 26, 2014
1 parent 09842e4 commit 0defe93
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def AddAccount(storage, userid=None): # pragma: no cover

# fix permissions
try:
os.chmod(Auth.config, 0640)
os.chmod(Auth.config, 0660)
os.chown(Auth.config, 0, Auth.GetLPID())
except:
sys.stderr.write("DEBUG: Cannot alter file permissions\n")
Expand Down Expand Up @@ -156,7 +156,7 @@ def SetupAuth(interactive=False, permissions=['https://www.googleapis.com/auth/c
# fix permissions
if modifiedconfig: # pragma: no cover
try:
os.chmod(Auth.config, 0640)
os.chmod(Auth.config, 0660)
os.chown(Auth.config, 0, Auth.GetLPID())
except:
sys.stderr.write("DEBUG: Cannot alter file permissions\n")
Expand Down
2 changes: 1 addition & 1 deletion backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
CCPVersion = "20140126 213803"
CCPVersion = "20140126 215144"
print "CUPS Cloud Print CUPS Backend Version " + CCPVersion
sys.exit(0)

Expand Down
2 changes: 1 addition & 1 deletion deleteaccount.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
CCPVersion = "20140126 213803"
CCPVersion = "20140126 215144"
print "CUPS Cloud Print Delete Account Script Version " + CCPVersion
sys.exit(0)

Expand Down
2 changes: 1 addition & 1 deletion dynamicppd.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
CCPVersion = "20140126 213803"
CCPVersion = "20140126 215144"
print "CUPS Cloud Print Dynamic PPD Generator Version " + CCPVersion
sys.exit(0)

Expand Down
2 changes: 1 addition & 1 deletion listcloudprinters.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
CCPVersion = "20140126 213803"
CCPVersion = "20140126 215144"
print "CUPS Cloud Print Printer Lister Version " + CCPVersion
sys.exit(0)

Expand Down
2 changes: 1 addition & 1 deletion listdrivefiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
CCPVersion = "20140126 213803"
CCPVersion = "20140126 215144"
print "CUPS Cloud Print Printer Drive Lister Version " + CCPVersion
sys.exit(0)

Expand Down
2 changes: 1 addition & 1 deletion reportissues.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
CCPVersion = "20140126 213803"
CCPVersion = "20140126 215144"
print "CUPS Cloud Print Issue Reporting Script Version " + CCPVersion
sys.exit(0)

Expand Down
2 changes: 1 addition & 1 deletion setupcloudprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
CCPVersion = "20140126 213803"
CCPVersion = "20140126 215144"
print "CUPS Cloud Print Setup Script Version " + CCPVersion
sys.exit(0)

Expand Down
2 changes: 1 addition & 1 deletion submitjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
CCPVersion = "20140126 213803"
CCPVersion = "20140126 215144"
print "CUPS Cloud Print Submit Job Version " + CCPVersion
sys.exit(0)

Expand Down
7 changes: 6 additions & 1 deletion upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
sys.stderr.write("If you are upgrading from version 20131013 or earlier you should be aware that the scripts have moved from /usr/lib/cloudprint-cups to /usr/share/cloudprint-cups\n")

# line below is replaced on commit
CCPVersion = "20140126 213803"
CCPVersion = "20140126 215144"

if len(sys.argv) == 2 and sys.argv[1] == 'version':
print "CUPS Cloud Print Upgrade Script Version " + CCPVersion
Expand All @@ -57,6 +57,11 @@
cupsprinters = connection.getPrinters()

if os.path.exists(Auth.config):
try:
os.chmod(Auth.config, 0660)
except Exception, e:
logging.error("Unable to fix config file permissions: %s", str(e))

try:
content_file = open(Auth.config, 'r')
content = content_file.read()
Expand Down

0 comments on commit 0defe93

Please sign in to comment.