Added John Reillys patch for error code returns from clean_up_printer_driver_strunct()
authorJeremy Allison <jra@samba.org>
Thu, 26 Oct 2000 22:09:22 +0000 (22:09 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 26 Oct 2000 22:09:22 +0000 (22:09 +0000)
calls.
Jeremy.

source/include/proto.h
source/printing/nt_printing.c
source/rpc_server/srv_spoolss_nt.c

index c5294fd1ea5ccfbdf8810cc523482bb24ad61184..9b851f901d268f18de5e6e170c2196fa0d22a139 100644 (file)
@@ -1727,7 +1727,7 @@ BOOL delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, uint32
 void update_a_form(nt_forms_struct **list, const FORM *form, int count);
 int get_ntdrivers(fstring **list, char *architecture, uint32 version);
 BOOL get_short_archi(char *short_archi, char *long_archi);
-void clean_up_driver_struct(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, uint32 level);
+uint32 clean_up_driver_struct(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, uint32 level);
 BOOL move_driver_to_download_area(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, uint32 level, struct current_user *user, uint32 *perr);
 uint32 get_a_printer_driver_9x_compatible(pstring line, fstring model);
 uint32 del_a_printer(char *sharename);
index 9d4a7f203079db9779528f6c150fc3781c203fae..48b61ca7813b2412cbf53990d0f23e00e587ac98 100644 (file)
@@ -513,7 +513,7 @@ static uint32 clean_up_driver_struct_level_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *dri
         */
        if ((driver->cversion = get_correct_cversion(architecture,
                                                                                        driver->driverpath)) == -1)
-               return ERROR_INVALID_PARAMETER;     /* Not the best error. Fix JRR */
+               return NT_STATUS_FILE_INVALID;     /* Not the best error. Fix JRR */
 
        return NT_STATUS_NO_PROBLEMO;
 }
@@ -576,30 +576,32 @@ static uint32 clean_up_driver_struct_level_6(NT_PRINTER_DRIVER_INFO_LEVEL_6 *dri
         */
        if ((driver->version = get_correct_cversion(architecture,
                                                                                        driver->driverpath)) == -1)
-               return ERROR_INVALID_PARAMETER;     /* Not the best error. Fix JRR */
+               return NT_STATUS_FILE_INVALID;     /* Not the best error. Fix JRR */
 
        return NT_STATUS_NO_PROBLEMO;
 }
 
 /****************************************************************************
 ****************************************************************************/
-void clean_up_driver_struct(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, uint32 level)
+uint32 clean_up_driver_struct(NT_PRINTER_DRIVER_INFO_LEVEL driver_abstract, uint32 level)
 {
        switch (level) {
                case 3:
                {
                        NT_PRINTER_DRIVER_INFO_LEVEL_3 *driver;
                        driver=driver_abstract.info_3;
-                       clean_up_driver_struct_level_3(driver);
+                       return clean_up_driver_struct_level_3(driver);
                        break;
                }
                case 6:
                {
                        NT_PRINTER_DRIVER_INFO_LEVEL_6 *driver;
                        driver=driver_abstract.info_6;
-                       clean_up_driver_struct_level_6(driver);
+                       return clean_up_driver_struct_level_6(driver);
                        break;
                }
+               default:
+                       return ERROR_INVALID_PARAMETER;
        }
 }
 
index 0eb75a7480c3dd0fac429d17b985056d65f621fa..ebcccc8cf4b6ff5bbacf7957e75877b6d59ad72f 100644 (file)
@@ -4722,7 +4722,8 @@ uint32 _spoolss_addprinterdriver(pipes_struct *p, const UNISTR2 *server_name,
        convert_printer_driver_info(info, &driver, level);
 
        DEBUG(5,("Cleaning driver's information\n"));
-       clean_up_driver_struct(driver, level);
+       if ((err = clean_up_driver_struct(driver, level)) != NT_STATUS_NO_PROBLEMO )
+               goto done;
 
        DEBUG(5,("Moving driver to final destination\n"));
        if(!move_driver_to_download_area(driver, level, &user, &err)) {