Ignore:
Timestamp:
May 23, 2008, 6:56:41 AM (17 years ago)
Author:
Paul Smedley
Message:

Update source to 3.0.29

Location:
branches/samba-3.0/source/printing
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/printing/nt_printing.c

    r39 r134  
    7272        SERVER_EXECUTE,
    7373        SERVER_ALL_ACCESS
     74};
     75
     76/* Map generic permissions to job object specific permissions */
     77
     78GENERIC_MAPPING job_generic_mapping = {
     79        JOB_READ,
     80        JOB_WRITE,
     81        JOB_EXECUTE,
     82        JOB_ALL_ACCESS
    7483};
    7584
     
    37443753 Get a default printer info 2 struct.
    37453754****************************************************************************/
    3746 static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 *info, const char *servername, const char* sharename)
     3755
     3756static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 *info,
     3757                                        const char *servername,
     3758                                        const char* sharename,
     3759                                        BOOL get_loc_com)
    37473760{
    37483761        int snum = lp_servicenumber(sharename);
     
    37713784
    37723785#ifdef HAVE_CUPS
    3773         if ( (enum printing_types)lp_printing(snum) == PRINT_CUPS ) {           
     3786        if (get_loc_com && (enum printing_types)lp_printing(snum) == PRINT_CUPS ) {             
    37743787                /* Pull the location and comment strings from cups if we don't
    37753788                   already have one */
     
    38203833/****************************************************************************
    38213834****************************************************************************/
    3822 static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info, const char *servername, const char *sharename)
     3835
     3836static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info,
     3837                                const char *servername,
     3838                                const char *sharename,
     3839                                BOOL get_loc_com)
    38233840{
    38243841        int len = 0;
     
    38323849        dbuf = tdb_fetch(tdb_printers, kbuf);
    38333850        if (!dbuf.dptr) {
    3834                 return get_a_printer_2_default(info, servername, sharename);
     3851                return get_a_printer_2_default(info, servername,
     3852                                sharename, get_loc_com);
    38353853        }
    38363854
     
    38753893
    38763894#ifdef HAVE_CUPS
    3877         if ( (enum printing_types)lp_printing(snum) == PRINT_CUPS ) {           
     3895        if (get_loc_com && (enum printing_types)lp_printing(snum) == PRINT_CUPS ) {             
    38783896                /* Pull the location and comment strings from cups if we don't
    38793897                   already have one */
     
    44494467****************************************************************************/
    44504468
    4451 WERROR get_a_printer( Printer_entry *print_hnd, NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level,
    4452                         const char *sharename)
     4469static WERROR get_a_printer_internal( Printer_entry *print_hnd, NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level,
     4470                        const char *sharename, BOOL get_loc_com)
    44534471{
    44544472        WERROR result;
     
    44784496                        }
    44794497
    4480                         result = get_a_printer_2( (*pp_printer)->info_2, servername, sharename );
     4498                        result = get_a_printer_2( (*pp_printer)->info_2,
     4499                                        servername,
     4500                                        sharename,
     4501                                        get_loc_com);
    44814502       
    44824503                       
     
    45004521       
    45014522        return WERR_OK;
     4523}
     4524
     4525WERROR get_a_printer( Printer_entry *print_hnd, NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level,
     4526                        const char *sharename)
     4527{
     4528        return get_a_printer_internal(print_hnd, pp_printer, level,
     4529                                        sharename, True);
     4530}
     4531
     4532WERROR get_a_printer_search( Printer_entry *print_hnd, NT_PRINTER_INFO_LEVEL **pp_printer, uint32 level,
     4533                        const char *sharename)
     4534{
     4535        return get_a_printer_internal(print_hnd, pp_printer, level,
     4536                                        sharename, False);
    45024537}
    45034538
     
    47204755{
    47214756        int i = 0;
    4722        
     4757
    47234758        if ( !info )
    47244759                return False;
    4725                
     4760
     4761        /* mz: skip files that are in the list but already deleted */
     4762        if (!file || !file[0]) {
     4763                return false;
     4764        }
     4765
    47264766        if ( strequal(file, info->driverpath) )
    47274767                return True;
     
    48364876  Upon return, *info has been modified to only contain the driver files
    48374877  which are not in use
     4878
     4879  Fix from mz:
     4880
     4881  This needs to check all drivers to ensure that all files in use
     4882  have been removed from *info, not just the ones in the first
     4883  match.
    48384884****************************************************************************/
    48394885
     
    48454891        fstring                         *list = NULL;
    48464892        NT_PRINTER_DRIVER_INFO_LEVEL    driver;
    4847        
     4893        BOOL in_use = False;
     4894
    48484895        if ( !info )
    48494896                return False;
     
    48804927                if ( !strequal(info->name, driver.info_3->name) ) {
    48814928                        if ( trim_overlap_drv_files(info, driver.info_3) ) {
    4882                                 free_a_printer_driver(driver, 3);
    4883                                 SAFE_FREE( list );
    4884                                 return True;
     4929                                /* mz: Do not instantly return -
     4930                                 * we need to ensure this file isn't
     4931                                 * also in use by other drivers. */
     4932                                in_use = True;
    48854933                        }
    48864934                }
     
    48984946                dump_a_printer_driver( driver, 3 );
    48994947       
    4900         return False;
     4948        return in_use;
    49014949}
    49024950
     
    54255473}
    54265474
     5475void map_job_permissions(SEC_DESC *sd)
     5476{
     5477        int i;
     5478
     5479        for (i = 0; sd->dacl && i < sd->dacl->num_aces; i++) {
     5480                se_map_generic(&sd->dacl->aces[i].access_mask,
     5481                               &job_generic_mapping);
     5482        }
     5483}
     5484
     5485
    54275486/****************************************************************************
    54285487 Check a user has permissions to perform the given operation.  We use the
     
    55065565                }
    55075566
    5508                 /* Now this is the bit that really confuses me.  The access
    5509                    type needs to be changed from JOB_ACCESS_ADMINISTER to
    5510                    PRINTER_ACCESS_ADMINISTER for this to work.  Something
    5511                    to do with the child (job) object becoming like a
    5512                    printer??  -tpot */
    5513 
    5514                 access_type = PRINTER_ACCESS_ADMINISTER;
    5515         }
    5516        
     5567                map_job_permissions(secdesc->sec);
     5568        } else {
     5569                map_printer_permissions(secdesc->sec);
     5570        }
     5571
    55175572        /* Check access */
    5518        
    5519         map_printer_permissions(secdesc->sec);
    5520 
    55215573        result = se_access_check(secdesc->sec, user->nt_user_token, access_type,
    55225574                                 &access_granted, &status);
  • branches/samba-3.0/source/printing/printing.c

    r1 r134  
    25262526                goto fail;
    25272527
    2528         /* The print job has been sucessfully handed over to the back-end */
     2528        /* The print job has been successfully handed over to the back-end */
    25292529       
    25302530        pjob->spooled = True;
     
    25402540fail:
    25412541
    2542         /* The print job was not succesfully started. Cleanup */
     2542        /* The print job was not successfully started. Cleanup */
    25432543        /* Still need to add proper error return propagation! 010122:JRR */
    25442544        unlink(pjob->filename);
Note: See TracChangeset for help on using the changeset viewer.