/* spoolss_EnumForms */ static WERROR dcesrv_spoolss_EnumForms(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct spoolss_EnumForms *r) { struct ntptr_GenericHandle *handle; struct dcesrv_handle *h; WERROR status; struct smb_iconv_convenience *ic = lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx); DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY); handle = talloc_get_type(h->data, struct ntptr_GenericHandle); if (!handle) return WERR_BADFID; switch (handle->type) { case NTPTR_HANDLE_SERVER: status = ntptr_EnumPrintServerForms(handle, mem_ctx, r); W_ERROR_NOT_OK_RETURN(status); break; case NTPTR_HANDLE_PRINTER: status = ntptr_EnumPrinterForms(handle, mem_ctx, r); W_ERROR_NOT_OK_RETURN(status); break; default: return WERR_FOOBAR; } *r->out.needed = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumForms, ic, *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); }
/* spoolss_GetForm */ static WERROR dcesrv_spoolss_GetForm(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct spoolss_GetForm *r) { struct ntptr_GenericHandle *handle; struct dcesrv_handle *h; WERROR status; struct smb_iconv_convenience *ic = lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx); DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY); handle = talloc_get_type(h->data, struct ntptr_GenericHandle); if (!handle) return WERR_BADFID; switch (handle->type) { case NTPTR_HANDLE_SERVER: /* * stupid, but w2k3 returns WERR_BADFID here? */ return WERR_BADFID; case NTPTR_HANDLE_PRINTER: status = ntptr_GetPrinterForm(handle, mem_ctx, r); W_ERROR_NOT_OK_RETURN(status); break; default: return WERR_FOOBAR; } *r->out.needed = SPOOLSS_BUFFER_UNION(spoolss_FormInfo, 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); }
/* 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); }
/* spoolss_GetPrinterData */ static WERROR dcesrv_spoolss_GetPrinterData(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct spoolss_GetPrinterData *r) { struct ntptr_GenericHandle *handle; struct dcesrv_handle *h; WERROR status; struct smb_iconv_convenience *ic = lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx); DCESRV_PULL_HANDLE_WERR(h, r->in.handle, DCESRV_HANDLE_ANY); handle = talloc_get_type(h->data, struct ntptr_GenericHandle); if (!handle) return WERR_BADFID; r->out.type = talloc_zero(mem_ctx, enum winreg_Type); W_ERROR_HAVE_NO_MEMORY(r->out.type); r->out.needed = talloc_zero(mem_ctx, uint32_t); W_ERROR_HAVE_NO_MEMORY(r->out.needed); r->out.data = talloc_zero(mem_ctx, union spoolss_PrinterData); W_ERROR_HAVE_NO_MEMORY(r->out.data); switch (handle->type) { case NTPTR_HANDLE_SERVER: status = ntptr_GetPrintServerData(handle, mem_ctx, r); break; default: status = WERR_FOOBAR; break; } W_ERROR_NOT_OK_RETURN(status); *r->out.needed = ndr_size_spoolss_PrinterData(r->out.data, *r->out.type, ic, 0); *r->out.type = SPOOLSS_BUFFER_OK(*r->out.type, REG_NONE); r->out.data = SPOOLSS_BUFFER_OK(r->out.data, r->out.data); return SPOOLSS_BUFFER_OK(WERR_OK, WERR_MORE_DATA); }