]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
Replaced the duplicate DOS constants with appropriate ones from doserr.h to
authorTim Potter <tpot@samba.org>
Fri, 10 Aug 2001 05:41:53 +0000 (05:41 +0000)
committerTim Potter <tpot@samba.org>
Fri, 10 Aug 2001 05:41:53 +0000 (05:41 +0000)
emphasise the fact that the spoolss pipe returns DOS error codes instead of
32-bit nt status codes.

source/printing/nt_printing.c
source/printing/printing.c
source/rpc_server/srv_spoolss_nt.c
source/rpc_server/srv_srvsvc_nt.c
source/rpcclient/cmd_spoolss.c

index c2c98d05bb4a055c44ee72758177c415cc72696b..ba42309633c0aa1b900519072bf76893e5e55778 100644 (file)
@@ -454,7 +454,7 @@ BOOL delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, uint32
 
        if (n == *count) {
                DEBUG(10,("delete_a_form, [%s] not found\n", form_name));
-               *ret = ERROR_INVALID_PARAMETER;
+               *ret = ERRinvalidparam;
                return False;
        }
 
@@ -462,7 +462,7 @@ BOOL delete_a_form(nt_forms_struct **list, UNISTR2 *del_name, int *count, uint32
        kbuf.dsize = strlen(key)+1;
        kbuf.dptr = key;
        if (tdb_delete(tdb_forms, kbuf) != 0) {
-               *ret = ERROR_NOT_ENOUGH_MEMORY;
+               *ret = ERRnomem;
                return False;
        }
 
@@ -605,7 +605,7 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in,
                DEBUG(0,("get_correct_cversion: Unable to get passwd entry for uid %u\n",
                                (unsigned int)user->uid ));
                unbecome_root();
-               *perr = ERROR_ACCESS_DENIED;
+               *perr = ERRnoaccess;
                return -1;
        }
        unbecome_root();
@@ -630,7 +630,7 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in,
 
        if (!become_user(conn, conn->vuid)) {
                DEBUG(0,("get_correct_cversion: Can't become user %s\n", user_name ));
-               *perr = ERROR_ACCESS_DENIED;
+               *perr = ERRnoaccess;
                pop_sec_ctx();
                return -1;
        }
@@ -648,7 +648,7 @@ static uint32 get_correct_cversion(fstring architecture, fstring driverpath_in,
        if (!fsp) {
                DEBUG(3,("get_correct_cversion: Can't open file [%s], errno = %d\n",
                                driverpath, errno));
-               *perr = ERROR_ACCESS_DENIED;
+               *perr = ERRnoaccess;
                goto error_exit;
        }
 
@@ -808,7 +808,7 @@ static uint32 clean_up_driver_struct_level_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 *dri
                                                                        driver->driverpath, user, &err)) == -1)
                return err;
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
        
 /****************************************************************************
@@ -873,7 +873,7 @@ static uint32 clean_up_driver_struct_level_6(NT_PRINTER_DRIVER_INFO_LEVEL_6 *dri
                                                                        driver->driverpath, user, &err)) == -1)
                return err;
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /****************************************************************************
@@ -1634,7 +1634,7 @@ static uint32 get_a_printer_driver_3_default(NT_PRINTER_DRIVER_INFO_LEVEL_3 **in
        fstrcpy(info.helpfile, "");
 
        if ((info.dependentfiles=(fstring *)malloc(2*sizeof(fstring))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
 
        memset(info.dependentfiles, '\0', 2*sizeof(fstring));
        fstrcpy(info.dependentfiles[0], "");
@@ -3023,7 +3023,7 @@ uint32 delete_printer_driver (NT_PRINTER_DRIVER_INFO_LEVEL_3 *i)
        DEBUG(5,("delete_printer_driver: [%s] driver delete successful.\n",
                i->name));
        
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 /****************************************************************************
 ****************************************************************************/
@@ -3170,7 +3170,7 @@ uint32 nt_printing_setsec(char *printername, SEC_DESC_BUF *secdesc_ctr)
 
        if (!sec_io_desc_buf("nt_printing_setsec", &new_secdesc_ctr,
                             &ps, 1)) {
-               status = ERROR_INVALID_FUNCTION;
+               status = ERRbadfunc;
                goto out;
        }
 
@@ -3180,7 +3180,7 @@ uint32 nt_printing_setsec(char *printername, SEC_DESC_BUF *secdesc_ctr)
                status = 0;
        } else {
                DEBUG(1,("Failed to store secdesc for %s\n", printername));
-               status = ERROR_INVALID_FUNCTION;
+               status = ERRbadfunc;
        }
 
        /* Free malloc'ed memory */
@@ -3551,7 +3551,7 @@ uint32 printer_write_default_dev(int snum, const PRINTER_DEFAULT *printer_defaul
                return 0;
 
        if (get_a_printer(&printer, 2, lp_servicename(snum))!=0)
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
 
        /*
         * Just ignore it if we already have a devmode.
@@ -3569,15 +3569,15 @@ uint32 printer_write_default_dev(int snum, const PRINTER_DEFAULT *printer_defaul
        if ( (printer_default->access_required & PRINTER_ACCESS_ADMINISTER) != 
              PRINTER_ACCESS_ADMINISTER) {
                DEBUG(5,("printer_write_default_dev: invalid request access to update: %x\n", printer_default->access_required));
-               result = ERROR_ACCESS_DENIED;
+               result = ERRnoaccess;
                goto done;
        }
 
        if (!print_access_check(NULL, snum, PRINTER_ACCESS_ADMINISTER)) {
                DEBUG(5,("printer_write_default_dev: Access denied for printer %s\n",
                        lp_servicename(snum) ));
-               result = ERROR_ACCESS_DENIED;
-               /*result = NT_STATUS_NOPROBLEMO;*/
+               result = ERRnoaccess;
+               /*result = ERRsuccess;*/
                goto done;
        }
 
