[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha7-436-gacf523a
Günther Deschner
gd at samba.org
Tue Mar 17 11:11:41 GMT 2009
The branch, master has been updated
via acf523ad7edcde788ee79144928d74d91f0e0754 (commit)
via 2a8c078357dd7bd191d0f2c55d94834c4774ecfc (commit)
via ead6a49218845fb7aa8f16147b6787c8811d4b10 (commit)
via 80ecd11050061c6af30ff770e58af2f1a8291806 (commit)
via 57077f43a73cfca9b3ae6ea03ebe457925e4c232 (commit)
via 3e16ede0c2c73134201948e4018f6acefdca039c (commit)
from 4ea46d69bbb7651b213c5b0674f4f9fb05059acd (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit acf523ad7edcde788ee79144928d74d91f0e0754
Author: Günther Deschner <gd at samba.org>
Date: Tue Mar 17 00:34:59 2009 +0100
s3-net: fix net_spoolss_setprinterdata.
Guenther
commit 2a8c078357dd7bd191d0f2c55d94834c4774ecfc
Author: Günther Deschner <gd at samba.org>
Date: Tue Mar 17 01:47:40 2009 +0100
s3-net: use rpccli_spoolss_EnumPrinterData.
Guenther
commit ead6a49218845fb7aa8f16147b6787c8811d4b10
Author: Günther Deschner <gd at samba.org>
Date: Mon Mar 16 15:04:17 2009 +0100
s3-spoolss: remove spoolss_EnumPrinterData.
Guenther
commit 80ecd11050061c6af30ff770e58af2f1a8291806
Author: Günther Deschner <gd at samba.org>
Date: Mon Mar 16 14:58:55 2009 +0100
s3-spoolss: use pidl for _spoolss_EnumPrinterData.
Guenther
commit 57077f43a73cfca9b3ae6ea03ebe457925e4c232
Author: Günther Deschner <gd at samba.org>
Date: Mon Mar 16 15:02:43 2009 +0100
s3-spoolss: remove rpccli_spoolss_enumprinterdata.
Guenther
commit 3e16ede0c2c73134201948e4018f6acefdca039c
Author: Günther Deschner <gd at samba.org>
Date: Mon Mar 16 15:11:04 2009 +0100
s3-rpcclient: use rpccli_spoolss_EnumPrinterData in enumdata command.
Guenther
-----------------------------------------------------------------------
Summary of changes:
source3/include/proto.h | 11 ---
source3/include/rpc_spoolss.h | 22 ------
source3/rpc_client/cli_spoolss.c | 49 ------------
source3/rpc_parse/parse_spoolss.c | 94 -----------------------
source3/rpc_server/srv_spoolss.c | 22 +-----
source3/rpc_server/srv_spoolss_nt.c | 140 ++++++++++++-----------------------
source3/rpcclient/cmd_spoolss.c | 76 ++++++++++++++-----
source3/utils/net_rpc_printer.c | 95 ++++++++++++++++++------
8 files changed, 180 insertions(+), 329 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 04f5997..e73237d 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -5540,11 +5540,6 @@ WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli,
uint32_t offered,
enum winreg_Type *type,
union spoolss_PrinterData *data);
-WERROR rpccli_spoolss_enumprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *hnd, uint32 ndx,
- uint32 value_offered, uint32 data_offered,
- uint32 *value_needed, uint32 *data_needed,
- REGISTRY_VALUE *value);
WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *hnd, const char *keyname,
REGVAL_CTR *ctr);
@@ -5846,11 +5841,6 @@ bool make_systemtime(SYSTEMTIME *systime, struct tm *unixtime);
bool spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE *devmode);
uint32 spoolss_size_printer_enum_values(PRINTER_ENUM_VALUES *p);
bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16 *src);
-bool spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth);
-bool spoolss_io_q_enumprinterdata(const char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth);
-bool make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u,
- const POLICY_HND *hnd,
- uint32 idx, uint32 valuelen, uint32 datalen);
bool make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u,
const POLICY_HND *hnd, const char *key,
uint32 size);
@@ -6060,7 +6050,6 @@ struct spoolss_DeviceMode *construct_dev_mode_new(TALLOC_CTX *mem_ctx,
WERROR add_port_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, const char *portname, const char *uri );
bool add_printer_hook(TALLOC_CTX *ctx, NT_USER_TOKEN *token, NT_PRINTER_INFO_LEVEL *printer);
WERROR enumports_hook(TALLOC_CTX *ctx, int *count, char ***lines );
-WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, SPOOL_R_ENUMPRINTERDATA *r_u);
WERROR _spoolss_enumprinterkey(pipes_struct *p, SPOOL_Q_ENUMPRINTERKEY *q_u, SPOOL_R_ENUMPRINTERKEY *r_u);
WERROR _spoolss_enumprinterdataex(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATAEX *q_u, SPOOL_R_ENUMPRINTERDATAEX *r_u);
diff --git a/source3/include/rpc_spoolss.h b/source3/include/rpc_spoolss.h
index 26fb032..7c14e73 100644
--- a/source3/include/rpc_spoolss.h
+++ b/source3/include/rpc_spoolss.h
@@ -295,28 +295,6 @@ SYSTEMTIME;
/********************************************/
-typedef struct spool_q_enumprinterdata
-{
- POLICY_HND handle;
- uint32 index;
- uint32 valuesize;
- uint32 datasize;
-}
-SPOOL_Q_ENUMPRINTERDATA;
-
-typedef struct spool_r_enumprinterdata
-{
- uint32 valuesize;
- uint16 *value;
- uint32 realvaluesize;
- uint32 type;
- uint32 datasize;
- uint8 *data;
- uint32 realdatasize;
- WERROR status;
-}
-SPOOL_R_ENUMPRINTERDATA;
-
typedef struct spool_q_enumprinterkey
{
POLICY_HND handle;
diff --git a/source3/rpc_client/cli_spoolss.c b/source3/rpc_client/cli_spoolss.c
index d7458dc..66e760c 100644
--- a/source3/rpc_client/cli_spoolss.c
+++ b/source3/rpc_client/cli_spoolss.c
@@ -753,55 +753,6 @@ WERROR rpccli_spoolss_getprinterdata(struct rpc_pipe_client *cli,
/**********************************************************************
**********************************************************************/
-WERROR rpccli_spoolss_enumprinterdata(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
- POLICY_HND *hnd, uint32 ndx,
- uint32 value_offered, uint32 data_offered,
- uint32 *value_needed, uint32 *data_needed,
- REGISTRY_VALUE *value)
-{
- prs_struct qbuf, rbuf;
- SPOOL_Q_ENUMPRINTERDATA in;
- SPOOL_R_ENUMPRINTERDATA out;
-
- ZERO_STRUCT(in);
- ZERO_STRUCT(out);
-
- make_spoolss_q_enumprinterdata( &in, hnd, ndx, value_offered, data_offered );
-
- CLI_DO_RPC_WERR( cli, mem_ctx, &syntax_spoolss, SPOOLSS_ENUMPRINTERDATA,
- in, out,
- qbuf, rbuf,
- spoolss_io_q_enumprinterdata,
- spoolss_io_r_enumprinterdata,
- WERR_GENERAL_FAILURE );
-
- if ( value_needed )
- *value_needed = out.realvaluesize;
- if ( data_needed )
- *data_needed = out.realdatasize;
-
- if (!W_ERROR_IS_OK(out.status))
- return out.status;
-
- if (value) {
- rpcstr_pull(value->valuename, out.value, sizeof(value->valuename), -1,
- STR_TERMINATE);
- if (out.realdatasize) {
- value->data_p = (uint8 *)TALLOC_MEMDUP(mem_ctx, out.data,
- out.realdatasize);
- } else {
- value->data_p = NULL;
- }
- value->type = out.type;
- value->size = out.realdatasize;
- }
-
- return out.status;
-}
-
-/**********************************************************************
-**********************************************************************/
-
WERROR rpccli_spoolss_enumprinterdataex(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *hnd, const char *keyname,
REGVAL_CTR *ctr)
diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c
index 673526d..91cb40e 100644
--- a/source3/rpc_parse/parse_spoolss.c
+++ b/source3/rpc_parse/parse_spoolss.c
@@ -313,100 +313,6 @@ bool make_spoolss_buffer5(TALLOC_CTX *mem_ctx, BUFFER5 *buf5, uint32 len, uint16
/*******************************************************************
********************************************************************/
-bool spoolss_io_r_enumprinterdata(const char *desc, SPOOL_R_ENUMPRINTERDATA *r_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spoolss_io_r_enumprinterdata");
- depth++;
-
- if(!prs_align(ps))
- return False;
- if(!prs_uint32("valuesize", ps, depth, &r_u->valuesize))
- return False;
-
- if (UNMARSHALLING(ps) && r_u->valuesize) {
- r_u->value = PRS_ALLOC_MEM(ps, uint16, r_u->valuesize);
- if (!r_u->value) {
- DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata value\n"));
- return False;
- }
- }
-
- if(!prs_uint16uni(False, "value", ps, depth, r_u->value, r_u->valuesize ))
- return False;
-
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("realvaluesize", ps, depth, &r_u->realvaluesize))
- return False;
-
- if(!prs_uint32("type", ps, depth, &r_u->type))
- return False;
-
- if(!prs_uint32("datasize", ps, depth, &r_u->datasize))
- return False;
-
- if (UNMARSHALLING(ps) && r_u->datasize) {
- r_u->data = PRS_ALLOC_MEM(ps, uint8, r_u->datasize);
- if (!r_u->data) {
- DEBUG(0, ("spoolss_io_r_enumprinterdata: out of memory for printerdata data\n"));
- return False;
- }
- }
-
- if(!prs_uint8s(False, "data", ps, depth, r_u->data, r_u->datasize))
- return False;
- if(!prs_align(ps))
- return False;
-
- if(!prs_uint32("realdatasize", ps, depth, &r_u->realdatasize))
- return False;
- if(!prs_werror("status", ps, depth, &r_u->status))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool spoolss_io_q_enumprinterdata(const char *desc, SPOOL_Q_ENUMPRINTERDATA *q_u, prs_struct *ps, int depth)
-{
- prs_debug(ps, depth, desc, "spoolss_io_q_enumprinterdata");
- depth++;
-
- if(!prs_align(ps))
- return False;
- if(!smb_io_pol_hnd("printer handle",&q_u->handle,ps,depth))
- return False;
- if(!prs_uint32("index", ps, depth, &q_u->index))
- return False;
- if(!prs_uint32("valuesize", ps, depth, &q_u->valuesize))
- return False;
- if(!prs_uint32("datasize", ps, depth, &q_u->datasize))
- return False;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
-bool make_spoolss_q_enumprinterdata(SPOOL_Q_ENUMPRINTERDATA *q_u,
- const POLICY_HND *hnd,
- uint32 idx, uint32 valuelen, uint32 datalen)
-{
- memcpy(&q_u->handle, hnd, sizeof(q_u->handle));
- q_u->index=idx;
- q_u->valuesize=valuelen;
- q_u->datasize=datalen;
-
- return True;
-}
-
-/*******************************************************************
-********************************************************************/
-
bool make_spoolss_q_enumprinterdataex(SPOOL_Q_ENUMPRINTERDATAEX *q_u,
const POLICY_HND *hnd, const char *key,
uint32 size)
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index 1da15ae..ced4ed5 100644
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -350,27 +350,7 @@ static bool api_spoolss_getprinterdriverdirectory(pipes_struct *p)
static bool api_spoolss_enumprinterdata(pipes_struct *p)
{
- SPOOL_Q_ENUMPRINTERDATA q_u;
- SPOOL_R_ENUMPRINTERDATA 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_enumprinterdata("", &q_u, data, 0)) {
- DEBUG(0,("spoolss_io_q_enumprinterdata: unable to unmarshall SPOOL_Q_ENUMPRINTERDATA.\n"));
- return False;
- }
-
- r_u.status = _spoolss_enumprinterdata(p, &q_u, &r_u);
-
- if(!spoolss_io_r_enumprinterdata("", &r_u, rdata, 0)) {
- DEBUG(0,("spoolss_io_r_enumprinterdata: unable to marshall SPOOL_R_ENUMPRINTERDATA.\n"));
- return False;
- }
-
- return True;
+ return proxy_spoolss_call(p, NDR_SPOOLSS_ENUMPRINTERDATA);
}
/****************************************************************************
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 31cb030..83889cf 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -7913,29 +7913,15 @@ WERROR _spoolss_GetPrinterDriverDirectory(pipes_struct *p,
return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
}
-/****************************************************************************
-****************************************************************************/
+/****************************************************************
+ _spoolss_EnumPrinterData
+****************************************************************/
-WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, SPOOL_R_ENUMPRINTERDATA *r_u)
+WERROR _spoolss_EnumPrinterData(pipes_struct *p,
+ struct spoolss_EnumPrinterData *r)
{
- POLICY_HND *handle = &q_u->handle;
- uint32 idx = q_u->index;
- uint32 in_value_len = q_u->valuesize;
- uint32 in_data_len = q_u->datasize;
- uint32 *out_max_value_len = &r_u->valuesize;
- uint16 **out_value = &r_u->value;
- uint32 *out_value_len = &r_u->realvaluesize;
- uint32 *out_type = &r_u->type;
- uint32 *out_max_data_len = &r_u->datasize;
- uint8 **data_out = &r_u->data;
- uint32 *out_data_len = &r_u->realdatasize;
-
NT_PRINTER_INFO_LEVEL *printer = NULL;
-
- uint32 biggest_valuesize;
- uint32 biggest_datasize;
- uint32 data_len;
- Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
+ Printer_entry *Printer = find_printer_index_by_hnd(p, r->in.handle);
int snum;
WERROR result;
REGISTRY_VALUE *val = NULL;
@@ -7943,25 +7929,26 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
int i, key_index, num_values;
int name_length;
- *out_type = 0;
-
- *out_max_data_len = 0;
- *data_out = NULL;
- *out_data_len = 0;
+ *r->out.value_needed = 0;
+ *r->out.type = REG_NONE;
+ *r->out.data_needed = 0;
- DEBUG(5,("spoolss_enumprinterdata\n"));
+ DEBUG(5,("_spoolss_EnumPrinterData\n"));
if (!Printer) {
- DEBUG(2,("_spoolss_enumprinterdata: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle)));
+ DEBUG(2,("_spoolss_EnumPrinterData: Invalid handle (%s:%u:%u).\n",
+ OUR_HANDLE(r->in.handle)));
return WERR_BADFID;
}
- if (!get_printer_snum(p,handle, &snum, NULL))
+ if (!get_printer_snum(p, r->in.handle, &snum, NULL)) {
return WERR_BADFID;
+ }
result = get_a_printer(Printer, &printer, 2, lp_const_servicename(snum));
- if (!W_ERROR_IS_OK(result))
+ if (!W_ERROR_IS_OK(result)) {
return result;
+ }
p_data = printer->info_2->data;
key_index = lookup_printerkey( p_data, SPOOL_PRINTERDATA_KEY );
@@ -7974,12 +7961,12 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
* cf: MSDN EnumPrinterData remark section
*/
- if ( !in_value_len && !in_data_len && (key_index != -1) )
- {
- DEBUGADD(6,("Activating NT mega-hack to find sizes\n"));
+ if (!r->in.value_offered && !r->in.data_offered && (key_index != -1)) {
- biggest_valuesize = 0;
- biggest_datasize = 0;
+ uint32_t biggest_valuesize = 0;
+ uint32_t biggest_datasize = 0;
+
+ DEBUGADD(6,("Activating NT mega-hack to find sizes\n"));
num_values = regval_ctr_numvals( p_data->keys[key_index].values );
@@ -8001,10 +7988,11 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
/* the value is an UNICODE string but real_value_size is the length
in bytes including the trailing 0 */
- *out_value_len = 2 * (1+biggest_valuesize);
- *out_data_len = biggest_datasize;
+ *r->out.value_needed = 2 * (1 + biggest_valuesize);
+ *r->out.data_needed = biggest_datasize;
- DEBUG(6,("final values: [%d], [%d]\n", *out_value_len, *out_data_len));
+ DEBUG(6,("final values: [%d], [%d]\n",
+ *r->out.value_needed, *r->out.data_needed));
goto done;
}
@@ -8014,46 +8002,34 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
* that's the number of bytes not the number of unicode chars
*/
- if ( key_index != -1 )
- val = regval_ctr_specific_value( p_data->keys[key_index].values, idx );
+ if (key_index != -1) {
+ val = regval_ctr_specific_value(p_data->keys[key_index].values,
+ r->in.enum_index);
+ }
- if ( !val )
- {
+ if (!val) {
/* out_value should default to "" or else NT4 has
problems unmarshalling the response */
- *out_max_value_len=(in_value_len/sizeof(uint16));
-
- if (in_value_len) {
- if((*out_value=(uint16 *)TALLOC_ZERO(p->mem_ctx, in_value_len*sizeof(uint8))) == NULL)
- {
+ if (r->in.value_offered) {
+ *r->out.value_needed = 1;
+ r->out.value_name = talloc_strdup(r, "");
+ if (!r->out.value_name) {
result = WERR_NOMEM;
goto done;
}
- *out_value_len = (uint32)rpcstr_push((char *)*out_value, "", in_value_len, 0);
} else {
- *out_value=NULL;
- *out_value_len = 0;
+ r->out.value_name = NULL;
+ *r->out.value_needed = 0;
}
/* the data is counted in bytes */
- *out_max_data_len = in_data_len;
- *out_data_len = in_data_len;
-
- /* only allocate when given a non-zero data_len */
-
- if ( in_data_len && ((*data_out=(uint8 *)TALLOC_ZERO(p->mem_ctx, in_data_len*sizeof(uint8))) == NULL) )
- {
- result = WERR_NOMEM;
- goto done;
- }
+ *r->out.data_needed = r->in.data_offered;
result = WERR_NO_MORE_ITEMS;
- }
- else
- {
+ } else {
/*
* the value is:
* - counted in bytes in the request
@@ -8064,36 +8040,29 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
*/
/* name */
- *out_max_value_len=(in_value_len/sizeof(uint16));
- if (in_value_len) {
- if ( (*out_value = (uint16 *)TALLOC_ZERO(p->mem_ctx, in_value_len*sizeof(uint8))) == NULL )
- {
+ if (r->in.value_offered) {
+ r->out.value_name = talloc_strdup(r, regval_name(val));
+ if (!r->out.value_name) {
result = WERR_NOMEM;
goto done;
}
-
- *out_value_len = (uint32)rpcstr_push((char *)*out_value, regval_name(val), (size_t)in_value_len, 0);
+ *r->out.value_needed = strlen_m(regval_name(val));
} else {
- *out_value = NULL;
- *out_value_len = 0;
+ r->out.value_name = NULL;
+ *r->out.value_needed = 0;
}
/* type */
- *out_type = regval_type( val );
+ *r->out.type = regval_type(val);
/* data - counted in bytes */
- *out_max_data_len = in_data_len;
- if ( in_data_len && (*data_out = (uint8 *)TALLOC_ZERO(p->mem_ctx, in_data_len*sizeof(uint8))) == NULL)
- {
- result = WERR_NOMEM;
- goto done;
+ if (r->out.data && regval_size(val)) {
+ memcpy(r->out.data, regval_data_p(val), regval_size(val));
}
- data_len = regval_size(val);
- if ( *data_out && data_len )
- memcpy( *data_out, regval_data_p(val), data_len );
- *out_data_len = data_len;
+
+ *r->out.data_needed = regval_size(val);
}
done:
@@ -10252,17 +10221,6 @@ WERROR _spoolss_47(pipes_struct *p,
}
/****************************************************************
- _spoolss_EnumPrinterData
-****************************************************************/
-
-WERROR _spoolss_EnumPrinterData(pipes_struct *p,
- struct spoolss_EnumPrinterData *r)
-{
- p->rng_fault_state = true;
- return WERR_NOT_SUPPORTED;
-}
-
-/****************************************************************
_spoolss_4a
--
Samba Shared Repository
More information about the samba-cvs
mailing list