The branch, master has been updated
       via  228e75112ffe4124748e80d6571ddde4df22881f (commit)
      from  e17df483fbedb81aededdef5fbb6ae1d034bc2dd (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 228e75112ffe4124748e80d6571ddde4df22881f
Author: Günther Deschner <g...@samba.org>
Date:   Wed Feb 25 23:04:52 2009 +0100

    s4-spoolss: implement dcesrv_spoolss_GetPrintProcessorDirectory.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source4/ntptr/ntptr.h                       |    3 ++
 source4/ntptr/ntptr_interface.c             |    9 +++++
 source4/ntptr/simple_ldb/ntptr_simple_ldb.c |   43 +++++++++++++++++++++++++++
 source4/rpc_server/spoolss/dcesrv_spoolss.c |   14 ++++++++-
 4 files changed, 68 insertions(+), 1 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/ntptr/ntptr.h b/source4/ntptr/ntptr.h
index 24c467f..91817a2 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 109a9f5..b65a2e3 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 c570b03..459babc 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,
diff --git a/source4/rpc_server/spoolss/dcesrv_spoolss.c 
b/source4/rpc_server/spoolss/dcesrv_spoolss.c
index 33c657c..89b93bb 100644
--- a/source4/rpc_server/spoolss/dcesrv_spoolss.c
+++ b/source4/rpc_server/spoolss/dcesrv_spoolss.c
@@ -454,7 +454,19 @@ static WERROR dcesrv_spoolss_EnumPrintProcessors(struct 
dcesrv_call_state *dce_c
 static WERROR dcesrv_spoolss_GetPrintProcessorDirectory(struct 
dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                       struct spoolss_GetPrintProcessorDirectory *r)
 {
-       DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
+       struct ntptr_context *ntptr = 
talloc_get_type(dce_call->context->private_data, struct ntptr_context);
+       WERROR status;
+       struct smb_iconv_convenience *ic = lp_iconv_convenience(ntptr->lp_ctx);
+
+       status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, 
r->in.server);
+       W_ERROR_NOT_OK_RETURN(status);
+
+       status = ntptr_GetPrintProcessorDirectory(ntptr, mem_ctx, r);
+       W_ERROR_NOT_OK_RETURN(status);
+
+       *r->out.needed  = 
SPOOLSS_BUFFER_UNION(spoolss_PrintProcessorDirectoryInfo, ic, r->out.info, 
r->in.level);
+       r->out.info     = SPOOLSS_BUFFER_OK(r->out.info, NULL);
+       return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
 }
 
 


-- 
Samba Shared Repository

Reply via email to