summaryrefslogtreecommitdiff
path: root/source4/python/examples/spoolss/psec.py
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2004-02-21 11:08:10 +0000
committerStefan Metzmacher <metze@samba.org>2004-02-21 11:08:10 +0000
commita6a935d937495e83652d70fef57badf27537428d (patch)
tree1b0b50c33ce525c558457d2a541b78da1d93e028 /source4/python/examples/spoolss/psec.py
parente967ff114e767113f0f98d98db628ffa204314eb (diff)
downloadsamba-a6a935d937495e83652d70fef57badf27537428d.tar.gz
samba-a6a935d937495e83652d70fef57badf27537428d.tar.bz2
samba-a6a935d937495e83652d70fef57badf27537428d.zip
remove the python stuff, this will be rewritten on top of libsmb.so
and maintained in a external tree. (discussed with tpot) metze (This used to be commit 54a01008413e1f03a49f5d6f9e2f98c8b8d1c87a)
Diffstat (limited to 'source4/python/examples/spoolss/psec.py')
-rwxr-xr-xsource4/python/examples/spoolss/psec.py88
1 files changed, 0 insertions, 88 deletions
diff --git a/source4/python/examples/spoolss/psec.py b/source4/python/examples/spoolss/psec.py
deleted file mode 100755
index 498a0ef174..0000000000
--- a/source4/python/examples/spoolss/psec.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/env python
-#
-# Get or set the security descriptor on a printer
-#
-
-import sys, re, string
-from samba import spoolss
-
-if len(sys.argv) != 3:
- print "Usage: psec.py getsec|setsec printername"
- sys.exit(1)
-
-op = sys.argv[1]
-printername = sys.argv[2]
-
-# Display security descriptor
-
-if op == "getsec":
-
- try:
- hnd = spoolss.openprinter(printername)
- except:
- print "error opening printer %s" % printername
- sys.exit(1)
-
- secdesc = hnd.getprinter(level = 3)["security_descriptor"]
-
- print secdesc["owner_sid"]
- print secdesc["group_sid"]
-
- for acl in secdesc["dacl"]["ace_list"]:
- print "%d %d 0x%08x %s" % (acl["type"], acl["flags"],
- acl["mask"], acl["trustee"])
-
- spoolss.closeprinter(hnd)
-
- sys.exit(0)
-
-# Set security descriptor
-
-if op == "setsec":
-
- # Open printer
-
- try:
- hnd = spoolss.openprinter(printername,
- creds = {"domain": "NPSD-TEST2",
- "username": "Administrator",
- "password": "penguin"})
- except:
- print "error opening printer %s" % printername
- sys.exit(1)
-
- # Read lines from standard input and build security descriptor
-
- lines = sys.stdin.readlines()
-
- secdesc = {}
-
- secdesc["owner_sid"] = lines[0]
- secdesc["group_sid"] = lines[1]
-
- secdesc["revision"] = 1
- secdesc["dacl"] = {}
- secdesc["dacl"]["revision"] = 2
- secdesc["dacl"]["ace_list"] = []
-
- for acl in lines[2:]:
- match = re.match("(\d+) (\d+) (0[xX][\dA-Fa-f]+) (\S+)", acl)
- secdesc["dacl"]["ace_list"].append(
- {"type": int(match.group(1)), "flags": int(match.group(2)),
- "mask": string.atoi(match.group(3), 0), "trustee": match.group(4)})
-
- # Build info3 structure
-
- info3 = {}
-
- info3["flags"] = 0x8004 # self-relative, dacl present
- info3["level"] = 3
- info3["security_descriptor"] = secdesc
-
- hnd.setprinter(info3)
-
- spoolss.closeprinter(hnd)
- sys.exit(0)
-
-print "invalid operation %s" % op
-sys.exit(1)