s3-spoolss: use pidl for _spoolss_SetForm.
authorGünther Deschner <gd@samba.org>
Sun, 8 Feb 2009 18:19:57 +0000 (19:19 +0100)
committerGünther Deschner <gd@samba.org>
Mon, 9 Feb 2009 09:42:33 +0000 (10:42 +0100)
Guenther

source3/include/proto.h
source3/printing/nt_printing.c
source3/rpc_server/srv_spoolss.c
source3/rpc_server/srv_spoolss_nt.c

index 574dd49..d33eaf9 100644 (file)
@@ -4794,7 +4794,7 @@ int write_ntforms(nt_forms_struct **list, int number);
 bool add_a_form(nt_forms_struct **list, struct spoolss_AddFormInfo1 *form, int *count);
 bool delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, WERROR *ret);
 bool delete_a_form_by_string(nt_forms_struct **list, const char *del_name, int *count, WERROR *ret);
-void update_a_form(nt_forms_struct **list, const FORM *form, int count);
+void update_a_form(nt_forms_struct **list, struct spoolss_AddFormInfo1 *form, int count);
 int get_ntdrivers(fstring **list, const char *architecture, uint32 version);
 const char *get_short_archi(const char *long_archi);
 WERROR clean_up_driver_struct(struct pipes_struct *rpc_pipe,
index 70c5864..97e7180 100644 (file)
@@ -986,28 +986,26 @@ bool delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, WERROR
  Update a form struct.
 ****************************************************************************/
 
-void update_a_form(nt_forms_struct **list, const FORM *form, int count)
+void update_a_form(nt_forms_struct **list, struct spoolss_AddFormInfo1 *form, int count)
 {
        int n=0;
-       fstring form_name;
-       unistr2_to_ascii(form_name, &(form->name), sizeof(form_name));
 
-       DEBUG(106, ("[%s]\n", form_name));
+       DEBUG(106, ("[%s]\n", form->form_name));
        for (n=0; n<count; n++) {
                DEBUGADD(106, ("n [%d]:[%s]\n", n, (*list)[n].name));
-               if (!strncmp((*list)[n].name, form_name, strlen(form_name)))
+               if (!strncmp((*list)[n].name, form->form_name, strlen(form->form_name)))
                        break;
        }
 
        if (n==count) return;
 
-       (*list)[n].flag=form->flags;
-       (*list)[n].width=form->size_x;
-       (*list)[n].length=form->size_y;
-       (*list)[n].left=form->left;
-       (*list)[n].top=form->top;
-       (*list)[n].right=form->right;
-       (*list)[n].bottom=form->bottom;
+       (*list)[n].flag         = form->flags;
+       (*list)[n].width        = form->size.width;
+       (*list)[n].length       = form->size.height;
+       (*list)[n].left         = form->area.left;
+       (*list)[n].top          = form->area.top;
+       (*list)[n].right        = form->area.right;
+       (*list)[n].bottom       = form->area.bottom;
 }
 
 /****************************************************************************
index fa2bea5..d2a7a51 100644 (file)
@@ -943,27 +943,7 @@ static bool api_spoolss_deleteform(pipes_struct *p)
 
 static bool api_spoolss_setform(pipes_struct *p)
 {
-       SPOOL_Q_SETFORM q_u;
-       SPOOL_R_SETFORM r_u;
-       prs_struct *data = &p->in_data.data;
-       prs_struct *rdata = &p->out_data.rdata;
-
-       ZERO_STRUCT(q_u);
-       ZERO_STRUCT(r_u);
-       
-       if(!spoolss_io_q_setform("", &q_u, data, 0)) {
-               DEBUG(0,("spoolss_io_q_setform: unable to unmarshall SPOOL_Q_SETFORM.\n"));
-               return False;
-       }
-       
-       r_u.status = _spoolss_setform(p, &q_u, &r_u);
-                                     
-       if(!spoolss_io_r_setform("", &r_u, rdata, 0)) {
-               DEBUG(0,("spoolss_io_r_setform: unable to marshall SPOOL_R_SETFORM.\n"));
-               return False;
-       }
-
-       return True;
+       return proxy_spoolss_call(p, NDR_SPOOLSS_SETFORM);
 }
 
 /****************************************************************************
index 575c4c8..3d9d00b 100644 (file)
@@ -8598,13 +8598,15 @@ done:
        return status;
 }
 
-/****************************************************************************
-****************************************************************************/
+/****************************************************************
+ _spoolss_SetForm
+****************************************************************/
 
-WERROR _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM *r_u)
+WERROR _spoolss_SetForm(pipes_struct *p,
+                       struct spoolss_SetForm *r)
 {
-       POLICY_HND *handle = &q_u->handle;
-       FORM *form = &q_u->form;
+       POLICY_HND *handle = r->in.handle;
+       struct spoolss_AddFormInfo1 *form = r->in.info.info1;
        nt_forms_struct tmpForm;
        int snum;
        WERROR status = WERR_OK;
@@ -8614,10 +8616,11 @@ WERROR _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM *
        nt_forms_struct *list=NULL;
        Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
 
-       DEBUG(5,("spoolss_setform\n"));
+       DEBUG(5,("_spoolss_SetForm\n"));
 
        if (!Printer) {
-               DEBUG(2,("_spoolss_setform: Invalid handle (%s:%u:%u).\n", OUR_HANDLE(handle)));
+               DEBUG(2,("_spoolss_SetForm: Invalid handle (%s:%u:%u).\n",
+                       OUR_HANDLE(handle)));
                return WERR_BADFID;
        }
 
@@ -8634,13 +8637,13 @@ WERROR _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM *
        }
 
        if ( !(Printer->access_granted & (PRINTER_ACCESS_ADMINISTER|SERVER_ACCESS_ADMINISTER)) ) {
-               DEBUG(2,("_spoolss_setform: denied by handle permissions\n"));
+               DEBUG(2,("_spoolss_SetForm: denied by handle permissions\n"));
                status = WERR_ACCESS_DENIED;
                goto done;
        }
 
        /* can't set if builtin */
-       if (get_a_builtin_ntform(&form->name,&tmpForm)) {
+       if (get_a_builtin_ntform_by_string(form->form_name, &tmpForm)) {
                status = WERR_INVALID_PARAM;
                goto done;
        }
@@ -10222,17 +10225,6 @@ WERROR _spoolss_GetForm(pipes_struct *p,
        return WERR_NOT_SUPPORTED;
 }
 
-/****************************************************************
- _spoolss_SetForm
-****************************************************************/
-
-WERROR _spoolss_SetForm(pipes_struct *p,
-                       struct spoolss_SetForm *r)
-{
-       p->rng_fault_state = true;
-       return WERR_NOT_SUPPORTED;
-}
-
 /****************************************************************
  _spoolss_EnumForms
 ****************************************************************/