summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2004-02-26 23:04:11 +0000
committerTim Potter <tpot@samba.org>2004-02-26 23:04:11 +0000
commit9d3529105e6a58dde57f0654c5a2cd5f7ba609af (patch)
tree68cfc56cac93f85d2247730c12d2849221abe95f
parente1190848a17fc54b479315b5f11238461bc3fa62 (diff)
downloadsamba-9d3529105e6a58dde57f0654c5a2cd5f7ba609af.tar.gz
samba-9d3529105e6a58dde57f0654c5a2cd5f7ba609af.tar.bz2
samba-9d3529105e6a58dde57f0654c5a2cd5f7ba609af.zip
Fix for writable printerdata problem - bugzilla #1112.
(This used to be commit a05b9f0cc55300e2a25c87849a4417afea0cd867)
-rw-r--r--source3/python/samba/printerdata.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/source3/python/samba/printerdata.py b/source3/python/samba/printerdata.py
index 33251f6a00..0b53a3dfb5 100644
--- a/source3/python/samba/printerdata.py
+++ b/source3/python/samba/printerdata.py
@@ -15,8 +15,10 @@
from samba import spoolss
class printerdata:
- def __init__(self, host, creds = {}):
- self.hnd = spoolss.openprinter(host, creds = creds)
+ def __init__(self, host, creds = {}, access = 0x02000000):
+ # For read access, use MAXIMUM_ALLOWED_ACCESS = 0x02000000
+ # For write access, use PRINTER_ACCESS_ADMINISTER = 0x00000004
+ self.hnd = spoolss.openprinter(host, creds = creds, access = access)
def keys(self):
return self.hnd.enumprinterdata().keys()
@@ -30,10 +32,14 @@ class printerdata:
"data": value})
class printerdata_ex:
- def __init__(self, host):
+ def __init__(self, host, creds = {}, access = 0x02000000):
+ # For read access, use MAXIMUM_ALLOWED_ACCESS = 0x02000000
+ # For write access, use PRINTER_ACCESS_ADMINISTER = 0x00000004
self.host = host
self.top_level_keys = ["PrinterDriverData", "DsSpooler", "DsDriver",
"DsUser"]
+ self.creds = creds
+ self.access = access
def keys(self):
return self.top_level_keys
@@ -45,8 +51,8 @@ class printerdata_ex:
return 0
class printerdata_ex_subkey:
- def __init__(self, host, key):
- self.hnd = spoolss.openprinter(host)
+ def __init__(self, host, key, creds, access):
+ self.hnd = spoolss.openprinter(host, creds, access)
self.key = key
def keys(self):
@@ -56,4 +62,4 @@ class printerdata_ex:
return self.hnd.getprinterdataex(self.key, key)['data']
def __getitem__(self, key):
- return self.printerdata_ex_subkey(self.host, key)
+ return self.printerdata_ex_subkey(self.host, key, creds, access)