svn commit: samba r3645 - branches/SAMBA_3_0/source/rpc_client branches/SAMBA_3_0/source/rpc_parse branches/SAMBA_3_0/source/rpcclient trunk/source/rpc_client trunk/source/rpc_parse trunk/source/rpcclient

gd at samba.org gd at samba.org
Wed Nov 10 00:53:36 GMT 2004


Author: gd
Date: 2004-11-10 00:53:35 +0000 (Wed, 10 Nov 2004)
New Revision: 3645

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3645

Log:
Allow deldriverex in rpcclient to delete drivers for a specific
architecture and a specific version.

Guenther

Modified:
   branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c
   branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c
   branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c
   trunk/source/rpc_client/cli_spoolss.c
   trunk/source/rpc_parse/parse_spoolss.c
   trunk/source/rpcclient/cmd_spoolss.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c	2004-11-09 23:55:04 UTC (rev 3644)
+++ branches/SAMBA_3_0/source/rpc_client/cli_spoolss.c	2004-11-10 00:53:35 UTC (rev 3645)
@@ -1089,7 +1089,7 @@
  */
 WERROR cli_spoolss_deleteprinterdriverex(struct cli_state *cli, 
                                          TALLOC_CTX *mem_ctx, const char *arch,
-                                         const char *driver)
+                                         const char *driver, uint32 version)
 {
 	prs_struct    qbuf, rbuf;
 	SPOOL_Q_DELETEPRINTERDRIVEREX q;
@@ -1109,7 +1109,7 @@
 	strupper_m(server);
 
 	/* Write the request */
-	make_spoolss_q_deleteprinterdriverex(mem_ctx, &q, server, arch, driver);
+	make_spoolss_q_deleteprinterdriverex(mem_ctx, &q, server, arch, driver, version);
 
 	/* Marshall data and send request */
 

Modified: branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c	2004-11-09 23:55:04 UTC (rev 3644)
+++ branches/SAMBA_3_0/source/rpc_parse/parse_spoolss.c	2004-11-10 00:53:35 UTC (rev 3645)
@@ -1225,7 +1225,8 @@
                                            SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, 
                                            const char *server,
                                            const char* arch, 
-                                           const char* driver )
+                                           const char* driver,
+                                           uint32 version)
 {
 	DEBUG(5,("make_spoolss_q_deleteprinterdriverex\n"));
  
@@ -1237,7 +1238,12 @@
 	init_unistr2(&q_u->server, server, UNI_STR_TERMINATE);
 	init_unistr2(&q_u->arch, arch, UNI_STR_TERMINATE);
 	init_unistr2(&q_u->driver, driver, UNI_STR_TERMINATE);
- 
+
+	if (version >= 0) { 
+		q_u->delete_flags |= DPD_DELETE_SPECIFIC_VERSION;
+		q_u->version = version;
+	}
+
 	return True;
 }
 

Modified: branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c
===================================================================
--- branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c	2004-11-09 23:55:04 UTC (rev 3644)
+++ branches/SAMBA_3_0/source/rpcclient/cmd_spoolss.c	2004-11-10 00:53:35 UTC (rev 3645)
@@ -1551,7 +1551,6 @@
 {
 	WERROR result, ret = WERR_UNKNOWN_PRINTER_DRIVER;
  
-	fstring   servername;
 	int   i;
 	int vers = -1;
  
@@ -1569,13 +1568,10 @@
 		vers = atoi (argv[3]);
  
  
-	slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-	strupper_m(servername);
- 
 	/* delete the driver for all architectures */
 	for (i=0; archi_table[i].long_archi; i++) {
 
-		if (arch &&  strcmp ( archi_table[i].long_archi, arch)) 
+		if (arch &&  !strequal( archi_table[i].long_archi, arch)) 
 			continue;
 
 		if (vers >= 0 && archi_table[i].version != vers)
@@ -1583,19 +1579,19 @@
 
 		/* make the call to remove the driver */
 		result = cli_spoolss_deleteprinterdriverex(
-			cli, mem_ctx, archi_table[i].long_archi, argv[1]);
+			cli, mem_ctx, archi_table[i].long_archi, argv[1], archi_table[i].version); 
 
 		if ( !W_ERROR_IS_OK(result) ) 
 		{
 			if ( !W_ERROR_EQUAL(result, WERR_UNKNOWN_PRINTER_DRIVER) ) {
-				printf ("Failed to remove driver %s for arch [%s] - error 0x%x!\n", 
-					argv[1], archi_table[i].long_archi, W_ERROR_V(result));
+				printf ("Failed to remove driver %s for arch [%s] (version: %d): %s\n", 
+					argv[1], archi_table[i].long_archi, archi_table[i].version, dos_errstr(result));
 			}
 		} 
 		else 
 		{
-			printf ("Driver %s and files removed for arch [%s].\n", argv[1], 
-			archi_table[i].long_archi);
+			printf ("Driver %s and files removed for arch [%s] (version: %d).\n", argv[1], 
+			archi_table[i].long_archi, archi_table[i].version);
 			ret = WERR_OK;
 		}
 	}
