[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha7-606-g045151b

Günther Deschner gd at samba.org
Fri Mar 20 09:51:07 GMT 2009


The branch, master has been updated
       via  045151b767c62ac1343e86cb3886107226e73fda (commit)
      from  1524abd8bf12d82e1fb0063585fc9a465fc7bf9c (commit)

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


- Log -----------------------------------------------------------------
commit 045151b767c62ac1343e86cb3886107226e73fda
Author: Günther Deschner <gd at samba.org>
Date:   Thu Mar 19 12:53:01 2009 +0100

    s3-spoolss: pure comsetics.
    
    sorry, I just need to do that.
    
    Guenther

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

Summary of changes:
 source3/include/proto.h             |    5 +-
 source3/rpc_server/srv_spoolss_nt.c |  259 +++++++++++++++++------------------
 source3/rpcclient/cmd_spoolss.c     |   32 ++--
 source3/utils/net_rpc_printer.c     |   82 ++++++------
 4 files changed, 188 insertions(+), 190 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/proto.h b/source3/include/proto.h
index d815448..9bffa4d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5931,8 +5931,9 @@ void reset_all_printerdata(struct messaging_context *msg,
 bool convert_devicemode(const char *printername,
 			const struct spoolss_DeviceMode *devmode,
 			NT_DEVICEMODE **pp_nt_devmode);
-WERROR set_printer_dataex( NT_PRINTER_INFO_LEVEL *printer, const char *key, const char *value,
-                                  uint32 type, uint8 *data, int real_len  );
+WERROR set_printer_dataex(NT_PRINTER_INFO_LEVEL *printer,
+			  const char *key, const char *value,
+			  uint32_t type, uint8_t *data, int real_len);
 void spoolss_notify_server_name(int snum,
 				       struct spoolss_Notify *data,
 				       print_queue_struct *queue,
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index ab15e5c..b66f48a 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -66,13 +66,13 @@ typedef struct _counter_printer_0 {
 	struct _counter_printer_0 *prev;
 
 	int snum;
-	uint32 counter;
+	uint32_t counter;
 } counter_printer_0;
 
 static counter_printer_0 *counter_list;
 
 static struct rpc_pipe_client *notify_cli_pipe; /* print notify back-channel pipe handle*/
-static uint32 smb_connections=0;
+static uint32_t smb_connections = 0;
 
 
 /* in printing/nt_printing.c */
@@ -186,7 +186,7 @@ static void srv_spoolss_replycloseprinter(int snum, struct policy_handle *handle
         	/* Tell the connections db we're no longer interested in
 		 * printer notify messages. */
 
-		register_message_flags( False, FLAG_MSG_PRINT_NOTIFY );
+		register_message_flags(false, FLAG_MSG_PRINT_NOTIFY);
 	}
 
 	smb_connections--;
@@ -198,7 +198,7 @@ static void srv_spoolss_replycloseprinter(int snum, struct policy_handle *handle
 
 static int printer_entry_destructor(Printer_entry *Printer)
 {
-	if (Printer->notify.client_connected==True) {
+	if (Printer->notify.client_connected == true) {
 		int snum = -1;
 
 		if ( Printer->printer_type == SPLHND_SERVER) {
@@ -217,7 +217,7 @@ static int printer_entry_destructor(Printer_entry *Printer)
 	Printer->notify.localmachine[0]='\0';
 	Printer->notify.printerlocal=0;
 	TALLOC_FREE(Printer->notify.option);
-	Printer->notify.client_connected=False;
+	Printer->notify.client_connected = false;
 
 	free_nt_devicemode( &Printer->nt_devmode );
 	free_a_printer( &Printer->printer_info, 2 );
@@ -255,12 +255,12 @@ static bool close_printer_handle(pipes_struct *p, struct policy_handle *hnd)
 	if (!Printer) {
 		DEBUG(2,("close_printer_handle: Invalid handle (%s:%u:%u)\n",
 			OUR_HANDLE(hnd)));
-		return False;
+		return false;
 	}
 
 	close_policy_hnd(p, hnd);
 
-	return True;
+	return true;
 }
 
 /****************************************************************************
@@ -273,7 +273,7 @@ WERROR delete_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *sh
 	char *command = NULL;
 	int ret;
 	SE_PRIV se_printop = SE_PRINT_OPERATOR;
-	bool is_print_op = False;
+	bool is_print_op = false;
 
 	/* can't fail if we don't try */
 
@@ -315,7 +315,7 @@ WERROR delete_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *sh
 		return WERR_BADFID; /* What to return here? */
 
 	/* go ahead and re-read the services immediately */
-	reload_services( False );
+	reload_services(false);
 
 	if ( lp_servicenumber( sharename )  < 0 )
 		return WERR_ACCESS_DENIED;
@@ -373,7 +373,7 @@ static bool get_printer_snum(pipes_struct *p, struct policy_handle *hnd,
 	if (!Printer) {
 		DEBUG(2,("get_printer_snum: Invalid handle (%s:%u:%u)\n",
 			OUR_HANDLE(hnd)));
-		return False;
+		return false;
 	}
 
 	switch (Printer->printer_type) {
@@ -382,9 +382,9 @@ static bool get_printer_snum(pipes_struct *p, struct policy_handle *hnd,
 			*number = print_queue_snum(Printer->sharename);
 			return (*number != -1);
 		case SPLHND_SERVER:
-			return False;
+			return false;
 		default:
-			return False;
+			return false;
 	}
 }
 
@@ -399,7 +399,7 @@ static bool set_printer_hnd_printertype(Printer_entry *Printer, char *handlename
 
 	if ( strlen(handlename) < 3 ) {
 		DEBUGADD(4,("A print server must have at least 1 char ! %s\n", handlename));
-		return False;
+		return false;
 	}
 
 	/* it's a print server */
@@ -413,7 +413,7 @@ static bool set_printer_hnd_printertype(Printer_entry *Printer, char *handlename
 		Printer->printer_type = SPLHND_PRINTER;
 	}
 
-	return True;
+	return true;
 }
 
 /****************************************************************************
@@ -430,7 +430,7 @@ static bool set_printer_hnd_name(Printer_entry *Printer, char *handlename)
 	char *aprinter, *printername;
 	const char *servername;
 	fstring sname;
-	bool found=False;
+	bool found = false;
 	NT_PRINTER_INFO_LEVEL *printer = NULL;
 	WERROR result;
 
@@ -450,15 +450,15 @@ static bool set_printer_hnd_name(Printer_entry *Printer, char *handlename)
 	/* save the servername to fill in replies on this handle */
 
 	if ( !is_myname_or_ipaddr( servername ) )
-		return False;
+		return false;
 
 	fstrcpy( Printer->servername, servername );
 
 	if ( Printer->printer_type == SPLHND_SERVER )
-		return True;
+		return true;
 
 	if ( Printer->printer_type != SPLHND_PRINTER )
-		return False;
+		return false;
 
 	DEBUGADD(5, ("searching for [%s]\n", aprinter ));
 
@@ -467,12 +467,12 @@ static bool set_printer_hnd_name(Printer_entry *Printer, char *handlename)
 	if ( strequal( aprinter, SPL_XCV_MONITOR_TCPMON ) ) {
 		Printer->printer_type = SPLHND_PORTMON_TCP;
 		fstrcpy(sname, SPL_XCV_MONITOR_TCPMON);
-		found = True;
+		found = true;
 	}
 	else if ( strequal( aprinter, SPL_XCV_MONITOR_LOCALMON ) ) {
 		Printer->printer_type = SPLHND_PORTMON_LOCAL;
 		fstrcpy(sname, SPL_XCV_MONITOR_LOCALMON);
-		found = True;
+		found = true;
 	}
 
 	/* Search all sharenames first as this is easier than pulling
@@ -490,7 +490,7 @@ static bool set_printer_hnd_name(Printer_entry *Printer, char *handlename)
 
 		fstrcpy(sname, lp_servicename(snum));
 		if ( strequal( aprinter, sname ) ) {
-			found = True;
+			found = true;
 			break;
 		}
 
@@ -528,7 +528,7 @@ static bool set_printer_hnd_name(Printer_entry *Printer, char *handlename)
 
 		if ( strequal(printername, aprinter) ) {
 			free_a_printer( &printer, 2);
-			found = True;
+			found = true;
 			break;
 		}
 
@@ -541,14 +541,14 @@ static bool set_printer_hnd_name(Printer_entry *Printer, char *handlename)
 
 	if ( !found ) {
 		DEBUGADD(4,("Printer not found\n"));
-		return False;
+		return false;
 	}
 
 	DEBUGADD(4,("set_printer_hnd_name: Printer found: %s -> %s\n", aprinter, sname));
 
 	fstrcpy(Printer->sharename, sname);
 
-	return True;
+	return true;
 }
 
 /****************************************************************************
@@ -570,7 +570,7 @@ static bool open_printer_hnd(pipes_struct *p, struct policy_handle *hnd,
 
 	if (!create_policy_hnd(p, hnd, new_printer)) {
 		TALLOC_FREE(new_printer);
-		return False;
+		return false;
 	}
 
 	/* Add to the internal list. */
@@ -580,19 +580,19 @@ static bool open_printer_hnd(pipes_struct *p, struct policy_handle *hnd,
 
 	if (!set_printer_hnd_printertype(new_printer, name)) {
 		close_printer_handle(p, hnd);
-		return False;
+		return false;
 	}
 
 	if (!set_printer_hnd_name(new_printer, name)) {
 		close_printer_handle(p, hnd);
-		return False;
+		return false;
 	}
 
 	new_printer->access_granted = access_granted;
 
 	DEBUG(5, ("%d printer handles active\n", (int)p->pipe_handles->count ));
 
-	return True;
+	return true;
 }
 
 /***************************************************************************
@@ -600,17 +600,17 @@ static bool open_printer_hnd(pipes_struct *p, struct policy_handle *hnd,
  given by (notify_type, notify_field).
  **************************************************************************/
 
-static bool is_monitoring_event_flags(uint32 flags, uint16 notify_type,
-				      uint16 notify_field)
+static bool is_monitoring_event_flags(uint32_t flags, uint16_t notify_type,
+				      uint16_t notify_field)
 {
-	return True;
+	return true;
 }
 
-static bool is_monitoring_event(Printer_entry *p, uint16 notify_type,
-				uint16 notify_field)
+static bool is_monitoring_event(Printer_entry *p, uint16_t notify_type,
+				uint16_t notify_field)
 {
 	struct spoolss_NotifyOption *option = p->notify.option;
-	uint32 i, j;
+	uint32_t i, j;
 
 	/*
 	 * Flags should always be zero when the change notify
@@ -620,7 +620,7 @@ static bool is_monitoring_event(Printer_entry *p, uint16 notify_type,
 	 */
 
 	if (!option) {
-		return False;
+		return false;
 	}
 
 	if (p->notify.flags)
@@ -638,7 +638,7 @@ static bool is_monitoring_event(Printer_entry *p, uint16 notify_type,
 
 		for (j = 0; j < option->types[i].count; j++) {
 			if (option->types[i].fields[j].field == notify_field) {
-				return True;
+				return true;
 			}
 		}
 	}
@@ -646,7 +646,7 @@ static bool is_monitoring_event(Printer_entry *p, uint16 notify_type,
 	DEBUG(10, ("Open handle for \\\\%s\\%s is not monitoring 0x%02x/0x%02x\n",
 		   p->servername, p->sharename, notify_type, notify_field));
 
-	return False;
+	return false;
 }
 
 #define SETUP_SPOOLSS_NOTIFY_DATA_INTEGER(_data, _integer) \
@@ -849,7 +849,7 @@ static TALLOC_CTX* notify_ctr_getctx( SPOOLSS_NOTIFY_MSG_CTR *ctr )
 /***********************************************************************
  **********************************************************************/
 
-static SPOOLSS_NOTIFY_MSG_GROUP* notify_ctr_getgroup( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx )
+static SPOOLSS_NOTIFY_MSG_GROUP* notify_ctr_getgroup( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32_t idx )
 {
 	if ( !ctr || !ctr->msg_groups )
 		return NULL;
@@ -940,7 +940,7 @@ static int notify_msg_ctr_addmsg( SPOOLSS_NOTIFY_MSG_CTR *ctr, SPOOLSS_NOTIFY_MS
  back registered
  **********************************************************************/
 
-static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx )
+static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32_t idx )
 {
 	Printer_entry 		 *p;
 	TALLOC_CTX		 *mem_ctx = notify_ctr_getctx( ctr );
@@ -1113,23 +1113,23 @@ done:
 static bool notify2_unpack_msg( SPOOLSS_NOTIFY_MSG *msg, struct timeval *tv, void *buf, size_t len )
 {
 
-	uint32 tv_sec, tv_usec;
+	uint32_t tv_sec, tv_usec;
 	size_t offset = 0;
 
 	/* Unpack message */
 
-	offset += tdb_unpack((uint8 *)buf + offset, len - offset, "f",
+	offset += tdb_unpack((uint8_t *)buf + offset, len - offset, "f",
 			     msg->printer);
 
-	offset += tdb_unpack((uint8 *)buf + offset, len - offset, "ddddddd",
+	offset += tdb_unpack((uint8_t *)buf + offset, len - offset, "ddddddd",
 				&tv_sec, &tv_usec,
 				&msg->type, &msg->field, &msg->id, &msg->len, &msg->flags);
 
 	if (msg->len == 0)
-		tdb_unpack((uint8 *)buf + offset, len - offset, "dd",
+		tdb_unpack((uint8_t *)buf + offset, len - offset, "dd",
 			   &msg->notify.value[0], &msg->notify.value[1]);
 	else
-		tdb_unpack((uint8 *)buf + offset, len - offset, "B",
+		tdb_unpack((uint8_t *)buf + offset, len - offset, "B",
 			   &msg->len, &msg->notify.data);
 
 	DEBUG(3, ("notify2_unpack_msg: got NOTIFY2 message for printer %s, jobid %u type %d, field 0x%02x, flags 0x%04x\n",
@@ -1142,9 +1142,9 @@ static bool notify2_unpack_msg( SPOOLSS_NOTIFY_MSG *msg, struct timeval *tv, voi
 		DEBUG(3, ("notify2_unpack_msg: value1 = %d, value2 = %d\n", msg->notify.value[0],
 			  msg->notify.value[1]));
 	else
-		dump_data(3, (uint8 *)msg->notify.data, msg->len);
+		dump_data(3, (uint8_t *)msg->notify.data, msg->len);
 
-	return True;
+	return true;
 }
 
 /********************************************************************
@@ -1233,7 +1233,8 @@ static void receive_notify2_message_list(struct messaging_context *msg,
 
 	/* cleanup */
 
-	DEBUG(10,("receive_notify2_message_list: processed %u messages\n", (uint32)msg_count ));
+	DEBUG(10,("receive_notify2_message_list: processed %u messages\n",
+		(uint32_t)msg_count ));
 
 	notify_msg_ctr_destroy( &messages );
 
@@ -1251,16 +1252,16 @@ static bool srv_spoolss_drv_upgrade_printer(char* drivername)
 	int len = strlen(drivername);
 
 	if (!len)
-		return False;
+		return false;
 
 	DEBUG(10,("srv_spoolss_drv_upgrade_printer: Sending message about driver upgrade [%s]\n",
 		drivername));
 
 	messaging_send_buf(smbd_messaging_context(), procid_self(),
 			   MSG_PRINTER_DRVUPGRADE,
-			   (uint8 *)drivername, len+1);
+			   (uint8_t *)drivername, len+1);
 
-	return True;
+	return true;
 }
 
 /**********************************************************************
@@ -1328,7 +1329,7 @@ void update_monitored_printq_cache( void )
 	int snum;
 
 	/* loop through all printers and update the cache where
-	   client_connected == True */
+	   client_connected == true */
 	while ( printer )
 	{
 		if ( (printer->printer_type == SPLHND_PRINTER)
@@ -1354,16 +1355,16 @@ static bool srv_spoolss_reset_printerdata(char* drivername)
 	int len = strlen(drivername);
 
 	if (!len)
-		return False;
+		return false;
 
 	DEBUG(10,("srv_spoolss_reset_printerdata: Sending message about resetting printerdata [%s]\n",
 		drivername));
 
 	messaging_send_buf(smbd_messaging_context(), procid_self(),
 			   MSG_PRINTERDATA_INIT_RESET,
-			   (uint8 *)drivername, len+1);
+			   (uint8_t *)drivername, len+1);
 
-	return True;
+	return true;
 }
 
 /**********************************************************************
@@ -1527,7 +1528,7 @@ bool convert_devicemode(const char *printername,
 	if ((devmode->__driverextra_length != 0) && (devmode->driverextra_data.data != NULL)) {
 		SAFE_FREE(nt_devmode->nt_dev_private);
 		nt_devmode->driverextra = devmode->__driverextra_length;
-		if((nt_devmode->nt_dev_private=SMB_MALLOC_ARRAY(uint8, nt_devmode->driverextra)) == NULL)
+		if((nt_devmode->nt_dev_private = SMB_MALLOC_ARRAY(uint8_t, nt_devmode->driverextra)) == NULL)
 			return false;
 		memcpy(nt_devmode->nt_dev_private, devmode->driverextra_data.data, nt_devmode->driverextra);
 	}
@@ -2017,7 +2018,7 @@ static WERROR _spoolss_enddocprinter_internal(pipes_struct *p,
 	if (!get_printer_snum(p, handle, &snum, NULL))
 		return WERR_BADFID;
 
-	Printer->document_started=False;
+	Printer->document_started = false;
 	print_job_end(snum, Printer->jobid,NORMAL_CLOSE);
 	/* error codes unhandled so far ... */
 
@@ -2064,7 +2065,7 @@ WERROR _spoolss_DeletePrinter(pipes_struct *p,
 
 	result = delete_printer_handle(p, r->in.handle);
 
-	update_c_setprinter(False);
+	update_c_setprinter(false);
 
 	return result;
 }
@@ -2170,7 +2171,7 @@ WERROR _spoolss_DeletePrinterDriver(pipes_struct *p,
 			/* remove the Win2k driver first*/
 
 			status_win2k = delete_printer_driver(
-				p, info_win2k.info_3, 3, False );
+				p, info_win2k.info_3, 3, false);
 			free_a_printer_driver( info_win2k, 3 );
 
 			/* this should not have failed---if it did, report to client */
@@ -2182,7 +2183,7 @@ WERROR _spoolss_DeletePrinterDriver(pipes_struct *p,
 		}
 	}
 
-	status = delete_printer_driver(p, info.info_3, version, False);
+	status = delete_printer_driver(p, info.info_3, version, false);
 
 	/* if at least one of the deletes succeeded return OK */
 
@@ -2207,7 +2208,6 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
 	NT_PRINTER_DRIVER_INFO_LEVEL	info;
 	NT_PRINTER_DRIVER_INFO_LEVEL	info_win2k;
 	int				version;
-	uint32_t			flags = r->in.delete_flags;
 	bool				delete_files;
 	WERROR				status;
 	WERROR				status_win2k = WERR_ACCESS_DENIED;
@@ -2234,7 +2234,7 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
 		return WERR_INVALID_ENVIRONMENT;
 	}
 
-	if ( flags & DPD_DELETE_SPECIFIC_VERSION )
+	if (r->in.delete_flags & DPD_DELETE_SPECIFIC_VERSION)
 		version = r->in.version;
 
 	ZERO_STRUCT(info);
@@ -2250,7 +2250,7 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
 		 * then we've failed
 		 */
 
-		if ( (flags&DPD_DELETE_SPECIFIC_VERSION) || (version !=2) )
+		if ( (r->in.delete_flags & DPD_DELETE_SPECIFIC_VERSION) || (version !=2) )
 			goto done;
 
 		/* try for Win2k driver if "Windows NT x86" */
@@ -2279,11 +2279,11 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,
 	 * Refer to MSDN docs on DeletePrinterDriverEx() for details.
 	 */
 
-	delete_files = flags & (DPD_DELETE_ALL_FILES|DPD_DELETE_UNUSED_FILES);
+	delete_files = r->in.delete_flags & (DPD_DELETE_ALL_FILES|DPD_DELETE_UNUSED_FILES);
 
 	/* fail if any files are in use and DPD_DELETE_ALL_FILES is set */
 
-	if ( delete_files && printer_driver_files_in_use(info.info_3) & (flags&DPD_DELETE_ALL_FILES) ) {
+	if ( delete_files && printer_driver_files_in_use(info.info_3) & (r->in.delete_flags & DPD_DELETE_ALL_FILES) ) {
 		/* no idea of the correct error here */
 		status = WERR_ACCESS_DENIED;
 		goto done;
@@ -2292,11 +2292,11 @@ WERROR _spoolss_DeletePrinterDriverEx(pipes_struct *p,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list