root/source4/rpc_server/spoolss/dcesrv_spoolss.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. dcesrv_spoolss_parse_printer_name
  2. dcesrv_spoolss_check_server_name
  3. dcerpc_spoolss_bind
  4. dcesrv_spoolss_EnumPrinters
  5. dcesrv_spoolss_OpenPrinter
  6. dcesrv_spoolss_SetJob
  7. dcesrv_spoolss_GetJob
  8. dcesrv_spoolss_EnumJobs
  9. dcesrv_spoolss_AddPrinter
  10. dcesrv_spoolss_DeletePrinter
  11. dcesrv_spoolss_SetPrinter
  12. dcesrv_spoolss_GetPrinter
  13. dcesrv_spoolss_AddPrinterDriver
  14. dcesrv_spoolss_EnumPrinterDrivers
  15. dcesrv_spoolss_GetPrinterDriver
  16. dcesrv_spoolss_GetPrinterDriverDirectory
  17. dcesrv_spoolss_DeletePrinterDriver
  18. dcesrv_spoolss_AddPrintProcessor
  19. dcesrv_spoolss_EnumPrintProcessors
  20. dcesrv_spoolss_GetPrintProcessorDirectory
  21. dcesrv_spoolss_StartDocPrinter
  22. dcesrv_spoolss_StartPagePrinter
  23. dcesrv_spoolss_WritePrinter
  24. dcesrv_spoolss_EndPagePrinter
  25. dcesrv_spoolss_AbortPrinter
  26. dcesrv_spoolss_ReadPrinter
  27. dcesrv_spoolss_EndDocPrinter
  28. dcesrv_spoolss_AddJob
  29. dcesrv_spoolss_ScheduleJob
  30. dcesrv_spoolss_GetPrinterData
  31. dcesrv_spoolss_SetPrinterData
  32. dcesrv_spoolss_WaitForPrinterChange
  33. dcesrv_spoolss_ClosePrinter
  34. dcesrv_spoolss_AddForm
  35. dcesrv_spoolss_DeleteForm
  36. dcesrv_spoolss_GetForm
  37. dcesrv_spoolss_SetForm
  38. dcesrv_spoolss_EnumForms
  39. dcesrv_spoolss_EnumPorts
  40. dcesrv_spoolss_EnumMonitors
  41. dcesrv_spoolss_AddPort
  42. dcesrv_spoolss_ConfigurePort
  43. dcesrv_spoolss_DeletePort
  44. dcesrv_spoolss_CreatePrinterIC
  45. dcesrv_spoolss_PlayGDIScriptOnPrinterIC
  46. dcesrv_spoolss_DeletePrinterIC
  47. dcesrv_spoolss_AddPrinterConnection
  48. dcesrv_spoolss_DeletePrinterConnection
  49. dcesrv_spoolss_PrinterMessageBox
  50. dcesrv_spoolss_AddMonitor
  51. dcesrv_spoolss_DeleteMonitor
  52. dcesrv_spoolss_DeletePrintProcessor
  53. dcesrv_spoolss_AddPrintProvidor
  54. dcesrv_spoolss_DeletePrintProvidor
  55. dcesrv_spoolss_EnumPrintProcDataTypes
  56. dcesrv_spoolss_ResetPrinter
  57. dcesrv_spoolss_GetPrinterDriver2
  58. dcesrv_spoolss_FindFirstPrinterChangeNotification
  59. dcesrv_spoolss_FindNextPrinterChangeNotification
  60. dcesrv_spoolss_FindClosePrinterNotify
  61. dcesrv_spoolss_RouterFindFirstPrinterChangeNotificationOld
  62. dcesrv_spoolss_ReplyOpenPrinter
  63. dcesrv_spoolss_RouterReplyPrinter
  64. dcesrv_spoolss_ReplyClosePrinter
  65. dcesrv_spoolss_AddPortEx
  66. dcesrv_spoolss_RouterFindFirstPrinterChangeNotification
  67. dcesrv_spoolss_SpoolerInit
  68. dcesrv_spoolss_ResetPrinterEx
  69. dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx
  70. dcesrv_spoolss_RouterReplyPrinterEx
  71. dcesrv_spoolss_RouterRefreshPrinterChangeNotify
  72. dcesrv_spoolss_44
  73. dcesrv_spoolss_OpenPrinterEx
  74. dcesrv_spoolss_AddPrinterEx
  75. dcesrv_spoolss_47
  76. dcesrv_spoolss_EnumPrinterData
  77. dcesrv_spoolss_DeletePrinterData
  78. dcesrv_spoolss_4a
  79. dcesrv_spoolss_4b
  80. dcesrv_spoolss_4c
  81. dcesrv_spoolss_SetPrinterDataEx
  82. dcesrv_spoolss_GetPrinterDataEx
  83. dcesrv_spoolss_EnumPrinterDataEx
  84. dcesrv_spoolss_EnumPrinterKey
  85. dcesrv_spoolss_DeletePrinterDataEx
  86. dcesrv_spoolss_DeletePrinterKey
  87. dcesrv_spoolss_53
  88. dcesrv_spoolss_DeletePrinterDriverEx
  89. dcesrv_spoolss_55
  90. dcesrv_spoolss_56
  91. dcesrv_spoolss_57
  92. dcesrv_spoolss_XcvData
  93. dcesrv_spoolss_AddPrinterDriverEx
  94. dcesrv_spoolss_5a
  95. dcesrv_spoolss_5b
  96. dcesrv_spoolss_5c
  97. dcesrv_spoolss_5d
  98. dcesrv_spoolss_5e
  99. dcesrv_spoolss_5f

   1 /* 
   2    Unix SMB/CIFS implementation.
   3 
   4    endpoint server for the spoolss pipe
   5 
   6    Copyright (C) Tim Potter 2004
   7    Copyright (C) Stefan Metzmacher 2005
   8    
   9    This program is free software; you can redistribute it and/or modify
  10    it under the terms of the GNU General Public License as published by
  11    the Free Software Foundation; either version 3 of the License, or
  12    (at your option) any later version.
  13    
  14    This program is distributed in the hope that it will be useful,
  15    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17    GNU General Public License for more details.
  18    
  19    You should have received a copy of the GNU General Public License
  20    along with this program.  If not, see <http://www.gnu.org/licenses/>.
  21 */
  22 
  23 #include "includes.h"
  24 #include "rpc_server/dcerpc_server.h"
  25 #include "librpc/gen_ndr/ndr_spoolss.h"
  26 #include "rpc_server/common/common.h"
  27 #include "ntptr/ntptr.h"
  28 #include "lib/socket/socket.h"
  29 #include "smbd/service_stream.h"
  30 #include "librpc/gen_ndr/ndr_spoolss_c.h"
  31 #include "auth/credentials/credentials.h"
  32 #include "param/param.h"
  33 
  34 enum spoolss_handle {
  35         SPOOLSS_NOTIFY
  36 };
  37 
  38 #define SPOOLSS_BUFFER_UNION(fn,ic,info,level) \
  39         ((info)?ndr_size_##fn(info, level, ic, 0):0)
  40 
  41 #define SPOOLSS_BUFFER_UNION_ARRAY(fn,ic,info,level,count) \
  42         ((info)?ndr_size_##fn##_info(dce_call, ic, level, count, info):0)
  43 
  44 #define SPOOLSS_BUFFER_OK(val_true,val_false) ((r->in.offered >= *r->out.needed)?val_true:val_false)
  45 
  46 static WERROR dcesrv_spoolss_parse_printer_name(TALLOC_CTX *mem_ctx, const char *name,
     /* [<][>][^][v][top][bottom][index][help] */
  47                                          const char **_server_name,
  48                                          const char **_object_name,
  49                                          enum ntptr_HandleType *_object_type)
  50 {
  51         char *p;
  52         char *server = NULL;
  53         char *server_unc = NULL;
  54         const char *object = name;
  55 
  56         /* no printername is there it's like open server */
  57         if (!name) {
  58                 *_server_name = NULL;
  59                 *_object_name = NULL;
  60                 *_object_type = NTPTR_HANDLE_SERVER;
  61                 return WERR_OK;
  62         }
  63 
  64         /* just "\\" is invalid */
  65         if (strequal("\\\\", name)) {
  66                 return WERR_INVALID_PRINTER_NAME;
  67         }
  68 
  69         if (strncmp("\\\\", name, 2) == 0) {
  70                 server_unc = talloc_strdup(mem_ctx, name);
  71                 W_ERROR_HAVE_NO_MEMORY(server_unc);
  72                 server = server_unc + 2;
  73 
  74                 /* here we know we have "\\" in front not followed
  75                  * by '\0', now see if we have another "\" in the string
  76                  */
  77                 p = strchr_m(server, '\\');
  78                 if (!p) {
  79                         /* there's no other "\", so it's ("\\%s",server)
  80                          */
  81                         *_server_name = server_unc;
  82                         *_object_name = NULL;
  83                         *_object_type = NTPTR_HANDLE_SERVER;
  84                         return WERR_OK;
  85                 }
  86                 /* here we know that we have ("\\%s\",server),
  87                  * if we have '\0' as next then it's an invalid name
  88                  * otherwise the printer_name
  89                  */
  90                 p[0] = '\0';
  91                 /* everything that follows is the printer name */
  92                 p++;
  93                 object = p;
  94 
  95                 /* just "" as server is invalid */
  96                 if (strequal(server, "")) {
  97                         return WERR_INVALID_PRINTER_NAME;
  98                 }
  99         }
 100 
 101         /* just "" is invalid */
 102         if (strequal(object, "")) {
 103                 return WERR_INVALID_PRINTER_NAME;
 104         }
 105 
 106 #define XCV_PORT ",XcvPort "
 107 #define XCV_MONITOR ",XcvMonitor "
 108         if (strncmp(object, XCV_PORT, strlen(XCV_PORT)) == 0) {
 109                 object += strlen(XCV_PORT);
 110 
 111                 /* just "" is invalid */
 112                 if (strequal(object, "")) {
 113                         return WERR_INVALID_PRINTER_NAME;
 114                 }
 115 
 116                 *_server_name = server_unc;
 117                 *_object_name = object;
 118                 *_object_type = NTPTR_HANDLE_PORT;
 119                 return WERR_OK;
 120         } else if (strncmp(object, XCV_MONITOR, strlen(XCV_MONITOR)) == 0) {
 121                 object += strlen(XCV_MONITOR);
 122 
 123                 /* just "" is invalid */
 124                 if (strequal(object, "")) {
 125                         return WERR_INVALID_PRINTER_NAME;
 126                 }
 127 
 128                 *_server_name = server_unc;
 129                 *_object_name = object;
 130                 *_object_type = NTPTR_HANDLE_MONITOR;
 131                 return WERR_OK;
 132         }
 133 
 134         *_server_name = server_unc;
 135         *_object_name = object;
 136         *_object_type = NTPTR_HANDLE_PRINTER;
 137         return WERR_OK;
 138 }
 139 
 140 /*
 141  * Check server_name is:
 142  * -  "" , functions that don't allow "",
 143  *         should check that on their own, before calling this function
 144  * -  our name (only netbios yet, TODO: need to test dns name!)
 145  * -  our ip address of the current use socket
 146  * otherwise return WERR_INVALID_PRINTER_NAME
 147  */
 148 static WERROR dcesrv_spoolss_check_server_name(struct dcesrv_call_state *dce_call, 
     /* [<][>][^][v][top][bottom][index][help] */
 149                                         TALLOC_CTX *mem_ctx,
 150                                         const char *server_name)
 151 {
 152         bool ret;
 153         struct socket_address *myaddr;
 154         const char **aliases;
 155         int i;
 156 
 157         /* NULL is ok */
 158         if (!server_name) return WERR_OK;
 159 
 160         /* "" is ok */
 161         ret = strequal("",server_name);
 162         if (ret) return WERR_OK;
 163 
 164         /* just "\\" is invalid */
 165         if (strequal("\\\\", server_name)) {
 166                 return WERR_INVALID_PRINTER_NAME;
 167         }
 168 
 169         /* then we need "\\" */
 170         if (strncmp("\\\\", server_name, 2) != 0) {
 171                 return WERR_INVALID_PRINTER_NAME;
 172         }
 173 
 174         server_name += 2;
 175 
 176         /* NETBIOS NAME is ok */
 177         ret = strequal(lp_netbios_name(dce_call->conn->dce_ctx->lp_ctx), server_name);
 178         if (ret) return WERR_OK;
 179 
 180         aliases = lp_netbios_aliases(dce_call->conn->dce_ctx->lp_ctx);
 181 
 182         for (i=0; aliases && aliases[i]; i++) {
 183                 if (strequal(aliases[i], server_name)) {
 184                         return WERR_OK;
 185                 }
 186         }
 187 
 188         /* DNS NAME is ok
 189          * TODO: we need to check if aliases are also ok
 190          */
 191         if (lp_realm(dce_call->conn->dce_ctx->lp_ctx)) {
 192                 char *str;
 193 
 194                 str = talloc_asprintf(mem_ctx, "%s.%s",
 195                                                 lp_netbios_name(dce_call->conn->dce_ctx->lp_ctx),
 196                                                 lp_realm(dce_call->conn->dce_ctx->lp_ctx));
 197                 W_ERROR_HAVE_NO_MEMORY(str);
 198 
 199                 ret = strequal(str, server_name);
 200                 talloc_free(str);
 201                 if (ret) return WERR_OK;
 202         }
 203 
 204         myaddr = dcesrv_connection_get_my_addr(dce_call->conn, mem_ctx);
 205         W_ERROR_HAVE_NO_MEMORY(myaddr);
 206 
 207         ret = strequal(myaddr->addr, server_name);
 208         talloc_free(myaddr);
 209         if (ret) return WERR_OK;
 210 
 211         return WERR_INVALID_PRINTER_NAME;
 212 }
 213 
 214 static NTSTATUS dcerpc_spoolss_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface)
     /* [<][>][^][v][top][bottom][index][help] */
 215 {
 216         NTSTATUS status;
 217         struct ntptr_context *ntptr;
 218 
 219         status = ntptr_init_context(dce_call->context, dce_call->conn->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
 220                                     lp_ntptr_providor(dce_call->conn->dce_ctx->lp_ctx), &ntptr);
 221         NT_STATUS_NOT_OK_RETURN(status);
 222 
 223         dce_call->context->private_data = ntptr;
 224 
 225         return NT_STATUS_OK;
 226 }
 227 
 228 #define DCESRV_INTERFACE_SPOOLSS_BIND dcerpc_spoolss_bind
 229 
 230 /* 
 231   spoolss_EnumPrinters 
 232 */
 233 static WERROR dcesrv_spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 234                        struct spoolss_EnumPrinters *r)
 235 {
 236         struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context);
 237         WERROR status;
 238         struct smb_iconv_convenience *ic = lp_iconv_convenience(ntptr->lp_ctx);
 239 
 240         status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, r->in.server);
 241         W_ERROR_NOT_OK_RETURN(status);
 242 
 243         status = ntptr_EnumPrinters(ntptr, mem_ctx, r);
 244         W_ERROR_NOT_OK_RETURN(status);
 245 
 246         *r->out.needed  = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPrinters, ic, *r->out.info, r->in.level, *r->out.count);
 247         *r->out.info    = SPOOLSS_BUFFER_OK(*r->out.info, NULL);
 248         *r->out.count   = SPOOLSS_BUFFER_OK(*r->out.count, 0);
 249         return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
 250 }
 251 
 252 static WERROR dcesrv_spoolss_OpenPrinterEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
 253                        struct spoolss_OpenPrinterEx *r);
 254 /* 
 255   spoolss_OpenPrinter 
 256 */
 257 static WERROR dcesrv_spoolss_OpenPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 258                        struct spoolss_OpenPrinter *r)
 259 {
 260         WERROR status;
 261         struct spoolss_OpenPrinterEx *r2;
 262 
 263         r2 = talloc(mem_ctx, struct spoolss_OpenPrinterEx);
 264         W_ERROR_HAVE_NO_MEMORY(r2);
 265 
 266         r2->in.printername      = r->in.printername;
 267         r2->in.datatype         = r->in.datatype;
 268         r2->in.devmode_ctr      = r->in.devmode_ctr;
 269         r2->in.access_mask      = r->in.access_mask;
 270         r2->in.level            = 1;
 271         r2->in.userlevel.level1 = NULL;
 272 
 273         r2->out.handle          = r->out.handle;
 274 
 275         /* TODO: we should take care about async replies here,
 276                  if spoolss_OpenPrinterEx() would be async!
 277          */
 278         status = dcesrv_spoolss_OpenPrinterEx(dce_call, mem_ctx, r2);
 279 
 280         r->out.handle           = r2->out.handle;
 281 
 282         return status;
 283 }
 284 
 285 
 286 /* 
 287   spoolss_SetJob 
 288 */
 289 static WERROR dcesrv_spoolss_SetJob(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 290                        struct spoolss_SetJob *r)
 291 {
 292         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 293 }
 294 
 295 
 296 /* 
 297   spoolss_GetJob 
 298 */
 299 static WERROR dcesrv_spoolss_GetJob(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 300                        struct spoolss_GetJob *r)
 301 {
 302         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 303 }
 304 
 305 
 306 /* 
 307   spoolss_EnumJobs 
 308 */
 309 static WERROR dcesrv_spoolss_EnumJobs(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 310                        struct spoolss_EnumJobs *r)
 311 {
 312         return WERR_OK;
 313 }
 314 
 315 
 316 /* 
 317   spoolss_AddPrinter 
 318 */
 319 static WERROR dcesrv_spoolss_AddPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 320                        struct spoolss_AddPrinter *r)
 321 {
 322         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 323 }
 324 
 325 
 326 /* 
 327   spoolss_DeletePrinter 
 328 */
 329 static WERROR dcesrv_spoolss_DeletePrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 330                        struct spoolss_DeletePrinter *r)
 331 {
 332         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 333 }
 334 
 335 
 336 /* 
 337   spoolss_SetPrinter 
 338 */
 339 static WERROR dcesrv_spoolss_SetPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 340                        struct spoolss_SetPrinter *r)
 341 {
 342         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 343 }
 344 
 345 
 346 /* 
 347   spoolss_GetPrinter 
 348 */
 349 static WERROR dcesrv_spoolss_GetPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 350                        struct spoolss_GetPrinter *r)
 351 {
 352         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 353 }
 354 
 355 
 356 /* 
 357   spoolss_AddPrinterDriver 
 358 */
 359 static WERROR dcesrv_spoolss_AddPrinterDriver(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 360                        struct spoolss_AddPrinterDriver *r)
 361 {
 362         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 363 }
 364 
 365 
 366 /* 
 367   spoolss_EnumPrinterDrivers 
 368 */
 369 static WERROR dcesrv_spoolss_EnumPrinterDrivers(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 370                        struct spoolss_EnumPrinterDrivers *r)
 371 {
 372         struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context);
 373         WERROR status;
 374         struct smb_iconv_convenience *ic = lp_iconv_convenience(ntptr->lp_ctx);
 375 
 376         status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, r->in.server);
 377         W_ERROR_NOT_OK_RETURN(status);
 378 
 379         status = ntptr_EnumPrinterDrivers(ntptr, mem_ctx, r);
 380         W_ERROR_NOT_OK_RETURN(status);
 381 
 382         *r->out.needed  = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPrinterDrivers, ic, *r->out.info, r->in.level, *r->out.count);
 383         *r->out.info    = SPOOLSS_BUFFER_OK(*r->out.info, NULL);
 384         *r->out.count   = SPOOLSS_BUFFER_OK(*r->out.count, 0);
 385         return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
 386 }
 387 
 388 
 389 /* 
 390   spoolss_GetPrinterDriver 
 391 */
 392 static WERROR dcesrv_spoolss_GetPrinterDriver(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 393                        struct spoolss_GetPrinterDriver *r)
 394 {
 395         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 396 }
 397 
 398 
 399 /* 
 400   spoolss_GetPrinterDriverDirectory 
 401 */
 402 static WERROR dcesrv_spoolss_GetPrinterDriverDirectory(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 403                        struct spoolss_GetPrinterDriverDirectory *r)
 404 {
 405         struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context);
 406         WERROR status;
 407         struct smb_iconv_convenience *ic = lp_iconv_convenience(ntptr->lp_ctx);
 408 
 409         status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, r->in.server);
 410         W_ERROR_NOT_OK_RETURN(status);
 411 
 412         status = ntptr_GetPrinterDriverDirectory(ntptr, mem_ctx, r);
 413         W_ERROR_NOT_OK_RETURN(status);
 414 
 415         *r->out.needed  = SPOOLSS_BUFFER_UNION(spoolss_DriverDirectoryInfo, ic, r->out.info, r->in.level);
 416         r->out.info     = SPOOLSS_BUFFER_OK(r->out.info, NULL);
 417         return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
 418 }
 419 
 420 
 421 /* 
 422   spoolss_DeletePrinterDriver 
 423 */
 424 static WERROR dcesrv_spoolss_DeletePrinterDriver(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 425                        struct spoolss_DeletePrinterDriver *r)
 426 {
 427         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 428 }
 429 
 430 
 431 /* 
 432   spoolss_AddPrintProcessor 
 433 */
 434 static WERROR dcesrv_spoolss_AddPrintProcessor(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 435                        struct spoolss_AddPrintProcessor *r)
 436 {
 437         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 438 }
 439 
 440 
 441 /* 
 442   spoolss_EnumPrintProcessors 
 443 */
 444 static WERROR dcesrv_spoolss_EnumPrintProcessors(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 445                        struct spoolss_EnumPrintProcessors *r)
 446 {
 447         return WERR_OK;
 448 }
 449 
 450 
 451 /* 
 452   spoolss_GetPrintProcessorDirectory 
 453 */
 454 static WERROR dcesrv_spoolss_GetPrintProcessorDirectory(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 455                        struct spoolss_GetPrintProcessorDirectory *r)
 456 {
 457         struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context);
 458         WERROR status;
 459         struct smb_iconv_convenience *ic = lp_iconv_convenience(ntptr->lp_ctx);
 460 
 461         status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, r->in.server);
 462         W_ERROR_NOT_OK_RETURN(status);
 463 
 464         status = ntptr_GetPrintProcessorDirectory(ntptr, mem_ctx, r);
 465         W_ERROR_NOT_OK_RETURN(status);
 466 
 467         *r->out.needed  = SPOOLSS_BUFFER_UNION(spoolss_PrintProcessorDirectoryInfo, ic, r->out.info, r->in.level);
 468         r->out.info     = SPOOLSS_BUFFER_OK(r->out.info, NULL);
 469         return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
 470 }
 471 
 472 
 473 /* 
 474   spoolss_StartDocPrinter 
 475 */
 476 static WERROR dcesrv_spoolss_StartDocPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 477                        struct spoolss_StartDocPrinter *r)
 478 {
 479         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 480 }
 481 
 482 
 483 /* 
 484   spoolss_StartPagePrinter 
 485 */
 486 static WERROR dcesrv_spoolss_StartPagePrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 487                        struct spoolss_StartPagePrinter *r)
 488 {
 489         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 490 }
 491 
 492 
 493 /* 
 494   spoolss_WritePrinter 
 495 */
 496 static WERROR dcesrv_spoolss_WritePrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 497                        struct spoolss_WritePrinter *r)
 498 {
 499         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 500 }
 501 
 502 
 503 /* 
 504   spoolss_EndPagePrinter 
 505 */
 506 static WERROR dcesrv_spoolss_EndPagePrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 507                        struct spoolss_EndPagePrinter *r)
 508 {
 509         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 510 }
 511 
 512 
 513 /* 
 514   spoolss_AbortPrinter 
 515 */
 516 static WERROR dcesrv_spoolss_AbortPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 517                        struct spoolss_AbortPrinter *r)
 518 {
 519         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 520 }
 521 
 522 
 523 /* 
 524   spoolss_ReadPrinter 
 525 */
 526 static WERROR dcesrv_spoolss_ReadPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 527                        struct spoolss_ReadPrinter *r)
 528 {
 529         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 530 }
 531 
 532 
 533 /* 
 534   spoolss_EndDocPrinter 
 535 */
 536 static WERROR dcesrv_spoolss_EndDocPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 537                        struct spoolss_EndDocPrinter *r)
 538 {
 539         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 540 }
 541 
 542 
 543 /* 
 544   spoolss_AddJob 
 545 */
 546 static WERROR dcesrv_spoolss_AddJob(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 547                        struct spoolss_AddJob *r)
 548 {
 549         if (r->in.level != 1) {
 550                 return WERR_UNKNOWN_LEVEL;
 551         }
 552 
 553         return WERR_INVALID_PARAM;
 554 }
 555 
 556 
 557 /* 
 558   spoolss_ScheduleJob 
 559 */
 560 static WERROR dcesrv_spoolss_ScheduleJob(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 561                        struct spoolss_ScheduleJob *r)
 562 {
 563         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 564 }
 565 
 566 
 567 /* 
 568   spoolss_GetPrinterData 
 569 */
 570 static WERROR dcesrv_spoolss_GetPrinterData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 571                        struct spoolss_GetPrinterData *r)
 572 {
 573         struct ntptr_GenericHandle *handle;
 574         struct dcesrv_handle *h;
 575         WERROR status;
 576         struct smb_iconv_convenience *ic = lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx);
 577 
 578         DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY);
 579         handle = talloc_get_type(h->data, struct ntptr_GenericHandle);
 580         if (!handle)
 581                 return WERR_BADFID;
 582 
 583         r->out.type = talloc_zero(mem_ctx, enum winreg_Type);
 584         W_ERROR_HAVE_NO_MEMORY(r->out.type);
 585 
 586         r->out.needed = talloc_zero(mem_ctx, uint32_t);
 587         W_ERROR_HAVE_NO_MEMORY(r->out.needed);
 588 
 589         r->out.data = talloc_zero(mem_ctx, union spoolss_PrinterData);
 590         W_ERROR_HAVE_NO_MEMORY(r->out.data);
 591 
 592         switch (handle->type) {
 593                 case NTPTR_HANDLE_SERVER:
 594                         status = ntptr_GetPrintServerData(handle, mem_ctx, r);
 595                         break;
 596                 default:
 597                         status = WERR_FOOBAR;
 598                         break;
 599         }
 600 
 601         W_ERROR_NOT_OK_RETURN(status);
 602 
 603         *r->out.needed  = ndr_size_spoolss_PrinterData(r->out.data, *r->out.type, ic, 0);
 604         *r->out.type    = SPOOLSS_BUFFER_OK(*r->out.type, REG_NONE);
 605         r->out.data     = SPOOLSS_BUFFER_OK(r->out.data, r->out.data);
 606         return SPOOLSS_BUFFER_OK(WERR_OK, WERR_MORE_DATA);
 607 }
 608 
 609 
 610 /* 
 611   spoolss_SetPrinterData 
 612 */
 613 static WERROR dcesrv_spoolss_SetPrinterData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 614                        struct spoolss_SetPrinterData *r)
 615 {
 616         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 617 }
 618 
 619 
 620 /* 
 621   spoolss_WaitForPrinterChange 
 622 */
 623 static WERROR dcesrv_spoolss_WaitForPrinterChange(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 624                        struct spoolss_WaitForPrinterChange *r)
 625 {
 626         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 627 }
 628 
 629 
 630 /* 
 631   spoolss_ClosePrinter 
 632 */
 633 static WERROR dcesrv_spoolss_ClosePrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 634                        struct spoolss_ClosePrinter *r)
 635 {
 636         struct dcesrv_handle *h;
 637 
 638         *r->out.handle = *r->in.handle;
 639 
 640         DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY);
 641 
 642         talloc_free(h);
 643 
 644         ZERO_STRUCTP(r->out.handle);
 645 
 646         return WERR_OK;
 647 }
 648 
 649 
 650 /* 
 651   spoolss_AddForm 
 652 */
 653 static WERROR dcesrv_spoolss_AddForm(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 654                        struct spoolss_AddForm *r)
 655 {
 656         struct ntptr_GenericHandle *handle;
 657         struct dcesrv_handle *h;
 658         WERROR status;
 659 
 660         DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY);
 661         handle = talloc_get_type(h->data, struct ntptr_GenericHandle);
 662         if (!handle)
 663                 return WERR_BADFID;
 664 
 665         switch (handle->type) {
 666                 case NTPTR_HANDLE_SERVER:
 667                         status = ntptr_AddPrintServerForm(handle, mem_ctx, r);
 668                         W_ERROR_NOT_OK_RETURN(status);
 669                         break;
 670                 case NTPTR_HANDLE_PRINTER:
 671                         status = ntptr_AddPrinterForm(handle, mem_ctx, r);
 672                         W_ERROR_NOT_OK_RETURN(status);
 673                         break;
 674                 default:
 675                         return WERR_FOOBAR;
 676         }
 677 
 678         return WERR_OK;
 679 }
 680 
 681 
 682 /* 
 683   spoolss_DeleteForm 
 684 */
 685 static WERROR dcesrv_spoolss_DeleteForm(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 686                        struct spoolss_DeleteForm *r)
 687 {
 688         struct ntptr_GenericHandle *handle;
 689         struct dcesrv_handle *h;
 690         WERROR status;
 691 
 692         DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY);
 693         handle = talloc_get_type(h->data, struct ntptr_GenericHandle);
 694         if (!handle)
 695                 return WERR_BADFID;
 696 
 697         switch (handle->type) {
 698                 case NTPTR_HANDLE_SERVER:
 699                         status = ntptr_DeletePrintServerForm(handle, mem_ctx, r);
 700                         W_ERROR_NOT_OK_RETURN(status);
 701                         break;
 702                 case NTPTR_HANDLE_PRINTER:
 703                         status = ntptr_DeletePrinterForm(handle, mem_ctx, r);
 704                         W_ERROR_NOT_OK_RETURN(status);
 705                         break;
 706                 default:
 707                         return WERR_FOOBAR;
 708         }
 709 
 710         return WERR_OK;
 711 }
 712 
 713 
 714 /* 
 715   spoolss_GetForm 
 716 */
 717 static WERROR dcesrv_spoolss_GetForm(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 718                        struct spoolss_GetForm *r)
 719 {
 720         struct ntptr_GenericHandle *handle;
 721         struct dcesrv_handle *h;
 722         WERROR status;
 723         struct smb_iconv_convenience *ic = lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx);
 724 
 725         DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY);
 726         handle = talloc_get_type(h->data, struct ntptr_GenericHandle);
 727         if (!handle)
 728                 return WERR_BADFID;
 729 
 730         switch (handle->type) {
 731                 case NTPTR_HANDLE_SERVER:
 732                         /*
 733                          * stupid, but w2k3 returns WERR_BADFID here?
 734                          */
 735                         return WERR_BADFID;
 736                 case NTPTR_HANDLE_PRINTER:
 737                         status = ntptr_GetPrinterForm(handle, mem_ctx, r);
 738                         W_ERROR_NOT_OK_RETURN(status);
 739                         break;
 740                 default:
 741                         return WERR_FOOBAR;
 742         }
 743 
 744         *r->out.needed  = SPOOLSS_BUFFER_UNION(spoolss_FormInfo, ic, r->out.info, r->in.level);
 745         r->out.info     = SPOOLSS_BUFFER_OK(r->out.info, NULL);
 746         return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
 747 }
 748 
 749 
 750 /* 
 751   spoolss_SetForm 
 752 */
 753 static WERROR dcesrv_spoolss_SetForm(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 754                        struct spoolss_SetForm *r)
 755 {
 756         struct ntptr_GenericHandle *handle;
 757         struct dcesrv_handle *h;
 758         WERROR status;
 759 
 760         DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY);
 761         handle = talloc_get_type(h->data, struct ntptr_GenericHandle);
 762         if (!handle)
 763                 return WERR_BADFID;
 764 
 765         switch (handle->type) {
 766                 case NTPTR_HANDLE_SERVER:
 767                         status = ntptr_SetPrintServerForm(handle, mem_ctx, r);
 768                         W_ERROR_NOT_OK_RETURN(status);
 769                         break;
 770                 case NTPTR_HANDLE_PRINTER:
 771                         status = ntptr_SetPrinterForm(handle, mem_ctx, r);
 772                         W_ERROR_NOT_OK_RETURN(status);
 773                         break;
 774                 default:
 775                         return WERR_FOOBAR;
 776         }
 777 
 778         return WERR_OK;
 779 }
 780 
 781 
 782 /* 
 783   spoolss_EnumForms 
 784 */
 785 static WERROR dcesrv_spoolss_EnumForms(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 786                        struct spoolss_EnumForms *r)
 787 {
 788         struct ntptr_GenericHandle *handle;
 789         struct dcesrv_handle *h;
 790         WERROR status;
 791         struct smb_iconv_convenience *ic = lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx);
 792 
 793         DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY);
 794         handle = talloc_get_type(h->data, struct ntptr_GenericHandle);
 795         if (!handle)
 796                 return WERR_BADFID;
 797 
 798         switch (handle->type) {
 799                 case NTPTR_HANDLE_SERVER:
 800                         status = ntptr_EnumPrintServerForms(handle, mem_ctx, r);
 801                         W_ERROR_NOT_OK_RETURN(status);
 802                         break;
 803                 case NTPTR_HANDLE_PRINTER:
 804                         status = ntptr_EnumPrinterForms(handle, mem_ctx, r);
 805                         W_ERROR_NOT_OK_RETURN(status);
 806                         break;
 807                 default:
 808                         return WERR_FOOBAR;
 809         }
 810 
 811         *r->out.needed  = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumForms, ic, *r->out.info, r->in.level, *r->out.count);
 812         *r->out.info    = SPOOLSS_BUFFER_OK(*r->out.info, NULL);
 813         *r->out.count   = SPOOLSS_BUFFER_OK(*r->out.count, 0);
 814         return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
 815 }
 816 
 817 
 818 /* 
 819   spoolss_EnumPorts 
 820 */
 821 static WERROR dcesrv_spoolss_EnumPorts(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 822                        struct spoolss_EnumPorts *r)
 823 {
 824         struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context);
 825         WERROR status;
 826         struct smb_iconv_convenience *ic = lp_iconv_convenience(ntptr->lp_ctx);
 827 
 828         status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, r->in.servername);
 829         W_ERROR_NOT_OK_RETURN(status);
 830 
 831         status = ntptr_EnumPorts(ntptr, mem_ctx, r);
 832         W_ERROR_NOT_OK_RETURN(status);
 833 
 834         *r->out.needed  = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPorts, ic, *r->out.info, r->in.level, *r->out.count);
 835         *r->out.info    = SPOOLSS_BUFFER_OK(*r->out.info, NULL);
 836         *r->out.count   = SPOOLSS_BUFFER_OK(*r->out.count, 0);
 837         return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
 838 }
 839 
 840 
 841 /* 
 842   spoolss_EnumMonitors 
 843 */
 844 static WERROR dcesrv_spoolss_EnumMonitors(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 845                        struct spoolss_EnumMonitors *r)
 846 {
 847         struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context);
 848         WERROR status;
 849         struct smb_iconv_convenience *ic = lp_iconv_convenience(ntptr->lp_ctx);
 850 
 851         status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, r->in.servername);
 852         W_ERROR_NOT_OK_RETURN(status);
 853 
 854         status = ntptr_EnumMonitors(ntptr, mem_ctx, r);
 855         W_ERROR_NOT_OK_RETURN(status);
 856 
 857         *r->out.needed  = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumMonitors, ic, *r->out.info, r->in.level, *r->out.count);
 858         *r->out.info    = SPOOLSS_BUFFER_OK(*r->out.info, NULL);
 859         *r->out.count   = SPOOLSS_BUFFER_OK(*r->out.count, 0);
 860         return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER);
 861 }
 862 
 863 
 864 /* 
 865   spoolss_AddPort 
 866 */
 867 static WERROR dcesrv_spoolss_AddPort(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 868                        struct spoolss_AddPort *r)
 869 {
 870         return WERR_NOT_SUPPORTED;
 871 }
 872 
 873 
 874 /* 
 875   spoolss_ConfigurePort 
 876 */
 877 static WERROR dcesrv_spoolss_ConfigurePort(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 878                        struct spoolss_ConfigurePort *r)
 879 {
 880         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 881 }
 882 
 883 
 884 /* 
 885   spoolss_DeletePort 
 886 */
 887 static WERROR dcesrv_spoolss_DeletePort(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 888                        struct spoolss_DeletePort *r)
 889 {
 890         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 891 }
 892 
 893 
 894 /* 
 895   spoolss_CreatePrinterIC 
 896 */
 897 static WERROR dcesrv_spoolss_CreatePrinterIC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 898                        struct spoolss_CreatePrinterIC *r)
 899 {
 900         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 901 }
 902 
 903 
 904 /* 
 905   spoolss_PlayGDIScriptOnPrinterIC 
 906 */
 907 static WERROR dcesrv_spoolss_PlayGDIScriptOnPrinterIC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 908                        struct spoolss_PlayGDIScriptOnPrinterIC *r)
 909 {
 910         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 911 }
 912 
 913 
 914 /* 
 915   spoolss_DeletePrinterIC 
 916 */
 917 static WERROR dcesrv_spoolss_DeletePrinterIC(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 918                        struct spoolss_DeletePrinterIC *r)
 919 {
 920         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 921 }
 922 
 923 
 924 /* 
 925   spoolss_AddPrinterConnection 
 926 */
 927 static WERROR dcesrv_spoolss_AddPrinterConnection(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 928                        struct spoolss_AddPrinterConnection *r)
 929 {
 930         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 931 }
 932 
 933 
 934 /* 
 935   spoolss_DeletePrinterConnection 
 936 */
 937 static WERROR dcesrv_spoolss_DeletePrinterConnection(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 938                        struct spoolss_DeletePrinterConnection *r)
 939 {
 940         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 941 }
 942 
 943 
 944 /* 
 945   spoolss_PrinterMessageBox 
 946 */
 947 static WERROR dcesrv_spoolss_PrinterMessageBox(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 948                        struct spoolss_PrinterMessageBox *r)
 949 {
 950         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 951 }
 952 
 953 
 954 /* 
 955   spoolss_AddMonitor 
 956 */
 957 static WERROR dcesrv_spoolss_AddMonitor(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 958                        struct spoolss_AddMonitor *r)
 959 {
 960         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 961 }
 962 
 963 
 964 /* 
 965   spoolss_DeleteMonitor 
 966 */
 967 static WERROR dcesrv_spoolss_DeleteMonitor(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 968                        struct spoolss_DeleteMonitor *r)
 969 {
 970         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 971 }
 972 
 973 
 974 /* 
 975   spoolss_DeletePrintProcessor 
 976 */
 977 static WERROR dcesrv_spoolss_DeletePrintProcessor(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 978                        struct spoolss_DeletePrintProcessor *r)
 979 {
 980         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 981 }
 982 
 983 
 984 /* 
 985   spoolss_AddPrintProvidor 
 986 */
 987 static WERROR dcesrv_spoolss_AddPrintProvidor(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 988                        struct spoolss_AddPrintProvidor *r)
 989 {
 990         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
 991 }
 992 
 993 
 994 /* 
 995   spoolss_DeletePrintProvidor 
 996 */
 997 static WERROR dcesrv_spoolss_DeletePrintProvidor(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
 998                        struct spoolss_DeletePrintProvidor *r)
 999 {
1000         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1001 }
1002 
1003 
1004 /* 
1005   spoolss_EnumPrintProcDataTypes 
1006 */
1007 static WERROR dcesrv_spoolss_EnumPrintProcDataTypes(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1008                        struct spoolss_EnumPrintProcDataTypes *r)
1009 {
1010         return WERR_OK;
1011 }
1012 
1013 
1014 /* 
1015   spoolss_ResetPrinter 
1016 */
1017 static WERROR dcesrv_spoolss_ResetPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1018                        struct spoolss_ResetPrinter *r)
1019 {
1020         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1021 }
1022 
1023 
1024 /* 
1025   spoolss_GetPrinterDriver2 
1026 */
1027 static WERROR dcesrv_spoolss_GetPrinterDriver2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1028                        struct spoolss_GetPrinterDriver2 *r)
1029 {
1030         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1031 }
1032 
1033 
1034 /* 
1035   spoolss_FindFirstPrinterChangeNotification 
1036 */
1037 static WERROR dcesrv_spoolss_FindFirstPrinterChangeNotification(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1038                        struct spoolss_FindFirstPrinterChangeNotification *r)
1039 {
1040         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1041 }
1042 
1043 
1044 /* 
1045   spoolss_FindNextPrinterChangeNotification 
1046 */
1047 static WERROR dcesrv_spoolss_FindNextPrinterChangeNotification(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1048                        struct spoolss_FindNextPrinterChangeNotification *r)
1049 {
1050         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1051 }
1052 
1053 
1054 /* 
1055   spoolss_FindClosePrinterNotify 
1056 */
1057 static WERROR dcesrv_spoolss_FindClosePrinterNotify(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1058                        struct spoolss_FindClosePrinterNotify *r)
1059 {
1060         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1061 }
1062 
1063 
1064 /* 
1065   spoolss_RouterFindFirstPrinterChangeNotificationOld 
1066 */
1067 static WERROR dcesrv_spoolss_RouterFindFirstPrinterChangeNotificationOld(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1068                        struct spoolss_RouterFindFirstPrinterChangeNotificationOld *r)
1069 {
1070         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1071 }
1072 
1073 
1074 /* 
1075   spoolss_ReplyOpenPrinter 
1076 */
1077 static WERROR dcesrv_spoolss_ReplyOpenPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1078                        struct spoolss_ReplyOpenPrinter *r)
1079 {
1080         struct dcesrv_handle *handle;
1081 
1082         handle = dcesrv_handle_new(dce_call->context, SPOOLSS_NOTIFY);
1083         W_ERROR_HAVE_NO_MEMORY(handle);
1084 
1085         /* For now, just return a handle */
1086 
1087         *r->out.handle = handle->wire_handle;
1088 
1089         return WERR_OK;
1090 }
1091 
1092 
1093 /* 
1094   spoolss_RouterReplyPrinter 
1095 */
1096 static WERROR dcesrv_spoolss_RouterReplyPrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1097                        struct spoolss_RouterReplyPrinter *r)
1098 {
1099         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1100 }
1101 
1102 
1103 /* 
1104   spoolss_ReplyClosePrinter 
1105 */
1106 static WERROR dcesrv_spoolss_ReplyClosePrinter(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1107                        struct spoolss_ReplyClosePrinter *r)
1108 {
1109         struct dcesrv_handle *handle;
1110         
1111         DCESRV_PULL_HANDLE_WERR(handle, r->in.handle, SPOOLSS_NOTIFY);
1112 
1113         talloc_free(handle);
1114 
1115         ZERO_STRUCTP(r->out.handle);
1116 
1117         return WERR_OK;
1118 }
1119 
1120 /* 
1121   spoolss_AddPortEx 
1122 */
1123 static WERROR dcesrv_spoolss_AddPortEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1124                        struct spoolss_AddPortEx *r)
1125 {
1126         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1127 }
1128 
1129 
1130 /* 
1131   spoolss_RouterFindFirstPrinterChangeNotification 
1132 */
1133 static WERROR dcesrv_spoolss_RouterFindFirstPrinterChangeNotification(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1134                        struct spoolss_RouterFindFirstPrinterChangeNotification *r)
1135 {
1136         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1137 }
1138 
1139 
1140 /* 
1141   spoolss_SpoolerInit 
1142 */
1143 static WERROR dcesrv_spoolss_SpoolerInit(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1144                        struct spoolss_SpoolerInit *r)
1145 {
1146         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1147 }
1148 
1149 
1150 /* 
1151   spoolss_ResetPrinterEx 
1152 */
1153 static WERROR dcesrv_spoolss_ResetPrinterEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1154                        struct spoolss_ResetPrinterEx *r)
1155 {
1156         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1157 }
1158 
1159 
1160 /* 
1161   spoolss_RemoteFindFirstPrinterChangeNotifyEx 
1162 */
1163 static WERROR dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1164                        struct spoolss_RemoteFindFirstPrinterChangeNotifyEx *r)
1165 {
1166         struct dcerpc_pipe *p;
1167         struct dcerpc_binding *binding;
1168         NTSTATUS status;
1169         struct spoolss_ReplyOpenPrinter rop;
1170         struct cli_credentials *creds;
1171         struct policy_handle notify_handle;
1172 
1173         DEBUG(2, ("Received RFFPCNex from %s\n", r->in.local_machine));
1174 
1175         /*
1176          * TODO: for now just open a connection to the client and drop it again
1177          *       to keep the w2k3 PrintServer 
1178          *       happy to allow to open the Add Printer GUI
1179          *       and the torture suite passing
1180          */
1181 
1182         binding = talloc_zero(mem_ctx, struct dcerpc_binding);
1183 
1184         binding->transport = NCACN_NP; 
1185         if (strncmp(r->in.local_machine, "\\\\", 2))
1186                 return WERR_INVALID_COMPUTERNAME;
1187         binding->host = r->in.local_machine+2;
1188 
1189         creds = cli_credentials_init_anon(mem_ctx); /* FIXME: Use machine credentials instead ? */
1190 
1191         status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_spoolss, 
1192                                        creds, dce_call->event_ctx,
1193                                        dce_call->conn->dce_ctx->lp_ctx);
1194 
1195         if (NT_STATUS_IS_ERR(status)) {
1196                 DEBUG(0, ("unable to call back to %s\n", r->in.local_machine));
1197                 return WERR_SERVER_UNAVAILABLE;
1198         }
1199 
1200         ZERO_STRUCT(rop);
1201         rop.in.server_name = lp_netbios_name(dce_call->conn->dce_ctx->lp_ctx);
1202         W_ERROR_HAVE_NO_MEMORY(rop.in.server_name);
1203         rop.in.printer_local = 0;
1204         rop.in.type = REG_NONE;
1205         rop.in.bufsize = 0;
1206         rop.in.buffer = NULL;
1207         rop.out.handle = &notify_handle;
1208 
1209         status = dcerpc_spoolss_ReplyOpenPrinter(p, mem_ctx, &rop);
1210         if (NT_STATUS_IS_ERR(status)) {
1211                 DEBUG(0, ("unable to open remote printer %s\n",
1212                         r->in.local_machine));
1213                 return WERR_SERVER_UNAVAILABLE;
1214         }
1215 
1216         talloc_free(p);
1217 
1218         return WERR_OK;
1219 }
1220 
1221 
1222 /* 
1223   spoolss_RouterReplyPrinterEx
1224 */
1225 static WERROR dcesrv_spoolss_RouterReplyPrinterEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1226                        struct spoolss_RouterReplyPrinterEx *r)
1227 {
1228         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1229 }
1230 
1231 
1232 /* 
1233   spoolss_RouterRefreshPrinterChangeNotify
1234 */
1235 static WERROR dcesrv_spoolss_RouterRefreshPrinterChangeNotify(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1236                        struct spoolss_RouterRefreshPrinterChangeNotify *r)
1237 {
1238         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1239 }
1240 
1241 
1242 /* 
1243   spoolss_44 
1244 */
1245 static WERROR dcesrv_spoolss_44(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1246                        struct spoolss_44 *r)
1247 {
1248         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1249 }
1250 
1251 /* 
1252   spoolss_OpenPrinterEx 
1253 */
1254 static WERROR dcesrv_spoolss_OpenPrinterEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1255                        struct spoolss_OpenPrinterEx *r)
1256 {
1257         struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context);
1258         struct ntptr_GenericHandle *handle;
1259         struct dcesrv_handle *h;
1260         const char *server;
1261         const char *object;
1262         enum ntptr_HandleType type;
1263         WERROR status;
1264 
1265         ZERO_STRUCTP(r->out.handle);
1266 
1267         status = dcesrv_spoolss_parse_printer_name(mem_ctx, r->in.printername, &server, &object, &type);
1268         W_ERROR_NOT_OK_RETURN(status);
1269 
1270         status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, server);
1271         W_ERROR_NOT_OK_RETURN(status);
1272 
1273         switch (type) {
1274                 case NTPTR_HANDLE_SERVER:
1275                         status = ntptr_OpenPrintServer(ntptr, mem_ctx, r, server, &handle);
1276                         W_ERROR_NOT_OK_RETURN(status);
1277                         break;
1278                 case NTPTR_HANDLE_PORT:
1279                         status = ntptr_OpenPort(ntptr, mem_ctx, r, object, &handle);
1280                         W_ERROR_NOT_OK_RETURN(status);
1281                         break;
1282                 case NTPTR_HANDLE_MONITOR:
1283                         status = ntptr_OpenMonitor(ntptr, mem_ctx, r, object, &handle);
1284                         W_ERROR_NOT_OK_RETURN(status);
1285                         break;
1286                 case NTPTR_HANDLE_PRINTER:
1287                         status = ntptr_OpenPrinter(ntptr, mem_ctx, r, object, &handle);
1288                         W_ERROR_NOT_OK_RETURN(status);
1289                         break;
1290                 default:
1291                         return WERR_FOOBAR;
1292         }
1293 
1294         h = dcesrv_handle_new(dce_call->context, handle->type);
1295         W_ERROR_HAVE_NO_MEMORY(h);
1296 
1297         h->data = talloc_steal(h, handle);
1298 
1299         *r->out.handle  = h->wire_handle;
1300 
1301         return WERR_OK;
1302 }
1303 
1304 /* 
1305   spoolss_AddPrinterEx 
1306 */
1307 static WERROR dcesrv_spoolss_AddPrinterEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1308                        struct spoolss_AddPrinterEx *r)
1309 {
1310         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1311 }
1312 
1313 
1314 /* 
1315   spoolss_47 
1316 */
1317 static WERROR dcesrv_spoolss_47(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1318                        struct spoolss_47 *r)
1319 {
1320         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1321 }
1322 
1323 
1324 /* 
1325   spoolss_EnumPrinterData 
1326 */
1327 static WERROR dcesrv_spoolss_EnumPrinterData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1328                        struct spoolss_EnumPrinterData *r)
1329 {
1330         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1331 }
1332 
1333 
1334 /* 
1335   spoolss_DeletePrinterData 
1336 */
1337 static WERROR dcesrv_spoolss_DeletePrinterData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1338                        struct spoolss_DeletePrinterData *r)
1339 {
1340         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1341 }
1342 
1343 
1344 /* 
1345   spoolss_4a 
1346 */
1347 static WERROR dcesrv_spoolss_4a(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1348                        struct spoolss_4a *r)
1349 {
1350         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1351 }
1352 
1353 
1354 /* 
1355   spoolss_4b 
1356 */
1357 static WERROR dcesrv_spoolss_4b(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1358                        struct spoolss_4b *r)
1359 {
1360         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1361 }
1362 
1363 
1364 /* 
1365   spoolss_4c 
1366 */
1367 static WERROR dcesrv_spoolss_4c(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1368                        struct spoolss_4c *r)
1369 {
1370         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1371 }
1372 
1373 
1374 /* 
1375   spoolss_SetPrinterDataEx 
1376 */
1377 static WERROR dcesrv_spoolss_SetPrinterDataEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1378                        struct spoolss_SetPrinterDataEx *r)
1379 {
1380         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1381 }
1382 
1383 
1384 /* 
1385   spoolss_GetPrinterDataEx 
1386 */
1387 static WERROR dcesrv_spoolss_GetPrinterDataEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1388                        struct spoolss_GetPrinterDataEx *r)
1389 {
1390         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1391 }
1392 
1393 
1394 /* 
1395   spoolss_EnumPrinterDataEx 
1396 */
1397 static WERROR dcesrv_spoolss_EnumPrinterDataEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1398                        struct spoolss_EnumPrinterDataEx *r)
1399 {
1400         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1401 }
1402 
1403 
1404 /* 
1405   spoolss_EnumPrinterKey 
1406 */
1407 static WERROR dcesrv_spoolss_EnumPrinterKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1408                        struct spoolss_EnumPrinterKey *r)
1409 {
1410         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1411 }
1412 
1413 
1414 /* 
1415   spoolss_DeletePrinterDataEx 
1416 */
1417 static WERROR dcesrv_spoolss_DeletePrinterDataEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1418                        struct spoolss_DeletePrinterDataEx *r)
1419 {
1420         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1421 }
1422 
1423 
1424 /* 
1425   spoolss_DeletePrinterKey 
1426 */
1427 static WERROR dcesrv_spoolss_DeletePrinterKey(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1428                        struct spoolss_DeletePrinterKey *r)
1429 {
1430         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1431 }
1432 
1433 
1434 /* 
1435   spoolss_53 
1436 */
1437 static WERROR dcesrv_spoolss_53(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1438                        struct spoolss_53 *r)
1439 {
1440         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1441 }
1442 
1443 
1444 /* 
1445   spoolss_DeletePrinterDriverEx 
1446 */
1447 static WERROR dcesrv_spoolss_DeletePrinterDriverEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1448                        struct spoolss_DeletePrinterDriverEx *r)
1449 {
1450         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1451 }
1452 
1453 
1454 /* 
1455   spoolss_55 
1456 */
1457 static WERROR dcesrv_spoolss_55(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1458                        struct spoolss_55 *r)
1459 {
1460         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1461 }
1462 
1463 
1464 /* 
1465   spoolss_56 
1466 */
1467 static WERROR dcesrv_spoolss_56(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1468                        struct spoolss_56 *r)
1469 {
1470         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1471 }
1472 
1473 
1474 /* 
1475   spoolss_57 
1476 */
1477 static WERROR dcesrv_spoolss_57(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1478                        struct spoolss_57 *r)
1479 {
1480         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1481 }
1482 
1483 
1484 /* 
1485   spoolss_XcvData
1486 */
1487 static WERROR dcesrv_spoolss_XcvData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1488                        struct spoolss_XcvData *r)
1489 {
1490         struct ntptr_GenericHandle *handle;
1491         struct dcesrv_handle *h;
1492         WERROR status;
1493 
1494         DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY);
1495         handle = talloc_get_type(h->data, struct ntptr_GenericHandle);
1496 
1497         switch (handle->type) {
1498                 case NTPTR_HANDLE_SERVER:
1499                         status = ntptr_XcvDataPrintServer(handle, mem_ctx, r);
1500                         W_ERROR_NOT_OK_RETURN(status);
1501                         break;
1502                 case NTPTR_HANDLE_PRINTER:
1503                         status = ntptr_XcvDataPrinter(handle, mem_ctx, r);
1504                         W_ERROR_NOT_OK_RETURN(status);
1505                         break;
1506                 case NTPTR_HANDLE_PORT:
1507                         status = ntptr_XcvDataPort(handle, mem_ctx, r);
1508                         W_ERROR_NOT_OK_RETURN(status);
1509                         break;
1510                 case NTPTR_HANDLE_MONITOR:
1511                         status = ntptr_XcvDataMonitor(handle, mem_ctx, r);
1512                         W_ERROR_NOT_OK_RETURN(status);
1513                         break;
1514                 default:
1515                         return WERR_FOOBAR;
1516         }
1517 
1518         /* TODO: handle the buffer sizes here! */
1519         return WERR_OK;
1520 }
1521 
1522 
1523 /* 
1524   spoolss_AddPrinterDriverEx 
1525 */
1526 static WERROR dcesrv_spoolss_AddPrinterDriverEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1527                        struct spoolss_AddPrinterDriverEx *r)
1528 {
1529         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1530 }
1531 
1532 
1533 /* 
1534   spoolss_5a 
1535 */
1536 static WERROR dcesrv_spoolss_5a(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1537                        struct spoolss_5a *r)
1538 {
1539         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1540 }
1541 
1542 
1543 /* 
1544   spoolss_5b 
1545 */
1546 static WERROR dcesrv_spoolss_5b(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1547                        struct spoolss_5b *r)
1548 {
1549         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1550 }
1551 
1552 
1553 /* 
1554   spoolss_5c 
1555 */
1556 static WERROR dcesrv_spoolss_5c(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1557                        struct spoolss_5c *r)
1558 {
1559         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1560 }
1561 
1562 
1563 /* 
1564   spoolss_5d 
1565 */
1566 static WERROR dcesrv_spoolss_5d(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1567                        struct spoolss_5d *r)
1568 {
1569         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1570 }
1571 
1572 
1573 /* 
1574   spoolss_5e 
1575 */
1576 static WERROR dcesrv_spoolss_5e(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1577                        struct spoolss_5e *r)
1578 {
1579         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1580 }
1581 
1582 
1583 /* 
1584   spoolss_5f 
1585 */
1586 static WERROR dcesrv_spoolss_5f(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
     /* [<][>][^][v][top][bottom][index][help] */
1587                        struct spoolss_5f *r)
1588 {
1589         DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
1590 }
1591 
1592 
1593 /* include the generated boilerplate */
1594 #include "librpc/gen_ndr/ndr_spoolss_s.c"

/* [<][>][^][v][top][bottom][index][help] */