summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/rpc_server/srv_spoolss.c22
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c106
3 files changed, 46 insertions, 83 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 80db935967..7af45128ca 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -6245,7 +6245,6 @@ WERROR _spoolss_enumprintmonitors(pipes_struct *p, SPOOL_Q_ENUMPRINTMONITORS *q_
WERROR _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *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);
-WERROR _spoolss_getprintprocessordirectory(pipes_struct *p, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u);
/* The following definitions come from rpc_server/srv_srvsvc_nt.c */
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index 4074f8601b..639dbde5c4 100644
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -865,27 +865,7 @@ static bool api_spoolss_enumprinterdataex(pipes_struct *p)
static bool api_spoolss_getprintprocessordirectory(pipes_struct *p)
{
- SPOOL_Q_GETPRINTPROCESSORDIRECTORY q_u;
- SPOOL_R_GETPRINTPROCESSORDIRECTORY 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_getprintprocessordirectory("", &q_u, data, 0)) {
- DEBUG(0,("spoolss_io_q_getprintprocessordirectory: unable to unmarshall SPOOL_Q_GETPRINTPROCESSORDIRECTORY.\n"));
- return False;
- }
-
- r_u.status = _spoolss_getprintprocessordirectory(p, &q_u, &r_u);
-
- if(!spoolss_io_r_getprintprocessordirectory("", &r_u, rdata, 0)) {
- DEBUG(0,("spoolss_io_r_getprintprocessordirectory: unable to marshall SPOOL_R_GETPRINTPROCESSORDIRECTORY.\n"));
- return False;
- }
-
- return True;
+ return proxy_spoolss_call(p, NDR_SPOOLSS_GETPRINTPROCESSORDIRECTORY);
}
/****************************************************************************
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 171953b6ab..9d7e4d2b14 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -9730,84 +9730,79 @@ done:
/****************************************************************************
****************************************************************************/
-static void fill_printprocessordirectory_1(PRINTPROCESSOR_DIRECTORY_1 *info, const char *name)
+static WERROR getprintprocessordirectory_level_1(TALLOC_CTX *mem_ctx,
+ const char *servername,
+ const char *environment,
+ struct spoolss_PrintProcessorDirectoryInfo1 *info1,
+ uint32_t offered,
+ uint32_t *needed)
{
- init_unistr(&info->name, name);
-}
-
-static WERROR getprintprocessordirectory_level_1(UNISTR2 *name,
- UNISTR2 *environment,
- RPC_BUFFER *buffer,
- uint32 offered,
- uint32 *needed)
-{
- char *long_archi = NULL;
- PRINTPROCESSOR_DIRECTORY_1 *info=NULL;
- WERROR result = WERR_OK;
- TALLOC_CTX *ctx = talloc_tos();
+ const char *long_archi = SPOOLSS_ARCHITECTURE_NT_X86;
+ const char *short_archi;
- long_archi = unistr2_to_ascii_talloc(ctx, environment);
- if (!long_archi) {
- return WERR_NOMEM;
+ if (environment) {
+ long_archi = environment;
}
- if (!get_short_archi(long_archi))
+ short_archi = get_short_archi(long_archi);
+ if (!short_archi) {
return WERR_INVALID_ENVIRONMENT;
+ }
- if((info=SMB_MALLOC_P(PRINTPROCESSOR_DIRECTORY_1)) == NULL)
- return WERR_NOMEM;
+ /* I think this should look like this - gd
+ info1->directory_name = talloc_asprintf(mem_ctx,
+ "C:\\WINNT\\System32\\spool\\PRTPROCS\\%s", short_archi);
+ */
+ info1->directory_name = talloc_strdup(mem_ctx,
+ "C:\\WINNT\\System32\\spool\\PRTPROCS\\W32X86");
- fill_printprocessordirectory_1(info, "C:\\WINNT\\System32\\spool\\PRTPROCS\\W32X86");
+ if (!info1->directory_name) {
+ return WERR_NOMEM;
+ }
- *needed += spoolss_size_printprocessordirectory_info_1(info);
+ *needed += ndr_size_spoolss_PrintProcessorDirectoryInfo1(info1, NULL, 0);
if (*needed > offered) {
- result = WERR_INSUFFICIENT_BUFFER;
- goto out;
- }
-
- if (!rpcbuf_alloc_size(buffer, *needed)) {
- result = WERR_INSUFFICIENT_BUFFER;
- goto out;
+ return WERR_INSUFFICIENT_BUFFER;
}
- smb_io_printprocessordirectory_1("", buffer, info, 0);
-
-out:
- SAFE_FREE(info);
-
- return result;
+ return WERR_OK;
}
-WERROR _spoolss_getprintprocessordirectory(pipes_struct *p, SPOOL_Q_GETPRINTPROCESSORDIRECTORY *q_u, SPOOL_R_GETPRINTPROCESSORDIRECTORY *r_u)
+/****************************************************************
+ _spoolss_GetPrintProcessorDirectory
+****************************************************************/
+
+WERROR _spoolss_GetPrintProcessorDirectory(pipes_struct *p,
+ struct spoolss_GetPrintProcessorDirectory *r)
{
- uint32 level = q_u->level;
- RPC_BUFFER *buffer = NULL;
- uint32 offered = q_u->offered;
- uint32 *needed = &r_u->needed;
WERROR result;
/* that's an [in out] buffer */
- if (!q_u->buffer && (offered!=0)) {
+ if (!r->in.buffer && (r->in.offered != 0)) {
return WERR_INVALID_PARAM;
}
- if (offered > MAX_RPC_DATA_SIZE) {
+ if (r->in.offered > MAX_RPC_DATA_SIZE) {
return WERR_INVALID_PARAM;
}
- rpcbuf_move(q_u->buffer, &r_u->buffer);
- buffer = r_u->buffer;
+ DEBUG(5,("_spoolss_GetPrintProcessorDirectory\n"));
- DEBUG(5,("_spoolss_getprintprocessordirectory\n"));
-
- *needed=0;
+ *r->out.needed = 0;
- switch(level) {
+ switch (r->in.level) {
case 1:
- result = getprintprocessordirectory_level_1
- (&q_u->name, &q_u->environment, buffer, offered, needed);
+ result = getprintprocessordirectory_level_1(p->mem_ctx,
+ r->in.server,
+ r->in.environment,
+ &r->out.info->info1,
+ r->in.offered,
+ r->out.needed);
+ if (W_ERROR_EQUAL(result, WERR_INSUFFICIENT_BUFFER)) {
+ TALLOC_FREE(r->out.info);
+ }
break;
default:
result = WERR_UNKNOWN_LEVEL;
@@ -10246,17 +10241,6 @@ WERROR _spoolss_EnumPrintProcessors(pipes_struct *p,
}
/****************************************************************
- _spoolss_GetPrintProcessorDirectory
-****************************************************************/
-
-WERROR _spoolss_GetPrintProcessorDirectory(pipes_struct *p,
- struct spoolss_GetPrintProcessorDirectory *r)
-{
- p->rng_fault_state = true;
- return WERR_NOT_SUPPORTED;
-}
-
-/****************************************************************
_spoolss_ReadPrinter
****************************************************************/