summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2006-03-06 18:40:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:10:57 -0500
commit129fd6c5c641cf4c2db31eb093baebd08df63107 (patch)
tree13d69f46f16172abfe6808b1edde699b79de9302
parentfa94300f5fd3b115cebe1604d8c002e6b669b472 (diff)
downloadsamba-129fd6c5c641cf4c2db31eb093baebd08df63107.tar.gz
samba-129fd6c5c641cf4c2db31eb093baebd08df63107.tar.bz2
samba-129fd6c5c641cf4c2db31eb093baebd08df63107.zip
r13878: move PORT_DATA_1 to use static sized UNICODE strings as per MSDN
(This used to be commit c803e1b2afdfc5bd983f046c976c01adebcfa1ad)
-rwxr-xr-xsource3/include/rpc_spoolss.h16
-rw-r--r--source3/rpc_parse/parse_spoolss.c35
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c8
3 files changed, 30 insertions, 29 deletions
diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h
index 4d24ee4f0f..5429511a8b 100755
--- a/source3/include/rpc_spoolss.h
+++ b/source3/include/rpc_spoolss.h
@@ -2174,17 +2174,23 @@ SPOOL_R_GETPRINTPROCESSORDIRECTORY;
/**************************************/
+#define MAX_PORTNAME 64
+#define MAX_NETWORK_NAME 49
+#define MAX_SNMP_COMM_NAME 33
+#define MAX_QUEUE_NAME 33
+#define MAX_IPADDR_STRING 17
+
typedef struct {
- UNISTR portname; /* constant 64 wchars */
+ uint16 portname[MAX_PORTNAME];
uint32 version;
uint32 protocol;
uint32 size;
uint32 reserved;
- UNISTR hostaddress; /* constant 49 wchars */
- UNISTR snmpcommunity; /* constant 33 wchars */
+ uint16 hostaddress[MAX_NETWORK_NAME];
+ uint16 snmpcommunity[MAX_SNMP_COMM_NAME];
uint32 dblspool;
- UNISTR queue; /* constant 33 wchars */
- UNISTR ipaddress; /* constant 17 wchars */
+ uint16 queue[MAX_QUEUE_NAME];
+ uint16 ipaddress[MAX_IPADDR_STRING];
uint32 port;
uint32 snmpenabled;
uint32 snmpdevindex;
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 6f1ace8214..5a17860814 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -7491,28 +7491,21 @@ BOOL make_monitorui_buf( RPC_BUFFER *buf, const char *dllname )
/*******************************************************************
********************************************************************/
+
+#define PORT_DATA_1_PAD 540
static BOOL smb_io_port_data_1( const char *desc, RPC_BUFFER *buf, int depth, SPOOL_PORT_DATA_1 *p1 )
{
prs_struct *ps = &buf->prs;
- uint8 *fodder = NULL;
+ uint8 padding[PORT_DATA_1_PAD];
prs_debug(ps, depth, desc, "smb_io_port_data_1");
depth++;
if(!prs_align(ps))
return False;
-
- if ( UNMARSHALLING(ps) ) {
- p1->portname.buffer = PRS_ALLOC_MEM( ps, uint16, 64 );
- p1->hostaddress.buffer = PRS_ALLOC_MEM( ps, uint16, 49 );
- p1->snmpcommunity.buffer = PRS_ALLOC_MEM( ps, uint16, 33 );
- p1->queue.buffer = PRS_ALLOC_MEM( ps, uint16, 33 );
- p1->ipaddress.buffer = PRS_ALLOC_MEM( ps, uint16, 17 );
- fodder = PRS_ALLOC_MEM( ps, uint8, 540 );
- }
- if( !prs_uint16s(True, "portname", ps, depth, p1->portname.buffer, 64))
+ if( !prs_uint16s(True, "portname", ps, depth, p1->portname, MAX_PORTNAME))
return False;
if (!prs_uint32("version", ps, depth, &p1->version))
@@ -7524,21 +7517,20 @@ static BOOL smb_io_port_data_1( const char *desc, RPC_BUFFER *buf, int depth, SP
if (!prs_uint32("reserved", ps, depth, &p1->reserved))
return False;
- if( !prs_uint16s(True, "hostaddress", ps, depth, p1->hostaddress.buffer, 49))
+ if( !prs_uint16s(True, "hostaddress", ps, depth, p1->hostaddress, MAX_NETWORK_NAME))
return False;
- if( !prs_uint16s(True, "snmpcommunity", ps, depth, p1->snmpcommunity.buffer, 33))
+ if( !prs_uint16s(True, "snmpcommunity", ps, depth, p1->snmpcommunity, MAX_SNMP_COMM_NAME))
return False;
if (!prs_uint32("dblspool", ps, depth, &p1->dblspool))
return False;
- if( !prs_uint16s(True, "queue", ps, depth, p1->queue.buffer, 33))
+ if( !prs_uint16s(True, "queue", ps, depth, p1->queue, MAX_QUEUE_NAME))
return False;
- if( !prs_uint16s(True, "ipaddress", ps, depth, p1->ipaddress.buffer, 17))
+ if( !prs_uint16s(True, "ipaddress", ps, depth, p1->ipaddress, MAX_IPADDR_STRING))
return False;
- /* fodder according to MSDN */
- if( !prs_uint8s(False, "", ps, depth, fodder, 540))
+ if( !prs_uint8s(False, "", ps, depth, padding, PORT_DATA_1_PAD))
return False;
if (!prs_uint32("port", ps, depth, &p1->port))
@@ -7563,12 +7555,9 @@ BOOL convert_port_data_1( NT_PORT_DATA_1 *port1, RPC_BUFFER *buf )
if ( !smb_io_port_data_1( "port_data_1", buf, 0, &spdata_1 ) )
return False;
- rpcstr_pull(port1->name, spdata_1.portname.buffer, sizeof(port1->name),
- -1, 0);
- rpcstr_pull(port1->queue, spdata_1.queue.buffer, sizeof(port1->queue),
- -1, 0);
- rpcstr_pull(port1->hostaddr, spdata_1.hostaddress.buffer,
- sizeof(port1->hostaddr), -1, 0);
+ rpcstr_pull(port1->name, spdata_1.portname, sizeof(port1->name), -1, 0);
+ rpcstr_pull(port1->queue, spdata_1.queue, sizeof(port1->queue), -1, 0);
+ rpcstr_pull(port1->hostaddr, spdata_1.hostaddress, sizeof(port1->hostaddr), -1, 0);
port1->port = spdata_1.port;
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index a9d4e14aae..938658c479 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -9528,6 +9528,7 @@ static WERROR process_xcvtcp_command( NT_USER_TOKEN *token, const char *command,
/*******************************************************************
*******************************************************************/
+#if 0 /* don't support management using the "Local Port" monitor */
static WERROR xcvlocal_monitorui( NT_USER_TOKEN *token, RPC_BUFFER *in,
RPC_BUFFER *out, uint32 *needed )
@@ -9554,6 +9555,12 @@ struct xcv_api_table xcvlocal_cmds[] = {
{ "MonitorUI", xcvlocal_monitorui },
{ NULL, NULL }
};
+#else
+struct xcv_api_table xcvlocal_cmds[] = {
+ { NULL, NULL }
+};
+#endif
+
/*******************************************************************
@@ -9566,7 +9573,6 @@ static WERROR process_xcvlocal_command( NT_USER_TOKEN *token, const char *comman
int i;
DEBUG(10,("process_xcvlocal_command: Received command \"%s\"\n", command));
-
for ( i=0; xcvlocal_cmds[i].name; i++ ) {
if ( strcmp( command, xcvlocal_cmds[i].name ) == 0 )