[jcifs] Re: jcifs.smb.Dfs bugs

Michael B Allen miallen at ioplex.com
Mon Apr 28 16:05:01 GMT 2008


On Mon, 28 Apr 2008 16:34:06 +0200
Ronny Schuetz <Usenet.r96 at gishpuppy.com> wrote:

> Hi Mike,
> 
> >> Looks like my previous assumption was totally wrong, I apologize. I was 
> >> misled by the null values returned by SmbFile#getDfsPath() just before 
> >> renameTo() failed. Adding an exists() calls directly before renameTo() 
> >> as discussed earlier in this list helped here for most of the cases.
> > 
> > Is that a bug I said I was going to fix. What's the approx. date and
> > Subject of the thread?
> 
> Yes. See http://article.gmane.org/gmane.network.samba.java/6578/

Ok. Will investigate....

> By the way, I found some minor other issues SmbFile and SmbTransport. 
> Maybe you want to include into the code base:
> 
> SmbFile#getDfsPath():
> 
> Changes:
>   - one slash was missing in "smb://"
>   - "/" was appended to path even if it already had one at the end
> 
> New code:
> 
>      public String getDfsPath() throws SmbException {
>          resolveDfs(null);
> 
>          if( dfsReferral == null ) {
>              return null;
>          }
> 
>          String path = "smb://" + dfsReferral.server + "/" +
> dfsReferral.share + unc;
>          path = path.replace( '\\', '/' );
>          if (isDirectory() && !path.endsWith("/")) {
>              path += '/';
>          }
>          return path;
>      }

I'll add this to the TODO for further investigation ...

> SmbTransport#checkStatus():
> 
> Changes:
> 
> - Avoid ArrayIndexOutOfBoundsException in case all referred shares are 
> offline
> 
> Replace
> 
> SmbFile.dfs.insert(req.path, drs[0]);
> throw drs[0];
> 
> with
> 
> if(drs.length == 0)
> {
>   throw new SmbException( resp.errorCode, null );
> }
> else
> {
>   SmbFile.dfs.insert(req.path, drs[0]);
>   throw drs[0];
> }

Ditto.

Thanks,
Mike

-- 
Michael B Allen
PHP Active Directory SPNEGO SSO
http://www.ioplex.com/


More information about the jcifs mailing list