summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-05-18 15:32:47 +0200
committerGünther Deschner <gd@samba.org>2010-05-18 15:34:02 +0200
commit007b9962676efef4cf2230f304ce263ce1e75555 (patch)
tree8757c9369a3d133914854959bcc5c4d6e72fbe43 /source3/utils
parenta79b446e11c56de5244ec9b9823c436122fe5ffe (diff)
downloadsamba-007b9962676efef4cf2230f304ce263ce1e75555.tar.gz
samba-007b9962676efef4cf2230f304ce263ce1e75555.tar.bz2
samba-007b9962676efef4cf2230f304ce263ce1e75555.zip
s3-net: also dump security descriptors from ntprinters.tdb in "net printing dump".
Guenther
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/net_printing.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/source3/utils/net_printing.c b/source3/utils/net_printing.c
index a04601fa80..33de480a1b 100644
--- a/source3/utils/net_printing.c
+++ b/source3/utils/net_printing.c
@@ -26,6 +26,7 @@
#define FORMS_PREFIX "FORMS/"
#define DRIVERS_PREFIX "DRIVERS/"
#define PRINTERS_PREFIX "PRINTERS/"
+#define SECDESC_PREFIX "SECDESC/"
static void dump_form(TALLOC_CTX *mem_ctx,
const char *key_name,
@@ -117,6 +118,37 @@ static void dump_printer(TALLOC_CTX *mem_ctx,
}
}
+static void dump_sd(TALLOC_CTX *mem_ctx,
+ const char *key_name,
+ unsigned char *data,
+ size_t length)
+{
+ enum ndr_err_code ndr_err;
+ DATA_BLOB blob;
+ char *s;
+ struct sec_desc_buf r;
+
+ printf("found security descriptor: %s\n", key_name);
+
+ blob = data_blob_const(data, length);
+
+ ZERO_STRUCT(r);
+
+ ndr_err = ndr_pull_struct_blob(&blob, mem_ctx, &r,
+ (ndr_pull_flags_fn_t)ndr_pull_sec_desc_buf);
+ if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+ d_fprintf(stderr, _("security descriptor pull failed: %s\n"),
+ ndr_errstr(ndr_err));
+ return;
+ }
+
+ s = NDR_PRINT_STRUCT_STRING(mem_ctx, sec_desc_buf, &r);
+ if (s) {
+ printf("%s\n", s);
+ }
+}
+
+
static int net_printing_dump(struct net_context *c, int argc,
const char **argv)
{
@@ -163,6 +195,13 @@ static int net_printing_dump(struct net_context *c, int argc,
SAFE_FREE(dbuf.dptr);
continue;
}
+
+ if (strncmp((const char *)kbuf.dptr, SECDESC_PREFIX, strlen(SECDESC_PREFIX)) == 0) {
+ dump_sd(ctx, (const char *)kbuf.dptr+strlen(SECDESC_PREFIX), dbuf.dptr, dbuf.dsize);
+ SAFE_FREE(dbuf.dptr);
+ continue;
+ }
+
}
ret = 0;