mirror of
https://github.com/samba-team/samba.git
synced 2025-11-11 00:23:51 +03:00
r3645: Allow deldriverex in rpcclient to delete drivers for a specific
architecture and a specific version. Guenther
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
dfa910e4ab
commit
a24df09386
@@ -1089,7 +1089,7 @@ WERROR cli_spoolss_addprinterex (struct cli_state *cli, TALLOC_CTX *mem_ctx,
|
||||
*/
|
||||
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 @@ WERROR cli_spoolss_deleteprinterdriverex(struct cli_state *cli,
|
||||
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 */
|
||||
|
||||
|
||||
@@ -1225,7 +1225,8 @@ BOOL make_spoolss_q_deleteprinterdriverex( TALLOC_CTX *mem_ctx,
|
||||
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"));
|
||||
|
||||
@@ -1238,6 +1239,11 @@ BOOL make_spoolss_q_deleteprinterdriverex( TALLOC_CTX *mem_ctx,
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -1551,7 +1551,6 @@ static WERROR cmd_spoolss_deletedriverex(struct cli_state *cli,
|
||||
{
|
||||
WERROR result, ret = WERR_UNKNOWN_PRINTER_DRIVER;
|
||||
|
||||
fstring servername;
|
||||
int i;
|
||||
int vers = -1;
|
||||
|
||||
@@ -1569,13 +1568,10 @@ static WERROR cmd_spoolss_deletedriverex(struct cli_state *cli,
|
||||
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 @@ static WERROR cmd_spoolss_deletedriverex(struct cli_state *cli,
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user