diff options
Diffstat (limited to 'source4/ntptr')
-rw-r--r-- | source4/ntptr/ntptr.h | 3 | ||||
-rw-r--r-- | source4/ntptr/ntptr_interface.c | 9 | ||||
-rw-r--r-- | source4/ntptr/simple_ldb/ntptr_simple_ldb.c | 43 |
3 files changed, 55 insertions, 0 deletions
diff --git a/source4/ntptr/ntptr.h b/source4/ntptr/ntptr.h index 24c467fe65..91817a202f 100644 --- a/source4/ntptr/ntptr.h +++ b/source4/ntptr/ntptr.h @@ -74,6 +74,7 @@ struct spoolss_EnumForms; struct spoolss_EnumPorts; struct spoolss_EnumPrintProcessors; struct spoolss_XcvData; +struct spoolss_GetPrintProcessorDirectory; /* the ntptr operations structure - contains function pointers to the backend implementations of each operation */ @@ -144,6 +145,8 @@ struct ntptr_ops { /* PrintProcessor functions */ WERROR (*EnumPrintProcessors)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, struct spoolss_EnumPrintProcessors *r); + WERROR (*GetPrintProcessorDirectory)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrintProcessorDirectory *r); /* Printer functions */ WERROR (*EnumPrinters)(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, diff --git a/source4/ntptr/ntptr_interface.c b/source4/ntptr/ntptr_interface.c index 109a9f560b..b65a2e32cd 100644 --- a/source4/ntptr/ntptr_interface.c +++ b/source4/ntptr/ntptr_interface.c @@ -263,6 +263,15 @@ WERROR ntptr_EnumPrintProcessors(struct ntptr_context *ntptr, TALLOC_CTX *mem_ct return ntptr->ops->EnumPrintProcessors(ntptr, mem_ctx, r); } +WERROR ntptr_GetPrintProcessorDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrintProcessorDirectory *r) +{ + if (!ntptr->ops->GetPrintProcessorDirectory) { + return WERR_NOT_SUPPORTED; + } + return ntptr->ops->GetPrintProcessorDirectory(ntptr, mem_ctx, r); +} + /* Printer functions */ WERROR ntptr_EnumPrinters(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, diff --git a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c index c570b03a35..459babce0e 100644 --- a/source4/ntptr/simple_ldb/ntptr_simple_ldb.c +++ b/source4/ntptr/simple_ldb/ntptr_simple_ldb.c @@ -750,6 +750,47 @@ static WERROR sptr_GetPrinterForm(struct ntptr_GenericHandle *printer, TALLOC_CT return WERR_OK; } +static WERROR sptr_GetPrintProcessorDirectory(struct ntptr_context *ntptr, TALLOC_CTX *mem_ctx, + struct spoolss_GetPrintProcessorDirectory *r) +{ + union spoolss_PrintProcessorDirectoryInfo *info; + const char *prefix; + const char *postfix; + + /* + * NOTE: normally r->in.level is 1, but both w2k3 and nt4 sp6a + * are ignoring the r->in.level completely, so we do :-) + */ + + /* + * TODO: check the server name is ours + * - if it's a invalid UNC then return WERR_INVALID_NAME + * - if it's the wrong host name return WERR_INVALID_PARAM + * - if it's "" then we need to return a local WINDOWS path + */ + if (!r->in.server || !r->in.server[0]) { + prefix = "C:\\PRTPROCS"; + } else { + prefix = talloc_asprintf(mem_ctx, "%s\\prnproc$", r->in.server); + W_ERROR_HAVE_NO_MEMORY(prefix); + } + + if (r->in.environment && strcmp(SPOOLSS_ARCHITECTURE_NT_X86, r->in.environment) == 0) { + postfix = "W32X86"; + } else { + return WERR_INVALID_ENVIRONMENT; + } + + info = talloc(mem_ctx, union spoolss_PrintProcessorDirectoryInfo); + W_ERROR_HAVE_NO_MEMORY(info); + + info->info1.directory_name = talloc_asprintf(mem_ctx, "%s\\%s", prefix, postfix); + W_ERROR_HAVE_NO_MEMORY(info->info1.directory_name); + + r->out.info = info; + return WERR_OK; +} + /* initialialise the simble ldb backend, registering ourselves with the ntptr subsystem @@ -793,6 +834,8 @@ static const struct ntptr_ops ntptr_simple_ldb_ops = { /* PrintProcessor functions */ /* .EnumPrintProcessors = sptr_EnumPrintProcessors, */ + .GetPrintProcessorDirectory = sptr_GetPrintProcessorDirectory, + /* Printer functions */ .EnumPrinters = sptr_EnumPrinters, .OpenPrinter = sptr_OpenPrinter, |