@@ -2464,7 +2460,7 @@
 	{ "adddriver",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_addprinterdriver,	PI_SPOOLSS, "Add a print driver",                  "" },
 	{ "addprinter",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_addprinterex,	PI_SPOOLSS, "Add a printer",                       "" },
 	{ "deldriver",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_deletedriver,	PI_SPOOLSS, "Delete a printer driver",             "" },
-	{ "deldriverex",	RPC_RTYPE_WERROR, NULL, cmd_spoolss_deletedriverex, PI_SPOOLSS, "Delete a printer driver with files",      "" },
+	{ "deldriverex",	RPC_RTYPE_WERROR, NULL, cmd_spoolss_deletedriverex,	PI_SPOOLSS, "Delete a printer driver with files",  "" },
 	{ "enumdata",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_data,		PI_SPOOLSS, "Enumerate printer data",              "" },
 	{ "enumdataex",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_data_ex,	PI_SPOOLSS, "Enumerate printer data for a key",    "" },
 	{ "enumkey",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_printerkey,	PI_SPOOLSS, "Enumerate printer keys",              "" },
@@ -2486,7 +2482,7 @@
 	{ "deleteform",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_deleteform,         PI_SPOOLSS, "Delete form",                         "" },
 	{ "enumforms",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_forms,         PI_SPOOLSS, "Enumerate forms",                     "" },
 	{ "setprinter",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprinter,         PI_SPOOLSS, "Set printer comment",                 "" },
-	{ "setprintername",	RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprintername,         PI_SPOOLSS, "Set printername",                 "" },
+	{ "setprintername",	RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprintername,	PI_SPOOLSS, "Set printername",                 "" },
 	{ "setprinterdata",	RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprinterdata,     PI_SPOOLSS, "Set REG_SZ printer data",             "" },
 	{ "rffpcnex",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_rffpcnex,           PI_SPOOLSS, "Rffpcnex test", "" },
 

Modified: trunk/source/rpc_client/cli_spoolss.c
===================================================================
--- trunk/source/rpc_client/cli_spoolss.c	2004-11-09 23:55:04 UTC (rev 3644)
+++ trunk/source/rpc_client/cli_spoolss.c	2004-11-10 00:53:35 UTC (rev 3645)
@@ -1089,7 +1089,7 @@
  */
 WERROR cli_spoolss_deleteprinterdriverex(struct cli_state *cli, 
                                          TALLOC_CTX *mem_ctx, const char *arch,
-                                         const char *driver)
+                                         const char *driver, uint32 version)
 {
 	prs_struct    qbuf, rbuf;
 	SPOOL_Q_DELETEPRINTERDRIVEREX q;
@@ -1109,7 +1109,7 @@
 	strupper_m(server);
 
 	/* Write the request */
-	make_spoolss_q_deleteprinterdriverex(mem_ctx, &q, server, arch, driver);
+	make_spoolss_q_deleteprinterdriverex(mem_ctx, &q, server, arch, driver, version);
 
 	/* Marshall data and send request */
 

Modified: trunk/source/rpc_parse/parse_spoolss.c
===================================================================
--- trunk/source/rpc_parse/parse_spoolss.c	2004-11-09 23:55:04 UTC (rev 3644)
+++ trunk/source/rpc_parse/parse_spoolss.c	2004-11-10 00:53:35 UTC (rev 3645)
@@ -1225,7 +1225,8 @@
                                            SPOOL_Q_DELETEPRINTERDRIVEREX *q_u, 
                                            const char *server,
                                            const char* arch, 
-                                           const char* driver )
+                                           const char* driver,
+                                           uint32 version)
 {
 	DEBUG(5,("make_spoolss_q_deleteprinterdriverex\n"));
  
@@ -1237,7 +1238,12 @@
 	init_unistr2(&q_u->server, server, UNI_STR_TERMINATE);
 	init_unistr2(&q_u->arch, arch, UNI_STR_TERMINATE);
 	init_unistr2(&q_u->driver, driver, UNI_STR_TERMINATE);
- 
+
+	if (version >= 0) { 
+		q_u->delete_flags |= DPD_DELETE_SPECIFIC_VERSION;
+		q_u->version = version;
+	}
+
 	return True;
 }
 

