~ubuntu-branches/ubuntu/gutsy/samba/gutsy-updates

« back to all changes in this revision

Viewing changes to source/libsmb/clidfs.c

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Mitchell
  • Date: 2006-11-28 20:14:37 UTC
  • mfrom: (0.10.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061128201437-a6x4lzlhempazocp
Tags: 3.0.23d-1ubuntu1
* Merge from debian unstable.
* Drop python2.4-samba, replace with python-samba. Added Conflicts/Replaces
  on python2.4-samba
* Drop track-connection-dos.patch, ubuntu-winbind-panic.patch, 
  ubuntu-fix-ldap.patch, ubuntu-setlocale.patch, ubuntu-setlocale-fixes.patch
* Remaining Ubuntu changes:
  - Revert Debian's installation of mount.cifs and umount.cifs as suid
  - Comment out the default [homes] shares and add more verbose comments to
    explain what they do and how they work (closes: launchpad.net/27608)
  - Add a "valid users = %S" stanza to the commented-out [homes] section, to
    show users how to restrict access to \\server\username to only username.
  - Change the (commented-out) "printer admin" example to use "@lpadmin"
    instead of "@ntadmin", since the lpadmin group is used for spool admin.
  - Alter the panic-action script to encourage users to report their
    bugs in Ubuntu packages to Ubuntu, rather than reporting to Debian.
    Modify text to more closely match the Debian script
  - Munge our init script to deal with the fact that our implementation
    (or lack thereof) of log_daemon_msg and log_progress_msg differs
    from Debian's implementation of the same (Ubuntu #19691)
  - Kept ubuntu-auxsrc.patch: some auxilliary sources (undocumented in 
    previous changelogs)
  - Set default workgroup to MSHOME

Show diffs side-by-side

added added

removed removed

Lines of Context:
415
415
        /* strip a trailing backslash */
416
416
        
417
417
        len = strlen( newpath );
418
 
        if ( newpath[len-1] == '\\' )
 
418
        if ( (len > 0) && (newpath[len-1] == '\\') )
419
419
                newpath[len-1] = '\0';
420
420
                
421
421
        pstrcpy( clean, newpath );
585
585
        SMB_STRUCT_STAT sbuf;
586
586
        uint32 attributes;
587
587
        
 
588
        if ( !rootcli || !path || !targetcli )
 
589
                return False;
 
590
                
588
591
        *targetcli = NULL;
589
592
        
590
 
        if ( !rootcli || !path || !targetcli )
591
 
                return False;
592
 
                
593
593
        /* send a trans2_query_path_info to check for a referral */
594
594
        
595
595
        clean_path( cleanpath,  path );
652
652
 
653
653
        fullpath[consumed/2] = '\0';
654
654
        dos_clean_name( fullpath );
655
 
        ppath = strchr_m( fullpath, '\\' );
656
 
        ppath = strchr_m( ppath+1, '\\' );
657
 
        ppath = strchr_m( ppath+1, '\\' );
 
655
        if ((ppath = strchr_m( fullpath, '\\' )) == NULL)
 
656
                return False;
 
657
        if ((ppath = strchr_m( ppath+1, '\\' )) == NULL)
 
658
                return False;
 
659
        if ((ppath = strchr_m( ppath+1, '\\' )) == NULL)
 
660
                return False;
658
661
        ppath++;
659
662
        
660
663
        pstr_sprintf( newmount, "%s\\%s", mountpt, ppath );
682
685
        CLIENT_DFS_REFERRAL *refs = NULL;
683
686
        size_t num_refs;
684
687
        uint16 consumed;
685
 
        struct cli_state *cli_ipc;
686
688
        pstring fullpath;
 
689
        BOOL res;
 
690
        uint16 cnum;
687
691
        
688
692
        if ( !cli || !sharename )
689
693
                return False;
690
694
 
 
695
        cnum = cli->cnum;
 
696
 
691
697
        /* special case.  never check for a referral on the IPC$ share */
692
698
 
693
699
        if ( strequal( sharename, "IPC$" ) )
699
705
 
700
706
        /* check for the referral */
701
707
 
702
 
        if ( !(cli_ipc = cli_cm_open( cli->desthost, "IPC$", False )) )
703
 
                return False;
704
 
        
705
 
        if ( !cli_dfs_get_referral(cli_ipc, fullpath, &refs, &num_refs, &consumed) 
706
 
                || !num_refs )
707
 
        {
 
708
        if (!cli_send_tconX(cli, "IPC$", "IPC", NULL, 0)) {
 
709
                return False;
 
710
        }
 
711
 
 
712
        res = cli_dfs_get_referral(cli, fullpath, &refs, &num_refs, &consumed);
 
713
 
 
714
        if (!cli_tdis(cli)) {
 
715
                SAFE_FREE( refs );
 
716
                return False;
 
717
        }
 
718
 
 
719
        cli->cnum = cnum;
 
720
                
 
721
        if (!res || !num_refs ) {
 
722
                SAFE_FREE( refs );
708
723
                return False;
709
724
        }
710
725
        
712
727
 
713
728
        /* check that this is not a self-referral */
714
729
 
715
 
        if ( strequal( cli->desthost, newserver ) && strequal( sharename, newshare ) )
 
730
        if ( strequal( cli->desthost, newserver ) && strequal( sharename, newshare ) ) {
 
731
                SAFE_FREE( refs );
716
732
                return False;
 
733
        }
717
734
        
718
735
        SAFE_FREE( refs );
719
736