diff options
author | Gerald Carter <jerry@samba.org> | 2001-05-17 18:57:25 +0000 |
---|---|---|
committer | Gerald Carter <jerry@samba.org> | 2001-05-17 18:57:25 +0000 |
commit | 09506ac0e64b84d73e3b8fdd4942fa52dba6060f (patch) | |
tree | 8c2a9a5acdc933dd5ee709def03fc78c4d177707 /source/rpcclient | |
parent | f2bb3c50f3481689521607f79ba2bfd696330380 (diff) | |
download | samba-09506ac0e64b84d73e3b8fdd4942fa52dba6060f.tar.gz samba-09506ac0e64b84d73e3b8fdd4942fa52dba6060f.tar.xz samba-09506ac0e64b84d73e3b8fdd4942fa52dba6060f.zip |
merge from 2.2 DeletePrinterDriver() server side stud coming
in separate commit after I get it working in 2.2.
Diffstat (limited to 'source/rpcclient')
-rw-r--r-- | source/rpcclient/cmd_spoolss.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/source/rpcclient/cmd_spoolss.c b/source/rpcclient/cmd_spoolss.c index aeb4ce3e20e..fc1ac494307 100644 --- a/source/rpcclient/cmd_spoolss.c +++ b/source/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" }, |