Modified: trunk/source/rpcclient/cmd_spoolss.c
===================================================================
--- trunk/source/rpcclient/cmd_spoolss.c	2004-11-09 23:55:04 UTC (rev 3644)
+++ trunk/source/rpcclient/cmd_spoolss.c	2004-11-10 00:53:35 UTC (rev 3645)
@@ -1551,7 +1551,6 @@
 {
 	WERROR result, ret = WERR_UNKNOWN_PRINTER_DRIVER;
  
-	fstring   servername;
 	int   i;
 	int vers = -1;
  
@@ -1569,13 +1568,10 @@
 		vers = atoi (argv[3]);
  
  
-	slprintf(servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
-	strupper_m(servername);
- 
 	/* delete the driver for all architectures */
 	for (i=0; archi_table[i].long_archi; i++) {
 
-		if (arch &&  strcmp ( archi_table[i].long_archi, arch)) 
+		if (arch &&  !strequal( archi_table[i].long_archi, arch)) 
 			continue;
 
 		if (vers >= 0 && archi_table[i].version != vers)
@@ -1583,19 +1579,19 @@
 
 		/* make the call to remove the driver */
 		result = cli_spoolss_deleteprinterdriverex(
-			cli, mem_ctx, archi_table[i].long_archi, argv[1]);
+			cli, mem_ctx, archi_table[i].long_archi, argv[1], archi_table[i].version); 
 
 		if ( !W_ERROR_IS_OK(result) ) 
 		{
 			if ( !W_ERROR_EQUAL(result, WERR_UNKNOWN_PRINTER_DRIVER) ) {
-				printf ("Failed to remove driver %s for arch [%s] - error 0x%x!\n", 
-					argv[1], archi_table[i].long_archi, W_ERROR_V(result));
+				printf ("Failed to remove driver %s for arch [%s] (version: %d): %s\n", 
+					argv[1], archi_table[i].long_archi, archi_table[i].version, dos_errstr(result));
 			}
 		} 
 		else 
 		{
-			printf ("Driver %s and files removed for arch [%s].\n", argv[1], 
-			archi_table[i].long_archi);
+			printf ("Driver %s and files removed for arch [%s] (version: %d).\n", argv[1], 
+			archi_table[i].long_archi, archi_table[i].version);
 			ret = WERR_OK;
 		}
 	}
@@ -2464,7 +2460,7 @@
 	{ "adddriver",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_addprinterdriver,	PI_SPOOLSS, "Add a print driver",                  "" },
 	{ "addprinter",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_addprinterex,	PI_SPOOLSS, "Add a printer",                       "" },
 	{ "deldriver",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_deletedriver,	PI_SPOOLSS, "Delete a printer driver",             "" },
-	{ "deldriverex",	RPC_RTYPE_WERROR, NULL, cmd_spoolss_deletedriverex, PI_SPOOLSS, "Delete a printer driver with files",      "" },
+	{ "deldriverex",	RPC_RTYPE_WERROR, NULL, cmd_spoolss_deletedriverex,	PI_SPOOLSS, "Delete a printer driver with files",  "" },
 	{ "enumdata",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_data,		PI_SPOOLSS, "Enumerate printer data",              "" },
 	{ "enumdataex",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_data_ex,	PI_SPOOLSS, "Enumerate printer data for a key",    "" },
 	{ "enumkey",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_printerkey,	PI_SPOOLSS, "Enumerate printer keys",              "" },
@@ -2486,7 +2482,7 @@
 	{ "deleteform",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_deleteform,         PI_SPOOLSS, "Delete form",                         "" },
 	{ "enumforms",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_forms,         PI_SPOOLSS, "Enumerate forms",                     "" },
 	{ "setprinter",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprinter,         PI_SPOOLSS, "Set printer comment",                 "" },
-	{ "setprintername",	RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprintername,         PI_SPOOLSS, "Set printername",                 "" },
+	{ "setprintername",	RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprintername,	PI_SPOOLSS, "Set printername",                 "" },
 	{ "setprinterdata",	RPC_RTYPE_WERROR, NULL, cmd_spoolss_setprinterdata,     PI_SPOOLSS, "Set REG_SZ printer data",             "" },
 	{ "rffpcnex",		RPC_RTYPE_WERROR, NULL, cmd_spoolss_rffpcnex,           PI_SPOOLSS, "Rffpcnex test", "" },
 



More information about the samba-cvs mailing list