[Bug 6116] Cannot access files in exposed shadow drive in version 3.0.5

samba-bugs at samba.org samba-bugs at samba.org
Fri Apr 22 16:11:40 MDT 2011


https://bugzilla.samba.org/show_bug.cgi?id=6116

--- Comment #10 from Leon V. <leonv at vaultnow.com> 2011-04-22 22:11:40 UTC ---
I may have figured it out, but I don't have any idea how to "Check-in" a fix. 
The problem is in util.c, function change_dir.  Version 3.0.8:

line number 1027 appends a slash to the curr_dir (current directory) variable.
1027    curr_dir[curr_dir_len] = '/';
line number 1028 then appends the dir (new directory)
1028    memcpy(curr_dir + curr_dir_len + 1, dir, len + 1);

The problem is, if you are in the root directory ("/"), line 1027 adds a second
slash ("//").

The fix I compiled and tested on my system (granted this is limited testing) is
to replace 1027 and 1028 with:

    // if in root, don't add a slash and don't add 
    // one to the current directory length
    if ( ( curr_dir_len == 1 ) && ( curr_dir[0] == '/' ) ) {
        memcpy(curr_dir + curr_dir_len, dir, len + 1);
    }
    else { // add the slash and add one to len curr_dir_len to
           // account for the slash that was added
    curr_dir[curr_dir_len] = '/';
    memcpy(curr_dir + curr_dir_len + 1, dir, len + 1);
    }

Accessing the shadow drive now works fine!

Leon

-- 
Configure bugmail: https://bugzilla.samba.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the rsync mailing list