[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Tue May 4 11:56:46 MDT 2010


The branch, master has been updated
       via  17ce20b... s3-spoolss: Remove duplicate macro.
       via  9c5a59b... s4-torture: Added the printername to the AddPrinter comment.
       via  f5e41c5... s4-torture: Fixed spoolss dsspooler printername test.
       via  6683b0d... s3-lib: Create a sec_desc_merge and sec_desc_merge_buf function.
      from  efb1aea... s4/waf: ABI update for lib/ldb

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 17ce20ba960747b863e9c476ee7e46e051697fb2
Author: Simo Sorce <idra at samba.org>
Date:   Tue Apr 27 11:15:17 2010 -0400

    s3-spoolss: Remove duplicate macro.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 9c5a59b11e22104787fe7bd4b872a9b9c93c77a3
Author: Andreas Schneider <asn at samba.org>
Date:   Tue May 4 10:21:52 2010 +0200

    s4-torture: Added the printername to the AddPrinter comment.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit f5e41c5cde30e72a7f3597814cebaee4c1f0f9b4
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Apr 30 14:38:07 2010 +0200

    s4-torture: Fixed spoolss dsspooler printername test.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

commit 6683b0d4b6908e54af501701bd20a12990e3e77f
Author: Andreas Schneider <asn at samba.org>
Date:   Mon Apr 26 17:38:56 2010 +0200

    s3-lib: Create a sec_desc_merge and sec_desc_merge_buf function.
    
    Signed-off-by: Günther Deschner <gd at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/include/proto.h               |    3 +-
 source3/lib/secdesc.c                 |   43 ++++++++++++++++++++++++++++++++-
 source3/printing/nt_printing.c        |    2 +-
 source3/rpc_server/srv_spoolss_nt.c   |    2 +-
 source3/rpc_server/srv_spoolss_util.c |    5 ----
 source4/torture/rpc/spoolss.c         |   16 ++++++++++--
 6 files changed, 59 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index dabfa15..2c5b710 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -693,7 +693,8 @@ ssize_t drain_socket(int sockfd, size_t count);
 /* The following definitions come from lib/secdesc.c  */
 
 uint32_t get_sec_info(const SEC_DESC *sd);
-SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb);
+SEC_DESC *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC *new_sdb, SEC_DESC *old_sdb);
+SEC_DESC_BUF *sec_desc_merge_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb);
 SEC_DESC *make_sec_desc(TALLOC_CTX *ctx,
 			enum security_descriptor_revision revision,
 			uint16 type,
diff --git a/source3/lib/secdesc.c b/source3/lib/secdesc.c
index d45be00..f5a0039 100644
--- a/source3/lib/secdesc.c
+++ b/source3/lib/secdesc.c
@@ -63,7 +63,7 @@ uint32_t get_sec_info(const SEC_DESC *sd)
  security descriptor new_sec.
 ********************************************************************/
 
-SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb)
+SEC_DESC_BUF *sec_desc_merge_buf(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BUF *old_sdb)
 {
 	DOM_SID *owner_sid, *group_sid;
 	SEC_DESC_BUF *return_sdb;
@@ -108,6 +108,47 @@ SEC_DESC_BUF *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC_BUF *new_sdb, SEC_DESC_BU
 	return(return_sdb);
 }
 
+SEC_DESC *sec_desc_merge(TALLOC_CTX *ctx, SEC_DESC *new_sdb, SEC_DESC *old_sdb)
+{
+	DOM_SID *owner_sid, *group_sid;
+	SEC_ACL *dacl, *sacl;
+	SEC_DESC *psd = NULL;
+	uint16 secdesc_type;
+	size_t secdesc_size;
+
+	/* Copy over owner and group sids.  There seems to be no flag for
+	   this so just check the pointer values. */
+
+	owner_sid = new_sdb->owner_sid ? new_sdb->owner_sid :
+		old_sdb->owner_sid;
+
+	group_sid = new_sdb->group_sid ? new_sdb->group_sid :
+		old_sdb->group_sid;
+
+	secdesc_type = new_sdb->type;
+
+	/* Ignore changes to the system ACL.  This has the effect of making
+	   changes through the security tab audit button not sticking.
+	   Perhaps in future Samba could implement these settings somehow. */
+
+	sacl = NULL;
+	secdesc_type &= ~SEC_DESC_SACL_PRESENT;
+
+	/* Copy across discretionary ACL */
+
+	if (secdesc_type & SEC_DESC_DACL_PRESENT) {
+		dacl = new_sdb->dacl;
+	} else {
+		dacl = old_sdb->dacl;
+	}
+
+	/* Create new security descriptor from bits */
+	psd = make_sec_desc(ctx, new_sdb->revision, secdesc_type,
+			    owner_sid, group_sid, sacl, dacl, &secdesc_size);
+
+	return psd;
+}
+
 /*******************************************************************
  Creates a SEC_DESC structure
 ********************************************************************/
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index ba667c3..9ac74d6 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -402,7 +402,7 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key,
 		return 0;
 	}
 
