[SCM] Samba Shared Repository - branch master updated

Günther Deschner gd at samba.org
Fri Oct 1 00:33:20 MDT 2010


The branch, master has been updated
       via  3975203 s3-spoolss: fix do_drv_upgrade_printer() which must have been broken since the days we moved away from fstrings.
       via  fa3264f s3-net: better handle obscure 0x80070002 error reply when trying to update an not yet published printer.
       via  21576e3 s3-net: make sure we dont crash when publishing a single printer.
       via  5cb5e0a s3-spoolss: make sure we dont crash on NULL setprinter level2 elements as seen from win7.
       via  48fca54 s3-spoolss: dont overwrite location change notify.
      from  62d87f8 s3-selftest: added samba3.posix_s3.rpc.spoolss.printer to knownfail

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


- Log -----------------------------------------------------------------
commit 3975203a0242a01fe6d3737f8f04ec80e90cb831
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 1 06:42:58 2010 +0200

    s3-spoolss: fix do_drv_upgrade_printer() which must have been broken since the
    days we moved away from fstrings.
    
    Guenther

commit fa3264f89b1de8c7a284b8bc4469a80db7c6084f
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 1 06:08:47 2010 +0200

    s3-net: better handle obscure 0x80070002 error reply when trying to update an
    not yet published printer.
    
    Guenther

commit 21576e3f8c32878910460bf9575c200ad93d682a
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 1 06:08:12 2010 +0200

    s3-net: make sure we dont crash when publishing a single printer.
    
    Guenther

commit 5cb5e0aa9881758ec9f5af7da4fbc002ba91f49b
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 1 06:07:25 2010 +0200

    s3-spoolss: make sure we dont crash on NULL setprinter level2 elements as seen from win7.
    
    Guenther

commit 48fca54a29375dfad84a9863c70fed8b88d70221
Author: Günther Deschner <gd at samba.org>
Date:   Fri Oct 1 06:05:38 2010 +0200

    s3-spoolss: dont overwrite location change notify.
    
    Guenther

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

Summary of changes:
 source3/include/proto.h             |    3 +++
 source3/printing/notify.c           |   13 +++++++++++++
 source3/rpc_server/srv_spoolss_nt.c |   33 +++++++++++++++++++++------------
 source3/utils/net_rpc_printer.c     |   15 ++++++++++++---
 4 files changed, 49 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index 5cdb956..866836f 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -4044,6 +4044,9 @@ void notify_printer_byname(struct tevent_context *ev,
 			   struct messaging_context *msg_ctx,
 			   const char *printername, uint32 change,
 			   const char *value);
+void notify_printer_sepfile(struct tevent_context *ev,
+			    struct messaging_context *msg_ctx,
+			    int snum, const char *sepfile);
 
 /* The following definitions come from printing/pcap.c  */
 
diff --git a/source3/printing/notify.c b/source3/printing/notify.c
index 9f07f6c..84a979e 100644
--- a/source3/printing/notify.c
+++ b/source3/printing/notify.c
@@ -577,6 +577,19 @@ void notify_printer_location(struct tevent_context *ev,
 		snum, strlen(location) + 1, location);
 }
 
+void notify_printer_sepfile(struct tevent_context *ev,
+			    struct messaging_context *msg_ctx,
+			    int snum, const char *sepfile)
+{
+	const char *sharename = lp_servicename(snum);
+
+	send_notify_field_buffer(
+		ev, msg_ctx,
+		sharename, PRINTER_NOTIFY_TYPE, PRINTER_NOTIFY_FIELD_SEPFILE,
+		snum, strlen(sepfile) + 1, sepfile);
+}
+
+
 void notify_printer_byname(struct tevent_context *ev,
 			   struct messaging_context *msg_ctx,
 			   const char *printername, uint32 change,
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 889c370..bb3b05d 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -1493,7 +1493,6 @@ void do_drv_upgrade_printer(struct messaging_context *msg,
 	const char *drivername;
 	int snum;
 	int n_services = lp_numservices();
-	size_t len;
 
 	tmp_ctx = talloc_new(NULL);
 	if (!tmp_ctx) return;
@@ -1505,8 +1504,7 @@ void do_drv_upgrade_printer(struct messaging_context *msg,
 		goto done;
 	}
 
-	len = MIN(data->length,sizeof(drivername)-1);
-	drivername = talloc_strndup(tmp_ctx, (const char *)data->data, len);
+	drivername = talloc_strndup(tmp_ctx, (const char *)data->data, data->length);
 	if (!drivername) {
 		DEBUG(0, ("do_drv_upgrade_printer: Out of memoery ?!\n"));
 		goto done;
@@ -1522,6 +1520,11 @@ void do_drv_upgrade_printer(struct messaging_context *msg,
 			continue;
 		}
 
+		/* ignore [printers] share */
+		if (strequal(lp_const_servicename(snum), "printers")) {
+			continue;
+		}
+
 		result = winreg_get_printer(tmp_ctx, server_info, msg,
 					    lp_const_servicename(snum),
 					    &pinfo2);
@@ -6127,7 +6130,8 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
 				printer->drivername));
 
 			notify_printer_driver(server_event_context(), msg_ctx,
-					      snum, printer->drivername);
+					      snum, printer->drivername ?
+					      printer->drivername : "");
 		}
 	}
 
