summaryrefslogtreecommitdiffstats
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2001-05-17 18:57:25 +0000
committerGerald Carter <jerry@samba.org>2001-05-17 18:57:25 +0000
commit013b454d1a2858b6f3b48e7b73f549ec7540d189 (patch)
tree5f7c5a9393c994a06c50bf69ca9177a94f30c513 /source3/rpcclient
parent8910320b85a01f0994ae6cb99d3e460f92f5f93b (diff)
downloadsamba-013b454d1a2858b6f3b48e7b73f549ec7540d189.tar.gz
samba-013b454d1a2858b6f3b48e7b73f549ec7540d189.tar.xz
samba-013b454d1a2858b6f3b48e7b73f549ec7540d189.zip
merge from 2.2 DeletePrinterDriver() server side stud coming
in separate commit after I get it working in 2.2. (This used to be commit 09506ac0e64b84d73e3b8fdd4942fa52dba6060f)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_spoolss.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index aeb4ce3e20e..fc1ac494307 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -1310,12 +1310,60 @@ done:
}
+static uint32 cmd_spoolss_deletedriver (struct cli_state *cli, int argc, char **argv)
+{
+ uint32 result = NT_STATUS_UNSUCCESSFUL;
+ fstring servername;
+ TALLOC_CTX *mem_ctx = NULL;
+
+ /* parse the command arguements */
+ if (argc != 3)
+ {
+ printf ("Usage: %s <arch> <driver>\n", argv[0]);
+ return NT_STATUS_NOPROBLEMO;
+ }
+
+ if (!(mem_ctx=talloc_init()))
+ {
+ DEBUG(0,("cmd_spoolss_deletedriver: talloc_init returned NULL!\n"));
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ slprintf (servername, sizeof(fstring)-1, "\\\\%s", cli->desthost);
+ strupper (servername);
+
+ /* Initialise RPC connection */
+ if (!cli_nt_session_open (cli, PIPE_SPOOLSS))
+ {
+ fprintf (stderr, "Could not initialize spoolss pipe!\n");
+ return NT_STATUS_UNSUCCESSFUL;
+ }
+
+ /* make the call to remove the driver */
+ if ((result = cli_spoolss_deleteprinterdriver(cli, mem_ctx, argv[1], argv[2])) != NT_STATUS_NO_PROBLEMO)
+ {
+ printf ("Failed to remove %s driver %s!\n", argv[1], argv[2]);
+ goto done;;
+ }
+ printf ("%s driver %s removed.\n", argv[1], argv[2]);
+
+
+done:
+ /* cleanup */
+ cli_nt_session_close (cli);
+ talloc_destroy(mem_ctx);
+
+ return result;
+}
+
+
/* List of commands exported by this module */
struct cmd_set spoolss_commands[] = {
{ "SPOOLSS", NULL, "" },
{ "adddriver", cmd_spoolss_addprinterdriver, "Add a print driver" },
{ "addprinter", cmd_spoolss_addprinterex, "Add a printer" },
+ { "deldriver", cmd_spoolss_deletedriver, "Delete a printer driver" },
{ "enumdata", cmd_spoolss_not_implemented, "Enumerate printer data (*)" },
{ "enumjobs", cmd_spoolss_not_implemented, "Enumerate print jobs (*)" },
{ "enumports", cmd_spoolss_enum_ports, "Enumerate printer ports" },