@@ -3590,7 +3590,7 @@ uint32 printer_write_default_dev(int snum, const PRINTER_DEFAULT *printer_defaul
        if (!convert_devicemode(printer->info_2->printername,
                                printer_default->devmode_cont.devmode,
                                &printer->info_2->devmode)) {
-               result = ERROR_NOT_ENOUGH_MEMORY;
+               result = ERRnomem;
                goto done;
        }
 
@@ -3599,7 +3599,7 @@ uint32 printer_write_default_dev(int snum, const PRINTER_DEFAULT *printer_defaul
         */
 
        if (add_a_printer(*printer, 2)!=0) {
-               result = ERROR_ACCESS_DENIED;
+               result = ERRnoaccess;
                goto done;
        }
 
index fdb9018ede1c3b00f7e2943af64fd313d94c1163..17bea61f8679ef0de35be10705960e8058c03971 100644 (file)
@@ -617,7 +617,7 @@ BOOL print_job_delete(struct current_user *user, int jobid, int *errcode)
        if (!owner && 
            !print_access_check(user, snum, JOB_ACCESS_ADMINISTER)) {
                DEBUG(3, ("delete denied by security descriptor\n"));
-               *errcode = ERROR_ACCESS_DENIED;
+               *errcode = ERRnoaccess;
                return False;
        }
 
@@ -656,7 +656,7 @@ BOOL print_job_pause(struct current_user *user, int jobid, int *errcode)
        if (!is_owner(user, jobid) &&
            !print_access_check(user, snum, JOB_ACCESS_ADMINISTER)) {
                DEBUG(3, ("pause denied by security descriptor\n"));
-               *errcode = ERROR_ACCESS_DENIED;
+               *errcode = ERRnoaccess;
                return False;
        }
 
@@ -664,7 +664,7 @@ BOOL print_job_pause(struct current_user *user, int jobid, int *errcode)
        ret = (*(current_printif->job_pause))(snum, pjob);
 
        if (ret != 0) {
-               *errcode = ERROR_INVALID_PARAMETER;
+               *errcode = ERRinvalidparam;
                return False;
        }
 
@@ -700,14 +700,14 @@ BOOL print_job_resume(struct current_user *user, int jobid, int *errcode)
        if (!is_owner(user, jobid) &&
            !print_access_check(user, snum, JOB_ACCESS_ADMINISTER)) {
                DEBUG(3, ("resume denied by security descriptor\n"));
-               *errcode = ERROR_ACCESS_DENIED;
+               *errcode = ERRnoaccess;
                return False;
        }
 
        ret = (*(current_printif->job_resume))(snum, pjob);
 
        if (ret != 0) {
-               *errcode = ERROR_INVALID_PARAMETER;
+               *errcode = ERRinvalidparam;
                return False;
        }
 
@@ -1190,14 +1190,14 @@ BOOL print_queue_pause(struct current_user *user, int snum, int *errcode)
        int ret;
        
        if (!print_access_check(user, snum, PRINTER_ACCESS_ADMINISTER)) {
-               *errcode = ERROR_ACCESS_DENIED;
+               *errcode = ERRnoaccess;
                return False;
        }
 
        ret = (*(current_printif->queue_pause))(snum);
 
        if (ret != 0) {
-               *errcode = ERROR_INVALID_PARAMETER;
+               *errcode = ERRinvalidparam;
                return False;
        }
 
@@ -1222,14 +1222,14 @@ BOOL print_queue_resume(struct current_user *user, int snum, int *errcode)
        int ret;
 
        if (!print_access_check(user, snum, PRINTER_ACCESS_ADMINISTER)) {
-               *errcode = ERROR_ACCESS_DENIED;
+               *errcode = ERRnoaccess;
                return False;
        }
 
        ret = (*(current_printif->queue_resume))(snum);
 
        if (ret != 0) {
-               *errcode = ERROR_INVALID_PARAMETER;
+               *errcode = ERRinvalidparam;
                return False;
        }
 
index d93f320e2f2ff8bf01126da2ed0a70b43000f013..a0f14a9e645c83e7e187ca073c6ec762e2bcf60b 100644 (file)
@@ -22,6 +22,9 @@
  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+/* Since the SPOOLSS rpc routines are basically DOS 16-bit calls wrapped
+   up, all the errors returned are DOS errors, not NT status codes. */
+
 #include "includes.h"
 
 extern int DEBUGLEVEL;
@@ -272,12 +275,12 @@ static uint32 delete_printer_handle(pipes_struct *p, POLICY_HND *hnd)
 
        if (!Printer) {
                DEBUG(0,("delete_printer_handle: Invalid handle (%s)\n", OUR_HANDLE(hnd)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        if (del_a_printer(Printer->dev.handlename) != 0) {
                DEBUG(3,("Error deleting printer %s\n", Printer->dev.handlename));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        /* Check calling user has permission to delete printer.  Note that
@@ -287,7 +290,7 @@ static uint32 delete_printer_handle(pipes_struct *p, POLICY_HND *hnd)
 
        if (!print_access_check(NULL, -1, PRINTER_ACCESS_ADMINISTER)) {
                DEBUG(3, ("printer delete denied by security descriptor\n"));
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        }
 
        if (*lp_deleteprinter_cmd()) {
@@ -304,7 +307,7 @@ static uint32 delete_printer_handle(pipes_struct *p, POLICY_HND *hnd)
                DEBUG(10,("Running [%s]\n", command));
                ret = smbrun(command, NULL);
                if (ret != 0) {
-                       return ERROR_INVALID_HANDLE; /* What to return here? */
+                       return ERRbadfid; /* What to return here? */
                }
                DEBUGADD(10,("returned [%d]\n", ret));
 
@@ -313,12 +316,12 @@ static uint32 delete_printer_handle(pipes_struct *p, POLICY_HND *hnd)
 
                if ( ( i = lp_servicenumber( Printer->dev.handlename ) ) >= 0 ) {
                        lp_killservice( i );
-                       return ERROR_SUCCESS;
+                       return ERRsuccess;
                } else
-                       return ERROR_ACCESS_DENIED;
+                       return ERRnoaccess;
        }
 
-       return ERROR_SUCCESS;
+       return ERRsuccess;
 }      
 
 /****************************************************************************
@@ -705,7 +708,7 @@ static BOOL srv_spoolss_sendnotify(pipes_struct *p, POLICY_HND *handle)
 uint32 _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u, SPOOL_R_OPEN_PRINTER_EX *r_u)
 {
 #if 0
-       uint32 result = NT_STATUS_NOPROBLEMO;
+       uint32 result = ERRsuccess;
 #endif
 
        UNISTR2 *printername = NULL;
@@ -722,7 +725,7 @@ uint32 _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u,
                printername = &q_u->printername;
 
        if (printername == NULL)
-               return ERROR_INVALID_PRINTER_NAME;
+               return ERRinvalidprintername;
 
        /* some sanity check because you can open a printer or a print server */
        /* aka: \\server\printer or \\server */
@@ -731,7 +734,7 @@ uint32 _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u,
        DEBUGADD(3,("checking name: %s\n",name));
 
        if (!open_printer_hnd(p, handle, name))
-               return ERROR_INVALID_PRINTER_NAME;
+               return ERRinvalidprintername;
        
 /*
        if (printer_default->datatype_ptr != NULL)
@@ -745,7 +748,7 @@ uint32 _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u,
        
        if (!set_printer_hnd_accesstype(p, handle, printer_default->access_required)) {
                close_printer_handle(p, handle);
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        }
                
        /*
@@ -775,7 +778,7 @@ uint32 _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u,
 
        if (handle_is_printserver(p, handle)) {
                if (printer_default->access_required == 0) {
-                       return NT_STATUS_NOPROBLEMO;
+                       return ERRsuccess;
                }
                else if ((printer_default->access_required & SERVER_ACCESS_ADMINISTER ) == SERVER_ACCESS_ADMINISTER) {
 
@@ -784,14 +787,14 @@ uint32 _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u,
 
                        if (!lp_ms_add_printer_wizard()) {
                                close_printer_handle(p, handle);
-                               return ERROR_ACCESS_DENIED;
+                               return ERRnoaccess;
                        }
                        else if (user.uid == 0 || user_in_list(uidtoname(user.uid), lp_printer_admin(snum))) {
-                               return NT_STATUS_NOPROBLEMO;
+                               return ERRsuccess;
                        } 
                        else {
                                close_printer_handle(p, handle);
-                               return ERROR_ACCESS_DENIED;
+                               return ERRnoaccess;
                        }
                }
        }
@@ -801,7 +804,7 @@ uint32 _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u,
                   doesn't have print permission.  */
 
                if (!get_printer_snum(p, handle, &snum))
-                       return ERROR_INVALID_HANDLE;
+                       return ERRbadfid;
 
                /* map an empty access mask to the minimum access mask */
                if (printer_default->access_required == 0x0)
@@ -810,7 +813,7 @@ uint32 _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u,
                if (!print_access_check(&user, snum, printer_default->access_required)) {
                        DEBUG(3, ("access DENIED for printer open\n"));
                        close_printer_handle(p, handle);
-                       return ERROR_ACCESS_DENIED;
+                       return ERRnoaccess;
                }
 
                /*
@@ -889,7 +892,7 @@ uint32 _spoolss_open_printer_ex( pipes_struct *p, SPOOL_Q_OPEN_PRINTER_EX *q_u,
 #endif
        }
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /****************************************************************************
@@ -1007,7 +1010,7 @@ static uint32 _spoolss_enddocprinter_internal(pipes_struct *p, POLICY_HND *handl
        
        if (!Printer) {
                DEBUG(0,("_spoolss_enddocprinter_internal: Invalid handle (%s)\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
        
        Printer->document_started=False;
@@ -1033,9 +1036,9 @@ uint32 _spoolss_closeprinter(pipes_struct *p, SPOOL_Q_CLOSEPRINTER *q_u, SPOOL_R
        memcpy(&r_u->handle, &q_u->handle, sizeof(r_u->handle));
 
        if (!close_printer_handle(p, handle))
-               return ERROR_INVALID_HANDLE;    
+               return ERRbadfid;       
                
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /********************************************************************
@@ -1057,7 +1060,7 @@ uint32 _spoolss_deleteprinter(pipes_struct *p, SPOOL_Q_DELETEPRINTER *q_u, SPOOL
 
        result = delete_printer_handle(p, handle);
 
-       if (result == ERROR_SUCCESS) {
+       if (result == ERRsuccess) {
                srv_spoolss_sendnotify(p, handle);
        }
                
@@ -1119,20 +1122,20 @@ uint32 _spoolss_deleteprinterdriver(pipes_struct *p, SPOOL_Q_DELETEPRINTERDRIVER
        /* check that we have a valid driver name first */
        if ((version=get_version_id(arch)) == -1) {
                /* this is what NT returns */
-               return ERROR_INVALID_ENVIRONMENT;
+               return ERRinvalidenvironment;
        }
                
        ZERO_STRUCT(info);
        if (get_a_printer_driver (&info, 3, driver, arch, version) != 0) {
                /* this is what NT returns */
-               return ERROR_UNKNOWN_PRINTER_DRIVER;
+               return ERRunknownprinterdriver;
        }
        
 
        if (printer_driver_in_use(arch, driver))
        {
                /* this is what NT returns */
-               return ERROR_PRINTER_DRIVER_IN_USE;
+               return ERRprinterdriverinuse;
        }
 
        return delete_printer_driver(info.info_3);       
@@ -1308,9 +1311,9 @@ uint32 _spoolss_getprinterdata(pipes_struct *p, SPOOL_Q_GETPRINTERDATA *q_u, SPO
        
        if (!Printer) {
                if((*data=(uint8 *)malloc(4*sizeof(uint8))) == NULL)
-                       return ERROR_NOT_ENOUGH_MEMORY;
+                       return ERRnomem;
                DEBUG(0,("_spoolss_getprinterdata: Invalid handle (%s).\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
        
        unistr2_to_ascii(value, valuename, sizeof(value)-1);
@@ -1325,18 +1328,18 @@ uint32 _spoolss_getprinterdata(pipes_struct *p, SPOOL_Q_GETPRINTERDATA *q_u, SPO
                /* reply this param doesn't exist */
                if (*out_size) {
                        if((*data=(uint8 *)talloc_zero(p->mem_ctx, *out_size*sizeof(uint8))) == NULL)
-                               return ERROR_NOT_ENOUGH_MEMORY;
+                               return ERRnomem;
                } else {
                        *data = NULL;
                }
 
-               return ERROR_INVALID_PARAMETER;
+               return ERRinvalidparam;
        }
        
        if (*needed > *out_size)
-               return ERROR_MORE_DATA;
+               return ERRmoredata;
        else {
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
     }
 }
 
@@ -1397,7 +1400,7 @@ uint32 _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE
 
        if (!Printer) {
                DEBUG(0,("_spoolss_rffpcnex: Invalid handle (%s).\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        Printer->notify.flags=flags;
@@ -1417,7 +1420,7 @@ uint32 _spoolss_rffpcnex(pipes_struct *p, SPOOL_Q_RFFPCNEX *q_u, SPOOL_R_RFFPCNE
                                        &Printer->notify.client_hnd))
                Printer->notify.client_connected=True;
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /*******************************************************************
@@ -2361,7 +2364,7 @@ static uint32 printserver_notify_info(pipes_struct *p, POLICY_HND *hnd,
        }
        */
        
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /*******************************************************************
@@ -2444,7 +2447,7 @@ static uint32 printer_notify_info(pipes_struct *p, POLICY_HND *hnd, SPOOL_NOTIFY
                info->data[i].id, info->data[i].size, info->data[i].enc_type));
        }
        */
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /********************************************************************
@@ -2459,7 +2462,7 @@ uint32 _spoolss_rfnpcnex( pipes_struct *p, SPOOL_Q_RFNPCNEX *q_u, SPOOL_R_RFNPCN
        SPOOL_NOTIFY_INFO *info = &r_u->info;
 
        Printer_entry *Printer=find_printer_index_by_hnd(p, handle);
-       uint32 result = ERROR_INVALID_HANDLE;
+       uint32 result = ERRbadfid;
 
        /* we always have a NOTIFY_INFO struct */
        r_u->info_ptr=0x1;
@@ -2885,7 +2888,7 @@ static BOOL enum_all_printers_info_1(uint32 flags, NEW_BUFFER *buffer, uint32 of
                        if (construct_printer_info_1(flags, &current_prt, snum)) {
                                if((printers=Realloc(printers, (*returned +1)*sizeof(PRINTER_INFO_1))) == NULL) {
                                        *returned=0;
-                                       return ERROR_NOT_ENOUGH_MEMORY;
+                                       return ERRnomem;
                                }
                                DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_1\n", *returned));             
                                memcpy(&printers[*returned], &current_prt, sizeof(PRINTER_INFO_1));
@@ -2899,7 +2902,7 @@ static BOOL enum_all_printers_info_1(uint32 flags, NEW_BUFFER *buffer, uint32 of
                (*needed) += spoolss_size_printer_info_1(&printers[i]);
 
        if (!alloc_buffer_size(buffer, *needed))
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
 
        /* fill the buffer with the structures */
        for (i=0; i<*returned; i++)
@@ -2910,10 +2913,10 @@ static BOOL enum_all_printers_info_1(uint32 flags, NEW_BUFFER *buffer, uint32 of
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /********************************************************************
@@ -2941,7 +2944,7 @@ static BOOL enum_all_printers_info_1_name(fstring name, NEW_BUFFER *buffer, uint
                return enum_all_printers_info_1(PRINTER_ENUM_ICON8, buffer, offered, needed, returned);
        }
        else
-               return ERROR_INVALID_NAME;
+               return ERRinvalidname;
 }
 
 /********************************************************************
@@ -2963,7 +2966,7 @@ static BOOL enum_all_printers_info_1_remote(fstring name, NEW_BUFFER *buffer, ui
         */
        
        if((printer=(PRINTER_INFO_1 *)malloc(sizeof(PRINTER_INFO_1))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
 
        *returned=1;
        
@@ -2981,7 +2984,7 @@ static BOOL enum_all_printers_info_1_remote(fstring name, NEW_BUFFER *buffer, ui
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(printer);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -2992,10 +2995,10 @@ static BOOL enum_all_printers_info_1_remote(fstring name, NEW_BUFFER *buffer, ui
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /********************************************************************
@@ -3029,7 +3032,7 @@ static BOOL enum_all_printers_info_2(NEW_BUFFER *buffer, uint32 offered, uint32
                                
                        if (construct_printer_info_2(&current_prt, snum)) {
                                if((printers=Realloc(printers, (*returned +1)*sizeof(PRINTER_INFO_2))) == NULL)
-                                       return ERROR_NOT_ENOUGH_MEMORY;
+                                       return ERRnomem;
                                DEBUG(4,("ReAlloced memory for [%d] PRINTER_INFO_2\n", *returned));             
                                memcpy(&printers[*returned], &current_prt, sizeof(PRINTER_INFO_2));
                                (*returned)++;
@@ -3046,7 +3049,7 @@ static BOOL enum_all_printers_info_2(NEW_BUFFER *buffer, uint32 offered, uint32
                        free_devmode(printers[i].devmode);
                }
                safe_free(printers);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -3061,10 +3064,10 @@ static BOOL enum_all_printers_info_2(NEW_BUFFER *buffer, uint32 offered, uint32
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /********************************************************************
@@ -3088,7 +3091,7 @@ static uint32 enumprinters_level1( uint32 flags, fstring name,
        if (flags & PRINTER_ENUM_NETWORK)
                return enum_all_printers_info_1_network(buffer, offered, needed, returned);
 
-       return NT_STATUS_NOPROBLEMO; /* NT4sp5 does that */
+       return ERRsuccess; /* NT4sp5 does that */
 }
 
 /********************************************************************
@@ -3114,13 +3117,13 @@ static uint32 enumprinters_level2( uint32 flags, fstring servername,
                if (strequal(servername, temp))
                        return enum_all_printers_info_2(buffer, offered, needed, returned);
                else
-                       return ERROR_INVALID_NAME;
+                       return ERRinvalidname;
        }
 
        if (flags & PRINTER_ENUM_REMOTE)
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /********************************************************************
@@ -3131,7 +3134,7 @@ static uint32 enumprinters_level5( uint32 flags, fstring servername,
                                 uint32 *needed, uint32 *returned)
 {
 /*     return enum_all_printers_info_5(buffer, offered, needed, returned);*/
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /********************************************************************
@@ -3187,7 +3190,7 @@ uint32 _spoolss_enumprinters( pipes_struct *p, SPOOL_Q_ENUMPRINTERS *q_u, SPOOL_
        case 3:
        case 4:
        default:
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
 
@@ -3198,7 +3201,7 @@ static uint32 getprinter_level_0(int snum, NEW_BUFFER *buffer, uint32 offered, u
        PRINTER_INFO_0 *printer=NULL;
 
        if((printer=(PRINTER_INFO_0*)malloc(sizeof(PRINTER_INFO_0))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
 
        construct_printer_info_0(printer, snum);
        
@@ -3207,7 +3210,7 @@ static uint32 getprinter_level_0(int snum, NEW_BUFFER *buffer, uint32 offered, u
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(printer);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -3217,10 +3220,10 @@ static uint32 getprinter_level_0(int snum, NEW_BUFFER *buffer, uint32 offered, u
        safe_free(printer);
 
        if (*needed > offered) {
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;    
+               return ERRsuccess;      
 }
 
 /****************************************************************************
@@ -3230,7 +3233,7 @@ static uint32 getprinter_level_1(int snum, NEW_BUFFER *buffer, uint32 offered, u
        PRINTER_INFO_1 *printer=NULL;
 
        if((printer=(PRINTER_INFO_1*)malloc(sizeof(PRINTER_INFO_1))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
 
        construct_printer_info_1(PRINTER_ENUM_ICON8, printer, snum);
        
@@ -3239,7 +3242,7 @@ static uint32 getprinter_level_1(int snum, NEW_BUFFER *buffer, uint32 offered, u
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(printer);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -3249,10 +3252,10 @@ static uint32 getprinter_level_1(int snum, NEW_BUFFER *buffer, uint32 offered, u
        safe_free(printer);
 
        if (*needed > offered) {
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;    
+               return ERRsuccess;      
 }
 
 /****************************************************************************
@@ -3262,7 +3265,7 @@ static uint32 getprinter_level_2(int snum, NEW_BUFFER *buffer, uint32 offered, u
        PRINTER_INFO_2 *printer=NULL;
 
        if((printer=(PRINTER_INFO_2*)malloc(sizeof(PRINTER_INFO_2)))==NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        
        construct_printer_info_2(printer, snum);
        
@@ -3271,23 +3274,23 @@ static uint32 getprinter_level_2(int snum, NEW_BUFFER *buffer, uint32 offered, u
 
        if (!alloc_buffer_size(buffer, *needed)) {
                free_printer_info_2(printer);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
        if (!smb_io_printer_info_2("", buffer, printer, 0)) {
                free_printer_info_2(printer);
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        }
        
        /* clear memory */
        free_printer_info_2(printer);
 
        if (*needed > offered) {
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;    
+               return ERRsuccess;      
 }
 
 /****************************************************************************
@@ -3297,14 +3300,14 @@ static uint32 getprinter_level_3(int snum, NEW_BUFFER *buffer, uint32 offered, u
        PRINTER_INFO_3 *printer=NULL;
 
        if (!construct_printer_info_3(&printer, snum))
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        
        /* check the required size. */  
        *needed += spoolss_size_printer_info_3(printer);
 
        if (!alloc_buffer_size(buffer, *needed)) {
                free_printer_info_3(printer);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -3314,10 +3317,10 @@ static uint32 getprinter_level_3(int snum, NEW_BUFFER *buffer, uint32 offered, u
        free_printer_info_3(printer);
        
        if (*needed > offered) {
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;    
+               return ERRsuccess;      
 }
 
 /****************************************************************************
@@ -3340,7 +3343,7 @@ uint32 _spoolss_getprinter(pipes_struct *p, SPOOL_Q_GETPRINTER *q_u, SPOOL_R_GET
        *needed=0;
 
        if (!get_printer_snum(p, handle, &snum))
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
 
        switch (level) {
        case 0:
@@ -3352,7 +3355,7 @@ uint32 _spoolss_getprinter(pipes_struct *p, SPOOL_Q_GETPRINTER *q_u, SPOOL_R_GET
        case 3:         
                return getprinter_level_3(snum, buffer, offered, needed);
        default:
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }      
                
@@ -3375,16 +3378,16 @@ static uint32 construct_printer_driver_info_1(DRIVER_INFO_1 *info, int snum, fst
        ZERO_STRUCT(driver);
 
        if (get_a_printer(&printer, 2, lp_servicename(snum)) != 0)
-               return ERROR_INVALID_PRINTER_NAME;
+               return ERRinvalidprintername;
 
        if (get_a_printer_driver(&driver, 3, printer->info_2->drivername, architecture, version) != 0)
-               return ERROR_UNKNOWN_PRINTER_DRIVER;
+               return ERRunknownprinterdriver;
 
        fill_printer_driver_info_1(info, driver, servername, architecture);
 
        free_a_printer(&printer,2);
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /********************************************************************
@@ -3433,16 +3436,16 @@ static uint32 construct_printer_driver_info_2(DRIVER_INFO_2 *info, int snum, fst
        ZERO_STRUCT(driver);
 
        if (!get_a_printer(&printer, 2, lp_servicename(snum)) != 0)
-               return ERROR_INVALID_PRINTER_NAME;
+               return ERRinvalidprintername;
 
        if (!get_a_printer_driver(&driver, 3, printer->info_2->drivername, architecture, version) != 0)
-               return ERROR_UNKNOWN_PRINTER_DRIVER;
+               return ERRunknownprinterdriver;
 
        fill_printer_driver_info_2(info, driver, servername);
 
        free_a_printer(&printer,2);
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /********************************************************************
@@ -3545,20 +3548,20 @@ static uint32 construct_printer_driver_info_3(DRIVER_INFO_3 *info, int snum, fst
        status=get_a_printer(&printer, 2, lp_servicename(snum) );
        DEBUG(8,("construct_printer_driver_info_3: status: %d\n", status));
        if (status != 0)
-               return ERROR_INVALID_PRINTER_NAME;
+               return ERRinvalidprintername;
 
        status=get_a_printer_driver(&driver, 3, printer->info_2->drivername, architecture, version);    
        DEBUG(8,("construct_printer_driver_info_3: status: %d\n", status));
        if (status != 0) {
                free_a_printer(&printer,2);
-               return ERROR_UNKNOWN_PRINTER_DRIVER;
+               return ERRunknownprinterdriver;
        }
 
        fill_printer_driver_info_3(info, driver, servername);
 
        free_a_printer(&printer,2);
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /********************************************************************
@@ -3639,7 +3642,7 @@ static uint32 construct_printer_driver_info_6(DRIVER_INFO_6 *info, int snum, fst
        status=get_a_printer(&printer, 2, lp_servicename(snum) );
        DEBUG(8,("construct_printer_driver_info_6: status: %d\n", status));
        if (status != 0)
-               return ERROR_INVALID_PRINTER_NAME;
+               return ERRinvalidprintername;
 
        status=get_a_printer_driver(&driver, 3, printer->info_2->drivername, architecture, version);    
        DEBUG(8,("construct_printer_driver_info_6: status: %d\n", status));
@@ -3650,7 +3653,7 @@ static uint32 construct_printer_driver_info_6(DRIVER_INFO_6 *info, int snum, fst
 
                if (version < 3) {
                        free_a_printer(&printer,2);
-                       return ERROR_UNKNOWN_PRINTER_DRIVER;
+                       return ERRunknownprinterdriver;
                }
 
                /* Yes - try again with a WinNT driver. */
@@ -3659,7 +3662,7 @@ static uint32 construct_printer_driver_info_6(DRIVER_INFO_6 *info, int snum, fst
                DEBUG(8,("construct_printer_driver_info_6: status: %d\n", status));
                if (status != 0) {
                        free_a_printer(&printer,2);
-                       return ERROR_UNKNOWN_PRINTER_DRIVER;
+                       return ERRunknownprinterdriver;
                }
        }
 
@@ -3667,7 +3670,7 @@ static uint32 construct_printer_driver_info_6(DRIVER_INFO_6 *info, int snum, fst
 
        free_a_printer(&printer,2);
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /****************************************************************************
@@ -3695,10 +3698,10 @@ static uint32 getprinterdriver2_level1(fstring servername, fstring architecture,
        uint32 status;
        
        if((info=(DRIVER_INFO_1 *)malloc(sizeof(DRIVER_INFO_1))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        
        status=construct_printer_driver_info_1(info, snum, servername, architecture, version);
-       if (status != NT_STATUS_NOPROBLEMO) {
+       if (status != ERRsuccess) {
                safe_free(info);
                return status;
        }
@@ -3708,7 +3711,7 @@ static uint32 getprinterdriver2_level1(fstring servername, fstring architecture,
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(info);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -3718,9 +3721,9 @@ static uint32 getprinterdriver2_level1(fstring servername, fstring architecture,
        safe_free(info);
 
        if (*needed > offered)
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -3731,10 +3734,10 @@ static uint32 getprinterdriver2_level2(fstring servername, fstring architecture,
        uint32 status;
        
        if((info=(DRIVER_INFO_2 *)malloc(sizeof(DRIVER_INFO_2))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        
        status=construct_printer_driver_info_2(info, snum, servername, architecture, version);
-       if (status != NT_STATUS_NOPROBLEMO) {
+       if (status != ERRsuccess) {
                safe_free(info);
                return status;
        }
@@ -3744,7 +3747,7 @@ static uint32 getprinterdriver2_level2(fstring servername, fstring architecture,
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(info);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -3754,9 +3757,9 @@ static uint32 getprinterdriver2_level2(fstring servername, fstring architecture,
        safe_free(info);
 
        if (*needed > offered)
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -3769,7 +3772,7 @@ static uint32 getprinterdriver2_level3(fstring servername, fstring architecture,
        ZERO_STRUCT(info);
 
        status=construct_printer_driver_info_3(&info, snum, servername, architecture, version);
-       if (status != NT_STATUS_NOPROBLEMO) {
+       if (status != ERRsuccess) {
                return status;
        }
 
@@ -3778,7 +3781,7 @@ static uint32 getprinterdriver2_level3(fstring servername, fstring architecture,
 
        if (!alloc_buffer_size(buffer, *needed)) {
                free_printer_driver_info_3(&info);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -3787,9 +3790,9 @@ static uint32 getprinterdriver2_level3(fstring servername, fstring architecture,
        free_printer_driver_info_3(&info);
 
        if (*needed > offered)
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -3802,7 +3805,7 @@ static uint32 getprinterdriver2_level6(fstring servername, fstring architecture,
        ZERO_STRUCT(info);
 
        status=construct_printer_driver_info_6(&info, snum, servername, architecture, version);
-       if (status != NT_STATUS_NOPROBLEMO) {
+       if (status != ERRsuccess) {
                return status;
        }
 
@@ -3811,7 +3814,7 @@ static uint32 getprinterdriver2_level6(fstring servername, fstring architecture,
 
        if (!alloc_buffer_size(buffer, *needed)) {
                free_printer_driver_info_6(&info);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -3820,9 +3823,9 @@ static uint32 getprinterdriver2_level6(fstring servername, fstring architecture,
        free_printer_driver_info_6(&info);
 
        if (*needed > offered)
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -3859,7 +3862,7 @@ uint32 _spoolss_getprinterdriver2(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVER2 *q_
        unistr2_to_ascii(architecture, uni_arch, sizeof(architecture)-1);
 
        if (!get_printer_snum(p, handle, &snum))
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
 
        switch (level) {
        case 1:
@@ -3871,7 +3874,7 @@ uint32 _spoolss_getprinterdriver2(pipes_struct *p, SPOOL_Q_GETPRINTERDRIVER2 *q_
        case 6:
                return getprinterdriver2_level6(servername, architecture, clientmajorversion, snum, buffer, offered, needed);
        default:
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
 
@@ -3890,7 +3893,7 @@ uint32 _spoolss_startpageprinter(pipes_struct *p, SPOOL_Q_STARTPAGEPRINTER *q_u,
        }
 
        DEBUG(3,("Error in startpageprinter printer handle\n"));
-       return ERROR_INVALID_HANDLE;
+       return ERRbadfid;
 }
 
 /****************************************************************************
@@ -3904,12 +3907,12 @@ uint32 _spoolss_endpageprinter(pipes_struct *p, SPOOL_Q_ENDPAGEPRINTER *q_u, SPO
 
        if (!Printer) {
                DEBUG(0,("_spoolss_endpageprinter: Invalid handle (%s).\n",OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
        
        Printer->page_started=False;
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /********************************************************************
@@ -3934,7 +3937,7 @@ uint32 _spoolss_startdocprinter(pipes_struct *p, SPOOL_Q_STARTDOCPRINTER *q_u, S
 
        if (!Printer) {
                DEBUG(0,("_spoolss_startdocprinter: Invalid handle (%s)\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        get_current_user(&user, p);
@@ -3955,13 +3958,13 @@ uint32 _spoolss_startdocprinter(pipes_struct *p, SPOOL_Q_STARTDOCPRINTER *q_u, S
                unistr2_to_ascii(datatype, &info_1->datatype, sizeof(datatype));
                if (strcmp(datatype, "RAW") != 0) {
                        (*jobid)=0;
-                       return ERROR_INVALID_DATATYPE;
+                       return ERRinvaliddatatype;
                }               
        }               
        
        /* get the share number of the printer */
        if (!get_printer_snum(p, handle, &snum)) {
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        unistr2_to_ascii(jobname, &info_1->docname, sizeof(jobname));
@@ -4009,7 +4012,7 @@ uint32 _spoolss_writeprinter(pipes_struct *p, SPOOL_Q_WRITEPRINTER *q_u, SPOOL_R
        if (!Printer) {
                DEBUG(0,("_spoolss_writeprinter: Invalid handle (%s)\n",OUR_HANDLE(handle)));
                r_u->buffer_written = q_u->buffer_size2;
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        (*buffer_written) = print_job_write(Printer->jobid, (char *)buffer, buffer_size);
@@ -4029,18 +4032,18 @@ static uint32 control_printer(POLICY_HND *handle, uint32 command,
                              pipes_struct *p)
 {
        struct current_user user;
-       int snum, errcode = ERROR_INVALID_FUNCTION;
+       int snum, errcode = ERRbadfunc;
        Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
 
        get_current_user(&user, p);
 
        if (!Printer) {
                DEBUG(0,("control_printer: Invalid handle (%s)\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        if (!get_printer_snum(p, handle, &snum))
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
 
        switch (command) {
        case PRINTER_CONTROL_PAUSE:
@@ -4060,7 +4063,7 @@ static uint32 control_printer(POLICY_HND *handle, uint32 command,
                }
                break;
        default:
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 
        return errcode;
@@ -4096,7 +4099,7 @@ static uint32 update_printer_sec(POLICY_HND *handle, uint32 level,
                DEBUG(0,("update_printer_sec: Invalid handle (%s)\n",
                         OUR_HANDLE(handle)));
 
-               result = ERROR_INVALID_HANDLE;
+               result = ERRbadfid;
                goto done;
        }
 
@@ -4146,7 +4149,7 @@ static uint32 update_printer_sec(POLICY_HND *handle, uint32 level,
        new_secdesc_ctr = sec_desc_merge(p->mem_ctx, secdesc_ctr, old_secdesc_ctr);
 
        if (sec_desc_equal(new_secdesc_ctr->sec, old_secdesc_ctr->sec)) {
-               result = NT_STATUS_NOPROBLEMO;
+               result = ERRsuccess;
                goto done;
        }
 
@@ -4160,7 +4163,7 @@ static uint32 update_printer_sec(POLICY_HND *handle, uint32 level,
           information. */
 
        if (!print_access_check(&user, snum, PRINTER_ACCESS_ADMINISTER)) {
-               result = ERROR_ACCESS_DENIED;
+               result = ERRnoaccess;
                goto done;
        }
 
@@ -4504,28 +4507,28 @@ static uint32 update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
 
        DEBUG(8,("update_printer\n"));
        
-       result = NT_STATUS_NOPROBLEMO;
+       result = ERRsuccess;
 
        if (level!=2) {
                DEBUG(0,("Send a mail to samba@samba.org\n"));
                DEBUGADD(0,("with the following message: update_printer: level!=2\n"));
-               result = ERROR_INVALID_LEVEL;
+               result = ERRunknownlevel;
                goto done;
        }
 
        if (!Printer) {
-               result = ERROR_INVALID_HANDLE;
+               result = ERRbadfid;
                goto done;
        }
 
        if (!get_printer_snum(p, handle, &snum)) {
-               result = ERROR_INVALID_HANDLE;
+               result = ERRbadfid;
                goto done;
        }
 
        if((get_a_printer(&printer, 2, lp_servicename(snum)) != 0) ||
           (get_a_printer(&old_printer, 2, lp_servicename(snum)) != 0)) {
-               result = ERROR_INVALID_HANDLE;
+               result = ERRbadfid;
                goto done;
        }
 
@@ -4546,7 +4549,7 @@ static uint32 update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
                DEBUGADD(8,("Converting the devicemode struct\n"));
                if (!convert_devicemode(printer->info_2->printername, devmode,
                                &printer->info_2->devmode)) {
-                       result =  ERROR_NOT_ENOUGH_MEMORY;
+                       result =  ERRnomem;
                        goto done;
                }
        }
@@ -4554,7 +4557,7 @@ static uint32 update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
        /* Do sanity check on the requested changes for Samba */
 
        if (!check_printer_ok(printer->info_2, snum)) {
-               result = ERROR_INVALID_PARAMETER;
+               result = ERRinvalidparam;
                goto done;
        }
 
@@ -4564,7 +4567,7 @@ static uint32 update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
 
        if (nt_printer_info_level_equal(printer, old_printer)) {
                DEBUG(3, ("printer info has not changed\n"));
-               result = NT_STATUS_NOPROBLEMO;
+               result = ERRsuccess;
                goto done;
        }
 
@@ -4573,7 +4576,7 @@ static uint32 update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
        if (!print_access_check(NULL, snum, PRINTER_ACCESS_ADMINISTER)) {
                DEBUG(3, ("printer property change denied by security "
                          "descriptor\n"));
-               result = ERROR_ACCESS_DENIED;
+               result = ERRnoaccess;
                goto done;
        }
 
@@ -4581,7 +4584,7 @@ static uint32 update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
 
        if (*lp_addprinter_cmd() )
                if ( !add_printer_hook(printer) ) {
-                       result = ERROR_ACCESS_DENIED;
+                       result = ERRnoaccess;
                        goto done;
                }
        
@@ -4589,7 +4592,7 @@ static uint32 update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
 
        if (add_a_printer(*printer, 2)!=0) {
                /* I don't really know what to return here !!! */
-               result = ERROR_ACCESS_DENIED;
+               result = ERRnoaccess;
                goto done;
        }
 
@@ -4618,7 +4621,7 @@ uint32 _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SET
        
        if (!Printer) {
                DEBUG(0,("_spoolss_setprinter: Invalid handle (%s)\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        /* check the level */   
@@ -4631,7 +4634,7 @@ uint32 _spoolss_setprinter(pipes_struct *p, SPOOL_Q_SETPRINTER *q_u, SPOOL_R_SET
                        return update_printer_sec(handle, level, info, p,
                                                  secdesc_ctr);
                default:
-                       return ERROR_INVALID_LEVEL;
+                       return ERRunknownlevel;
        }
 }
 
@@ -4646,7 +4649,7 @@ uint32 _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u)
        
        if (!Printer) {
                DEBUG(0,("_spoolss_fcpn: Invalid handle (%s)\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        if (Printer->notify.client_connected==True)
@@ -4660,7 +4663,7 @@ uint32 _spoolss_fcpn(pipes_struct *p, SPOOL_Q_FCPN *q_u, SPOOL_R_FCPN *r_u)
                free_spool_notify_option(&Printer->notify.option);
        Printer->notify.client_connected=False;
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /****************************************************************************
@@ -4672,7 +4675,7 @@ uint32 _spoolss_addjob(pipes_struct *p, SPOOL_Q_ADDJOB *q_u, SPOOL_R_ADDJOB *r_u
        spoolss_move_buffer(q_u->buffer, &r_u->buffer);
 
        r_u->needed = 0;
-       return ERROR_INVALID_PARAMETER; /* this is what a NT server
+       return ERRinvalidparam; /* this is what a NT server
                                            returns for AddJob. AddJob
                                            must fail on non-local
                                            printers */
@@ -4769,7 +4772,7 @@ static uint32 enumjobs_level1(print_queue_struct *queue, int snum,
        if (info==NULL) {
                safe_free(queue);
                *returned=0;
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        }
        
        for (i=0; i<*returned; i++)
@@ -4783,7 +4786,7 @@ static uint32 enumjobs_level1(print_queue_struct *queue, int snum,
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(info);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -4795,10 +4798,10 @@ static uint32 enumjobs_level1(print_queue_struct *queue, int snum,
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -4815,12 +4818,12 @@ static uint32 enumjobs_level2(print_queue_struct *queue, int snum,
        info=(JOB_INFO_2 *)malloc(*returned*sizeof(JOB_INFO_2));
        if (info==NULL) {
                *returned=0;
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        }
 
        if (get_a_printer(&ntprinter, 2, lp_servicename(snum)) !=0) {
                *returned = 0;
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        }
                
        for (i=0; i<*returned; i++)
@@ -4835,7 +4838,7 @@ static uint32 enumjobs_level2(print_queue_struct *queue, int snum,
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(info);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the structures */
@@ -4850,10 +4853,10 @@ static uint32 enumjobs_level2(print_queue_struct *queue, int snum,
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -4887,14 +4890,14 @@ uint32 _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJO
        *returned=0;
 
        if (!get_printer_snum(p, handle, &snum))
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
 
        *returned = print_queue_status(snum, &queue, &prt_status);
        DEBUGADD(4,("count:[%d], status:[%d], [%s]\n", *returned, prt_status.status, prt_status.message));
 
        if (*returned == 0) {
                safe_free(queue);
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
        }
 
        switch (level) {
@@ -4905,7 +4908,7 @@ uint32 _spoolss_enumjobs( pipes_struct *p, SPOOL_Q_ENUMJOBS *q_u, SPOOL_R_ENUMJO
        default:
                safe_free(queue);
                *returned=0;
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
 
@@ -4930,16 +4933,16 @@ uint32 _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r_u
 
        struct current_user user;
        print_status_struct prt_status;
-       int snum, errcode = ERROR_INVALID_FUNCTION;
+       int snum, errcode = ERRbadfunc;
                
        memset(&prt_status, 0, sizeof(prt_status));
 
        if (!get_printer_snum(p, handle, &snum)) {
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        if (!print_job_exists(jobid)) {
-               return ERROR_INVALID_PRINTER_NAME;
+               return ERRinvalidprintername;
        }
 
        get_current_user(&user, p);     
@@ -4963,7 +4966,7 @@ uint32 _spoolss_setjob(pipes_struct *p, SPOOL_Q_SETJOB *q_u, SPOOL_R_SETJOB *r_u
                }
                break;
        default:
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 
        return errcode;
@@ -4992,12 +4995,12 @@ static uint32 enumprinterdrivers_level1(fstring servername, fstring architecture
                DEBUGADD(4,("we have:[%d] drivers in environment [%s] and version [%d]\n", ndrivers, architecture, version));
 
                if(ndrivers == -1)
-                       return ERROR_NOT_ENOUGH_MEMORY;
+                       return ERRnomem;
 
                if(ndrivers != 0) {
                        if((driver_info_1=(DRIVER_INFO_1 *)Realloc(driver_info_1, (*returned+ndrivers) * sizeof(DRIVER_INFO_1))) == NULL) {
                                safe_free(list);
-                               return ERROR_NOT_ENOUGH_MEMORY;
+                               return ERRnomem;
                        }
                }
 
@@ -5025,7 +5028,7 @@ static uint32 enumprinterdrivers_level1(fstring servername, fstring architecture
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(driver_info_1);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the driver structures */
@@ -5038,10 +5041,10 @@ static uint32 enumprinterdrivers_level1(fstring servername, fstring architecture
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -5067,12 +5070,12 @@ static uint32 enumprinterdrivers_level2(fstring servername, fstring architecture
                DEBUGADD(4,("we have:[%d] drivers in environment [%s] and version [%d]\n", ndrivers, architecture, version));
 
                if(ndrivers == -1)
-                       return ERROR_NOT_ENOUGH_MEMORY;
+                       return ERRnomem;
 
                if(ndrivers != 0) {
                        if((driver_info_2=(DRIVER_INFO_2 *)Realloc(driver_info_2, (*returned+ndrivers) * sizeof(DRIVER_INFO_2))) == NULL) {
                                safe_free(list);
-                               return ERROR_NOT_ENOUGH_MEMORY;
+                               return ERRnomem;
                        }
                }
                
@@ -5101,7 +5104,7 @@ static uint32 enumprinterdrivers_level2(fstring servername, fstring architecture
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(driver_info_2);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the form structures */
@@ -5114,10 +5117,10 @@ static uint32 enumprinterdrivers_level2(fstring servername, fstring architecture
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -5143,12 +5146,12 @@ static uint32 enumprinterdrivers_level3(fstring servername, fstring architecture
                DEBUGADD(4,("we have:[%d] drivers in environment [%s] and version [%d]\n", ndrivers, architecture, version));
 
                if(ndrivers == -1)
-                       return ERROR_NOT_ENOUGH_MEMORY;
+                       return ERRnomem;
 
                if(ndrivers != 0) {
                        if((driver_info_3=(DRIVER_INFO_3 *)Realloc(driver_info_3, (*returned+ndrivers) * sizeof(DRIVER_INFO_3))) == NULL) {
                                safe_free(list);
-                               return ERROR_NOT_ENOUGH_MEMORY;
+                               return ERRnomem;
                        }
                }
 
@@ -5177,7 +5180,7 @@ static uint32 enumprinterdrivers_level3(fstring servername, fstring architecture
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(driver_info_3);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        
        /* fill the buffer with the driver structures */
@@ -5193,10 +5196,10 @@ static uint32 enumprinterdrivers_level3(fstring servername, fstring architecture
        
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -5238,7 +5241,7 @@ uint32 _spoolss_enumprinterdrivers( pipes_struct *p, SPOOL_Q_ENUMPRINTERDRIVERS
        default:
                *returned=0;
                safe_free(list);
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
 
@@ -5290,13 +5293,13 @@ uint32 _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMF
        DEBUGADD(5,("Number of user forms [%d]\n",     *numofforms));
        *numofforms += numbuiltinforms;
 
-       if (*numofforms == 0) return ERROR_NO_MORE_ITEMS;
+       if (*numofforms == 0) return ERRnomoreitems;
 
        switch (level) {
        case 1:
                if ((forms_1=(FORM_1 *)malloc(*numofforms * sizeof(FORM_1))) == NULL) {
                        *numofforms=0;
-                       return ERROR_NOT_ENOUGH_MEMORY;
+                       return ERRnomem;
                }
 
                /* construct the list of form structures */
@@ -5328,7 +5331,7 @@ uint32 _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMF
                
                if (!alloc_buffer_size(buffer, buffer_size)){
                        safe_free(forms_1);
-                       return ERROR_INSUFFICIENT_BUFFER;
+                       return ERRinsufficientbuffer;
                }
 
                /* fill the buffer with the form structures */
@@ -5345,15 +5348,15 @@ uint32 _spoolss_enumforms(pipes_struct *p, SPOOL_Q_ENUMFORMS *q_u, SPOOL_R_ENUMF
 
                if (*needed > offered) {
                        *numofforms=0;
-                       return ERROR_INSUFFICIENT_BUFFER;
+                       return ERRinsufficientbuffer;
                }
                else
-                       return NT_STATUS_NOPROBLEMO;
+                       return ERRsuccess;
                        
        default:
                safe_free(list);
                safe_free(builtinlist);
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 
 }
@@ -5394,7 +5397,7 @@ uint32 _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM *
                DEBUGADD(5,("Number of forms [%d]\n",     numofforms));
 
                if (numofforms == 0)
-                       return ERROR_INVALID_HANDLE;
+                       return ERRbadfid;
        }
 
        switch (level) {
@@ -5417,7 +5420,7 @@ uint32 _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM *
                        
                        safe_free(list);
                        if (i == numofforms) {
-                               return ERROR_INVALID_HANDLE;
+                               return ERRbadfid;
                        }
                }
                /* check the required size. */
@@ -5425,22 +5428,22 @@ uint32 _spoolss_getform(pipes_struct *p, SPOOL_Q_GETFORM *q_u, SPOOL_R_GETFORM *
                *needed=spoolss_size_form_1(&form_1);
                
                if (!alloc_buffer_size(buffer, buffer_size)){
-                       return ERROR_INSUFFICIENT_BUFFER;
+                       return ERRinsufficientbuffer;
                }
 
                if (*needed > offered) {
-                       return ERROR_INSUFFICIENT_BUFFER;
+                       return ERRinsufficientbuffer;
                }
 
                /* fill the buffer with the form structures */
                DEBUGADD(6,("adding form %s [%d] to buffer\n", form_name, i));
                smb_io_form_1("", buffer, &form_1, 0);
 
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
                        
        default:
                safe_free(list);
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
 
@@ -5488,7 +5491,7 @@ static uint32 enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *need
                        if (fd != -1)
                                close(fd);
                        /* Is this the best error to return here? */
-                       return ERROR_ACCESS_DENIED;
+                       return ERRnoaccess;
                }
 
                numlines = 0;
@@ -5498,9 +5501,9 @@ static uint32 enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *need
 
                if(numlines) {
                        if((ports=(PORT_INFO_1 *)malloc( numlines * sizeof(PORT_INFO_1) )) == NULL) {
-                               DEBUG(10,("Returning ERROR_NOT_ENOUGH_MEMORY [%x]\n", ERROR_NOT_ENOUGH_MEMORY));
+                               DEBUG(10,("Returning ERRnomem [%x]\n", ERRnomem));
                                file_lines_free(qlines);
-                               return ERROR_NOT_ENOUGH_MEMORY;
+                               return ERRnomem;
                        }
 
                        for (i=0; i<numlines; i++) {
@@ -5517,7 +5520,7 @@ static uint32 enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *need
                *returned = 1; /* Sole Samba port returned. */
 
                if((ports=(PORT_INFO_1 *)malloc( sizeof(PORT_INFO_1) )) == NULL)
-                       return ERROR_NOT_ENOUGH_MEMORY;
+                       return ERRnomem;
        
                DEBUG(10,("enumports_level_1: port name %s\n", SAMBA_PRINTER_PORT_NAME));
 
@@ -5532,7 +5535,7 @@ static uint32 enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *need
                
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(ports);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the ports structures */
@@ -5545,10 +5548,10 @@ static uint32 enumports_level_1(NEW_BUFFER *buffer, uint32 offered, uint32 *need
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -5586,7 +5589,7 @@ static uint32 enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *need
                        if (fd != -1)
                                close(fd);
                        /* Is this the best error to return here? */
-                       return ERROR_ACCESS_DENIED;
+                       return ERRnoaccess;
                }
 
                numlines = 0;
@@ -5596,9 +5599,9 @@ static uint32 enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *need
 
                if(numlines) {
                        if((ports=(PORT_INFO_2 *)malloc( numlines * sizeof(PORT_INFO_2) )) == NULL) {
-                               DEBUG(10,("Returning ERROR_NOT_ENOUGH_MEMORY [%x]\n", ERROR_NOT_ENOUGH_MEMORY));
+                               DEBUG(10,("Returning ERRnomem [%x]\n", ERRnomem));
                                file_lines_free(qlines);
-                               return ERROR_NOT_ENOUGH_MEMORY;
+                               return ERRnomem;
                        }
 
                        for (i=0; i<numlines; i++) {
@@ -5616,7 +5619,7 @@ static uint32 enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *need
                *returned = 1;
 
                if((ports=(PORT_INFO_2 *)malloc( sizeof(PORT_INFO_2) )) == NULL)
-                       return ERROR_NOT_ENOUGH_MEMORY;
+                       return ERRnomem;
        
                DEBUG(10,("enumports_level_2: port name %s\n", SAMBA_PRINTER_PORT_NAME));
 
@@ -5631,7 +5634,7 @@ static uint32 enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *need
                
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(ports);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        /* fill the buffer with the ports structures */
@@ -5644,10 +5647,10 @@ static uint32 enumports_level_2(NEW_BUFFER *buffer, uint32 offered, uint32 *need
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -5678,7 +5681,7 @@ uint32 _spoolss_enumports( pipes_struct *p, SPOOL_Q_ENUMPORTS *q_u, SPOOL_R_ENUM
        case 2:
                return enumports_level_2(buffer, offered, needed, returned);
        default:
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
 
@@ -5696,7 +5699,7 @@ static uint32 spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
 
        if ((printer = (NT_PRINTER_INFO_LEVEL *)malloc(sizeof(NT_PRINTER_INFO_LEVEL))) == NULL) {
                DEBUG(0,("spoolss_addprinterex_level_2: malloc fail.\n"));
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        }
 
        ZERO_STRUCTP(printer);
@@ -5707,7 +5710,7 @@ static uint32 spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
        if (*lp_addprinter_cmd() )
                if ( !add_printer_hook(printer) ) {
                        free_a_printer(&printer,2);
-                       return ERROR_ACCESS_DENIED;
+                       return ERRnoaccess;
        }
 
        slprintf(name, sizeof(name)-1, "\\\\%s\\%s", global_myname,
@@ -5715,13 +5718,13 @@ static uint32 spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
 
        if ((snum = print_queue_snum(printer->info_2->sharename)) == -1) {
                free_a_printer(&printer,2);
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        }
 
        /* you must be a printer admin to add a new printer */
        if (!print_access_check(NULL, snum, PRINTER_ACCESS_ADMINISTER)) {
                free_a_printer(&printer,2);
-               return ERROR_ACCESS_DENIED;             
+               return ERRnoaccess;             
        }
        
        /*
@@ -5730,27 +5733,27 @@ static uint32 spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
 
        if (!check_printer_ok(printer->info_2, snum)) {
                free_a_printer(&printer,2);
-               return ERROR_INVALID_PARAMETER;
+               return ERRinvalidparam;
        }
 
        /* write the ASCII on disk */
        if (add_a_printer(*printer, 2) != 0) {
                free_a_printer(&printer,2);
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        }
 
        if (!open_printer_hnd(p, handle, name)) {
                /* Handle open failed - remove addition. */
                del_a_printer(printer->info_2->sharename);
                free_a_printer(&printer,2);
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        }
 
        free_a_printer(&printer,2);
 
        srv_spoolss_sendnotify(p, handle);
 
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /****************************************************************************
@@ -5773,13 +5776,13 @@ uint32 _spoolss_addprinterex( pipes_struct *p, SPOOL_Q_ADDPRINTEREX *q_u, SPOOL_
                case 1:
                        /* we don't handle yet */
                        /* but I know what to do ... */
-                       return ERROR_INVALID_LEVEL;
+                       return ERRunknownlevel;
                case 2:
                        return spoolss_addprinterex_level_2(p, uni_srv_name, info,
                                                            unk0, unk1, unk2, unk3,
                                                            user_switch, user, handle);
                default:
-                       return ERROR_INVALID_LEVEL;
+                       return ERRunknownlevel;
        }
 }
 
@@ -5792,7 +5795,7 @@ uint32 _spoolss_addprinterdriver(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVER *q_u,
        uint32 level = q_u->level;
        SPOOL_PRINTER_DRIVER_INFO_LEVEL *info = &q_u->info;
 
-       uint32 err = NT_STATUS_NOPROBLEMO;
+       uint32 err = ERRsuccess;
        NT_PRINTER_DRIVER_INFO_LEVEL driver;
        struct current_user user;
        
@@ -5803,18 +5806,18 @@ uint32 _spoolss_addprinterdriver(pipes_struct *p, SPOOL_Q_ADDPRINTERDRIVER *q_u,
        convert_printer_driver_info(info, &driver, level);
 
        DEBUG(5,("Cleaning driver's information\n"));
-       if ((err = clean_up_driver_struct(driver, level, &user)) != NT_STATUS_NOPROBLEMO )
+       if ((err = clean_up_driver_struct(driver, level, &user)) != ERRsuccess )
                goto done;
 
        DEBUG(5,("Moving driver to final destination\n"));
        if(!move_driver_to_download_area(driver, level, &user, &err)) {
                if (err == 0)
-                       err = ERROR_ACCESS_DENIED;
+                       err = ERRnoaccess;
                goto done;
        }
 
        if (add_a_printer_driver(driver, level)!=0) {
-               err = ERROR_ACCESS_DENIED;
+               err = ERRnoaccess;
                goto done;
        }
 
@@ -5842,10 +5845,10 @@ static uint32 getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environmen
        unistr2_to_ascii(long_archi, uni_environment, sizeof(long_archi)-1);
 
        if (get_short_archi(short_archi, long_archi)==FALSE)
-               return ERROR_INVALID_ENVIRONMENT;
+               return ERRinvalidenvironment;
 
        if((info=(DRIVER_DIRECTORY_1 *)malloc(sizeof(DRIVER_DIRECTORY_1))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
 
        slprintf(path, sizeof(path)-1, "\\\\%s\\print$\\%s", global_myname, short_archi);
 
@@ -5857,7 +5860,7 @@ static uint32 getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environmen
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(info);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        smb_io_driverdir_1("", buffer, info, 0);
@@ -5865,9 +5868,9 @@ static uint32 getprinterdriverdir_level_1(UNISTR2 *name, UNISTR2 *uni_environmen
        safe_free(info);
        
        if (*needed > offered)
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -5894,7 +5897,7 @@ uint32 _spoolss_getprinterdriverdirectory(pipes_struct *p, SPOOL_Q_GETPRINTERDRI
        case 1:
                return getprinterdriverdir_level_1(name, uni_environment, buffer, offered, needed);
        default:
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
        
@@ -5944,14 +5947,14 @@ uint32 _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
 
        if (!Printer) {
                DEBUG(0,("_spoolss_enumprinterdata: Invalid handle (%s).\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        if (!get_printer_snum(p,handle, &snum))
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        
        if (get_a_printer(&printer, 2, lp_servicename(snum)) != 0)
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
 
        /*
         * The NT machine wants to know the biggest size of value and data
@@ -5974,7 +5977,7 @@ uint32 _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
                if (!get_specific_param_by_index(*printer, 2, idx, value, &data, &type, &data_len)) {
                        safe_free(data);
                        free_a_printer(&printer, 2);
-                       return ERROR_NO_MORE_ITEMS;
+                       return ERRnomoreitems;
                }
 #endif
 
@@ -6005,7 +6008,7 @@ uint32 _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
                if (param_index == 0) {
                        /* No parameters found. */
                        free_a_printer(&printer, 2);
-                       return ERROR_NO_MORE_ITEMS;
+                       return ERRnomoreitems;
                }
 
                /* the value is an UNICODE string but realvaluesize is the length in bytes including the leading 0 */
@@ -6015,7 +6018,7 @@ uint32 _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
                DEBUG(6,("final values: [%d], [%d]\n", *out_value_len, *out_data_len));
 
                free_a_printer(&printer, 2);
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
        }
        
        /*
@@ -6026,7 +6029,7 @@ uint32 _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
        if (!get_specific_param_by_index(*printer, 2, idx, value, &data, &type, &data_len)) {
                safe_free(data);
                free_a_printer(&printer, 2);
-               return ERROR_NO_MORE_ITEMS;
+               return ERRnomoreitems;
        }
 
        free_a_printer(&printer, 2);
@@ -6043,7 +6046,7 @@ uint32 _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
        *out_max_value_len=(in_value_len/sizeof(uint16));
        if((*out_value=(uint16 *)talloc_zero(p->mem_ctx,in_value_len*sizeof(uint8))) == NULL) {
                safe_free(data);
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        }
        
        *out_value_len = rpcstr_push((char *)*out_value,value, in_value_len, 0);
@@ -6054,7 +6057,7 @@ uint32 _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
        *out_max_data_len=in_data_len;
        if((*data_out=(uint8 *)talloc_zero(p->mem_ctx, in_data_len*sizeof(uint8))) == NULL) {
                safe_free(data);
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        }
        
        memcpy(*data_out, data, (size_t)data_len);
@@ -6062,7 +6065,7 @@ uint32 _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
 
        safe_free(data);
        
-       return NT_STATUS_NOPROBLEMO;
+       return ERRsuccess;
 }
 
 /****************************************************************************
@@ -6088,15 +6091,15 @@ uint32 _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SP
 
        if (!Printer) {
                DEBUG(0,("_spoolss_setprinterdata: Invalid handle (%s).\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        if (!get_printer_snum(p,handle, &snum))
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
 
        status = get_a_printer(&printer, 2, lp_servicename(snum));
        if (status != 0x0)
-               return ERROR_INVALID_NAME;
+               return ERRinvalidname;
 
        convert_specific_param(&param, value , type, data, real_len);
 
@@ -6114,7 +6117,7 @@ uint32 _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SP
                           old_param.data_len) == 0) {
 
                        DEBUG(3, ("setprinterdata hasn't changed\n"));
-                       status = NT_STATUS_NOPROBLEMO;
+                       status = ERRsuccess;
                        goto done;
                }
        }
@@ -6124,7 +6127,7 @@ uint32 _spoolss_setprinterdata( pipes_struct *p, SPOOL_Q_SETPRINTERDATA *q_u, SP
        if (!print_access_check(NULL, snum, PRINTER_ACCESS_ADMINISTER)) {
                DEBUG(3, ("security descriptor change denied by existing "
                          "security descriptor\n"));
-               status = ERROR_ACCESS_DENIED;
+               status = ERRnoaccess;
                goto done;
        }
 
@@ -6160,27 +6163,27 @@ uint32 _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *q_
        
        if (!Printer) {
                DEBUG(0,("_spoolss_deleteprinterdata: Invalid handle (%s).\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        if (!get_printer_snum(p, handle, &snum))
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
 
        if (!print_access_check(NULL, snum, PRINTER_ACCESS_ADMINISTER)) {
                DEBUG(3, ("_spoolss_deleteprinterdata: printer properties "
                          "change denied by existing security descriptor\n"));
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        }
 
        status = get_a_printer(&printer, 2, lp_servicename(snum));
        if (status != 0x0)
-               return ERROR_INVALID_NAME;
+               return ERRinvalidname;
 
        ZERO_STRUCTP(&param);
        unistr2_to_ascii(param.value, value, sizeof(param.value)-1);
 
        if(!unlink_specific_param_if_exist(printer->info_2, &param))
-               status = ERROR_INVALID_PARAMETER;
+               status = ERRinvalidparam;
        else
                status = mod_a_printer(*printer, 2);
 
@@ -6206,17 +6209,17 @@ uint32 _spoolss_addform( pipes_struct *p, SPOOL_Q_ADDFORM *q_u, SPOOL_R_ADDFORM
 
        if (!Printer) {
                DEBUG(0,("_spoolss_addform: Invalid handle (%s).\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        /* can't add if builtin */
        if (get_a_builtin_ntform(&form->name,&tmpForm)) {
-               return ERROR_INVALID_PARAMETER;
+               return ERRinvalidparam;
        }
 
        count=get_ntforms(&list);
        if(!add_a_form(&list, form, &count))
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        write_ntforms(&list, count);
 
        safe_free(list);
@@ -6241,17 +6244,17 @@ uint32 _spoolss_deleteform( pipes_struct *p, SPOOL_Q_DELETEFORM *q_u, SPOOL_R_DE
 
        if (!Printer) {
                DEBUG(0,("_spoolss_deleteform: Invalid handle (%s).\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
 
        /* can't delete if builtin */
        if (get_a_builtin_ntform(form_name,&tmpForm)) {
-               return ERROR_INVALID_PARAMETER;
+               return ERRinvalidparam;
        }
 
        count = get_ntforms(&list);
        if(!delete_a_form(&list, form_name, &count, &ret))
-               return ERROR_INVALID_PARAMETER;
+               return ERRinvalidparam;
 
        safe_free(list);
 
@@ -6277,11 +6280,11 @@ uint32 _spoolss_setform(pipes_struct *p, SPOOL_Q_SETFORM *q_u, SPOOL_R_SETFORM *
 
        if (!Printer) {
                DEBUG(0,("_spoolss_setform: Invalid handle (%s).\n", OUR_HANDLE(handle)));
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        }
        /* can't set if builtin */
        if (get_a_builtin_ntform(&form->name,&tmpForm)) {
-               return ERROR_INVALID_PARAMETER;
+               return ERRinvalidparam;
        }
 
        count=get_ntforms(&list);
@@ -6301,7 +6304,7 @@ static uint32 enumprintprocessors_level_1(NEW_BUFFER *buffer, uint32 offered, ui
        PRINTPROCESSOR_1 *info_1=NULL;
        
        if((info_1 = (PRINTPROCESSOR_1 *)malloc(sizeof(PRINTPROCESSOR_1))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
 
        (*returned) = 0x1;
        
@@ -6310,7 +6313,7 @@ static uint32 enumprintprocessors_level_1(NEW_BUFFER *buffer, uint32 offered, ui
        *needed += spoolss_size_printprocessor_info_1(info_1);
 
        if (!alloc_buffer_size(buffer, *needed))
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
 
        smb_io_printprocessor_info_1("", buffer, info_1, 0);
 
@@ -6318,10 +6321,10 @@ static uint32 enumprintprocessors_level_1(NEW_BUFFER *buffer, uint32 offered, ui
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -6357,7 +6360,7 @@ uint32 _spoolss_enumprintprocessors(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCESSORS
        case 1:
                return enumprintprocessors_level_1(buffer, offered, needed, returned);
        default:
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
 
@@ -6369,7 +6372,7 @@ static uint32 enumprintprocdatatypes_level_1(NEW_BUFFER *buffer, uint32 offered,
        PRINTPROCDATATYPE_1 *info_1=NULL;
        
        if((info_1 = (PRINTPROCDATATYPE_1 *)malloc(sizeof(PRINTPROCDATATYPE_1))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
 
        (*returned) = 0x1;
        
@@ -6378,7 +6381,7 @@ static uint32 enumprintprocdatatypes_level_1(NEW_BUFFER *buffer, uint32 offered,
        *needed += spoolss_size_printprocdatatype_info_1(info_1);
 
        if (!alloc_buffer_size(buffer, *needed))
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
 
        smb_io_printprocdatatype_info_1("", buffer, info_1, 0);
 
@@ -6386,10 +6389,10 @@ static uint32 enumprintprocdatatypes_level_1(NEW_BUFFER *buffer, uint32 offered,
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -6418,7 +6421,7 @@ uint32 _spoolss_enumprintprocdatatypes(pipes_struct *p, SPOOL_Q_ENUMPRINTPROCDAT
        case 1:
                return enumprintprocdatatypes_level_1(buffer, offered, needed, returned);
        default:
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
 
@@ -6431,7 +6434,7 @@ static uint32 enumprintmonitors_level_1(NEW_BUFFER *buffer, uint32 offered, uint
        PRINTMONITOR_1 *info_1=NULL;
        
        if((info_1 = (PRINTMONITOR_1 *)malloc(sizeof(PRINTMONITOR_1))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
 
        (*returned) = 0x1;
        
@@ -6440,7 +6443,7 @@ static uint32 enumprintmonitors_level_1(NEW_BUFFER *buffer, uint32 offered, uint
        *needed += spoolss_size_printmonitor_info_1(info_1);
 
        if (!alloc_buffer_size(buffer, *needed))
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
 
        smb_io_printmonitor_info_1("", buffer, info_1, 0);
 
@@ -6448,10 +6451,10 @@ static uint32 enumprintmonitors_level_1(NEW_BUFFER *buffer, uint32 offered, uint
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -6462,7 +6465,7 @@ static uint32 enumprintmonitors_level_2(NEW_BUFFER *buffer, uint32 offered, uint
        PRINTMONITOR_2 *info_2=NULL;
        
        if((info_2 = (PRINTMONITOR_2 *)malloc(sizeof(PRINTMONITOR_2))) == NULL)
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
 
        (*returned) = 0x1;
        
@@ -6473,7 +6476,7 @@ static uint32 enumprintmonitors_level_2(NEW_BUFFER *buffer, uint32 offered, uint
        *needed += spoolss_size_printmonitor_info_2(info_2);
 
        if (!alloc_buffer_size(buffer, *needed))
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
 
        smb_io_printmonitor_info_2("", buffer, info_2, 0);
 
@@ -6481,10 +6484,10 @@ static uint32 enumprintmonitors_level_2(NEW_BUFFER *buffer, uint32 offered, uint
 
        if (*needed > offered) {
                *returned=0;
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -6521,7 +6524,7 @@ uint32 _spoolss_enumprintmonitors(pipes_struct *p, SPOOL_Q_ENUMPRINTMONITORS *q_
        case 2:
                return enumprintmonitors_level_2(buffer, offered, needed, returned);
        default:
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
 
@@ -6537,7 +6540,7 @@ static uint32 getjob_level_1(print_queue_struct *queue, int count, int snum, uin
 
        if (info_1 == NULL) {
                safe_free(queue);
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        }
                
        for (i=0; i<count && found==False; i++) {
@@ -6549,7 +6552,7 @@ static uint32 getjob_level_1(print_queue_struct *queue, int count, int snum, uin
                safe_free(queue);
                safe_free(info_1);
                /* I shoud reply something else ... I can't find the good one */
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
        }
        
        fill_job_info_1(info_1, &(queue[i-1]), i, snum);
@@ -6560,7 +6563,7 @@ static uint32 getjob_level_1(print_queue_struct *queue, int count, int snum, uin
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(info_1);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        smb_io_job_info_1("", buffer, info_1, 0);
@@ -6568,9 +6571,9 @@ static uint32 getjob_level_1(print_queue_struct *queue, int count, int snum, uin
        safe_free(info_1);
 
        if (*needed > offered)
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 
@@ -6589,7 +6592,7 @@ static uint32 getjob_level_2(print_queue_struct *queue, int count, int snum, uin
 
        if (info_2 == NULL) {
                safe_free(queue);
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        }
 
        for (i=0; i<count && found==False; i++) {
@@ -6601,12 +6604,12 @@ static uint32 getjob_level_2(print_queue_struct *queue, int count, int snum, uin
                safe_free(queue);
                safe_free(info_2);
                /* I shoud reply something else ... I can't find the good one */
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
        }
        
        if (get_a_printer(&ntprinter, 2, lp_servicename(snum)) !=0) {
                safe_free(queue);
-               return ERROR_NOT_ENOUGH_MEMORY;
+               return ERRnomem;
        }
 
        fill_job_info_2(info_2, &(queue[i-1]), i, snum, ntprinter);
@@ -6618,7 +6621,7 @@ static uint32 getjob_level_2(print_queue_struct *queue, int count, int snum, uin
 
        if (!alloc_buffer_size(buffer, *needed)) {
                safe_free(info_2);
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        }
 
        smb_io_job_info_2("", buffer, info_2, 0);
@@ -6627,9 +6630,9 @@ static uint32 getjob_level_2(print_queue_struct *queue, int count, int snum, uin
        free(info_2);
 
        if (*needed > offered)
-               return ERROR_INSUFFICIENT_BUFFER;
+               return ERRinsufficientbuffer;
        else
-               return NT_STATUS_NOPROBLEMO;
+               return ERRsuccess;
 }
 
 /****************************************************************************
@@ -6660,7 +6663,7 @@ uint32 _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_
        *needed=0;
        
        if (!get_printer_snum(p, handle, &snum))
-               return ERROR_INVALID_HANDLE;
+               return ERRbadfid;
        
        count = print_queue_status(snum, &queue, &prt_status);
        
@@ -6674,6 +6677,6 @@ uint32 _spoolss_getjob( pipes_struct *p, SPOOL_Q_GETJOB *q_u, SPOOL_R_GETJOB *r_
                return getjob_level_2(queue, count, snum, jobid, buffer, offered, needed);
        default:
                safe_free(queue);
-               return ERROR_INVALID_LEVEL;
+               return ERRunknownlevel;
        }
 }
index 913b04bca3945624c14f0fb3f258c1f2c4749aa7..735a4291020e9c315b887ea0bff68a0ba2b0ee92 100644 (file)
@@ -1264,7 +1264,7 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S
        r_u->switch_value = 0;
 
        if (strequal(share_name,"IPC$") || strequal(share_name,"ADMIN$") || strequal(share_name,"global"))
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
 
        snum = find_service(share_name);
 
@@ -1274,17 +1274,17 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S
 
        /* No change to printer shares. */
        if (lp_print_ok(snum))
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
 
        get_current_user(&user,p);
 
        if (user.uid != 0)
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
 
        switch (q_u->info_level) {
        case 1:
                /* Not enough info in a level 1 to do anything. */
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        case 2:
                unistr2_to_ascii(comment, &q_u->info.share.info2.info_2_str.uni_remark, sizeof(share_name));
                unistr2_to_ascii(pathname, &q_u->info.share.info2.info_2_str.uni_path, sizeof(share_name));
@@ -1299,7 +1299,7 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S
                map_generic_share_sd_bits(psd);
                break;
        case 1005:
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        case 1501:
                fstrcpy(pathname, lp_pathname(snum));
                fstrcpy(comment, lp_comment(snum));
@@ -1314,7 +1314,7 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S
 
        /* We can only modify disk shares. */
        if (type != STYPE_DISKTREE)
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
                
        /* Check if the pathname is valid. */
        if (!(ptr = valid_share_pathname( pathname )))
@@ -1332,7 +1332,7 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S
 
        if (strcmp(ptr, lp_pathname(snum)) || strcmp(comment, lp_comment(snum)) ) {
                if (!lp_change_share_cmd() || !*lp_change_share_cmd())
-                       return ERROR_ACCESS_DENIED;
+                       return ERRnoaccess;
 
                slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\" \"%s\" \"%s\"",
                                lp_change_share_cmd(), CONFIGFILE, share_name, ptr, comment);
@@ -1340,7 +1340,7 @@ uint32 _srv_net_share_set_info(pipes_struct *p, SRV_Q_NET_SHARE_SET_INFO *q_u, S
                DEBUG(10,("_srv_net_share_set_info: Running [%s]\n", command ));
                if ((ret = smbrun(command, NULL)) != 0) {
                        DEBUG(0,("_srv_net_share_set_info: Running [%s] returned (%d)\n", command, ret ));
-                       return ERROR_ACCESS_DENIED;
+                       return ERRnoaccess;
                }
 
                /* Tell everyone we updated smb.conf. */
@@ -1394,18 +1394,18 @@ uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_S
 
        if (user.uid != 0) {
                DEBUG(10,("_srv_net_share_add: uid != 0. Access denied.\n"));
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        }
 
        if (!lp_add_share_cmd() || !*lp_add_share_cmd()) {
                DEBUG(10,("_srv_net_share_add: No add share command\n"));
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        }
 
        switch (q_u->info_level) {
        case 1:
                /* Not enough info in a level 1 to do anything. */
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        case 2:
                unistr2_to_ascii(share_name, &q_u->info.share.info2.info_2_str.uni_netname, sizeof(share_name));
                unistr2_to_ascii(comment, &q_u->info.share.info2.info_2_str.uni_remark, sizeof(share_name));
@@ -1422,14 +1422,14 @@ uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_S
                break;
        case 1005:
                /* DFS only level. */
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        default:
                DEBUG(5,("_srv_net_share_add: unsupported switch value %d\n", q_u->info_level));
                return NT_STATUS_INVALID_INFO_CLASS;
        }
 
        if (strequal(share_name,"IPC$") || strequal(share_name,"ADMIN$") || strequal(share_name,"global"))
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
 
        snum = find_service(share_name);
 
@@ -1439,7 +1439,7 @@ uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_S
 
        /* We can only add disk shares. */
        if (type != STYPE_DISKTREE)
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
                
        /* Check if the pathname is valid. */
        if (!(ptr = valid_share_pathname( pathname )))
@@ -1456,7 +1456,7 @@ uint32 _srv_net_share_add(pipes_struct *p, SRV_Q_NET_SHARE_ADD *q_u, SRV_R_NET_S
        DEBUG(10,("_srv_net_share_add: Running [%s]\n", command ));
        if ((ret = smbrun(command, NULL)) != 0) {
                DEBUG(0,("_srv_net_share_add: Running [%s] returned (%d)\n", command, ret ));
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        }
 
        if (psd) {
@@ -1497,7 +1497,7 @@ uint32 _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_S
        unistr2_to_ascii(share_name, &q_u->uni_share_name, sizeof(share_name));
 
        if (strequal(share_name,"IPC$") || strequal(share_name,"ADMIN$") || strequal(share_name,"global"))
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
 
        snum = find_service(share_name);
 
@@ -1506,15 +1506,15 @@ uint32 _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_S
 
        /* No change to printer shares. */
        if (lp_print_ok(snum))
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
 
        get_current_user(&user,p);
 
        if (user.uid != 0)
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
 
        if (!lp_delete_share_cmd() || !*lp_delete_share_cmd())
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
 
        slprintf(command, sizeof(command)-1, "%s \"%s\" \"%s\"",
                        lp_delete_share_cmd(), CONFIGFILE, lp_servicename(snum));
@@ -1522,7 +1522,7 @@ uint32 _srv_net_share_del(pipes_struct *p, SRV_Q_NET_SHARE_DEL *q_u, SRV_R_NET_S
        DEBUG(10,("_srv_net_share_del: Running [%s]\n", command ));
        if ((ret = smbrun(command, NULL)) != 0) {
                DEBUG(0,("_srv_net_share_del: Running [%s] returned (%d)\n", command, ret ));
-               return ERROR_ACCESS_DENIED;
+               return ERRnoaccess;
        }
 
        /* Delete the SD in the database. */
@@ -1635,7 +1635,7 @@ uint32 _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC
 
                if (!fsp) {
                        DEBUG(3,("_srv_net_file_query_secdesc: Unable to open file %s\n", filename));
-                       r_u->status = ERROR_ACCESS_DENIED;
+                       r_u->status = ERRnoaccess;
                        goto error_exit;
                }
        }
@@ -1644,7 +1644,7 @@ uint32 _srv_net_file_query_secdesc(pipes_struct *p, SRV_Q_NET_FILE_QUERY_SECDESC
 
        if (sd_size == 0) {
                DEBUG(3,("_srv_net_file_query_secdesc: Unable to get NT ACL for file %s\n", filename));
-               r_u->status = ERROR_ACCESS_DENIED;
+               r_u->status = ERRnoaccess;
                goto error_exit;
        }
 
@@ -1728,7 +1728,7 @@ uint32 _srv_net_file_set_secdesc(pipes_struct *p, SRV_Q_NET_FILE_SET_SECDESC *q_
 
                if (!fsp) {
                        DEBUG(3,("_srv_net_file_set_secdesc: Unable to open file %s\n", filename));
-                       r_u->status = ERROR_ACCESS_DENIED;
+                       r_u->status = ERRnoaccess;
                        goto error_exit;
                }
        }
@@ -1737,7 +1737,7 @@ uint32 _srv_net_file_set_secdesc(pipes_struct *p, SRV_Q_NET_FILE_SET_SECDESC *q_
 
        if (ret == False) {
                DEBUG(3,("_srv_net_file_set_secdesc: Unable to set NT ACL on file %s\n", filename));
-               r_u->status = ERROR_ACCESS_DENIED;
+               r_u->status = ERRnoaccess;
                goto error_exit;
        }
 
@@ -1863,7 +1863,7 @@ uint32 _srv_net_name_validate(pipes_struct *p, SRV_Q_NET_NAME_VALIDATE *q_u, SRV
 
        default:
                /*unsupported type*/
-               r_u->status = ERROR_INVALID_LEVEL;
+               r_u->status = ERRunknownlevel;
                break;
        }
 
index 0475b4317c6f3643ab3e13eb9b5dcdc3fdd8984d..c7d49dedaa21423d063d33a9810ccd9af44efb55 100644 (file)
@@ -758,10 +758,10 @@ static uint32 cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv
                                
                switch (result)
                {
-               case NT_STATUS_NOPROBLEMO:
+               case ERRsuccess:
                        break;
                        
-               case ERROR_UNKNOWN_PRINTER_DRIVER:
+               case ERRunknownprinterdriver:
                        continue;
 
                default:
@@ -799,7 +799,7 @@ static uint32 cmd_spoolss_getdriver(struct cli_state *cli, int argc, char **argv
        cli_nt_session_close (cli);
        talloc_destroy(mem_ctx);
        
-       if (result==ERROR_UNKNOWN_PRINTER_DRIVER)
+       if (result==ERRunknownprinterdriver)
                return NT_STATUS_NOPROBLEMO;
        else 
                return result;
@@ -893,8 +893,8 @@ static uint32 cmd_spoolss_enum_drivers(struct cli_state *cli, int argc, char **a
        cli_nt_session_close (cli);
        talloc_destroy(mem_ctx);
        
-       if (result==ERROR_UNKNOWN_PRINTER_DRIVER)
-               return NT_STATUS_NOPROBLEMO;
+       if (result==ERRunknownprinterdriver)
+               return ERRsuccess;
        else 
                return result;