/* spoolss_OpenPrinterEx */ static WERROR dcesrv_spoolss_OpenPrinterEx(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct spoolss_OpenPrinterEx *r) { struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context); struct ntptr_GenericHandle *handle; struct dcesrv_handle *h; const char *server; const char *object; enum ntptr_HandleType type; WERROR status; ZERO_STRUCTP(r->out.handle); status = dcesrv_spoolss_parse_printer_name(mem_ctx, r->in.printername, &server, &object, &type); W_ERROR_NOT_OK_RETURN(status); status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, server); W_ERROR_NOT_OK_RETURN(status); switch (type) { case NTPTR_HANDLE_SERVER: status = ntptr_OpenPrintServer(ntptr, mem_ctx, r, server, &handle); W_ERROR_NOT_OK_RETURN(status); break; case NTPTR_HANDLE_PORT: status = ntptr_OpenPort(ntptr, mem_ctx, r, object, &handle); W_ERROR_NOT_OK_RETURN(status); break; case NTPTR_HANDLE_MONITOR: status = ntptr_OpenMonitor(ntptr, mem_ctx, r, object, &handle); W_ERROR_NOT_OK_RETURN(status); break; case NTPTR_HANDLE_PRINTER: status = ntptr_OpenPrinter(ntptr, mem_ctx, r, object, &handle); W_ERROR_NOT_OK_RETURN(status); break; default: return WERR_FOOBAR; } h = dcesrv_handle_new(dce_call->context, handle->type); W_ERROR_HAVE_NO_MEMORY(h); h->data = talloc_steal(h, handle); *r->out.handle = h->wire_handle; return WERR_OK; }
/* spoolss_GetPrintProcessorDirectory */ static WERROR dcesrv_spoolss_GetPrintProcessorDirectory(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct spoolss_GetPrintProcessorDirectory *r) { struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context); WERROR status; 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, 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); }
/* spoolss_EnumMonitors */ static WERROR dcesrv_spoolss_EnumMonitors(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct spoolss_EnumMonitors *r) { struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private_data, struct ntptr_context); WERROR status; status = dcesrv_spoolss_check_server_name(dce_call, mem_ctx, r->in.servername); W_ERROR_NOT_OK_RETURN(status); status = ntptr_EnumMonitors(ntptr, mem_ctx, r); W_ERROR_NOT_OK_RETURN(status); *r->out.needed = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumMonitors, *r->out.info, r->in.level, *r->out.count); *r->out.info = SPOOLSS_BUFFER_OK(*r->out.info, NULL); *r->out.count = SPOOLSS_BUFFER_OK(*r->out.count, 0); return SPOOLSS_BUFFER_OK(WERR_OK, WERR_INSUFFICIENT_BUFFER); }