summaryrefslogtreecommitdiff
path: root/source3/rpcclient
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-03-17 05:55:41 +0000
committerTim Potter <tpot@samba.org>2003-03-17 05:55:41 +0000
commit1eae003fefaa8e4e9e131c9d5f2a299cec2b5e55 (patch)
treebdefc7df2e7fac926d5c1402b175428ee985c0ee /source3/rpcclient
parent355bea4b2cd62bdd00bfbb3fba017c62b11ebc95 (diff)
downloadsamba-1eae003fefaa8e4e9e131c9d5f2a299cec2b5e55.tar.gz
samba-1eae003fefaa8e4e9e131c9d5f2a299cec2b5e55.tar.bz2
samba-1eae003fefaa8e4e9e131c9d5f2a299cec2b5e55.zip
Applied waider's patch to return DOS error codes for pipes that
support it. (This used to be commit ac3df9a8051bd105e8e4192d36b3024fdf9f9506)
Diffstat (limited to 'source3/rpcclient')
-rw-r--r--source3/rpcclient/cmd_dfs.c10
-rw-r--r--source3/rpcclient/cmd_ds.c2
-rw-r--r--source3/rpcclient/cmd_lsarpc.c28
-rw-r--r--source3/rpcclient/cmd_netlogon.c10
-rw-r--r--source3/rpcclient/cmd_reg.c4
-rw-r--r--source3/rpcclient/cmd_samr.c36
-rw-r--r--source3/rpcclient/cmd_spoolss.c229
-rw-r--r--source3/rpcclient/cmd_srvsvc.c32
-rw-r--r--source3/rpcclient/rpcclient.c48
-rw-r--r--source3/rpcclient/rpcclient.h10
10 files changed, 217 insertions, 192 deletions
diff --git a/source3/rpcclient/cmd_dfs.c b/source3/rpcclient/cmd_dfs.c
index 715174c824..44e97f9881 100644
--- a/source3/rpcclient/cmd_dfs.c
+++ b/source3/rpcclient/cmd_dfs.c
@@ -227,11 +227,11 @@ struct cmd_set dfs_commands[] = {
{ "DFS" },
- { "dfsexist", cmd_dfs_exist, PI_NETDFS, "Query DFS support", "" },
- { "dfsadd", cmd_dfs_add, PI_NETDFS, "Add a DFS share", "" },
- { "dfsremove", cmd_dfs_remove, PI_NETDFS, "Remove a DFS share", "" },
- { "dfsgetinfo", cmd_dfs_getinfo, PI_NETDFS, "Query DFS share info", "" },
- { "dfsenum", cmd_dfs_enum, PI_NETDFS, "Enumerate dfs shares", "" },
+ { "dfsexist", RPC_RTYPE_NTSTATUS, cmd_dfs_exist, NULL, PI_NETDFS, "Query DFS support", "" },
+ { "dfsadd", RPC_RTYPE_NTSTATUS, cmd_dfs_add, NULL, PI_NETDFS, "Add a DFS share", "" },
+ { "dfsremove", RPC_RTYPE_NTSTATUS, cmd_dfs_remove, NULL, PI_NETDFS, "Remove a DFS share", "" },
+ { "dfsgetinfo",RPC_RTYPE_NTSTATUS, cmd_dfs_getinfo, NULL, PI_NETDFS, "Query DFS share info", "" },
+ { "dfsenum", RPC_RTYPE_NTSTATUS, cmd_dfs_enum, NULL, PI_NETDFS, "Enumerate dfs shares", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_ds.c b/source3/rpcclient/cmd_ds.c
index 9de6d6a9ec..4c2f52e291 100644
--- a/source3/rpcclient/cmd_ds.c
+++ b/source3/rpcclient/cmd_ds.c
@@ -53,7 +53,7 @@ struct cmd_set ds_commands[] = {
{ "LSARPC-DS" },
- { "dsroledominfo", cmd_ds_dsrole_getprimarydominfo, PI_LSARPC_DS, "Get Primary Domain Information", "" },
+ { "dsroledominfo", RPC_RTYPE_NTSTATUS, cmd_ds_dsrole_getprimarydominfo, NULL, PI_LSARPC_DS, "Get Primary Domain Information", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_lsarpc.c b/source3/rpcclient/cmd_lsarpc.c
index fab6a89ed5..808ef50a45 100644
--- a/source3/rpcclient/cmd_lsarpc.c
+++ b/source3/rpcclient/cmd_lsarpc.c
@@ -741,20 +741,20 @@ struct cmd_set lsarpc_commands[] = {
{ "LSARPC" },
- { "lsaquery", cmd_lsa_query_info_policy, PI_LSARPC, "Query info policy", "" },
- { "lookupsids", cmd_lsa_lookup_sids, PI_LSARPC, "Convert SIDs to names", "" },
- { "lookupnames", cmd_lsa_lookup_names, PI_LSARPC, "Convert names to SIDs", "" },
- { "enumtrust", cmd_lsa_enum_trust_dom, PI_LSARPC, "Enumerate trusted domains", "Usage: [preferred max number] [enum context (0)]" },
- { "enumprivs", cmd_lsa_enum_privilege, PI_LSARPC, "Enumerate privileges", "" },
- { "getdispname", cmd_lsa_get_dispname, PI_LSARPC, "Get the privilege name", "" },
- { "lsaenumsid", cmd_lsa_enum_sids, PI_LSARPC, "Enumerate the LSA SIDS", "" },
- { "lsaenumprivsaccount", cmd_lsa_enum_privsaccounts, PI_LSARPC, "Enumerate the privileges of an SID", "" },
- { "lsaenumacctrights", cmd_lsa_enum_acct_rights, PI_LSARPC, "Enumerate the rights of an SID", "" },
- { "lsaenumacctwithright",cmd_lsa_enum_acct_with_right,PI_LSARPC,"Enumerate accounts with a right", "" },
- { "lsaaddacctrights", cmd_lsa_add_acct_rights, PI_LSARPC, "Add rights to an account", "" },
- { "lsaremoveacctrights", cmd_lsa_remove_acct_rights, PI_LSARPC, "Remove rights from an account", "" },
- { "lsalookupprivvalue", cmd_lsa_lookupprivvalue, PI_LSARPC, "Get a privilege value given its name", "" },
- { "lsaquerysecobj", cmd_lsa_query_secobj, PI_LSARPC, "Query LSA security object", "" },
+ { "lsaquery", RPC_RTYPE_NTSTATUS, cmd_lsa_query_info_policy, NULL, PI_LSARPC, "Query info policy", "" },
+ { "lookupsids", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_sids, NULL, PI_LSARPC, "Convert SIDs to names", "" },
+ { "lookupnames", RPC_RTYPE_NTSTATUS, cmd_lsa_lookup_names, NULL, PI_LSARPC, "Convert names to SIDs", "" },
+ { "enumtrust", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_trust_dom, NULL, PI_LSARPC, "Enumerate trusted domains", "Usage: [preferred max number] [enum context (0)]" },
+ { "enumprivs", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_privilege, NULL, PI_LSARPC, "Enumerate privileges", "" },
+ { "getdispname", RPC_RTYPE_NTSTATUS, cmd_lsa_get_dispname, NULL, PI_LSARPC, "Get the privilege name", "" },
+ { "lsaenumsid", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_sids, NULL, PI_LSARPC, "Enumerate the LSA SIDS", "" },
+ { "lsaenumprivsaccount", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_privsaccounts, NULL, PI_LSARPC, "Enumerate the privileges of an SID", "" },
+ { "lsaenumacctrights", RPC_RTYPE_NTSTATUS, cmd_lsa_enum_acct_rights, NULL, PI_LSARPC, "Enumerate the rights of an SID", "" },
+ { "lsaenumacctwithright",RPC_RTYPE_NTSTATUS, cmd_lsa_enum_acct_with_right,NULL, PI_LSARPC,"Enumerate accounts with a right", "" },
+ { "lsaaddacctrights", RPC_RTYPE_NTSTATUS, cmd_lsa_add_acct_rights, NULL, PI_LSARPC, "Add rights to an account", "" },
+ { "lsaremoveacctrights", RPC_RTYPE_NTSTATUS, cmd_lsa_remove_acct_rights, NULL, PI_LSARPC, "Remove rights from an account", "" },
+ { "lsalookupprivvalue", RPC_RTYPE_NTSTATUS, cmd_lsa_lookupprivvalue, NULL, PI_LSARPC, "Get a privilege value given its name", "" },
+ { "lsaquerysecobj", RPC_RTYPE_NTSTATUS, cmd_lsa_query_secobj, NULL, PI_LSARPC, "Query LSA security object", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 407bff3735..1421c4da26 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -332,11 +332,11 @@ struct cmd_set netlogon_commands[] = {
{ "NETLOGON" },
- { "logonctrl2", cmd_netlogon_logon_ctrl2, PI_NETLOGON, "Logon Control 2", "" },
- { "logonctrl", cmd_netlogon_logon_ctrl, PI_NETLOGON, "Logon Control", "" },
- { "samsync", cmd_netlogon_sam_sync, PI_NETLOGON, "Sam Synchronisation", "" },
- { "samdeltas", cmd_netlogon_sam_deltas, PI_NETLOGON, "Query Sam Deltas", "" },
- { "samlogon", cmd_netlogon_sam_logon, PI_NETLOGON, "Sam Logon", "" },
+ { "logonctrl2", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl2, NULL, PI_NETLOGON, "Logon Control 2", "" },
+ { "logonctrl", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl, NULL, PI_NETLOGON, "Logon Control", "" },
+ { "samsync", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_sync, NULL, PI_NETLOGON, "Sam Synchronisation", "" },
+ { "samdeltas", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_deltas, NULL, PI_NETLOGON, "Query Sam Deltas", "" },
+ { "samlogon", RPC_RTYPE_NTSTATUS, cmd_netlogon_sam_logon, NULL, PI_NETLOGON, "Sam Logon", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_reg.c b/source3/rpcclient/cmd_reg.c
index 8943331dab..bf85d21716 100644
--- a/source3/rpcclient/cmd_reg.c
+++ b/source3/rpcclient/cmd_reg.c
@@ -970,10 +970,10 @@ struct cmd_set reg_commands[] = {
{ "REG" },
- { "shutdown", cmd_reg_shutdown, PI_WINREG, "Remote Shutdown",
+ { "shutdown", RPC_RTYPE_NTSTATUS, cmd_reg_shutdown, NULL, PI_WINREG, "Remote Shutdown",
"syntax: shutdown [-m message] [-t timeout] [-r] [-h] [-f] (-r == reboot, -h == halt, -f == force)" },
- { "abortshutdown", cmd_reg_abort_shutdown, PI_WINREG, "Abort Shutdown",
+ { "abortshutdown", RPC_RTYPE_NTSTATUS, cmd_reg_abort_shutdown, NULL, PI_WINREG, "Abort Shutdown",
"syntax: abortshutdown" },
/*
{ "regenum", cmd_reg_enum, "Registry Enumeration",
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 95ea27562e..866381456b 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -1494,24 +1494,24 @@ struct cmd_set samr_commands[] = {
{ "SAMR" },
- { "queryuser", cmd_samr_query_user, PI_SAMR, "Query user info", "" },
- { "querygroup", cmd_samr_query_group, PI_SAMR, "Query group info", "" },
- { "queryusergroups", cmd_samr_query_usergroups, PI_SAMR, "Query user groups", "" },
- { "queryuseraliases", cmd_samr_query_useraliases, PI_SAMR, "Query user aliases", "" },
- { "querygroupmem", cmd_samr_query_groupmem, PI_SAMR, "Query group membership", "" },
- { "queryaliasmem", cmd_samr_query_aliasmem, PI_SAMR, "Query alias membership", "" },
- { "querydispinfo", cmd_samr_query_dispinfo, PI_SAMR, "Query display info", "" },
- { "querydominfo", cmd_samr_query_dominfo, PI_SAMR, "Query domain info", "" },
- { "enumdomusers", cmd_samr_enum_dom_users, PI_SAMR, "Enumerate domain users", "" },
- { "enumdomgroups", cmd_samr_enum_dom_groups, PI_SAMR, "Enumerate domain groups", "" },
- { "enumalsgroups", cmd_samr_enum_als_groups, PI_SAMR, "Enumerate alias groups", "" },
-
- { "createdomuser", cmd_samr_create_dom_user, PI_SAMR, "Create domain user", "" },
- { "samlookupnames", cmd_samr_lookup_names, PI_SAMR, "Look up names", "" },
- { "samlookuprids", cmd_samr_lookup_rids, PI_SAMR, "Look up names", "" },
- { "deletedomuser", cmd_samr_delete_dom_user, PI_SAMR, "Delete domain user", "" },
- { "samquerysecobj", cmd_samr_query_sec_obj, PI_SAMR, "Query SAMR security object", "" },
- { "getdompwinfo", cmd_samr_get_dom_pwinfo, PI_SAMR, "Retrieve domain password info", "" },
+ { "queryuser", RPC_RTYPE_NTSTATUS, cmd_samr_query_user, NULL, PI_SAMR, "Query user info", "" },
+ { "querygroup", RPC_RTYPE_NTSTATUS, cmd_samr_query_group, NULL, PI_SAMR, "Query group info", "" },
+ { "queryusergroups", RPC_RTYPE_NTSTATUS, cmd_samr_query_usergroups, NULL, PI_SAMR, "Query user groups", "" },
+ { "queryuseraliases", RPC_RTYPE_NTSTATUS, cmd_samr_query_useraliases, NULL, PI_SAMR, "Query user aliases", "" },
+ { "querygroupmem", RPC_RTYPE_NTSTATUS, cmd_samr_query_groupmem, NULL, PI_SAMR, "Query group membership", "" },
+ { "queryaliasmem", RPC_RTYPE_NTSTATUS, cmd_samr_query_aliasmem, NULL, PI_SAMR, "Query alias membership", "" },
+ { "querydispinfo", RPC_RTYPE_NTSTATUS, cmd_samr_query_dispinfo, NULL, PI_SAMR, "Query display info", "" },
+ { "querydominfo", RPC_RTYPE_NTSTATUS, cmd_samr_query_dominfo, NULL, PI_SAMR, "Query domain info", "" },
+ { "enumdomusers", RPC_RTYPE_NTSTATUS, cmd_samr_enum_dom_users, NULL, PI_SAMR, "Enumerate domain users", "" },
+ { "enumdomgroups", RPC_RTYPE_NTSTATUS, cmd_samr_enum_dom_groups, NULL, PI_SAMR, "Enumerate domain groups", "" },
+ { "enumalsgroups", RPC_RTYPE_NTSTATUS, cmd_samr_enum_als_groups, NULL, PI_SAMR, "Enumerate alias groups", "" },
+
+ { "createdomuser", RPC_RTYPE_NTSTATUS, cmd_samr_create_dom_user, NULL, PI_SAMR, "Create domain user", "" },
+ { "samlookupnames", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_names, NULL, PI_SAMR, "Look up names", "" },
+ { "samlookuprids", RPC_RTYPE_NTSTATUS, cmd_samr_lookup_rids, NULL, PI_SAMR, "Look up names", "" },
+ { "deletedomuser", RPC_RTYPE_NTSTATUS, cmd_samr_delete_dom_user, NULL, PI_SAMR, "Delete domain user", "" },
+ { "samquerysecobj", RPC_RTYPE_NTSTATUS, cmd_samr_query_sec_obj, NULL, PI_SAMR, "Query SAMR security object", "" },
+ { "getdompwinfo", RPC_RTYPE_NTSTATUS, cmd_samr_get_dom_pwinfo, NULL, PI_SAMR, "Retrieve domain password info", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 9686fd1e24..3ce7f9e6ac 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -84,19 +84,19 @@ BOOL get_short_archi(char *short_archi, const char *long_archi)
/**********************************************************************
* dummy function -- placeholder
*/
-static NTSTATUS cmd_spoolss_not_implemented(struct cli_state *cli,
+static WERROR cmd_spoolss_not_implemented(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
printf ("(*) This command is not currently implemented.\n");
- return NT_STATUS_OK;
+ return WERR_OK;
}
#endif
/***********************************************************************
* Get printer information
*/
-static NTSTATUS cmd_spoolss_open_printer_ex(struct cli_state *cli,
+static WERROR cmd_spoolss_open_printer_ex(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -107,11 +107,11 @@ static NTSTATUS cmd_spoolss_open_printer_ex(struct cli_state *cli,
if (argc != 2) {
printf("Usage: %s <printername>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (!cli)
- return NT_STATUS_UNSUCCESSFUL;
+ return WERR_GENERAL_FAILURE;
slprintf (servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
strupper (servername);
@@ -134,7 +134,7 @@ static NTSTATUS cmd_spoolss_open_printer_ex(struct cli_state *cli,
}
}
- return W_ERROR_IS_OK(werror) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return werror;
}
@@ -298,7 +298,7 @@ static void display_print_info_3(PRINTER_INFO_3 *i3)
/* Enumerate printers */
-static NTSTATUS cmd_spoolss_enum_printers(struct cli_state *cli,
+static WERROR cmd_spoolss_enum_printers(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -311,7 +311,7 @@ static NTSTATUS cmd_spoolss_enum_printers(struct cli_state *cli,
if (argc > 3)
{
printf("Usage: %s [level] [name]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (argc == 2)
@@ -367,7 +367,7 @@ static NTSTATUS cmd_spoolss_enum_printers(struct cli_state *cli,
}
done:
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/****************************************************************************
@@ -403,7 +403,7 @@ static void display_port_info_2(PORT_INFO_2 *i2)
/* Enumerate ports */
-static NTSTATUS cmd_spoolss_enum_ports(struct cli_state *cli,
+static WERROR cmd_spoolss_enum_ports(struct cli_state *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -414,7 +414,7 @@ static NTSTATUS cmd_spoolss_enum_ports(struct cli_state *cli,
if (argc > 2) {
printf("Usage: %s [level]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (argc == 2)
@@ -449,13 +449,13 @@ static NTSTATUS cmd_spoolss_enum_ports(struct cli_state *cli,
}
}
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/***********************************************************************
* Set printer comment - use a level2 set.
*/
-static NTSTATUS cmd_spoolss_setprinter(struct cli_state *cli,
+static WERROR cmd_spoolss_setprinter(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -473,7 +473,7 @@ static NTSTATUS cmd_spoolss_setprinter(struct cli_state *cli,
if (argc == 1 || argc > 3) {
printf("Usage: %s printername comment\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* Open a printer handle */
@@ -519,13 +519,13 @@ static NTSTATUS cmd_spoolss_setprinter(struct cli_state *cli,
if (opened_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &pol);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/***********************************************************************
* Get printer information
*/
-static NTSTATUS cmd_spoolss_getprinter(struct cli_state *cli,
+static WERROR cmd_spoolss_getprinter(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -541,7 +541,7 @@ static NTSTATUS cmd_spoolss_getprinter(struct cli_state *cli,
if (argc == 1 || argc > 3) {
printf("Usage: %s <printername> [level]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* Open a printer handle */
@@ -601,7 +601,7 @@ static NTSTATUS cmd_spoolss_getprinter(struct cli_state *cli,
if (opened_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &pol);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
static void display_reg_value(REGISTRY_VALUE value)
@@ -644,7 +644,7 @@ static void display_reg_value(REGISTRY_VALUE value)
/***********************************************************************
* Get printer data
*/
-static NTSTATUS cmd_spoolss_getprinterdata(struct cli_state *cli,
+static WERROR cmd_spoolss_getprinterdata(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -661,7 +661,7 @@ static NTSTATUS cmd_spoolss_getprinterdata(struct cli_state *cli,
if (argc != 3) {
printf("Usage: %s <printername> <valuename>\n", argv[0]);
printf("<printername> of . queries print server\n");
- return NT_STATUS_OK;
+ return WERR_OK;
}
valuename = argv[2];
@@ -709,13 +709,13 @@ static NTSTATUS cmd_spoolss_getprinterdata(struct cli_state *cli,
if (opened_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &pol);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/***********************************************************************
* Get printer data
*/
-static NTSTATUS cmd_spoolss_getprinterdataex(struct cli_state *cli,
+static WERROR cmd_spoolss_getprinterdataex(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -733,7 +733,7 @@ static NTSTATUS cmd_spoolss_getprinterdataex(struct cli_state *cli,
printf("Usage: %s <printername> <keyname> <valuename>\n",
argv[0]);
printf("<printername> of . queries print server\n");
- return NT_STATUS_OK;
+ return WERR_OK;
}
valuename = argv[3];
keyname = argv[2];
@@ -784,7 +784,7 @@ static NTSTATUS cmd_spoolss_getprinterdataex(struct cli_state *cli,
if (opened_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &pol);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/****************************************************************************
@@ -900,13 +900,12 @@ static void display_print_driver_3(DRIVER_INFO_3 *i1)
/***********************************************************************
* Get printer information
*/
-static NTSTATUS cmd_spoolss_getdriver(struct cli_state *cli,
+static WERROR cmd_spoolss_getdriver(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
POLICY_HND pol;
WERROR werror;
- NTSTATUS result;
uint32 info_level = 3;
BOOL opened_hnd = False;
PRINTER_DRIVER_CTR ctr;
@@ -918,7 +917,7 @@ static NTSTATUS cmd_spoolss_getdriver(struct cli_state *cli,
if ((argc == 1) || (argc > 3))
{
printf("Usage: %s <printername> [level]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* get the arguments need to open the printer handle */
@@ -935,11 +934,9 @@ static NTSTATUS cmd_spoolss_getdriver(struct cli_state *cli,
PRINTER_ACCESS_USE,
servername, user, &pol);
- result = W_ERROR_IS_OK(werror) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
-
- if (!NT_STATUS_IS_OK(result)) {
+ if (!W_ERROR_IS_OK(werror)) {
printf("Error opening printer handle for %s!\n", printername);
- return result;
+ return werror;
}
opened_hnd = True;
@@ -984,13 +981,13 @@ static NTSTATUS cmd_spoolss_getdriver(struct cli_state *cli,
if (opened_hnd)
cli_spoolss_close_printer (cli, mem_ctx, &pol);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return werror;
}
/***********************************************************************
* Get printer information
*/
-static NTSTATUS cmd_spoolss_enum_drivers(struct cli_state *cli,
+static WERROR cmd_spoolss_enum_drivers(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -1003,7 +1000,7 @@ static NTSTATUS cmd_spoolss_enum_drivers(struct cli_state *cli,
if (argc > 2)
{
printf("Usage: enumdrivers [level]\n");
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (argc == 2)
@@ -1058,7 +1055,7 @@ static NTSTATUS cmd_spoolss_enum_drivers(struct cli_state *cli,
}
}
- return W_ERROR_IS_OK(werror) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return werror;
}
/****************************************************************************
@@ -1078,7 +1075,7 @@ static void display_printdriverdir_1(DRIVER_DIRECTORY_1 *i1)
/***********************************************************************
* Get printer driver directory information
*/
-static NTSTATUS cmd_spoolss_getdriverdir(struct cli_state *cli,
+static WERROR cmd_spoolss_getdriverdir(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -1089,7 +1086,7 @@ static NTSTATUS cmd_spoolss_getdriverdir(struct cli_state *cli,
if (argc > 2) {
printf("Usage: %s [environment]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* Get the arguments need to open the printer handle */
@@ -1111,7 +1108,7 @@ static NTSTATUS cmd_spoolss_getdriverdir(struct cli_state *cli,
if (W_ERROR_IS_OK(result))
display_printdriverdir_1(ctr.info1);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/*******************************************************************************
@@ -1222,7 +1219,7 @@ static BOOL init_drv_info_3_members (
}
-static NTSTATUS cmd_spoolss_addprinterdriver(struct cli_state *cli,
+static WERROR cmd_spoolss_addprinterdriver(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -1241,7 +1238,7 @@ static NTSTATUS cmd_spoolss_addprinterdriver(struct cli_state *cli,
printf ("\t<Config File Name>:<Help File Name>:<Language Monitor Name>:\\\n");
printf ("\t<Default Data Type>:<Comma Separated list of Files>\n");
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* Fill in the DRIVER_INFO_3 struct */
@@ -1249,7 +1246,7 @@ static NTSTATUS cmd_spoolss_addprinterdriver(struct cli_state *cli,
if (!get_short_archi(arch, argv[1]))
{
printf ("Error Unknown architechture [%s]\n", argv[1]);
- return NT_STATUS_INVALID_PARAMETER;
+ return WERR_INVALID_PARAM;
}
else
set_drv_info_3_env(&info3, arch);
@@ -1257,7 +1254,7 @@ static NTSTATUS cmd_spoolss_addprinterdriver(struct cli_state *cli,
if (!init_drv_info_3_members(mem_ctx, &info3, argv[2]))
{
printf ("Error Invalid parameter list - %s.\n", argv[2]);
- return NT_STATUS_INVALID_PARAMETER;
+ return WERR_INVALID_PARAM;
}
@@ -1271,11 +1268,11 @@ static NTSTATUS cmd_spoolss_addprinterdriver(struct cli_state *cli,
driver_name);
}
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
-static NTSTATUS cmd_spoolss_addprinterex(struct cli_state *cli,
+static WERROR cmd_spoolss_addprinterex(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -1289,7 +1286,7 @@ static NTSTATUS cmd_spoolss_addprinterex(struct cli_state *cli,
if (argc != 5)
{
printf ("Usage: %s <name> <shared name> <driver> <port>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
slprintf (servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
@@ -1329,10 +1326,10 @@ static NTSTATUS cmd_spoolss_addprinterex(struct cli_state *cli,
if (W_ERROR_IS_OK(result))
printf ("Printer %s successfully installed.\n", argv[1]);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
-static NTSTATUS cmd_spoolss_setdriver(struct cli_state *cli,
+static WERROR cmd_spoolss_setdriver(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -1351,7 +1348,7 @@ static NTSTATUS cmd_spoolss_setdriver(struct cli_state *cli,
if (argc != 3)
{
printf ("Usage: %s <printer> <driver>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
slprintf (servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
@@ -1406,11 +1403,11 @@ done:
if (opened_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &pol);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
-static NTSTATUS cmd_spoolss_deletedriver(struct cli_state *cli,
+static WERROR cmd_spoolss_deletedriver(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -1422,7 +1419,7 @@ static NTSTATUS cmd_spoolss_deletedriver(struct cli_state *cli,
if (argc != 2)
{
printf ("Usage: %s <driver>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
slprintf (servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
@@ -1449,10 +1446,10 @@ static NTSTATUS cmd_spoolss_deletedriver(struct cli_state *cli,
}
}
- return W_ERROR_IS_OK(result) || W_ERROR_EQUAL(result, WERR_UNKNOWN_PRINTER_DRIVER) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
-static NTSTATUS cmd_spoolss_getprintprocdir(struct cli_state *cli,
+static WERROR cmd_spoolss_getprintprocdir(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -1464,17 +1461,17 @@ static NTSTATUS cmd_spoolss_getprintprocdir(struct cli_state *cli,
/* parse the command arguements */
if (argc > 2) {
printf ("Usage: %s [environment]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (asprintf(&servername, "\\\\%s", cli->desthost) < 0)
- return NT_STATUS_NO_MEMORY;
+ return WERR_NOMEM;
strupper(servername);
if (asprintf(&environment, "%s", (argc == 2) ? argv[1] :
PRINTER_DRIVER_ARCHITECTURE) < 0) {
SAFE_FREE(servername);
- return NT_STATUS_NO_MEMORY;
+ return WERR_NOMEM;
}
result = cli_spoolss_getprintprocessordirectory(
@@ -1491,12 +1488,12 @@ static NTSTATUS cmd_spoolss_getprintprocdir(struct cli_state *cli,
SAFE_FREE(servername);
SAFE_FREE(environment);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/* Add a form */
-static NTSTATUS cmd_spoolss_addform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+static WERROR cmd_spoolss_addform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
POLICY_HND handle;
@@ -1509,7 +1506,7 @@ static NTSTATUS cmd_spoolss_addform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (argc != 3) {
printf ("Usage: %s <printer> <formname>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* Get a printer handle */
@@ -1550,12 +1547,12 @@ static NTSTATUS cmd_spoolss_addform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
SAFE_FREE(servername);
SAFE_FREE(printername);
- return W_ERROR_IS_OK(werror) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return werror;
}
/* Set a form */
-static NTSTATUS cmd_spoolss_setform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+static WERROR cmd_spoolss_setform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
POLICY_HND handle;
@@ -1568,7 +1565,7 @@ static NTSTATUS cmd_spoolss_setform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (argc != 3) {
printf ("Usage: %s <printer> <formname>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* Get a printer handle */
@@ -1608,12 +1605,12 @@ static NTSTATUS cmd_spoolss_setform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
SAFE_FREE(servername);
SAFE_FREE(printername);
- return W_ERROR_IS_OK(werror) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return werror;
}
/* Get a form */
-static NTSTATUS cmd_spoolss_getform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+static WERROR cmd_spoolss_getform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
POLICY_HND handle;
@@ -1627,7 +1624,7 @@ static NTSTATUS cmd_spoolss_getform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
if (argc != 3) {
printf ("Usage: %s <printer> <formname>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* Get a printer handle */
@@ -1671,12 +1668,12 @@ static NTSTATUS cmd_spoolss_getform(struct cli_state *cli, TALLOC_CTX *mem_ctx,
SAFE_FREE(servername);
SAFE_FREE(printername);
- return W_ERROR_IS_OK(werror) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return werror;
}
/* Delete a form */
-static NTSTATUS cmd_spoolss_deleteform(struct cli_state *cli,
+static WERROR cmd_spoolss_deleteform(struct cli_state *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -1689,7 +1686,7 @@ static NTSTATUS cmd_spoolss_deleteform(struct cli_state *cli,
if (argc != 3) {
printf ("Usage: %s <printer> <formname>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* Get a printer handle */
@@ -1718,12 +1715,12 @@ static NTSTATUS cmd_spoolss_deleteform(struct cli_state *cli,
SAFE_FREE(servername);
SAFE_FREE(printername);
- return W_ERROR_IS_OK(werror) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return werror;
}
/* Enumerate forms */
-static NTSTATUS cmd_spoolss_enum_forms(struct cli_state *cli,
+static WERROR cmd_spoolss_enum_forms(struct cli_state *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -1738,7 +1735,7 @@ static NTSTATUS cmd_spoolss_enum_forms(struct cli_state *cli,
if (argc != 2) {
printf ("Usage: %s <printer>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* Get a printer handle */
@@ -1788,10 +1785,10 @@ static NTSTATUS cmd_spoolss_enum_forms(struct cli_state *cli,
SAFE_FREE(servername);
SAFE_FREE(printername);
- return W_ERROR_IS_OK(werror) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return werror;
}
-static NTSTATUS cmd_spoolss_setprinterdata(struct cli_state *cli,
+static WERROR cmd_spoolss_setprinterdata(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -1807,7 +1804,7 @@ static NTSTATUS cmd_spoolss_setprinterdata(struct cli_state *cli,
/* parse the command arguements */
if (argc != 4) {
printf ("Usage: %s <printer> <value> <data>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
slprintf (servername, sizeof(servername)-1, "\\\\%s", cli->desthost);
@@ -1869,7 +1866,7 @@ done:
if (opened_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &pol);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
static void display_job_info_1(JOB_INFO_1 *job)
@@ -1910,7 +1907,7 @@ static void display_job_info_2(JOB_INFO_2 *job)
/* Enumerate jobs */
-static NTSTATUS cmd_spoolss_enum_jobs(struct cli_state *cli,
+static WERROR cmd_spoolss_enum_jobs(struct cli_state *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -1924,7 +1921,7 @@ static NTSTATUS cmd_spoolss_enum_jobs(struct cli_state *cli,
if (argc < 2 || argc > 3) {
printf("Usage: %s printername [level]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (argc == 3)
@@ -1980,12 +1977,12 @@ done:
if (got_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &hnd);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/* enumerate data */
-static NTSTATUS cmd_spoolss_enum_data( struct cli_state *cli,
+static WERROR cmd_spoolss_enum_data( struct cli_state *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -1998,7 +1995,7 @@ static NTSTATUS cmd_spoolss_enum_data( struct cli_state *cli,
if (argc != 2) {
printf("Usage: %s printername\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
/* Open printer handle */
@@ -2039,12 +2036,12 @@ done:
if (got_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &hnd);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/* enumerate data for a given key */
-static NTSTATUS cmd_spoolss_enum_data_ex( struct cli_state *cli,
+static WERROR cmd_spoolss_enum_data_ex( struct cli_state *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -2059,7 +2056,7 @@ static NTSTATUS cmd_spoolss_enum_data_ex( struct cli_state *cli,
if (argc != 3) {
printf("Usage: %s printername <keyname>\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
keyname = argv[2];
@@ -2104,12 +2101,12 @@ done:
if (got_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &hnd);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/* enumerate subkeys */
-static NTSTATUS cmd_spoolss_enum_printerkey( struct cli_state *cli,
+static WERROR cmd_spoolss_enum_printerkey( struct cli_state *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -2124,7 +2121,7 @@ static NTSTATUS cmd_spoolss_enum_printerkey( struct cli_state *cli,
if (argc < 2 || argc > 3) {
printf("Usage: %s printername [keyname]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (argc == 3)
@@ -2178,10 +2175,10 @@ done:
if (got_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &hnd);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
-static NTSTATUS cmd_spoolss_rffpcnex(struct cli_state *cli,
+static WERROR cmd_spoolss_rffpcnex(struct cli_state *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
@@ -2257,7 +2254,7 @@ done:
if (got_hnd)
cli_spoolss_close_printer(cli, mem_ctx, &hnd);
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/* List of commands exported by this module */
@@ -2265,33 +2262,33 @@ struct cmd_set spoolss_commands[] = {
{ "SPOOLSS" },
- { "adddriver", cmd_spoolss_addprinterdriver, PI_SPOOLSS, "Add a print driver", "" },
- { "addprinter", cmd_spoolss_addprinterex, PI_SPOOLSS, "Add a printer", "" },
- { "deldriver", cmd_spoolss_deletedriver, PI_SPOOLSS, "Delete a printer driver", "" },
- { "enumdata", cmd_spoolss_enum_data, PI_SPOOLSS, "Enumerate printer data", "" },
- { "enumdataex", cmd_spoolss_enum_data_ex, PI_SPOOLSS, "Enumerate printer data for a key", "" },
- { "enumkey", cmd_spoolss_enum_printerkey, PI_SPOOLSS, "Enumerate printer keys", "" },
- { "enumjobs", cmd_spoolss_enum_jobs, PI_SPOOLSS, "Enumerate print jobs", "" },
- { "enumports", cmd_spoolss_enum_ports, PI_SPOOLSS, "Enumerate printer ports", "" },
- { "enumdrivers", cmd_spoolss_enum_drivers, PI_SPOOLSS, "Enumerate installed printer drivers", "" },
- { "enumprinters", cmd_spoolss_enum_printers, PI_SPOOLSS, "Enumerate printers", "" },
- { "getdata", cmd_spoolss_getprinterdata, PI_SPOOLSS, "Get print driver data", "" },
- { "getdataex", cmd_spoolss_getprinterdataex, PI_SPOOLSS, "Get printer driver data with keyname", ""},
- { "getdriver", cmd_spoolss_getdriver, PI_SPOOLSS, "Get print driver information", "" },
- { "getdriverdir", cmd_spoolss_getdriverdir, PI_SPOOLSS, "Get print driver upload directory", "" },
- { "getprinter", cmd_spoolss_getprinter, PI_SPOOLSS, "Get printer info", "" },
- { "getprintprocdir", cmd_spoolss_getprintprocdir, PI_SPOOLSS, "Get print processor directory", "" },
- { "openprinter", cmd_spoolss_open_printer_ex, PI_SPOOLSS, "Open printer handle", "" },
- { "setdriver", cmd_spoolss_setdriver, PI_SPOOLSS, "Set printer driver", "" },
- { "getprintprocdir", cmd_spoolss_getprintprocdir, PI_SPOOLSS, "Get print processor directory", "" },
- { "addform", cmd_spoolss_addform, PI_SPOOLSS, "Add form", "" },
- { "setform", cmd_spoolss_setform, PI_SPOOLSS, "Set form", "" },
- { "getform", cmd_spoolss_getform, PI_SPOOLSS, "Get form", "" },
- { "deleteform", cmd_spoolss_deleteform, PI_SPOOLSS, "Delete form", "" },
- { "enumforms", cmd_spoolss_enum_forms, PI_SPOOLSS, "Enumerate forms", "" },
- { "setprinter", cmd_spoolss_setprinter, PI_SPOOLSS, "Set printer comment", "" },
- { "setprinterdata", cmd_spoolss_setprinterdata, PI_SPOOLSS, "Set REG_SZ printer data", "" },
- { "rffpcnex", cmd_spoolss_rffpcnex, PI_SPOOLSS, "Rffpcnex test", "" },
+ { "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", "" },
+ { "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", "" },
+ { "enumjobs", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_jobs, PI_SPOOLSS, "Enumerate print jobs", "" },
+ { "enumports", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_ports, PI_SPOOLSS, "Enumerate printer ports", "" },
+ { "enumdrivers", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_drivers, PI_SPOOLSS, "Enumerate installed printer drivers", "" },
+ { "enumprinters", RPC_RTYPE_WERROR, NULL, cmd_spoolss_enum_printers, PI_SPOOLSS, "Enumerate printers", "" },
+ { "getdata", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinterdata, PI_SPOOLSS, "Get print driver data", "" },
+ { "getdataex", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinterdataex, PI_SPOOLSS, "Get printer driver data with keyname", ""},
+ { "getdriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getdriver, PI_SPOOLSS, "Get print driver information", "" },
+ { "getdriverdir", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getdriverdir, PI_SPOOLSS, "Get print driver upload directory", "" },
+ { "getprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprinter, PI_SPOOLSS, "Get printer info", "" },
+ { "getprintprocdir",RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprintprocdir, PI_SPOOLSS, "Get print processor directory", "" },
+ { "openprinter", RPC_RTYPE_WERROR, NULL, cmd_spoolss_open_printer_ex, PI_SPOOLSS, "Open printer handle", "" },
+ { "setdriver", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setdriver, PI_SPOOLSS, "Set printer driver", "" },
+ { "getprintprocdir", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getprintprocdir, PI_SPOOLSS, "Get print processor directory", "" },
+ { "addform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_addform, PI_SPOOLSS, "Add form", "" },
+ { "setform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_setform, PI_SPOOLSS, "Set form", "" },
+ { "getform", RPC_RTYPE_WERROR, NULL, cmd_spoolss_getform, PI_SPOOLSS, "Get form", "" },
+ { "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", "" },
+ { "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", "" },
{ NULL }
};
diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c
index 8597c7bc2e..3e569f51ce 100644
--- a/source3/rpcclient/cmd_srvsvc.c
+++ b/source3/rpcclient/cmd_srvsvc.c
@@ -179,7 +179,7 @@ static void display_srv_info_102(SRV_INFO_102 *sv102)
}
/* Server query info */
-static NTSTATUS cmd_srvsvc_srv_query_info(struct cli_state *cli,
+static WERROR cmd_srvsvc_srv_query_info(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -189,7 +189,7 @@ static NTSTATUS cmd_srvsvc_srv_query_info(struct cli_state *cli,
if (argc > 2) {
printf("Usage: %s [infolevel]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (argc == 2)
@@ -217,7 +217,7 @@ static NTSTATUS cmd_srvsvc_srv_query_info(struct cli_state *cli,
}
done:
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
static void display_share_info_1(SRV_SHARE_INFO_1 *info1)
@@ -246,7 +246,7 @@ static void display_share_info_2(SRV_SHARE_INFO_2 *info2)
printf("\tpassword:\t%s\n", passwd);
}
-static NTSTATUS cmd_srvsvc_net_share_enum(struct cli_state *cli,
+static WERROR cmd_srvsvc_net_share_enum(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -258,7 +258,7 @@ static NTSTATUS cmd_srvsvc_net_share_enum(struct cli_state *cli,
if (argc > 2) {
printf("Usage: %s [infolevel]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (argc == 2)
@@ -289,10 +289,10 @@ static NTSTATUS cmd_srvsvc_net_share_enum(struct cli_state *cli,
}
done:
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
-static NTSTATUS cmd_srvsvc_net_remote_tod(struct cli_state *cli,
+static WERROR cmd_srvsvc_net_remote_tod(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -301,7 +301,7 @@ static NTSTATUS cmd_srvsvc_net_remote_tod(struct cli_state *cli,
if (argc > 1) {
printf("Usage: %s\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
result = cli_srvsvc_net_remote_tod(
@@ -311,10 +311,10 @@ static NTSTATUS cmd_srvsvc_net_remote_tod(struct cli_state *cli,
goto done;
done:
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
-static NTSTATUS cmd_srvsvc_net_file_enum(struct cli_state *cli,
+static WERROR cmd_srvsvc_net_file_enum(struct cli_state *cli,
TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -326,7 +326,7 @@ static NTSTATUS cmd_srvsvc_net_file_enum(struct cli_state *cli,
if (argc > 2) {
printf("Usage: %s [infolevel]\n", argv[0]);
- return NT_STATUS_OK;
+ return WERR_OK;
}
if (argc == 2)
@@ -343,7 +343,7 @@ static NTSTATUS cmd_srvsvc_net_file_enum(struct cli_state *cli,
goto done;
done:
- return W_ERROR_IS_OK(result) ? NT_STATUS_OK : NT_STATUS_UNSUCCESSFUL;
+ return result;
}
/* List of commands exported by this module */
@@ -352,10 +352,10 @@ struct cmd_set srvsvc_commands[] = {
{ "SRVSVC" },
- { "srvinfo", cmd_srvsvc_srv_query_info, PI_SRVSVC, "Server query info", "" },
- { "netshareenum", cmd_srvsvc_net_share_enum, PI_SRVSVC, "Enumerate shares", "" },
- { "netfileenum", cmd_srvsvc_net_file_enum, PI_SRVSVC, "Enumerate open files", "" },
- { "netremotetod", cmd_srvsvc_net_remote_tod, PI_SRVSVC, "Fetch remote time of day", "" },
+ { "srvinfo", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_srv_query_info, PI_SRVSVC, "Server query info", "" },
+ { "netshareenum",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_share_enum, PI_SRVSVC, "Enumerate shares", "" },
+ { "netfileenum", RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_file_enum, PI_SRVSVC, "Enumerate open files", "" },
+ { "netremotetod",RPC_RTYPE_WERROR, NULL, cmd_srvsvc_net_remote_tod, PI_SRVSVC, "Fetch remote time of day", "" },
{ NULL }
};
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index c3b2cd4ea1..2338d72f19 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -73,7 +73,10 @@ static char **completion_fn(char *text, int start, int end)
for (i=0; commands->cmd_set[i].name; i++)
{
if ((strncmp(text, commands->cmd_set[i].name, strlen(text)) == 0) &&
- commands->cmd_set[i].fn)
+ (( commands->cmd_set[i].returntype == RPC_RTYPE_NTSTATUS &&
+ commands->cmd_set[i].ntfn ) ||
+ ( commands->cmd_set[i].returntype == RPC_RTYPE_WERROR &&
+ commands->cmd_set[i].wfn)))
{
matches[count] = strdup(commands->cmd_set[i].name);
if (!matches[count])
@@ -393,18 +396,18 @@ static struct cmd_set rpcclient_commands[] = {
{ "GENERAL OPTIONS" },
- { "help", cmd_help, -1, "Get help on commands", "[command]" },
- { "?", cmd_help, -1, "Get help on commands", "[command]" },
- { "debuglevel", cmd_debuglevel, -1, "Set debug level", "level" },
- { "list", cmd_listcommands, -1, "List available commands on <pipe>", "pipe" },
- { "exit", cmd_quit, -1, "Exit program", "" },
- { "quit", cmd_quit, -1, "Exit program", "" },
+ { "help", RPC_RTYPE_NTSTATUS, cmd_help, NULL, -1, "Get help on commands", "[command]" },
+ { "?", RPC_RTYPE_NTSTATUS, cmd_help, NULL, -1, "Get help on commands", "[command]" },
+ { "debuglevel", RPC_RTYPE_NTSTATUS, cmd_debuglevel, NULL, -1, "Set debug level", "level" },
+ { "list", RPC_RTYPE_NTSTATUS, cmd_listcommands, NULL, -1, "List available commands on <pipe>", "pipe" },
+ { "exit", RPC_RTYPE_NTSTATUS, cmd_quit, NULL, -1, "Exit program", "" },
+ { "quit", RPC_RTYPE_NTSTATUS, cmd_quit, NULL, -1, "Exit program", "" },
{ NULL }
};
static struct cmd_set separator_command[] = {
- { "---------------", NULL, -1, "----------------------" },
+ { "---------------", MAX_RPC_RETURN_TYPE, NULL, NULL, -1, "----------------------" },
{ NULL }
};
@@ -458,7 +461,8 @@ static NTSTATUS do_cmd(struct cli_state *cli,
struct cmd_set *cmd_entry,
int argc, char **argv)
{
- NTSTATUS result;
+ NTSTATUS ntresult;
+ WERROR wresult;
TALLOC_CTX *mem_ctx;
@@ -477,9 +481,22 @@ static NTSTATUS do_cmd(struct cli_state *cli,
return NT_STATUS_UNSUCCESSFUL;
}
- /* Run command */
-
- result = cmd_entry->fn(cli, mem_ctx, argc, (const char **) argv);
+ /* Run command */
+
+ if ( cmd_entry->returntype == RPC_RTYPE_NTSTATUS ) {
+ ntresult = cmd_entry->ntfn(cli, mem_ctx, argc, (const char **) argv);
+ if (!NT_STATUS_IS_OK(ntresult)) {
+ printf("result was %s\n", nt_errstr(ntresult));
+ }
+ } else {
+ wresult = cmd_entry->wfn( cli, mem_ctx, argc, (const char **) argv);
+ /* print out the DOS error */
+ if (!W_ERROR_IS_OK(wresult)) {
+ printf( "result was %s\n", dos_errstr(wresult));
+ }
+ ntresult = W_ERROR_IS_OK(wresult)?NT_STATUS_OK:NT_STATUS_UNSUCCESSFUL;
+ }
+
/* Cleanup */
@@ -488,7 +505,7 @@ static NTSTATUS do_cmd(struct cli_state *cli,
talloc_destroy(mem_ctx);
- return result;
+ return ntresult;
}
@@ -517,7 +534,8 @@ static NTSTATUS process_cmd(struct cli_state *cli, char *cmd)
while (temp_set->name) {
if (strequal(argv[0], temp_set->name)) {
- if (!temp_set->fn) {
+ if (!(temp_set->returntype == RPC_RTYPE_NTSTATUS && temp_set->ntfn ) &&
+ !(temp_set->returntype == RPC_RTYPE_WERROR && temp_set->wfn )) {
fprintf (stderr, "Invalid command\n");
goto out_free;
}
@@ -535,9 +553,11 @@ static NTSTATUS process_cmd(struct cli_state *cli, char *cmd)
}
out_free:
+/* moved to do_cmd()
if (!NT_STATUS_IS_OK(result)) {
printf("result was %s\n", nt_errstr(result));
}
+*/
if (argv) {
/* NOTE: popt allocates the whole argv, including the
diff --git a/source3/rpcclient/rpcclient.h b/source3/rpcclient/rpcclient.h
index 1bd3c1a641..1db4246d37 100644
--- a/source3/rpcclient/rpcclient.h
+++ b/source3/rpcclient/rpcclient.h
@@ -22,10 +22,18 @@
#ifndef RPCCLIENT_H
#define RPCCLIENT_H
+typedef enum {
+ RPC_RTYPE_NTSTATUS = 0,
+ RPC_RTYPE_WERROR,
+ MAX_RPC_RETURN_TYPE,
+} RPC_RETURN_TYPE;
+
struct cmd_set {
const char *name;
- NTSTATUS (*fn)(struct cli_state *cli, TALLOC_CTX *mem_ctx, int argc,
+ RPC_RETURN_TYPE returntype;
+ NTSTATUS (*ntfn)(struct cli_state *cli, TALLOC_CTX *mem_ctx, int argc,
const char **argv);
+ WERROR (*wfn)(struct cli_state *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv);
int pipe_idx;
const char *description;
const char *usage;