-	if ( !(sd_store = sec_desc_merge( ctx, sd_new, sd_orig )) ) {
+	if ( !(sd_store = sec_desc_merge_buf( ctx, sd_new, sd_orig )) ) {
 		DEBUG(0,("sec_desc_upg_fn: Failed to update sec_desc for %s\n", key.dptr ));
 		return 0;
 	}
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index db6a6d7..f96a147 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -5465,7 +5465,7 @@ static WERROR update_printer_sec(struct policy_handle *handle,
 		}
 	}
 
-	new_secdesc_ctr = sec_desc_merge(p->mem_ctx, secdesc_ctr, old_secdesc_ctr);
+	new_secdesc_ctr = sec_desc_merge_buf(p->mem_ctx, secdesc_ctr, old_secdesc_ctr);
 	if (!new_secdesc_ctr) {
 		result = WERR_NOMEM;
 		goto done;
diff --git a/source3/rpc_server/srv_spoolss_util.c b/source3/rpc_server/srv_spoolss_util.c
index a0dc128..0044279 100644
--- a/source3/rpc_server/srv_spoolss_util.c
+++ b/source3/rpc_server/srv_spoolss_util.c
@@ -3633,11 +3633,6 @@ WERROR winreg_get_driver(TALLOC_CTX *mem_ctx,
 
 		v = &enum_values[i];
 
-#define CHECK_ERROR(result) \
-	if (W_ERROR_IS_OK(result)) continue; \
-	if (W_ERROR_EQUAL(result, WERR_NOT_FOUND)) result = WERR_OK; \
-	if (!W_ERROR_IS_OK(result)) break
-
 		result = winreg_enumval_to_dword(info8, v,
 						 "Version",
 						 &info8->version);
diff --git a/source4/torture/rpc/spoolss.c b/source4/torture/rpc/spoolss.c
index bb114b6..61d1bcc 100644
--- a/source4/torture/rpc/spoolss.c
+++ b/source4/torture/rpc/spoolss.c
@@ -4972,6 +4972,7 @@ static bool test_PrinterData_DsSpooler(struct torture_context *tctx,
 	union spoolss_SetPrinterInfo sinfo;
 	union spoolss_PrinterInfo info;
 	struct dcerpc_binding_handle *b = p->binding_handle;
+	const char *pname;
 
 	ZERO_STRUCT(info_ctr);
 	ZERO_STRUCT(devmode_ctr);
@@ -5061,7 +5062,14 @@ do {\
 	TEST_SZ("description", info.info2.comment);
 	TEST_SZ("driverName", info.info2.drivername);
 	TEST_SZ("location", info.info2.location);
-	TEST_SZ("printerName", info.info2.printername);
+
+	pname = strrchr(info.info2.printername, '\\');
+	if (pname == NULL) {
+		pname = info.info2.printername;
+	} else {
+		pname++;
+	}
+	TEST_SZ("printerName", pname);
 	/* TEST_SZ("printSeparatorFile", info.info2.sepfile); */
 	/* TEST_SZ("printShareName", info.info2.sharename); */
 
@@ -5966,7 +5974,8 @@ static bool test_AddPrinter_wellknown(struct torture_context *tctx,
 	ZERO_STRUCT(userlevel_ctr);
 	ZERO_STRUCT(info1);
 
-	torture_comment(tctx, "Testing AddPrinter%s level 1\n", ex ? "Ex":"");
+	torture_comment(tctx, "Testing AddPrinter%s(%s) level 1\n",
+			ex ? "Ex":"", printername);
 
 	/* try to add printer to wellknown printer list (level 1) */
 
@@ -6068,7 +6077,8 @@ static bool test_AddPrinter_normal(struct torture_context *tctx,
 	ZERO_STRUCT(secdesc_ctr);
 	ZERO_STRUCT(userlevel_ctr);
 
-	torture_comment(tctx, "Testing AddPrinter%s level 2\n", ex ? "Ex":"");
+	torture_comment(tctx, "Testing AddPrinter%s(%s) level 2\n",
+			ex ? "Ex":"", printername);
 
 	devmode_ctr.devmode = devmode;
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list