@@ -6145,7 +6149,8 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
 
 		if (!force_update) {
 			notify_printer_comment(server_event_context(), msg_ctx,
-					       snum, printer->comment);
+					       snum, printer->comment ?
+					       printer->comment : "");
 		}
 	}
 
@@ -6164,7 +6169,8 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
 		if (!force_update) {
 			notify_printer_sharename(server_event_context(),
 						 msg_ctx,
-						 snum, printer->sharename);
+						 snum, printer->sharename ?
+						 printer->sharename : "");
 		}
 	}
 
@@ -6191,7 +6197,7 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
 
 		if (!force_update) {
 			notify_printer_printername(server_event_context(),
-						   msg_ctx, snum, p);
+						   msg_ctx, snum, p ? p : "");
 		}
 	}
 
@@ -6209,7 +6215,8 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
 
 		if (!force_update) {
 			notify_printer_port(server_event_context(),
-					    msg_ctx, snum, printer->portname);
+					    msg_ctx, snum, printer->portname ?
+					    printer->portname : "");
 		}
 	}
 
@@ -6228,7 +6235,8 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
 		if (!force_update) {
 			notify_printer_location(server_event_context(),
 						msg_ctx, snum,
-						printer->location);
+						printer->location ?
+						printer->location : "");
 		}
 	}
 
@@ -6245,9 +6253,10 @@ static WERROR update_dsspooler(TALLOC_CTX *mem_ctx,
 					  buffer.length);
 
 		if (!force_update) {
-			notify_printer_location(server_event_context(),
-						msg_ctx, snum,
-						printer->location);
+			notify_printer_sepfile(server_event_context(),
+					       msg_ctx, snum,
+					       printer->sepfile ?
+					       printer->sepfile : "");
 		}
 	}
 
diff --git a/source3/utils/net_rpc_printer.c b/source3/utils/net_rpc_printer.c
index 589a569..0396e2a 100644
--- a/source3/utils/net_rpc_printer.c
+++ b/source3/utils/net_rpc_printer.c
@@ -1093,6 +1093,11 @@ static bool get_printer_info(struct rpc_pipe_client *pipe_hnd,
 					 &hnd))
 		return false;
 
+	*info_p = talloc_zero(mem_ctx, union spoolss_PrinterInfo);
+	if (*info_p == NULL) {
+		return false;
+	}
+
 	if (!net_spoolss_getprinter(pipe_hnd, mem_ctx, &hnd, level, *info_p)) {
 		rpccli_spoolss_ClosePrinter(pipe_hnd, mem_ctx, &hnd, NULL);
 		return false;
@@ -1317,9 +1322,13 @@ static NTSTATUS rpc_printer_publish_internals_args(struct rpc_pipe_client *pipe_
 						      0, /* command */
 						      &result);
 
-		if (!W_ERROR_IS_OK(result) && (W_ERROR_V(result) != W_ERROR_V(WERR_IO_PENDING))) {
-			printf(_("cannot set printer-info: %s\n"),
-			       win_errstr(result));
+		if (!W_ERROR_IS_OK(result) && !W_ERROR_EQUAL(result, WERR_IO_PENDING)) {
+			if ((action == DSPRINT_UPDATE) && W_ERROR_EQUAL(result, W_ERROR(0x80070002))) {
+				printf(_("printer not published yet\n"));
+			} else {
+				printf(_("cannot set printer-info: %s\n"),
+				       win_errstr(result));
+			}
 			goto done;
 		}
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list