Fix syntax errors.
[ira/wip.git] / source4 / rpc_server / spoolss / dcesrv_spoolss.c
index a183ccb9f0cbabad4e81c469f98b5f7ffd24e620..d041d79b3e4c8acdd4622373d2161382951450ad 100644 (file)
@@ -35,11 +35,11 @@ enum spoolss_handle {
        SPOOLSS_NOTIFY
 };
 
-#define SPOOLSS_BUFFER_UNION(fn,info,level) \
-       ((info)?ndr_size_##fn(info, level, 0):0)
+#define SPOOLSS_BUFFER_UNION(fn,ic,info,level) \
+       ((info)?ndr_size_##fn(info, level, ic, 0):0)
 
-#define SPOOLSS_BUFFER_UNION_ARRAY(fn,info,level,count) \
-       ((info)?ndr_size_##fn##_info(dce_call, lp_iconv_convenience(dce_call->conn->dce_ctx->lp_ctx), level, count, info):0)
+#define SPOOLSS_BUFFER_UNION_ARRAY(fn,ic,info,level,count) \
+       ((info)?ndr_size_##fn##_info(dce_call, ic, level, count, info):0)
 
 #define SPOOLSS_BUFFER_OK(val_true,val_false) ((r->in.offered >= r->out.needed)?val_true:val_false)
 
@@ -235,6 +235,7 @@ static WERROR dcesrv_spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TA
 {
        struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private, 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);
@@ -242,7 +243,7 @@ static WERROR dcesrv_spoolss_EnumPrinters(struct dcesrv_call_state *dce_call, TA
        status = ntptr_EnumPrinters(ntptr, mem_ctx, r);
        W_ERROR_NOT_OK_RETURN(status);
 
-       r->out.needed   = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPrinters, r->out.info, r->in.level, r->out.count);
+       r->out.needed   = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPrinters, 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);
@@ -370,6 +371,7 @@ static WERROR dcesrv_spoolss_EnumPrinterDrivers(struct dcesrv_call_state *dce_ca
 {
        struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private, 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);
@@ -377,7 +379,7 @@ static WERROR dcesrv_spoolss_EnumPrinterDrivers(struct dcesrv_call_state *dce_ca
        status = ntptr_EnumPrinterDrivers(ntptr, mem_ctx, r);
        W_ERROR_NOT_OK_RETURN(status);
 
-       r->out.needed   = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPrinterDrivers, r->out.info, r->in.level, r->out.count);
+       r->out.needed   = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPrinterDrivers, 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);
@@ -402,6 +404,7 @@ static WERROR dcesrv_spoolss_GetPrinterDriverDirectory(struct dcesrv_call_state
 {
        struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private, 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);
@@ -409,7 +412,7 @@ static WERROR dcesrv_spoolss_GetPrinterDriverDirectory(struct dcesrv_call_state
        status = ntptr_GetPrinterDriverDirectory(ntptr, mem_ctx, r);
        W_ERROR_NOT_OK_RETURN(status);
 
-       r->out.needed   = SPOOLSS_BUFFER_UNION(spoolss_DriverDirectoryInfo, r->out.info, r->in.level);
+       r->out.needed   = SPOOLSS_BUFFER_UNION(spoolss_DriverDirectoryInfo, 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);
 }
@@ -554,6 +557,7 @@ static WERROR dcesrv_spoolss_GetPrinterData(struct dcesrv_call_state *dce_call,
        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);
@@ -571,7 +575,7 @@ static WERROR dcesrv_spoolss_GetPrinterData(struct dcesrv_call_state *dce_call,
 
        W_ERROR_NOT_OK_RETURN(status);
 
-       r->out.needed   = ndr_size_spoolss_PrinterData(&r->out.data, r->out.type, 0);
+       r->out.needed   = ndr_size_spoolss_PrinterData(&r->out.data, r->out.type, ic, 0);
        r->out.type     = SPOOLSS_BUFFER_OK(r->out.type, SPOOLSS_PRINTER_DATA_TYPE_NULL);
        r->out.data     = SPOOLSS_BUFFER_OK(r->out.data, r->out.data);
        return SPOOLSS_BUFFER_OK(WERR_OK, WERR_MORE_DATA);
@@ -691,6 +695,7 @@ static WERROR dcesrv_spoolss_GetForm(struct dcesrv_call_state *dce_call, TALLOC_
        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);
@@ -711,7 +716,7 @@ static WERROR dcesrv_spoolss_GetForm(struct dcesrv_call_state *dce_call, TALLOC_
                        return WERR_FOOBAR;
        }
 
-       r->out.needed   = SPOOLSS_BUFFER_UNION(spoolss_FormInfo, r->out.info, r->in.level);
+       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);
 }
@@ -758,6 +763,7 @@ static WERROR dcesrv_spoolss_EnumForms(struct dcesrv_call_state *dce_call, TALLO
        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);
@@ -777,7 +783,7 @@ static WERROR dcesrv_spoolss_EnumForms(struct dcesrv_call_state *dce_call, TALLO
                        return WERR_FOOBAR;
        }
 
-       r->out.needed   = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumForms, r->out.info, r->in.level, r->out.count);
+       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);
@@ -792,6 +798,7 @@ static WERROR dcesrv_spoolss_EnumPorts(struct dcesrv_call_state *dce_call, TALLO
 {
        struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private, 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.servername);
        W_ERROR_NOT_OK_RETURN(status);
@@ -799,7 +806,7 @@ static WERROR dcesrv_spoolss_EnumPorts(struct dcesrv_call_state *dce_call, TALLO
        status = ntptr_EnumPorts(ntptr, mem_ctx, r);
        W_ERROR_NOT_OK_RETURN(status);
 
-       r->out.needed   = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPorts, r->out.info, r->in.level, r->out.count);
+       r->out.needed   = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumPorts, 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);
@@ -814,6 +821,7 @@ static WERROR dcesrv_spoolss_EnumMonitors(struct dcesrv_call_state *dce_call, TA
 {
        struct ntptr_context *ntptr = talloc_get_type(dce_call->context->private, 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.servername);
        W_ERROR_NOT_OK_RETURN(status);
@@ -821,7 +829,7 @@ static WERROR dcesrv_spoolss_EnumMonitors(struct dcesrv_call_state *dce_call, TA
        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.needed   = SPOOLSS_BUFFER_UNION_ARRAY(spoolss_EnumMonitors, 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);