[SCM] Samba Shared Repository - branch master updated -
release-4-0-0alpha6-1118-g00173c6
Günther Deschner
gd at samba.org
Tue Feb 24 10:14:54 GMT 2009
The branch, master has been updated
via 00173c6ce6e6aa394acc0685827b0b9fb1faf45c (commit)
via 13995f5212bf1f5db4d246e8de3f63b761788d71 (commit)
via aa576c292f6b16ee95e539c921f54f9b07313f17 (commit)
via 0ca5b72ad951df5f1cc3be30ca5be87399714dcc (commit)
from 022946d1961ddca40a9ac1fc00cf79ae32797669 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 00173c6ce6e6aa394acc0685827b0b9fb1faf45c
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 24 10:34:40 2009 +0100
s3-spoolss: merge path handling in _spoolss_PrintProcessorDirectory and
_spoolss_PrinterDriverDirectory.
Guenther
commit 13995f5212bf1f5db4d246e8de3f63b761788d71
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 24 10:43:53 2009 +0100
s3: re-run make samba3-idl.
Guenther
commit aa576c292f6b16ee95e539c921f54f9b07313f17
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 24 10:41:05 2009 +0100
spoolss: return subcontext spoolss_DriverInfo in spoolss_GetPrinterDriver2.
Guenther
commit 0ca5b72ad951df5f1cc3be30ca5be87399714dcc
Author: Günther Deschner <gd at samba.org>
Date: Tue Feb 24 10:40:21 2009 +0100
spoolss: add SPOOLSS_DEFAULT_SERVER_PATH.
Guenther
-----------------------------------------------------------------------
Summary of changes:
librpc/gen_ndr/cli_spoolss.c | 2 +-
librpc/gen_ndr/cli_spoolss.h | 2 +-
librpc/gen_ndr/ndr_spoolss.c | 19 +++++-
librpc/gen_ndr/spoolss.h | 3 +-
librpc/gen_ndr/srv_spoolss.c | 4 +-
librpc/idl/spoolss.idl | 3 +-
source3/rpc_server/srv_spoolss_nt.c | 127 +++++++++++++++++++++++++----------
7 files changed, 115 insertions(+), 45 deletions(-)
Changeset truncated at 500 lines:
diff --git a/librpc/gen_ndr/cli_spoolss.c b/librpc/gen_ndr/cli_spoolss.c
index 02a05b9..2aa42b9 100644
--- a/librpc/gen_ndr/cli_spoolss.c
+++ b/librpc/gen_ndr/cli_spoolss.c
@@ -2540,7 +2540,7 @@ NTSTATUS rpccli_spoolss_GetPrinterDriver2(struct rpc_pipe_client *cli,
uint32_t offered /* [in] */,
uint32_t client_major_version /* [in] */,
uint32_t client_minor_version /* [in] */,
- DATA_BLOB *info /* [out] [unique] */,
+ union spoolss_DriverInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
uint32_t *needed /* [out] [ref] */,
uint32_t *server_major_version /* [out] [ref] */,
uint32_t *server_minor_version /* [out] [ref] */,
diff --git a/librpc/gen_ndr/cli_spoolss.h b/librpc/gen_ndr/cli_spoolss.h
index bb38d59..83b2e28 100644
--- a/librpc/gen_ndr/cli_spoolss.h
+++ b/librpc/gen_ndr/cli_spoolss.h
@@ -331,7 +331,7 @@ NTSTATUS rpccli_spoolss_GetPrinterDriver2(struct rpc_pipe_client *cli,
uint32_t offered /* [in] */,
uint32_t client_major_version /* [in] */,
uint32_t client_minor_version /* [in] */,
- DATA_BLOB *info /* [out] [unique] */,
+ union spoolss_DriverInfo *info /* [out] [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */,
uint32_t *needed /* [out] [ref] */,
uint32_t *server_major_version /* [out] [ref] */,
uint32_t *server_minor_version /* [out] [ref] */,
diff --git a/librpc/gen_ndr/ndr_spoolss.c b/librpc/gen_ndr/ndr_spoolss.c
index 3e210b2..642ac0b 100644
--- a/librpc/gen_ndr/ndr_spoolss.c
+++ b/librpc/gen_ndr/ndr_spoolss.c
@@ -20096,7 +20096,13 @@ static enum ndr_err_code ndr_push_spoolss_GetPrinterDriver2(struct ndr_push *ndr
if (flags & NDR_OUT) {
NDR_CHECK(ndr_push_unique_ptr(ndr, r->out.info));
if (r->out.info) {
- NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, *r->out.info));
+ {
+ struct ndr_push *_ndr_info;
+ NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info, 4, r->in.offered));
+ NDR_CHECK(ndr_push_set_switch_value(_ndr_info, r->out.info, r->in.level));
+ NDR_CHECK(ndr_push_spoolss_DriverInfo(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+ NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info, 4, r->in.offered));
+ }
}
if (r->out.needed == NULL) {
return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
@@ -20188,7 +20194,13 @@ static enum ndr_err_code ndr_pull_spoolss_GetPrinterDriver2(struct ndr_pull *ndr
if (r->out.info) {
_mem_save_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
NDR_PULL_SET_MEM_CTX(ndr, r->out.info, 0);
- NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, r->out.info));
+ {
+ struct ndr_pull *_ndr_info;
+ NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info, 4, r->in.offered));
+ NDR_CHECK(ndr_pull_set_switch_value(_ndr_info, r->out.info, r->in.level));
+ NDR_CHECK(ndr_pull_spoolss_DriverInfo(_ndr_info, NDR_SCALARS|NDR_BUFFERS, r->out.info));
+ NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info, 4, r->in.offered));
+ }
NDR_PULL_SET_MEM_CTX(ndr, _mem_save_info_0, 0);
}
if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
@@ -20255,7 +20267,8 @@ _PUBLIC_ void ndr_print_spoolss_GetPrinterDriver2(struct ndr_print *ndr, const c
ndr_print_ptr(ndr, "info", r->out.info);
ndr->depth++;
if (r->out.info) {
- ndr_print_DATA_BLOB(ndr, "info", *r->out.info);
+ ndr_print_set_switch_value(ndr, r->out.info, r->in.level);
+ ndr_print_spoolss_DriverInfo(ndr, "info", r->out.info);
}
ndr->depth--;
ndr_print_ptr(ndr, "needed", r->out.needed);
diff --git a/librpc/gen_ndr/spoolss.h b/librpc/gen_ndr/spoolss.h
index 0e8ba37..0b77997 100644
--- a/librpc/gen_ndr/spoolss.h
+++ b/librpc/gen_ndr/spoolss.h
@@ -10,6 +10,7 @@
#define PRINTER_ENUM_ICONMASK ( (PRINTER_ENUM_ICON1|PRINTER_ENUM_ICON2|PRINTER_ENUM_ICON3|PRINTER_ENUM_ICON4|PRINTER_ENUM_ICON5|PRINTER_ENUM_ICON6|PRINTER_ENUM_ICON7|PRINTER_ENUM_ICON8) )
#define SPOOLSS_ARCHITECTURE_NT_X86 ( "Windows NT x86" )
+#define SPOOLSS_DEFAULT_SERVER_PATH ( "C:\\WINDOWS\\system32\\spool" )
#define PRINTER_CHANGE_PRINTER ( 0x000000FF )
#define PRINTER_CHANGE_JOB ( 0x0000FF00 )
#define PRINTER_CHANGE_FORM ( (PRINTER_CHANGE_ADD_FORM|PRINTER_CHANGE_SET_FORM|PRINTER_CHANGE_DELETE_FORM) )
@@ -2282,7 +2283,7 @@ struct spoolss_GetPrinterDriver2 {
} in;
struct {
- DATA_BLOB *info;/* [unique] */
+ union spoolss_DriverInfo *info;/* [unique,subcontext_size(offered),subcontext(4),switch_is(level)] */
uint32_t *needed;/* [ref] */
uint32_t *server_major_version;/* [ref] */
uint32_t *server_minor_version;/* [ref] */
diff --git a/librpc/gen_ndr/srv_spoolss.c b/librpc/gen_ndr/srv_spoolss.c
index f6c17cb..891be85 100644
--- a/librpc/gen_ndr/srv_spoolss.c
+++ b/librpc/gen_ndr/srv_spoolss.c
@@ -4169,7 +4169,7 @@ static bool api_spoolss_GetPrinterDriver2(pipes_struct *p)
}
ZERO_STRUCT(r->out);
- r->out.info = talloc_zero(r, DATA_BLOB);
+ r->out.info = talloc_zero(r, union spoolss_DriverInfo);
if (r->out.info == NULL) {
talloc_free(r);
return false;
@@ -8080,7 +8080,7 @@ NTSTATUS rpc_spoolss_dispatch(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
case NDR_SPOOLSS_GETPRINTERDRIVER2: {
struct spoolss_GetPrinterDriver2 *r = (struct spoolss_GetPrinterDriver2 *)_r;
ZERO_STRUCT(r->out);
- r->out.info = talloc_zero(mem_ctx, DATA_BLOB);
+ r->out.info = talloc_zero(mem_ctx, union spoolss_DriverInfo);
if (r->out.info == NULL) {
return NT_STATUS_NO_MEMORY;
}
diff --git a/librpc/idl/spoolss.idl b/librpc/idl/spoolss.idl
index b8f4c13..510ad3e 100644
--- a/librpc/idl/spoolss.idl
+++ b/librpc/idl/spoolss.idl
@@ -1118,6 +1118,7 @@ import "misc.idl", "security.idl", "winreg.idl";
/******************/
/* Function: 0x1a */
const string SPOOLSS_ARCHITECTURE_NT_X86 = "Windows NT x86";
+ const string SPOOLSS_DEFAULT_SERVER_PATH = "C:\\WINDOWS\\system32\\spool";
typedef [public,gensize] struct {
[value(ndr_size_spoolss_OSVersion(r,ndr->iconv_convenience,ndr->flags))] uint32 _ndr_size;
@@ -1504,7 +1505,7 @@ import "misc.idl", "security.idl", "winreg.idl";
[in] uint32 offered,
[in] uint32 client_major_version,
[in] uint32 client_minor_version,
- [out,unique] DATA_BLOB *info,
+ [out,unique,subcontext(4),subcontext_size(offered),switch_is(level)] spoolss_DriverInfo *info,
[out,ref] uint32 *needed,
[out,ref] uint32 *server_major_version,
[out,ref] uint32 *server_minor_version
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index a4679eb..62301c0 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -8059,45 +8059,106 @@ WERROR _spoolss_AddPrinterDriverEx(pipes_struct *p,
/****************************************************************************
****************************************************************************/
-static WERROR getprinterdriverdir_level_1(TALLOC_CTX *mem_ctx,
+struct _spoolss_paths {
+ int type;
+ const char *share;
+ const char *dir;
+};
+
+enum { SPOOLSS_DRIVER_PATH, SPOOLSS_PRTPROCS_PATH };
+
+static const struct _spoolss_paths spoolss_paths[]= {
+ { SPOOLSS_DRIVER_PATH, "print$", "DRIVERS" },
+ { SPOOLSS_PRTPROCS_PATH, "prnproc$", "PRTPROCS" }
+};
+
+static WERROR compose_spoolss_server_path(TALLOC_CTX *mem_ctx,
const char *servername,
const char *environment,
- struct spoolss_DriverDirectoryInfo1 *info1,
- uint32_t offered,
- uint32_t *needed)
+ int component,
+ char **path)
{
- char *path = NULL;
const char *pservername = NULL;
const char *long_archi = SPOOLSS_ARCHITECTURE_NT_X86;
const char *short_archi;
- if (environment) {
+ *path = NULL;
+
+ /* environment may be empty */
+ if (environment && strlen(environment)) {
long_archi = environment;
}
- pservername = canon_servername(servername);
+ /* servername may be empty */
+ if (servername && strlen(servername)) {
+ pservername = canon_servername(servername);
- if ( !is_myname_or_ipaddr(pservername))
- return WERR_INVALID_PARAM;
+ if (!is_myname_or_ipaddr(pservername)) {
+ return WERR_INVALID_PARAM;
+ }
+ }
- if (!(short_archi = get_short_archi(long_archi)))
+ if (!(short_archi = get_short_archi(long_archi))) {
return WERR_INVALID_ENVIRONMENT;
+ }
- path = talloc_asprintf(mem_ctx,
- "\\\\%s\\print$\\%s", pservername, short_archi);
- if (!path) {
+ switch (component) {
+ case SPOOLSS_PRTPROCS_PATH:
+ case SPOOLSS_DRIVER_PATH:
+ if (pservername) {
+ *path = talloc_asprintf(mem_ctx,
+ "\\\\%s\\%s\\%s",
+ pservername,
+ spoolss_paths[component].share,
+ short_archi);
+ } else {
+ *path = talloc_asprintf(mem_ctx, "%s\\%s\\%s",
+ SPOOLSS_DEFAULT_SERVER_PATH,
+ spoolss_paths[component].dir,
+ short_archi);
+ }
+ break;
+ default:
+ return WERR_INVALID_PARAM;
+ }
+
+ if (!*path) {
return WERR_NOMEM;
}
+ return WERR_OK;
+}
+
+/****************************************************************************
+****************************************************************************/
+
+static WERROR getprinterdriverdir_level_1(TALLOC_CTX *mem_ctx,
+ const char *servername,
+ const char *environment,
+ struct spoolss_DriverDirectoryInfo1 *r,
+ uint32_t offered,
+ uint32_t *needed)
+{
+ WERROR werr;
+ char *path = NULL;
+
+ werr = compose_spoolss_server_path(mem_ctx,
+ servername,
+ environment,
+ SPOOLSS_DRIVER_PATH,
+ &path);
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
+ }
+
DEBUG(4,("printer driver directory: [%s]\n", path));
- info1->directory_name = path;
+ r->directory_name = path;
- *needed += ndr_size_spoolss_DriverDirectoryInfo1(info1, NULL, 0);
+ *needed += ndr_size_spoolss_DriverDirectoryInfo1(r, NULL, 0);
if (*needed > offered) {
talloc_free(path);
- ZERO_STRUCTP(info1);
return WERR_INSUFFICIENT_BUFFER;
}
@@ -9728,36 +9789,30 @@ done:
static WERROR getprintprocessordirectory_level_1(TALLOC_CTX *mem_ctx,
const char *servername,
const char *environment,
- struct spoolss_PrintProcessorDirectoryInfo1 *info1,
+ struct spoolss_PrintProcessorDirectoryInfo1 *r,
uint32_t offered,
uint32_t *needed)
{
- const char *long_archi = SPOOLSS_ARCHITECTURE_NT_X86;
- const char *short_archi;
-
- if (environment) {
- long_archi = environment;
- }
+ WERROR werr;
+ char *path = NULL;
- short_archi = get_short_archi(long_archi);
- if (!short_archi) {
- return WERR_INVALID_ENVIRONMENT;
+ werr = compose_spoolss_server_path(mem_ctx,
+ servername,
+ environment,
+ SPOOLSS_PRTPROCS_PATH,
+ &path);
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
}
- /* 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");
+ DEBUG(4,("print processor directory: [%s]\n", path));
- if (!info1->directory_name) {
- return WERR_NOMEM;
- }
+ r->directory_name = path;
- *needed += ndr_size_spoolss_PrintProcessorDirectoryInfo1(info1, NULL, 0);
+ *needed += ndr_size_spoolss_PrintProcessorDirectoryInfo1(r, NULL, 0);
if (*needed > offered) {
+ talloc_free(path);
return WERR_INSUFFICIENT_BUFFER;
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list