summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2009-03-06 23:36:31 +0100
committerGünther Deschner <gd@samba.org>2009-03-07 00:55:37 +0100
commite9179a6850a99d9d6ec25eba86ec02c9c1279850 (patch)
tree43e796b1f2f984ee1f352f776f21b225e2aaf45d
parentc7e19c2627e5a336f506ad6e781547288e1b10c5 (diff)
downloadsamba-e9179a6850a99d9d6ec25eba86ec02c9c1279850.tar.gz
samba-e9179a6850a99d9d6ec25eba86ec02c9c1279850.tar.bz2
samba-e9179a6850a99d9d6ec25eba86ec02c9c1279850.zip
s3-rpcclient: use rpccli_spoolss_enumports wrapper.
Guenther
-rw-r--r--source3/rpcclient/cmd_spoolss.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
index 01e61b9a8c..03d88f743c 100644
--- a/source3/rpcclient/cmd_spoolss.c
+++ b/source3/rpcclient/cmd_spoolss.c
@@ -359,55 +359,45 @@ static WERROR cmd_spoolss_enum_printers(struct rpc_pipe_client *cli,
/****************************************************************************
****************************************************************************/
-static void display_port_info_1(PORT_INFO_1 *i1)
+static void display_port_info_1(struct spoolss_PortInfo1 *r)
{
- fstring buffer;
-
- rpcstr_pull(buffer, i1->port_name.buffer, sizeof(buffer), -1, STR_TERMINATE);
- printf("\tPort Name:\t[%s]\n", buffer);
+ printf("\tPort Name:\t[%s]\n", r->port_name);
}
/****************************************************************************
****************************************************************************/
-static void display_port_info_2(PORT_INFO_2 *i2)
+static void display_port_info_2(struct spoolss_PortInfo2 *r)
{
- fstring buffer;
-
- rpcstr_pull(buffer, i2->port_name.buffer, sizeof(buffer), -1, STR_TERMINATE);
- printf("\tPort Name:\t[%s]\n", buffer);
- rpcstr_pull(buffer, i2->monitor_name.buffer, sizeof(buffer), -1, STR_TERMINATE);
-
- printf("\tMonitor Name:\t[%s]\n", buffer);
- rpcstr_pull(buffer, i2->description.buffer, sizeof(buffer), -1, STR_TERMINATE);
-
- printf("\tDescription:\t[%s]\n", buffer);
+ printf("\tPort Name:\t[%s]\n", r->port_name);
+ printf("\tMonitor Name:\t[%s]\n", r->monitor_name);
+ printf("\tDescription:\t[%s]\n", r->description);
printf("\tPort Type:\t" );
- if ( i2->port_type ) {
+ if (r->port_type) {
int comma = 0; /* hack */
printf( "[" );
- if ( i2->port_type & PORT_TYPE_READ ) {
+ if (r->port_type & SPOOLSS_PORT_TYPE_READ) {
printf( "Read" );
comma = 1;
}
- if ( i2->port_type & PORT_TYPE_WRITE ) {
+ if (r->port_type & SPOOLSS_PORT_TYPE_WRITE) {
printf( "%sWrite", comma ? ", " : "" );
comma = 1;
}
/* These two have slightly different interpretations
on 95/98/ME but I'm disregarding that for now */
- if ( i2->port_type & PORT_TYPE_REDIRECTED ) {
+ if (r->port_type & SPOOLSS_PORT_TYPE_REDIRECTED) {
printf( "%sRedirected", comma ? ", " : "" );
comma = 1;
}
- if ( i2->port_type & PORT_TYPE_NET_ATTACHED ) {
+ if (r->port_type & SPOOLSS_PORT_TYPE_NET_ATTACHED) {
printf( "%sNet-Attached", comma ? ", " : "" );
}
printf( "]\n" );
} else {
printf( "[Unset]\n" );
}
- printf("\tReserved:\t[%d]\n", i2->reserved);
+ printf("\tReserved:\t[%d]\n", r->reserved);
printf("\n");
}
@@ -420,8 +410,8 @@ static WERROR cmd_spoolss_enum_ports(struct rpc_pipe_client *cli,
{
WERROR result;
uint32 info_level = 1;
- PORT_INFO_CTR ctr;
uint32 returned;
+ union spoolss_PortInfo *info;
if (argc > 2) {
printf("Usage: %s [level]\n", argv[0]);
@@ -433,20 +423,22 @@ static WERROR cmd_spoolss_enum_ports(struct rpc_pipe_client *cli,
/* Enumerate ports */
- ZERO_STRUCT(ctr);
-
- result = rpccli_spoolss_enum_ports(cli, mem_ctx, info_level, &returned, &ctr);
-
+ result = rpccli_spoolss_enumports(cli, mem_ctx,
+ cli->srv_name_slash,
+ info_level,
+ 0,
+ &returned,
+ &info);
if (W_ERROR_IS_OK(result)) {
int i;
for (i = 0; i < returned; i++) {
switch (info_level) {
case 1:
- display_port_info_1(&ctr.port.info_1[i]);
+ display_port_info_1(&info[i].info1);
break;
case 2:
- display_port_info_2(&ctr.port.info_2[i]);
+ display_port_info_2(&info[i].info2);
break;
default:
printf("unknown info level %d\n", info_level);