mirror of
https://github.com/samba-team/samba.git
synced 2025-08-26 01:49:31 +03:00
s3-spoolss: remove rpccli_spoolss_addprinterex.
Guenther
This commit is contained in:
@ -5501,8 +5501,6 @@ WERROR rpccli_spoolss_enumprinterdrivers (struct rpc_pipe_client *cli,
|
||||
uint32 level, const char *env,
|
||||
uint32 *num_drivers,
|
||||
PRINTER_DRIVER_CTR *ctr);
|
||||
WERROR rpccli_spoolss_addprinterex (struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
uint32 level, PRINTER_INFO_CTR*ctr);
|
||||
WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
POLICY_HND *handle, int level, uint32 *num_forms,
|
||||
FORM_1 **forms);
|
||||
@ -5813,11 +5811,7 @@ bool sec_io_desc_buf(const char *desc, SEC_DESC_BUF **ppsdb, prs_struct *ps, int
|
||||
|
||||
bool spoolss_io_system_time(const char *desc, prs_struct *ps, int depth, SYSTEMTIME *systime);
|
||||
bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime);
|
||||
bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u );
|
||||
bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode);
|
||||
bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u,
|
||||
const char *srv_name, const char* clientname, const char* user_name,
|
||||
uint32 level, PRINTER_INFO_CTR *ctr);
|
||||
bool make_spoolss_printer_info_2(TALLOC_CTX *ctx, SPOOL_PRINTER_INFO_LEVEL_2 **spool_info2,
|
||||
PRINTER_INFO_2 *info);
|
||||
bool make_spoolss_printer_info_3(TALLOC_CTX *mem_ctx, SPOOL_PRINTER_INFO_LEVEL_3 **spool_info3,
|
||||
@ -5930,9 +5924,6 @@ bool spool_io_printer_info_level_3(const char *desc, SPOOL_PRINTER_INFO_LEVEL_3
|
||||
bool spool_io_printer_info_level_2(const char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth);
|
||||
bool spool_io_printer_info_level_7(const char *desc, SPOOL_PRINTER_INFO_LEVEL_7 *il, prs_struct *ps, int depth);
|
||||
bool spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth);
|
||||
bool spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth);
|
||||
bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u,
|
||||
prs_struct *ps, int depth);
|
||||
bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src);
|
||||
bool uni_2_asc_printer_info_2(const SPOOL_PRINTER_INFO_LEVEL_2 *uni,
|
||||
NT_PRINTER_INFO_LEVEL_2 *d);
|
||||
|
@ -261,25 +261,6 @@ PRINTER_MESSAGE_INFO;
|
||||
#define DRIVER_MAX_VERSION 4
|
||||
|
||||
|
||||
/* this struct is undocumented */
|
||||
/* thanks to the ddk ... */
|
||||
typedef struct {
|
||||
uint32 size; /* length of user_name & client_name + 2? */
|
||||
UNISTR2 *client_name;
|
||||
UNISTR2 *user_name;
|
||||
uint32 build;
|
||||
uint32 major;
|
||||
uint32 minor;
|
||||
uint32 processor;
|
||||
} SPOOL_USER_1;
|
||||
|
||||
typedef struct {
|
||||
uint32 level;
|
||||
union {
|
||||
SPOOL_USER_1 *user1;
|
||||
} user;
|
||||
} SPOOL_USER_CTR;
|
||||
|
||||
/*
|
||||
* Devicemode structure
|
||||
*/
|
||||
@ -966,21 +947,6 @@ SPOOL_R_SETPRINTER;
|
||||
|
||||
/********************************************/
|
||||
|
||||
typedef struct {
|
||||
UNISTR2 *server_name;
|
||||
uint32 level;
|
||||
SPOOL_PRINTER_INFO_LEVEL info;
|
||||
DEVMODE_CTR devmode_ctr;
|
||||
SEC_DESC_BUF *secdesc_ctr;
|
||||
uint32 user_switch;
|
||||
SPOOL_USER_CTR user_ctr;
|
||||
} SPOOL_Q_ADDPRINTEREX;
|
||||
|
||||
typedef struct {
|
||||
POLICY_HND handle;
|
||||
WERROR status;
|
||||
} SPOOL_R_ADDPRINTEREX;
|
||||
|
||||
typedef struct spool_q_enumprintprocessors
|
||||
{
|
||||
uint32 name_ptr;
|
||||
|
@ -977,41 +977,6 @@ WERROR rpccli_spoolss_enumprinterdrivers (struct rpc_pipe_client *cli,
|
||||
/**********************************************************************
|
||||
**********************************************************************/
|
||||
|
||||
WERROR rpccli_spoolss_addprinterex (struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
uint32 level, PRINTER_INFO_CTR*ctr)
|
||||
{
|
||||
prs_struct qbuf, rbuf;
|
||||
SPOOL_Q_ADDPRINTEREX in;
|
||||
SPOOL_R_ADDPRINTEREX out;
|
||||
fstring server, client, user;
|
||||
|
||||
ZERO_STRUCT(in);
|
||||
ZERO_STRUCT(out);
|
||||
|
||||
slprintf(client, sizeof(fstring)-1, "\\\\%s", global_myname());
|
||||
slprintf(server, sizeof(fstring)-1, "\\\\%s", cli->desthost);
|
||||
|
||||
strupper_m(client);
|
||||
strupper_m(server);
|
||||
|
||||
fstrcpy (user, cli->auth->user_name);
|
||||
|
||||
make_spoolss_q_addprinterex( mem_ctx, &in, server, client,
|
||||
user, level, ctr);
|
||||
|
||||
CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ADDPRINTEREX,
|
||||
in, out,
|
||||
qbuf, rbuf,
|
||||
spoolss_io_q_addprinterex,
|
||||
spoolss_io_r_addprinterex,
|
||||
WERR_GENERAL_FAILURE );
|
||||
|
||||
return out.status;
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************/
|
||||
|
||||
WERROR rpccli_spoolss_enumforms(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
|
||||
POLICY_HND *handle, int level, uint32 *num_forms,
|
||||
FORM_1 **forms)
|
||||
|
@ -70,78 +70,6 @@ bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime)
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
bool spool_io_user_level_1( const char *desc, prs_struct *ps, int depth, SPOOL_USER_1 *q_u )
|
||||
{
|
||||
prs_debug(ps, depth, desc, "");
|
||||
depth++;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("size", ps, depth, &q_u->size))
|
||||
return False;
|
||||
|
||||
if (!prs_io_unistr2_p("", ps, depth, &q_u->client_name))
|
||||
return False;
|
||||
if (!prs_io_unistr2_p("", ps, depth, &q_u->user_name))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("build", ps, depth, &q_u->build))
|
||||
return False;
|
||||
if (!prs_uint32("major", ps, depth, &q_u->major))
|
||||
return False;
|
||||
if (!prs_uint32("minor", ps, depth, &q_u->minor))
|
||||
return False;
|
||||
if (!prs_uint32("processor", ps, depth, &q_u->processor))
|
||||
return False;
|
||||
|
||||
if (!prs_io_unistr2("", ps, depth, q_u->client_name))
|
||||
return False;
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_io_unistr2("", ps, depth, q_u->user_name))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
static bool spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
if (q_u==NULL)
|
||||
return False;
|
||||
|
||||
prs_debug(ps, depth, desc, "spool_io_user_level");
|
||||
depth++;
|
||||
|
||||
if (!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_uint32("level", ps, depth, &q_u->level))
|
||||
return False;
|
||||
|
||||
switch ( q_u->level )
|
||||
{
|
||||
case 1:
|
||||
if ( !prs_pointer( "" , ps, depth, (void*)&q_u->user.user1,
|
||||
sizeof(SPOOL_USER_1), (PRS_POINTER_CAST)spool_io_user_level_1 ))
|
||||
{
|
||||
return False;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return False;
|
||||
}
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* read or write a DEVICEMODE struct.
|
||||
* on reading allocate memory for the private member
|
||||
@ -376,72 +304,6 @@ static bool spoolss_io_devmode_cont(const char *desc, DEVMODE_CTR *dm_c, prs_str
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* init a structure.
|
||||
********************************************************************/
|
||||
|
||||
bool make_spoolss_q_addprinterex( TALLOC_CTX *mem_ctx, SPOOL_Q_ADDPRINTEREX *q_u,
|
||||
const char *srv_name, const char* clientname, const char* user_name,
|
||||
uint32 level, PRINTER_INFO_CTR *ctr)
|
||||
{
|
||||
DEBUG(5,("make_spoolss_q_addprinterex\n"));
|
||||
|
||||
if (!ctr || !ctr->printers_2)
|
||||
return False;
|
||||
|
||||
ZERO_STRUCTP(q_u);
|
||||
|
||||
q_u->server_name = TALLOC_P( mem_ctx, UNISTR2 );
|
||||
if (!q_u->server_name) {
|
||||
return False;
|
||||
}
|
||||
init_unistr2(q_u->server_name, srv_name, UNI_FLAGS_NONE);
|
||||
|
||||
q_u->level = level;
|
||||
|
||||
q_u->info.level = level;
|
||||
q_u->info.info_ptr = (ctr->printers_2!=NULL)?1:0;
|
||||
switch (level) {
|
||||
case 2:
|
||||
/* init q_u->info.info2 from *info */
|
||||
if (!make_spoolss_printer_info_2(mem_ctx, &q_u->info.info_2, ctr->printers_2)) {
|
||||
DEBUG(0,("make_spoolss_q_addprinterex: Unable to fill SPOOL_Q_ADDPRINTEREX struct!\n"));
|
||||
return False;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
|
||||
q_u->user_switch=1;
|
||||
|
||||
q_u->user_ctr.level = 1;
|
||||
q_u->user_ctr.user.user1 = TALLOC_P( talloc_tos(), SPOOL_USER_1 );
|
||||
if (!q_u->user_ctr.user.user1) {
|
||||
return False;
|
||||
}
|
||||
q_u->user_ctr.user.user1->build = 1381;
|
||||
q_u->user_ctr.user.user1->major = 2;
|
||||
q_u->user_ctr.user.user1->minor = 0;
|
||||
q_u->user_ctr.user.user1->processor = 0;
|
||||
|
||||
q_u->user_ctr.user.user1->client_name = TALLOC_P( mem_ctx, UNISTR2 );
|
||||
if (!q_u->user_ctr.user.user1->client_name) {
|
||||
return False;
|
||||
}
|
||||
q_u->user_ctr.user.user1->user_name = TALLOC_P( mem_ctx, UNISTR2 );
|
||||
if (!q_u->user_ctr.user.user1->user_name) {
|
||||
return False;
|
||||
}
|
||||
init_unistr2(q_u->user_ctr.user.user1->client_name, clientname, UNI_STR_TERMINATE);
|
||||
init_unistr2(q_u->user_ctr.user.user1->user_name, user_name, UNI_STR_TERMINATE);
|
||||
|
||||
q_u->user_ctr.user.user1->size = q_u->user_ctr.user.user1->user_name->uni_str_len +
|
||||
q_u->user_ctr.user.user1->client_name->uni_str_len + 2;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
create a SPOOL_PRINTER_INFO_2 stuct from a PRINTER_INFO_2 struct
|
||||
*******************************************************************/
|
||||
@ -3017,89 +2879,6 @@ bool spool_io_printer_info_level(const char *desc, SPOOL_PRINTER_INFO_LEVEL *il,
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
bool spoolss_io_q_addprinterex(const char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth)
|
||||
{
|
||||
uint32 ptr_sec_desc = 0;
|
||||
|
||||
prs_debug(ps, depth, desc, "spoolss_io_q_addprinterex");
|
||||
depth++;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if (!prs_io_unistr2_p("ptr", ps, depth, &q_u->server_name))
|
||||
return False;
|
||||
if (!prs_io_unistr2("servername", ps, depth, q_u->server_name))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
if(!prs_uint32("info_level", ps, depth, &q_u->level))
|
||||
return False;
|
||||
|
||||
if(!spool_io_printer_info_level("", &q_u->info, ps, depth))
|
||||
return False;
|
||||
|
||||
if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth))
|
||||
return False;
|
||||
|
||||
if(!prs_align(ps))
|
||||
return False;
|
||||
|
||||
switch (q_u->level) {
|
||||
case 2:
|
||||
ptr_sec_desc = q_u->info.info_2->secdesc_ptr;
|
||||
break;
|
||||
case 3:
|
||||
ptr_sec_desc = q_u->info.info_3->secdesc_ptr;
|
||||
break;
|
||||
}
|
||||
if (ptr_sec_desc) {
|
||||
if (!sec_io_desc_buf(desc, &q_u->secdesc_ctr, ps, depth))
|
||||
return False;
|
||||
} else {
|
||||
uint32 dummy = 0;
|
||||
|
||||
/* Parse a NULL security descriptor. This should really
|
||||
happen inside the sec_io_desc_buf() function. */
|
||||
|
||||
prs_debug(ps, depth, "", "sec_io_desc_buf");
|
||||
if (!prs_uint32("size", ps, depth + 1, &dummy))
|
||||
return False;
|
||||
if (!prs_uint32("ptr", ps, depth + 1, &dummy))
|
||||
return False;
|
||||
}
|
||||
|
||||
if(!prs_uint32("user_switch", ps, depth, &q_u->user_switch))
|
||||
return False;
|
||||
if(!spool_io_user_level("", &q_u->user_ctr, ps, depth))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
********************************************************************/
|
||||
|
||||
bool spoolss_io_r_addprinterex(const char *desc, SPOOL_R_ADDPRINTEREX *r_u,
|
||||
prs_struct *ps, int depth)
|
||||
{
|
||||
prs_debug(ps, depth, desc, "spoolss_io_r_addprinterex");
|
||||
depth++;
|
||||
|
||||
if(!smb_io_pol_hnd("printer handle",&r_u->handle,ps,depth))
|
||||
return False;
|
||||
|
||||
if(!prs_werror("status", ps, depth, &r_u->status))
|
||||
return False;
|
||||
|
||||
return True;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
make a BUFFER5 struct from a uint16*
|
||||
******************************************************************/
|
||||
|
Reference in New Issue
Block a user