diff options
author | Günther Deschner <gd@samba.org> | 2009-02-10 01:43:25 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-02-10 11:26:45 +0100 |
commit | b4bda6da5ae63223207f08caec8fedfd8a654ee2 (patch) | |
tree | 5d1c2321e1fad117d61207a9c142c0ffcb13f506 /source3 | |
parent | 0fc13e7e2cb95f4e8a94b6fc91c72ee59b2963d6 (diff) | |
download | samba-b4bda6da5ae63223207f08caec8fedfd8a654ee2.tar.gz samba-b4bda6da5ae63223207f08caec8fedfd8a654ee2.tar.bz2 samba-b4bda6da5ae63223207f08caec8fedfd8a654ee2.zip |
s3-spoolss: use pidl for _spoolss_OpenPrinterEx.
Guenther
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_server/srv_spoolss.c | 23 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 80 |
2 files changed, 35 insertions, 68 deletions
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c index 61eb5c6c37..34b66effe4 100644 --- a/source3/rpc_server/srv_spoolss.c +++ b/source3/rpc_server/srv_spoolss.c @@ -77,34 +77,13 @@ static bool api_spoolss_open_printer(pipes_struct *p) return True; } - /******************************************************************** * api_spoolss_open_printer_ex ********************************************************************/ static bool api_spoolss_open_printer_ex(pipes_struct *p) { - SPOOL_Q_OPEN_PRINTER_EX q_u; - SPOOL_R_OPEN_PRINTER_EX r_u; - prs_struct *data = &p->in_data.data; - prs_struct *rdata = &p->out_data.rdata; - - ZERO_STRUCT(q_u); - ZERO_STRUCT(r_u); - - if (!spoolss_io_q_open_printer_ex("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_open_printer_ex: unable to unmarshall SPOOL_Q_OPEN_PRINTER_EX.\n")); - return False; - } - - r_u.status = _spoolss_open_printer_ex( p, &q_u, &r_u); - - if (!spoolss_io_r_open_printer_ex("",&r_u,rdata,0)){ - DEBUG(0,("spoolss_io_r_open_printer_ex: unable to marshall SPOOL_R_OPEN_PRINTER_EX.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_OPENPRINTEREX); } /******************************************************************** diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 84cb3392e2..8f43793a53 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -1623,27 +1623,25 @@ static bool convert_devicemode_new(const char *printername, return true; } -/******************************************************************** - ********************************************************************/ +/**************************************************************** + _spoolss_OpenPrinterEx +****************************************************************/ -WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, SPOOL_R_OPEN_PRINTER_EX *r_u) +WERROR _spoolss_OpenPrinterEx(pipes_struct *p, + struct spoolss_OpenPrinterEx *r) { - PRINTER_DEFAULT *printer_default = &q_u->printer_default; - POLICY_HND *handle = &r_u->handle; - - fstring name; + POLICY_HND *handle = r->out.handle; + char *name = CONST_DISCARD(char *, r->in.printername); int snum; Printer_entry *Printer=NULL; - if (!q_u->printername) { + if (!name) { return WERR_INVALID_PARAM; } /* some sanity check because you can open a printer or a print server */ /* aka: \\server\printer or \\server */ - unistr2_to_ascii(name, q_u->printername, sizeof(name)); - DEBUGADD(3,("checking name: %s\n",name)); if (!open_printer_hnd(p, handle, name, 0)) { @@ -1652,7 +1650,7 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, Printer=find_printer_index_by_hnd(p, handle); if ( !Printer ) { - DEBUG(0,(" _spoolss_open_printer_ex: logic error. Can't find printer " + DEBUG(0,("_spoolss_OpenPrinterEx: logic error. Can't find printer " "handle we created for printer %s\n", name )); close_printer_handle(p,handle); return WERR_INVALID_PARAM; @@ -1693,15 +1691,15 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, /* Map standard access rights to object specific access rights */ - se_map_standard(&printer_default->access_required, + se_map_standard(&r->in.access_mask, &printserver_std_mapping); /* Deny any object specific bits that don't apply to print servers (i.e printer and job specific bits) */ - printer_default->access_required &= SPECIFIC_RIGHTS_MASK; + r->in.access_mask &= SPECIFIC_RIGHTS_MASK; - if (printer_default->access_required & + if (r->in.access_mask & ~(SERVER_ACCESS_ADMINISTER | SERVER_ACCESS_ENUMERATE)) { DEBUG(3, ("access DENIED for non-printserver bits\n")); close_printer_handle(p, handle); @@ -1710,7 +1708,7 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, /* Allow admin access */ - if ( printer_default->access_required & SERVER_ACCESS_ADMINISTER ) + if ( r->in.access_mask & SERVER_ACCESS_ADMINISTER ) { SE_PRIV se_printop = SE_PRINT_OPERATOR; @@ -1734,14 +1732,14 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, return WERR_ACCESS_DENIED; } - printer_default->access_required = SERVER_ACCESS_ADMINISTER; + r->in.access_mask = SERVER_ACCESS_ADMINISTER; } else { - printer_default->access_required = SERVER_ACCESS_ENUMERATE; + r->in.access_mask = SERVER_ACCESS_ENUMERATE; } - DEBUG(4,("Setting print server access = %s\n", (printer_default->access_required == SERVER_ACCESS_ADMINISTER) + DEBUG(4,("Setting print server access = %s\n", (r->in.access_mask == SERVER_ACCESS_ADMINISTER) ? "SERVER_ACCESS_ADMINISTER" : "SERVER_ACCESS_ENUMERATE" )); /* We fall through to return WERR_OK */ @@ -1756,11 +1754,11 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, return WERR_BADFID; } - se_map_standard(&printer_default->access_required, &printer_std_mapping); + se_map_standard(&r->in.access_mask, &printer_std_mapping); /* map an empty access mask to the minimum access mask */ - if (printer_default->access_required == 0x0) - printer_default->access_required = PRINTER_ACCESS_USE; + if (r->in.access_mask == 0x0) + r->in.access_mask = PRINTER_ACCESS_USE; /* * If we are not serving the printer driver for this printer, @@ -1769,9 +1767,9 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, */ if (lp_use_client_driver(snum) - && (printer_default->access_required & PRINTER_ACCESS_ADMINISTER)) + && (r->in.access_mask & PRINTER_ACCESS_ADMINISTER)) { - printer_default->access_required = PRINTER_ACCESS_USE; + r->in.access_mask = PRINTER_ACCESS_USE; } /* check smb.conf parameters and the the sec_desc */ @@ -1784,24 +1782,24 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, if (!user_ok_token(uidtoname(p->server_info->utok.uid), NULL, p->server_info->ptok, snum) || !print_access_check(p->server_info, snum, - printer_default->access_required)) { + r->in.access_mask)) { DEBUG(3, ("access DENIED for printer open\n")); close_printer_handle(p, handle); return WERR_ACCESS_DENIED; } - if ((printer_default->access_required & SPECIFIC_RIGHTS_MASK)& ~(PRINTER_ACCESS_ADMINISTER|PRINTER_ACCESS_USE)) { + if ((r->in.access_mask & SPECIFIC_RIGHTS_MASK)& ~(PRINTER_ACCESS_ADMINISTER|PRINTER_ACCESS_USE)) { DEBUG(3, ("access DENIED for printer open - unknown bits\n")); close_printer_handle(p, handle); return WERR_ACCESS_DENIED; } - if (printer_default->access_required & PRINTER_ACCESS_ADMINISTER) - printer_default->access_required = PRINTER_ACCESS_ADMINISTER; + if (r->in.access_mask & PRINTER_ACCESS_ADMINISTER) + r->in.access_mask = PRINTER_ACCESS_ADMINISTER; else - printer_default->access_required = PRINTER_ACCESS_USE; + r->in.access_mask = PRINTER_ACCESS_USE; - DEBUG(4,("Setting printer access = %s\n", (printer_default->access_required == PRINTER_ACCESS_ADMINISTER) + DEBUG(4,("Setting printer access = %s\n", (r->in.access_mask == PRINTER_ACCESS_ADMINISTER) ? "PRINTER_ACCESS_ADMINISTER" : "PRINTER_ACCESS_USE" )); break; @@ -1811,7 +1809,7 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, return WERR_BADFID; } - Printer->access_granted = printer_default->access_required; + Printer->access_granted = r->in.access_mask; /* * If the client sent a devmode in the OpenPrinter() call, then @@ -1819,20 +1817,21 @@ WERROR _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, */ if ( (Printer->printer_type != SPLHND_SERVER) - && q_u->printer_default.devmode_cont.devmode_ptr ) + && r->in.devmode_ctr.devmode ) { - convert_devicemode( Printer->sharename, q_u->printer_default.devmode_cont.devmode, - &Printer->nt_devmode ); + convert_devicemode_new(Printer->sharename, + r->in.devmode_ctr.devmode, + &Printer->nt_devmode); } #if 0 /* JERRY -- I'm doubtful this is really effective */ /* HACK ALERT!!! Sleep for 1/3 of a second to try trigger a LAN/WAN optimization in Windows 2000 clients --jerry */ - if ( (printer_default->access_required == PRINTER_ACCESS_ADMINISTER) + if ( (r->in.access_mask == PRINTER_ACCESS_ADMINISTER) && (RA_WIN2K == get_remote_arch()) ) { - DEBUG(10,("_spoolss_open_printer_ex: Enabling LAN/WAN hack for Win2k clients.\n")); + DEBUG(10,("_spoolss_OpenPrinterEx: Enabling LAN/WAN hack for Win2k clients.\n")); sys_usleep( 500000 ); } #endif @@ -10632,17 +10631,6 @@ WERROR _spoolss_44(pipes_struct *p, } /**************************************************************** - _spoolss_OpenPrinterEx -****************************************************************/ - -WERROR _spoolss_OpenPrinterEx(pipes_struct *p, - struct spoolss_OpenPrinterEx *r) -{ - p->rng_fault_state = true; - return WERR_NOT_SUPPORTED; -} - -/**************************************************************** _spoolss_AddPrinterEx ****************************************************************/ |