mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
s3-spoolss: remove old spoolss_EnumPorts.
Guenther
This commit is contained in:
parent
03f1bec6ce
commit
631f277d1c
@ -5500,8 +5500,6 @@ WERROR rpccli_spoolss_enumprintprocessordatatypes(struct rpc_pipe_client *cli,
|
||||
WERROR rpccli_spoolss_enum_printers(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
char *name, uint32 flags, uint32 level,
|
||||
uint32 *num_printers, PRINTER_INFO_CTR *ctr);
|
||||
WERROR rpccli_spoolss_enum_ports(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
uint32 level, uint32 *num_ports, PORT_INFO_CTR *ctr);
|
||||
WERROR rpccli_spoolss_enumprinterdrivers (struct rpc_pipe_client *cli,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
uint32 level, const char *env,
|
||||
@ -5868,9 +5866,6 @@ bool make_spoolss_q_enumprinters(
|
||||
RPC_BUFFER *buffer,
|
||||
uint32 offered
|
||||
);
|
||||
bool make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u,
|
||||
fstring servername, uint32 level,
|
||||
RPC_BUFFER *buffer, uint32 offered);
|
||||
bool spoolss_io_q_enumprinters(const char *desc, SPOOL_Q_ENUMPRINTERS *q_u, prs_struct *ps, int depth);
|
||||
bool spoolss_io_r_enumprinters(const char *desc, SPOOL_R_ENUMPRINTERS *r_u, prs_struct *ps, int depth);
|
||||
bool spoolss_io_r_getprinter(const char *desc, SPOOL_R_GETPRINTER *r_u, prs_struct *ps, int depth);
|
||||
@ -5890,8 +5885,6 @@ bool make_spoolss_q_enumprinterdrivers(SPOOL_Q_ENUMPRINTERDRIVERS *q_u,
|
||||
uint32 level,
|
||||
RPC_BUFFER *buffer, uint32 offered);
|
||||
bool spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVERS *q_u, prs_struct *ps, int depth);
|
||||
bool spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth);
|
||||
bool spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth);
|
||||
bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src);
|
||||
bool spoolss_io_q_enumprintmonitors(const char *desc, SPOOL_Q_ENUMPRINTMONITORS *q_u, prs_struct *ps, int depth);
|
||||
bool spoolss_io_r_enumprintmonitors(const char *desc, SPOOL_R_ENUMPRINTMONITORS *r_u, prs_struct *ps, int depth);
|
||||
|
@ -699,43 +699,6 @@ typedef struct s_port_info_2
|
||||
}
|
||||
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;
|
||||
UNISTR2 name;
|
||||
uint32 level;
|
||||
RPC_BUFFER *buffer;
|
||||
uint32 offered;
|
||||
}
|
||||
SPOOL_Q_ENUMPORTS;
|
||||
|
||||
typedef struct port_info_ctr_info
|
||||
{
|
||||
union
|
||||
{
|
||||
PORT_INFO_1 *info_1;
|
||||
PORT_INFO_2 *info_2;
|
||||
}
|
||||
port;
|
||||
|
||||
}
|
||||
PORT_INFO_CTR;
|
||||
|
||||
typedef struct spool_r_enumports
|
||||
{
|
||||
RPC_BUFFER *buffer;
|
||||
uint32 needed; /* bytes needed */
|
||||
uint32 returned; /* number of printers */
|
||||
WERROR status;
|
||||
}
|
||||
SPOOL_R_ENUMPORTS;
|
||||
|
||||
typedef struct job_info_info
|
||||
{
|
||||
union
|
||||
|
@ -572,68 +572,6 @@ static bool decode_printer_info_3(TALLOC_CTX *mem_ctx, RPC_BUFFER *buffer,
|
||||
/**********************************************************************
|
||||
**********************************************************************/
|
||||
|
||||
static bool decode_port_info_1(TALLOC_CTX *mem_ctx, RPC_BUFFER *buffer,
|
||||
uint32 returned, PORT_INFO_1 **info)
|
||||
{
|
||||
uint32 i;
|
||||
PORT_INFO_1 *inf;
|
||||
|
||||
if (returned) {
|
||||
inf=TALLOC_ARRAY(mem_ctx, PORT_INFO_1, returned);
|
||||
if (!inf) {
|
||||
return False;
|
||||
}
|
||||
memset(inf, 0, returned*sizeof(PORT_INFO_1));
|
||||
} else {
|
||||
inf = NULL;
|
||||
}
|
||||
|
||||
prs_set_offset(&buffer->prs, 0);
|
||||
|
||||
for (i=0; i<returned; i++) {
|
||||
if (!smb_io_port_info_1("", buffer, &(inf[i]), 0)) {
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
*info=inf;
|
||||
return True;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************/
|
||||
|
||||
static bool decode_port_info_2(TALLOC_CTX *mem_ctx, RPC_BUFFER *buffer,
|
||||
uint32 returned, PORT_INFO_2 **info)
|
||||
{
|
||||
uint32 i;
|
||||
PORT_INFO_2 *inf;
|
||||
|
||||
if (returned) {
|
||||
inf=TALLOC_ARRAY(mem_ctx, PORT_INFO_2, returned);
|
||||
if (!inf) {
|
||||
return False;
|
||||
}
|
||||
memset(inf, 0, returned*sizeof(PORT_INFO_2));
|
||||
} else {
|
||||
inf = NULL;
|
||||
}
|
||||
|
||||
prs_set_offset(&buffer->prs, 0);
|
||||
|
||||
for (i=0; i<returned; i++) {
|
||||
if (!smb_io_port_info_2("", buffer, &(inf[i]), 0)) {
|
||||
return False;
|
||||
}
|
||||
}
|
||||
|
||||
*info=inf;
|
||||
return True;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************/
|
||||
|
||||
static bool decode_printer_driver_1(TALLOC_CTX *mem_ctx, RPC_BUFFER *buffer,
|
||||
uint32 returned, DRIVER_INFO_1 **info)
|
||||
{
|
||||
@ -860,78 +798,6 @@ WERROR rpccli_spoolss_enum_printers(struct rpc_pipe_client *cli, TALLOC_CTX *mem
|
||||
/**********************************************************************
|
||||
**********************************************************************/
|
||||
|
||||
WERROR rpccli_spoolss_enum_ports(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
uint32 level, uint32 *num_ports, PORT_INFO_CTR *ctr)
|
||||
{
|
||||
prs_struct qbuf, rbuf;
|
||||
SPOOL_Q_ENUMPORTS in;
|
||||
SPOOL_R_ENUMPORTS out;
|
||||
RPC_BUFFER buffer;
|
||||
fstring server;
|
||||
uint32 offered;
|
||||
|
||||
ZERO_STRUCT(in);
|
||||
ZERO_STRUCT(out);
|
||||
|
||||
slprintf(server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
|
||||
strupper_m(server);
|
||||
|
||||
offered = 0;
|
||||
if (!rpcbuf_init(&buffer, offered, mem_ctx))
|
||||
return WERR_NOMEM;
|
||||
make_spoolss_q_enumports( &in, server, level, &buffer, offered );
|
||||
|
||||
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPORTS,
|
||||
in, out,
|
||||
qbuf, rbuf,
|
||||
spoolss_io_q_enumports,
|
||||
spoolss_io_r_enumports,
|
||||
WERR_GENERAL_FAILURE );
|
||||
|
||||
if ( W_ERROR_EQUAL( out.status, WERR_INSUFFICIENT_BUFFER ) ) {
|
||||
offered = out.needed;
|
||||
|
||||
ZERO_STRUCT(in);
|
||||
ZERO_STRUCT(out);
|
||||
|
||||
if (!rpcbuf_init(&buffer, offered, mem_ctx))
|
||||
return WERR_NOMEM;
|
||||
make_spoolss_q_enumports( &in, server, level, &buffer, offered );
|
||||
|
||||
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPORTS,
|
||||
in, out,
|
||||
qbuf, rbuf,
|
||||
spoolss_io_q_enumports,
|
||||
spoolss_io_r_enumports,
|
||||
WERR_GENERAL_FAILURE );
|
||||
}
|
||||
|
||||
if ( !W_ERROR_IS_OK(out.status) )
|
||||
return out.status;
|
||||
|
||||
switch (level) {
|
||||
case 1:
|
||||
if (!decode_port_info_1(mem_ctx, out.buffer, out.returned, &ctr->port.info_1)) {
|
||||
return WERR_GENERAL_FAILURE;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!decode_port_info_2(mem_ctx, out.buffer, out.returned, &ctr->port.info_2)) {
|
||||
return WERR_GENERAL_FAILURE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return WERR_UNKNOWN_LEVEL;
|
||||
}
|
||||
|
||||
*num_ports = out.returned;
|
||||
|
||||
return out.status;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************/
|
||||
|
||||
WERROR rpccli_spoolss_enumprinterdrivers (struct rpc_pipe_client *cli,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
uint32 level, const char *env,
|
||||
|
@ -828,52 +828,6 @@ bool smb_io_printer_info_7(const char *desc, RPC_BUFFER *buffer, PRINTER_INFO_7
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Parse a PORT_INFO_1 structure.
|
||||
********************************************************************/
|
||||
|
||||
bool smb_io_port_info_1(const char *desc, RPC_BUFFER *buffer, PORT_INFO_1 *info, int depth)
|
||||
{
|
||||
prs_struct *ps=&buffer->prs;
|
||||
|
||||
prs_debug(ps, depth, desc, "smb_io_port_info_1");
|
||||
depth++;
|
||||
|
||||
buffer->struct_start=prs_offset(ps);
|
||||
|
||||
if (!smb_io_relstr("port_name", buffer, depth, &info->port_name))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Parse a PORT_INFO_2 structure.
|
||||
********************************************************************/
|
||||
|
||||
bool smb_io_port_info_2(const char *desc, RPC_BUFFER *buffer, PORT_INFO_2 *info, int depth)
|
||||
{
|
||||
prs_struct *ps=&buffer->prs;
|
||||
|
||||
prs_debug(ps, depth, desc, "smb_io_port_info_2");
|
||||
depth++;
|
||||
|
||||
buffer->struct_start=prs_offset(ps);
|
||||
|
||||
if (!smb_io_relstr("port_name", buffer, depth, &info->port_name))
|
||||
return False;
|
||||
if (!smb_io_relstr("monitor_name", buffer, depth, &info->monitor_name))
|
||||
return False;
|
||||
if (!smb_io_relstr("description", buffer, depth, &info->description))
|
||||
return False;
|
||||
if (!prs_uint32("port_type", ps, depth, &info->port_type))
|
||||
return False;
|
||||
if (!prs_uint32("reserved", ps, depth, &info->reserved))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Parse a DRIVER_INFO_1 structure.
|
||||
********************************************************************/
|
||||
@ -1747,24 +1701,6 @@ bool make_spoolss_q_enumprinters(
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* init a structure.
|
||||
********************************************************************/
|
||||
|
||||
bool make_spoolss_q_enumports(SPOOL_Q_ENUMPORTS *q_u,
|
||||
fstring servername, uint32 level,
|
||||
RPC_BUFFER *buffer, uint32 offered)
|
||||
{
|
||||
q_u->name_ptr = (servername != NULL) ? 1 : 0;
|
||||
init_buf_unistr2(&q_u->name, &q_u->name_ptr, servername);
|
||||
|
||||
q_u->level=level;
|
||||
q_u->buffer=buffer;
|
||||
q_u->offered=offered;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* read a structure.
|
||||
* called from spoolss_enumprinters (srv_spoolss.c)
|
||||
@ -2067,68 +2003,6 @@ bool spoolss_io_q_enumprinterdrivers(const char *desc, SPOOL_Q_ENUMPRINTERDRIVER
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
Parse a SPOOL_R_ENUMPORTS structure.
|
||||
********************************************************************/
|
||||
|
||||
bool spoolss_io_r_enumports(const char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth)
|
||||
{
|
||||
prs_debug(ps, depth, desc, "spoolss_io_r_enumports");
|
||||
depth++;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_rpcbuffer_p("", ps, depth, &r_u->buffer))
|
||||
return False;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("needed", ps, depth, &r_u->needed))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("returned", ps, depth, &r_u->returned))
|
||||
return False;
|
||||
|
||||
if (!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
bool spoolss_io_q_enumports(const char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
prs_debug(ps, depth, desc, "");
|
||||
depth++;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("", ps, depth, &q_u->name_ptr))
|
||||
return False;
|
||||
if (!smb_io_unistr2("", &q_u->name,True,ps,depth))
|
||||
return False;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
if (!prs_uint32("level", ps, depth, &q_u->level))
|
||||
return False;
|
||||
|
||||
if (!prs_rpcbuffer_p("", ps, depth, &q_u->buffer))
|
||||
return False;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
if (!prs_uint32("offered", ps, depth, &q_u->offered))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
make a BUFFER5 struct from a uint16*
|
||||
******************************************************************/
|
||||
|
Loading…
x
Reference in New Issue
Block a user