oops ! forgot smb.h in last commit
authorJean-François Micouleau <jfm@samba.org>
Mon, 13 Mar 2000 19:34:04 +0000 (19:34 +0000)
committerJean-François Micouleau <jfm@samba.org>
Mon, 13 Mar 2000 19:34:04 +0000 (19:34 +0000)
added info level 1 parsing code for addprinter(ex)

J.F.

source/include/proto.h
source/include/rpc_spoolss.h
source/include/smb.h
source/rpc_parse/parse_spoolss.c
source/rpc_server/srv_spoolss.c
source/rpc_server/srv_spoolss_nt.c

index 1d8bf770208f3b5c5ae4926ad08b5dcf584cb240..d96d2f77c0bac606c4137a36ac14ce977c19fc76 100644 (file)
@@ -2429,6 +2429,7 @@ BOOL spoolss_io_q_enumforms(char *desc, SPOOL_Q_ENUMFORMS *q_u, prs_struct *ps,
 BOOL new_spoolss_io_r_enumforms(char *desc, SPOOL_R_ENUMFORMS *r_u, prs_struct *ps, int depth);
 BOOL new_spoolss_io_r_enumports(char *desc, SPOOL_R_ENUMPORTS *r_u, prs_struct *ps, int depth);
 BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps, int depth);
+BOOL spool_io_printer_info_level_1(char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth);
 BOOL spool_io_printer_info_level_2(char *desc, SPOOL_PRINTER_INFO_LEVEL_2 *il, prs_struct *ps, int depth);
 BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_struct *ps, int depth);
 BOOL spoolss_io_q_addprinterex(char *desc, SPOOL_Q_ADDPRINTEREX *q_u, prs_struct *ps, int depth);
index aef9afd59051bba6b6c063b87556e8c8f9d8f266..0777a602b12ee156c07b72a73d0874a8dc65825d 100755 (executable)
@@ -1192,6 +1192,17 @@ typedef struct spool_r_enumforms
 SPOOL_R_ENUMFORMS;
 
 
+typedef struct spool_printer_info_level_1
+{
+       uint32 flags;
+       uint32 description_ptr;
+       uint32 name_ptr;
+       uint32 comment_ptr;
+       UNISTR2 description;
+       UNISTR2 name;
+       UNISTR2 comment;        
+} SPOOL_PRINTER_INFO_LEVEL_1;
+
 typedef struct spool_printer_info_level_2
 {
        uint32 servername_ptr;
@@ -1234,6 +1245,7 @@ typedef struct spool_printer_info_level
 {
        uint32 level;
        uint32 info_ptr;
+       SPOOL_PRINTER_INFO_LEVEL_1 *info_1;
        SPOOL_PRINTER_INFO_LEVEL_2 *info_2;
 }
 SPOOL_PRINTER_INFO_LEVEL;
index a179a7808ea072f51393047308cec51d222f0efb..6da6fc67e8c1823b230264553210865b5f4ff695 100644 (file)
@@ -171,6 +171,7 @@ implemented */
 #define ERRbaddirectory 267 /* Invalid directory name in a path. */
 #define ERRunknownipc 2142
 
+#define ERROR_ACCESS_DENIED              (5)
 #define ERROR_INVALID_PARAMETER                 (87)
 #define ERROR_INSUFFICIENT_BUFFER      (122)
 #define ERROR_INVALID_NAME             (123)
index 85d295eb3f3b9841b1434a723bdbcac1eb0c2c55..8ff26e090c48420f4b55e5f4797528fe0d39fa2a 100644 (file)
@@ -3045,6 +3045,36 @@ BOOL spoolss_io_q_enumports(char *desc, SPOOL_Q_ENUMPORTS *q_u, prs_struct *ps,
        return True;
 }
 
+/*******************************************************************
+ Parse a SPOOL_PRINTER_INFO_LEVEL_1 structure.
+********************************************************************/  
+BOOL spool_io_printer_info_level_1(char *desc, SPOOL_PRINTER_INFO_LEVEL_1 *il, prs_struct *ps, int depth)
+{      
+       prs_debug(ps, depth, desc, "spool_io_printer_info_level_1");
+       depth++;
+               
+       if(!prs_align(ps))
+               return False;
+
+       if(!prs_uint32("flags", ps, depth, &il->flags))
+               return False;
+       if(!prs_uint32("description_ptr", ps, depth, &il->description_ptr))
+               return False;
+       if(!prs_uint32("name_ptr", ps, depth, &il->name_ptr))
+               return False;
+       if(!prs_uint32("comment_ptr", ps, depth, &il->comment_ptr))
+               return False;
+               
+       if(!smb_io_unistr2("description", &il->description, il->description_ptr, ps, depth))
+               return False;
+       if(!smb_io_unistr2("name", &il->name, il->name_ptr, ps, depth))
+               return False;
+       if(!smb_io_unistr2("comment", &il->comment, il->comment_ptr, ps, depth))
+               return False;
+
+       return True;
+}
+
 /*******************************************************************
  Parse a SPOOL_PRINTER_INFO_LEVEL_2 structure.
 ********************************************************************/  
@@ -3142,8 +3172,10 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s
        
        /* if no struct inside just return */
        if (il->info_ptr==0) {
-               if (UNMARSHALLING(ps))
+               if (UNMARSHALLING(ps)) {
+                       il->info_1=NULL;
                        il->info_2=NULL;
+               }
                return True;
        }
                        
@@ -3158,6 +3190,12 @@ BOOL spool_io_printer_info_level(char *desc, SPOOL_PRINTER_INFO_LEVEL *il, prs_s
                 * level 2 is used by addprinter
                 * and by setprinter when updating printer's info
                 */     
+               case 1:
+                       if (UNMARSHALLING(ps))
+                               il->info_1=(SPOOL_PRINTER_INFO_LEVEL_1 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_1));
+                       if (!spool_io_printer_info_level_1("", il->info_1, ps, depth))
+                               return False;
+                       break;          
                case 2:
                        if (UNMARSHALLING(ps))
                                il->info_2=(SPOOL_PRINTER_INFO_LEVEL_2 *)malloc(sizeof(SPOOL_PRINTER_INFO_LEVEL_2));
index 1cf187d8256b1d0cfea5e64592de513418fdd681..1649df86089b18a3d7b1da345e208bc1b4cecfe9 100755 (executable)
@@ -759,6 +759,17 @@ static BOOL api_spoolss_addprinterex(uint16 vuid, prs_struct *data, prs_struct *
                return False;
        }
        
+       if (q_u.info.info_ptr!=0) {
+               switch (q_u.info.level) {
+                       case 1:
+                               safe_free(q_u.info.info_1);
+                               break;
+                       case 2:
+                               safe_free(q_u.info.info_2);
+                               break;
+               }
+       }
+               
        return True;
 }
 
index 340d776493e47a12baec8562b938772392017c0a..de994a1b5db90ace21e41a6f111601faff3306de 100644 (file)
@@ -2855,9 +2855,10 @@ uint32 _spoolss_setprinter(const POLICY_HND *handle, uint32 level,
                case 2:
                        return update_printer(handle, level, info, devmode_ctr.devmode);
                        break;
+               default:
+                       return ERROR_INVALID_LEVEL;
+                       break;
        }
-
-       return NT_STATUS_INVALID_INFO_CLASS;
 }
 
 /****************************************************************************