summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2000-07-21 19:59:51 +0000
committerGerald Carter <jerry@samba.org>2000-07-21 19:59:51 +0000
commit92708e3945cf294b3cb8d946200f8a7bf5d1def6 (patch)
treef6e76d30d21139758d6c113ac7c0a3591996b716
parente5c5b2723f85467ce5a4a759bbe63ef59958c4ba (diff)
downloadsamba-92708e3945cf294b3cb8d946200f8a7bf5d1def6.tar.gz
samba-92708e3945cf294b3cb8d946200f8a7bf5d1def6.tar.bz2
samba-92708e3945cf294b3cb8d946200f8a7bf5d1def6.zip
Added EnumPorts() and fixed up some problems
with the other spoolss client calls. Also cleaned up output for 'help' command. jerry (This used to be commit 56ce247977c05ef37888c2572e679c44346e5568)
-rw-r--r--source3/rpcclient/cmd_spoolss.c22
-rw-r--r--source3/rpcclient/display_spool.c68
-rw-r--r--source3/rpcclient/spoolss_cmds.c6
3 files changed, 96 insertions, 0 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 9b4da4f1af..2f338cdb22 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -98,6 +98,28 @@ uint32 cmd_spoolss_enum_printers(struct client_info *info, int argc, char *argv[
/****************************************************************************
nt spoolss query
****************************************************************************/
+uint32 cmd_spoolss_enum_ports(struct client_info *info, int argc, char *argv[])
+{
+ PORT_INFO_CTR ctr;
+
+ uint32 level = 2;
+
+ fstring srv_name;
+ fstrcpy(srv_name, "\\\\");
+ fstrcat(srv_name, info->dest_host);
+ strupper(srv_name);
+
+ if (msrpc_spoolss_enum_ports(srv_name, level, &ctr))
+ DEBUG(5,("cmd_spoolss_enum_printer: query succeeded\n"));
+ else
+ report(out_hnd, "FAILED\n");
+
+ return NT_STATUS_NOPROBLEMO;
+}
+
+/****************************************************************************
+nt spoolss query
+****************************************************************************/
uint32 cmd_spoolss_enum_printerdata(struct client_info *info, int argc, char *argv[])
{
fstring srv_name;
diff --git a/source3/rpcclient/display_spool.c b/source3/rpcclient/display_spool.c
index 713b70ccbf..f2e9deccbd 100644
--- a/source3/rpcclient/display_spool.c
+++ b/source3/rpcclient/display_spool.c
@@ -296,6 +296,74 @@ void display_printer_info_ctr(FILE *out_hnd, enum action_type action, uint32 lev
}
/****************************************************************************
+connection info level 3 container display function
+****************************************************************************/
+static void display_port_info_2_ctr(FILE *out_hnd, enum action_type action,
+ uint32 count, PORT_INFO_CTR *ctr)
+{
+ uint32 i = 0;
+ switch (action)
+ {
+ case ACTION_HEADER:
+ report(out_hnd, "Port Info Level 2:\n");
+ break;
+ case ACTION_ENUMERATE:
+ for (i=0; i<count; i++)
+ display_port_info_2(out_hnd, action, &ctr->port.info_2[i]);
+ break;
+ case ACTION_FOOTER:
+ report(out_hnd, "\n");
+ break;
+ }
+}
+
+/****************************************************************************
+connection info container display function
+****************************************************************************/
+void display_port_info_ctr(FILE *out_hnd, enum action_type action, uint32 level,
+ uint32 count, PORT_INFO_CTR *ctr)
+{
+ switch (level) {
+ case 2:
+ display_port_info_2_ctr(out_hnd, action, count, ctr);
+ break;
+ default:
+ report(out_hnd, "display_port_info_ctr: Unknown Info Level\n");
+ break;
+ }
+}
+
+
+/****************************************************************************
+connection info container display function
+****************************************************************************/
+void display_port_info_2(FILE *out_hnd, enum action_type action, PORT_INFO_2 *i2)
+{
+ fstring buffer;
+
+ switch (action)
+ {
+ case ACTION_HEADER:
+ report(out_hnd, "Port:\n");
+ break;
+ case ACTION_ENUMERATE:
+ unistr_to_ascii(buffer, i2->port_name.buffer, sizeof(buffer)-1);
+ fprintf (out_hnd, "\tPort Name:\t[%s]\n", buffer);
+ unistr_to_ascii(buffer, i2->monitor_name.buffer, sizeof(buffer)-1);
+ fprintf (out_hnd, "\tMonitor Name:\t[%s]\n", buffer);
+ unistr_to_ascii(buffer, i2->description.buffer, sizeof(buffer)-1);
+ fprintf (out_hnd, "\tDescription:\t[%s]\n", buffer);
+ fprintf (out_hnd, "\tPort Type:\t[%d]\n", i2->port_type);
+ fprintf (out_hnd, "\tReserved:\t[%d]\n", i2->reserved);
+ fprintf (out_hnd, "\n");
+ break;
+ case ACTION_FOOTER:
+ report(out_hnd, "\n");
+ break;
+ }
+}
+
+/****************************************************************************
connection info container display function
****************************************************************************/
void display_printer_enumdata(FILE *out_hnd, enum action_type action, uint32 idx,
diff --git a/source3/rpcclient/spoolss_cmds.c b/source3/rpcclient/spoolss_cmds.c
index 1538f560f9..630d2f2aa5 100644
--- a/source3/rpcclient/spoolss_cmds.c
+++ b/source3/rpcclient/spoolss_cmds.c
@@ -31,10 +31,16 @@ static const struct command_set spl_commands[] = {
* printer testing
*/
+ {"SPOOLSS", NULL, NULL, {NULL, NULL}},
+
{"spoolenum", cmd_spoolss_enum_printers,
"Enumerate Printers",
{NULL, NULL}},
+ {"spoolenumports", cmd_spoolss_enum_ports,
+ "Enumerate Ports",
+ {NULL, NULL}},
+
{"spoolenumdatas", cmd_spoolss_enum_printerdata,
"<printer name> Enumerate Printer datas",
{NULL, NULL}},