diff options
author | Günther Deschner <gd@samba.org> | 2009-02-12 22:23:04 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-02-12 22:51:29 +0100 |
commit | a4b0c5d871bcc8ec7a16a7bfaf891bd45934ffdf (patch) | |
tree | 04b70a139f6c4949e186042f7e81ad5d2de50fe3 | |
parent | 38e2888653638393ba603c6a4ffd2c3dfa5c718c (diff) | |
download | samba-a4b0c5d871bcc8ec7a16a7bfaf891bd45934ffdf.tar.gz samba-a4b0c5d871bcc8ec7a16a7bfaf891bd45934ffdf.tar.bz2 samba-a4b0c5d871bcc8ec7a16a7bfaf891bd45934ffdf.zip |
s3-spoolss: use pidl for _spoolss_SetPrinterDataEx.
Guenther
-rw-r--r-- | source3/rpc_server/srv_spoolss.c | 22 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 56 |
2 files changed, 23 insertions, 55 deletions
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c index df4b74eded..68b7c3c4b9 100644 --- a/source3/rpc_server/srv_spoolss.c +++ b/source3/rpc_server/srv_spoolss.c @@ -880,27 +880,7 @@ static bool api_spoolss_getprinterdataex(pipes_struct *p) static bool api_spoolss_setprinterdataex(pipes_struct *p) { - SPOOL_Q_SETPRINTERDATAEX q_u; - SPOOL_R_SETPRINTERDATAEX 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_setprinterdataex("", &q_u, data, 0)) { - DEBUG(0,("spoolss_io_q_setprinterdataex: unable to unmarshall SPOOL_Q_SETPRINTERDATAEX.\n")); - return False; - } - - r_u.status = _spoolss_setprinterdataex(p, &q_u, &r_u); - - if(!spoolss_io_r_setprinterdataex("", &r_u, rdata, 0)) { - DEBUG(0,("spoolss_io_r_setprinterdataex: unable to marshall SPOOL_R_SETPRINTERDATAEX.\n")); - return False; - } - - return True; + return proxy_spoolss_call(p, NDR_SPOOLSS_SETPRINTERDATAEX); } diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index fed7a1b404..7199441820 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -9221,37 +9221,34 @@ done: return status; } -/******************************************************************** - * spoolss_setprinterdataex - ********************************************************************/ +/**************************************************************** + _spoolss_SetPrinterDataEx +****************************************************************/ -WERROR _spoolss_setprinterdataex(pipes_struct *p, SPOOL_Q_SETPRINTERDATAEX *q_u, SPOOL_R_SETPRINTERDATAEX *r_u) +WERROR _spoolss_SetPrinterDataEx(pipes_struct *p, + struct spoolss_SetPrinterDataEx *r) { - POLICY_HND *handle = &q_u->handle; - uint32 type = q_u->type; - uint8 *data = q_u->data; - uint32 real_len = q_u->real_len; - + POLICY_HND *handle = r->in.handle; NT_PRINTER_INFO_LEVEL *printer = NULL; int snum = 0; WERROR status = WERR_OK; Printer_entry *Printer = find_printer_index_by_hnd(p, handle); - fstring valuename; - fstring keyname; char *oid_string; - DEBUG(4,("_spoolss_setprinterdataex\n")); + DEBUG(4,("_spoolss_SetPrinterDataEx\n")); /* From MSDN documentation of SetPrinterDataEx: pass request to SetPrinterData if key is "PrinterDriverData" */ if (!Printer) { - DEBUG(2,("_spoolss_setprinterdataex: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle))); + DEBUG(2,("_spoolss_SetPrinterDataEx: " + "Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle))); return WERR_BADFID; } if ( Printer->printer_type == SPLHND_SERVER ) { - DEBUG(10,("_spoolss_setprinterdataex: Not implemented for server handles yet\n")); + DEBUG(10,("_spoolss_SetPrinterDataEx: " + "Not implemented for server handles yet\n")); return WERR_INVALID_PARAM; } @@ -9268,7 +9265,8 @@ WERROR _spoolss_setprinterdataex(pipes_struct *p, SPOOL_Q_SETPRINTERDATAEX *q_u, if (Printer->access_granted != PRINTER_ACCESS_ADMINISTER) { - DEBUG(3, ("_spoolss_setprinterdataex: change denied by handle access permissions\n")); + DEBUG(3, ("_spoolss_SetPrinterDataEx: " + "change denied by handle access permissions\n")); return WERR_ACCESS_DENIED; } @@ -9276,12 +9274,9 @@ WERROR _spoolss_setprinterdataex(pipes_struct *p, SPOOL_Q_SETPRINTERDATAEX *q_u, if (!W_ERROR_IS_OK(status)) return status; - unistr2_to_ascii( valuename, &q_u->value, sizeof(valuename)); - unistr2_to_ascii( keyname, &q_u->key, sizeof(keyname)); - /* check for OID in valuename */ - if ( (oid_string = strchr( valuename, ',' )) != NULL ) + if ( (oid_string = strchr( r->in.value_name, ',' )) != NULL ) { *oid_string = '\0'; oid_string++; @@ -9289,14 +9284,18 @@ WERROR _spoolss_setprinterdataex(pipes_struct *p, SPOOL_Q_SETPRINTERDATAEX *q_u, /* save the registry data */ - status = set_printer_dataex( printer, keyname, valuename, type, data, real_len ); + status = set_printer_dataex( printer, r->in.key_name, r->in.value_name, + r->in.type, r->in.buffer, r->in.offered ); if ( W_ERROR_IS_OK(status) ) { /* save the OID if one was specified */ if ( oid_string ) { - fstrcat( keyname, "\\" ); - fstrcat( keyname, SPOOL_OID_KEY ); + char *str = talloc_asprintf(p->mem_ctx, "%s\\%s", + r->in.key_name, SPOOL_OID_KEY); + if (!str) { + return WERR_NOMEM; + } /* * I'm not checking the status here on purpose. Don't know @@ -9305,7 +9304,7 @@ WERROR _spoolss_setprinterdataex(pipes_struct *p, SPOOL_Q_SETPRINTERDATAEX *q_u, * this is right. --jerry */ - set_printer_dataex( printer, keyname, valuename, + set_printer_dataex( printer, str, r->in.value_name, REG_SZ, (uint8 *)oid_string, strlen(oid_string)+1 ); } @@ -10561,17 +10560,6 @@ WERROR _spoolss_4c(pipes_struct *p, } /**************************************************************** - _spoolss_SetPrinterDataEx -****************************************************************/ - -WERROR _spoolss_SetPrinterDataEx(pipes_struct *p, - struct spoolss_SetPrinterDataEx *r) -{ - p->rng_fault_state = true; - return WERR_NOT_SUPPORTED; -} - -/**************************************************************** _spoolss_EnumPrinterDataEx ****************************************************************/ |