decode port_type field in enumports
Waider
waider at waider.ie
Tue Mar 4 14:56:20 GMT 2003
Hi folks,
this patch against CVS HEAD provides decoding for the port_type field
when you do "enumports 2" in rpcclient.
Cheers,
Waider.
Index: include/rpc_spoolss.h
===================================================================
RCS file: /cvsroot/samba/source/include/rpc_spoolss.h,v
retrieving revision 1.95
diff -a -u -r1.95 rpc_spoolss.h
--- include/rpc_spoolss.h 15 Feb 2003 23:36:18 -0000 1.95
+++ include/rpc_spoolss.h 4 Mar 2003 14:51:50 -0000
@@ -1302,6 +1302,12 @@
}
PORT_INFO_2;
+/* Port Type bits */
+#define PORT_TYPE_WRITE 0x0001
+#define PORT_TYPE_READ 0x0002
+#define PORT_TYPE_REDIRECTED 0x0004
+#define PORT_TYPE_NET_ATTACHED 0x0008
+
typedef struct spool_q_enumports
{
uint32 name_ptr;
Index: rpcclient/cmd_spoolss.c
===================================================================
RCS file: /cvsroot/samba/source/rpcclient/cmd_spoolss.c,v
retrieving revision 1.107
diff -a -u -r1.107 cmd_spoolss.c
--- rpcclient/cmd_spoolss.c 25 Feb 2003 23:34:57 -0000 1.107
+++ rpcclient/cmd_spoolss.c 4 Mar 2003 14:51:56 -0000
@@ -396,7 +396,31 @@
rpcstr_pull(buffer, i2->description.buffer, sizeof(buffer), -1, STR_TERMINATE);
printf("\tDescription:\t[%s]\n", buffer);
- printf("\tPort Type:\t[%d]\n", i2->port_type);
+ printf("\tPort Type:\t" );
+ if ( i2->port_type ) {
+ int comma = 0; /* hack */
+ printf( "[" );
+ if ( i2->port_type & PORT_TYPE_READ ) {
+ printf( "Read" );
+ comma = 1;
+ }
+ if ( i2->port_type & 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 ) {
+ printf( "%sRedirected", comma ? ", " : "" );
+ comma = 1;
+ }
+ if ( i2->port_type & PORT_TYPE_NET_ATTACHED ) {
+ printf( "%sNet-Attached", comma ? ", " : "" );
+ }
+ printf( "]\n" );
+ } else {
+ printf( "[Unset]\n" );
+ }
printf("\tReserved:\t[%d]\n", i2->reserved);
printf("\n");
}
--
waider at waider.ie / Yes, it /is/ very personal of me.
"It's a poor workman who blames his tools, unless they're WINTEL-based."
- Conor Bob
More information about the samba-technical
mailing list