[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-1328-gbaf7850

Günther Deschner gd at samba.org
Thu Apr 30 15:34:02 GMT 2009


The branch, master has been updated
       via  baf78506895b8bd50433058ba0f18e1aaf8aeee5 (commit)
       via  af5a71d5280984a7d707e39fb522ecc7e1b71436 (commit)
      from  eee446a94841a5df97b3a47c7076ef52fb5ccdcf (commit)

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


- Log -----------------------------------------------------------------
commit baf78506895b8bd50433058ba0f18e1aaf8aeee5
Author: Günther Deschner <gd at samba.org>
Date:   Thu Apr 30 16:49:50 2009 +0200

    s3-printing: rework move_driver_file_to_download_area() a bit for clarity.
    
    Guenther

commit af5a71d5280984a7d707e39fb522ecc7e1b71436
Author: Günther Deschner <gd at samba.org>
Date:   Thu Apr 30 12:30:10 2009 +0200

    s3-lsa: use LSA_POLICY_MODE flags in _lsa_GetSystemAccessAccount().
    
    Guenther

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

Summary of changes:
 source3/include/privileges.h    |    6 ---
 source3/printing/nt_printing.c  |   72 +++++++++++++++++++++-----------------
 source3/rpc_server/srv_lsa_nt.c |    3 +-
 3 files changed, 42 insertions(+), 39 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/privileges.h b/source3/include/privileges.h
index 9a5d928..57d3fc0 100644
--- a/source3/include/privileges.h
+++ b/source3/include/privileges.h
@@ -77,12 +77,6 @@ extern const SE_PRIV se_take_ownership;
 /*
  * These are used in Lsa replies (srv_lsa_nt.c)
  */
-#define PR_NONE                0x0000
-#define PR_LOG_ON_LOCALLY      0x0001
-#define PR_ACCESS_FROM_NETWORK 0x0002
-#define PR_LOG_ON_BATCH_JOB    0x0004
-#define PR_LOG_ON_SERVICE      0x0010
-
 
 typedef struct {
 	uint32 high;
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 88e210c..b6e7032 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -1806,8 +1806,8 @@ static char* ffmt(unsigned char *c){
 static WERROR move_driver_file_to_download_area(TALLOC_CTX *mem_ctx,
 						connection_struct *conn,
 						const char *driver_file,
-						const char *architecture,
-						const char *new_dir,
+						const char *short_architecture,
+						uint32_t driver_version,
 						uint32_t version)
 {
 	char *old_name = NULL;
@@ -1815,26 +1815,30 @@ static WERROR move_driver_file_to_download_area(TALLOC_CTX *mem_ctx,
 	SMB_STRUCT_STAT st;
 	NTSTATUS status;
 
-	new_name = talloc_asprintf(mem_ctx, "%s/%s",
-				   architecture, driver_file);
-	W_ERROR_HAVE_NO_MEMORY(new_name);
-
 	old_name = talloc_asprintf(mem_ctx, "%s/%s",
-				   new_dir, driver_file);
+				   short_architecture, driver_file);
 	W_ERROR_HAVE_NO_MEMORY(old_name);
 
-	if (version != -1 && (version = file_version_is_newer(conn, new_name, old_name)) > 0) {
+	new_name = talloc_asprintf(mem_ctx, "%s/%d/%s",
+				   short_architecture, driver_version, driver_file);
+	W_ERROR_HAVE_NO_MEMORY(new_name);
+
+	if (version != -1 && (version = file_version_is_newer(conn, old_name, new_name)) > 0) {
 
-		new_name = driver_unix_convert(conn, new_name, &st);
-		W_ERROR_HAVE_NO_MEMORY(new_name);
+		old_name = driver_unix_convert(conn, old_name, &st);
+		W_ERROR_HAVE_NO_MEMORY(old_name);
 
-		status = copy_file(mem_ctx, conn, new_name, old_name,
+		DEBUG(10,("move_driver_file_to_download_area: copying '%s' to '%s'\n",
+			old_name, new_name));
+
+		status = copy_file(mem_ctx, conn, old_name, new_name,
 				   OPENX_FILE_EXISTS_TRUNCATE |
 				   OPENX_FILE_CREATE_IF_NOT_EXIST,
 				   0, false);
+
 		if (!NT_STATUS_IS_OK(status)) {
-			DEBUG(0,("move_driver_file_to_download_area: Unable to rename [%s] to [%s]\n",
-				new_name, old_name));
+			DEBUG(0,("move_driver_file_to_download_area: Unable to rename [%s] to [%s]: %s\n",
+				old_name, new_name, nt_errstr(status)));
 			return WERR_ACCESS_DENIED;
 		}
 	}
@@ -1848,7 +1852,7 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 {
 	NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver;
 	NT_PRINTER_DRIVER_INFO_LEVEL_3 converted_driver;
-	const char *architecture;
+	const char *short_architecture;
 	char *new_dir = NULL;
 	connection_struct *conn = NULL;
 	NTSTATUS nt_status;
@@ -1862,18 +1866,21 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 
 	*perr = WERR_OK;
 
-	if (level==3)
-		driver=driver_abstract.info_3;
-	else if (level==6) {
+	switch (level) {
+	case 3:
+		driver = driver_abstract.info_3;
+		break;
+	case 6:
 		convert_level_6_to_level3(&converted_driver, driver_abstract.info_6);
 		driver = &converted_driver;
-	} else {
+		break;
+	default:
 		DEBUG(0,("move_driver_to_download_area: Unknown info level (%u)\n", (unsigned int)level ));
 		return WERR_UNKNOWN_LEVEL;
 	}
 
-	architecture = get_short_archi(driver->environment);
-	if (!architecture) {
+	short_architecture = get_short_archi(driver->environment);
+	if (!short_architecture) {
 		return WERR_UNKNOWN_PRINTER_DRIVER;
 	}
 
@@ -1895,10 +1902,9 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 		return *perr;
 	}
 
-	DEBUG(5,("Creating first directory\n"));
 	new_dir = talloc_asprintf(ctx,
 				"%s/%d",
-				architecture,
+				short_architecture,
 				driver->cversion);
 	if (!new_dir) {
 		*perr = WERR_NOMEM;
@@ -1910,6 +1916,8 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 		goto err_exit;
 	}
 
+	DEBUG(5,("Creating first directory: %s\n", new_dir));
+
 	create_directory(conn, NULL, new_dir);
 
 	/* For each driver file, archi\filexxx.yyy, if there is a duplicate file
@@ -1936,8 +1944,8 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 		*perr = move_driver_file_to_download_area(ctx,
 							  conn,
 							  driver->driverpath,
-							  architecture,
-							  new_dir,
+							  short_architecture,
+							  driver->cversion,
 							  ver);
 		if (!W_ERROR_IS_OK(*perr)) {
 			if (W_ERROR_EQUAL(*perr, WERR_ACCESS_DENIED)) {
@@ -1953,8 +1961,8 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 			*perr = move_driver_file_to_download_area(ctx,
 								  conn,
 								  driver->datafile,
-								  architecture,
-								  new_dir,
+								  short_architecture,
+								  driver->cversion,
 								  ver);
 			if (!W_ERROR_IS_OK(*perr)) {
 				if (W_ERROR_EQUAL(*perr, WERR_ACCESS_DENIED)) {
@@ -1972,8 +1980,8 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 			*perr = move_driver_file_to_download_area(ctx,
 								  conn,
 								  driver->configfile,
-								  architecture,
-								  new_dir,
+								  short_architecture,
+								  driver->cversion,
 								  ver);
 			if (!W_ERROR_IS_OK(*perr)) {
 				if (W_ERROR_EQUAL(*perr, WERR_ACCESS_DENIED)) {
@@ -1992,8 +2000,8 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 			*perr = move_driver_file_to_download_area(ctx,
 								  conn,
 								  driver->helpfile,
-								  architecture,
-								  new_dir,
+								  short_architecture,
+								  driver->cversion,
 								  ver);
 			if (!W_ERROR_IS_OK(*perr)) {
 				if (W_ERROR_EQUAL(*perr, WERR_ACCESS_DENIED)) {
@@ -2020,8 +2028,8 @@ WERROR move_driver_to_download_area(struct pipes_struct *p,
 				*perr = move_driver_file_to_download_area(ctx,
 									  conn,
 									  driver->dependentfiles[i],
-									  architecture,
-									  new_dir,
+									  short_architecture,
+									  driver->cversion,
 									  ver);
 				if (!W_ERROR_IS_OK(*perr)) {
 					if (W_ERROR_EQUAL(*perr, WERR_ACCESS_DENIED)) {
diff --git a/source3/rpc_server/srv_lsa_nt.c b/source3/rpc_server/srv_lsa_nt.c
index 9481c20..d9d74ed 100644
--- a/source3/rpc_server/srv_lsa_nt.c
+++ b/source3/rpc_server/srv_lsa_nt.c
@@ -1716,7 +1716,8 @@ NTSTATUS _lsa_GetSystemAccessAccount(pipes_struct *p,
 	  they can be ORed together
 	*/
 
-	*r->out.access_mask = PR_LOG_ON_LOCALLY | PR_ACCESS_FROM_NETWORK;
+	*r->out.access_mask = LSA_POLICY_MODE_INTERACTIVE |
+			      LSA_POLICY_MODE_NETWORK;
 
 	return NT_STATUS_OK;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list