diff options
-rwxr-xr-x | source3/include/rpc_spoolss.h | 13 | ||||
-rw-r--r-- | source3/rpc_parse/parse_spoolss.c | 50 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 10 |
3 files changed, 37 insertions, 36 deletions
diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h index 8a10a0ffdb..eec58b1132 100755 --- a/source3/include/rpc_spoolss.h +++ b/source3/include/rpc_spoolss.h @@ -1348,7 +1348,6 @@ typedef struct spool_printer_info_level_2 UNISTR2 printprocessor; UNISTR2 datatype; UNISTR2 parameters; - SEC_DESC_BUF *secdesc; } SPOOL_PRINTER_INFO_LEVEL_2; @@ -1490,10 +1489,8 @@ typedef struct spool_q_addprinter UNISTR2 server_name; uint32 level; SPOOL_PRINTER_INFO_LEVEL info; - uint32 unk0; - uint32 unk1; - uint32 unk2; - uint32 unk3; + DEVMODE_CTR devmode_ctr; + SEC_DESC_BUF *secdesc_ctr; uint32 user_level; SPOOL_USER_LEVEL user; } @@ -1537,10 +1534,8 @@ typedef struct spool_q_addprinterex UNISTR2 server_name; uint32 level; SPOOL_PRINTER_INFO_LEVEL info; - uint32 unk0; - uint32 unk1; - uint32 unk2; - uint32 unk3; + DEVMODE_CTR devmode_ctr; + SEC_DESC_BUF *secdesc_ctr; uint32 user_switch; SPOOL_USER_CTR user_ctr; } diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 458aed1fce..c7e6f97a5d 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -778,6 +778,8 @@ BOOL make_spoolss_q_addprinterex( if (!ctr) return False; + ZERO_STRUCTP(q_u); + q_u->server_name_ptr = (srv_name!=NULL)?1:0; init_unistr2(&q_u->server_name, srv_name, strlen(srv_name)); @@ -797,8 +799,6 @@ BOOL make_spoolss_q_addprinterex( break; } - q_u->unk0 = q_u->unk1 = q_u->unk2 = q_u->unk3 = 0; - q_u->user_switch=1; q_u->user_ctr.level=1; @@ -868,7 +868,6 @@ BOOL make_spoolss_printer_info_2( init_unistr2_from_unistr(&inf->datatype, &info->datatype); init_unistr2_from_unistr(&inf->parameters, &info->parameters); init_unistr2_from_unistr(&inf->datatype, &info->datatype); - inf->secdesc = inf->secdesc; *spool_info2 = inf; @@ -4520,6 +4519,8 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s BOOL spoolss_io_q_addprinterex(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++; @@ -4539,26 +4540,33 @@ BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct if(!spool_io_printer_info_level("", &q_u->info, ps, depth)) return False; - /* the 4 unknown are all 0 */ - - /* - * en fait ils sont pas inconnu - * par recoupement avec rpcSetPrinter - * c'est le devicemode - * et le security descriptor. - */ - - if(!prs_align(ps)) - return False; - if(!prs_uint32("unk0", ps, depth, &q_u->unk0)) - return False; - if(!prs_uint32("unk1", ps, depth, &q_u->unk1)) - return False; - if(!prs_uint32("unk2", ps, depth, &q_u->unk2)) - return False; - if(!prs_uint32("unk3", ps, depth, &q_u->unk3)) + if (!spoolss_io_devmode_cont(desc, &q_u->devmode_ctr, ps, depth)) 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; + + /* 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)) diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 8a13ebe19e..c96612eef2 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -5843,7 +5843,7 @@ WERROR _spoolss_enumports( pipes_struct *p, SPOOL_Q_ENUMPORTS *q_u, SPOOL_R_ENUM ****************************************************************************/ static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_srv_name, const SPOOL_PRINTER_INFO_LEVEL *info, - uint32 unk0, uint32 unk1, uint32 unk2, uint32 unk3, + DEVICEMODE *devmode, SEC_DESC_BUF *sec_desc_buf, uint32 user_switch, const SPOOL_USER_CTR *user, POLICY_HND *handle) { @@ -5939,10 +5939,8 @@ WERROR _spoolss_addprinterex( pipes_struct *p, SPOOL_Q_ADDPRINTEREX *q_u, SPOOL_ UNISTR2 *uni_srv_name = &q_u->server_name; uint32 level = q_u->level; SPOOL_PRINTER_INFO_LEVEL *info = &q_u->info; - uint32 unk0 = q_u->unk0; - uint32 unk1 = q_u->unk1; - uint32 unk2 = q_u->unk2; - uint32 unk3 = q_u->unk3; + DEVICEMODE *devmode = q_u->devmode_ctr.devmode; + SEC_DESC_BUF *sdb = q_u->secdesc_ctr; uint32 user_switch = q_u->user_switch; SPOOL_USER_CTR *user = &q_u->user_ctr; POLICY_HND *handle = &r_u->handle; @@ -5954,7 +5952,7 @@ WERROR _spoolss_addprinterex( pipes_struct *p, SPOOL_Q_ADDPRINTEREX *q_u, SPOOL_ return WERR_UNKNOWN_LEVEL; case 2: return spoolss_addprinterex_level_2(p, uni_srv_name, info, - unk0, unk1, unk2, unk3, + devmode, sdb, user_switch, user, handle); default: return WERR_UNKNOWN_LEVEL; |