[jcifs] SmbFileOutputStream with append=true misbehaving on a
certain NAS
Daniel Tripp
dtripp at mdisolutions.com
Fri Jan 18 18:13:45 GMT 2008
The NAS says "Vantec" on it. Unfortunately it's not under my control to
update the OS or firmware.
I have attached two WireShark captures corresponding to two versions of my
program: one which uses JCIFS and exhibits the problem in my previous
e-mail, and one which uses normal java IO and runs correctly, but depends on
being logged into the share already via Windows Explorer. I am new to
WireShark so forgive me if I don't know what I'm doing.
As you can see in the code below, I tried creating a separate SmbFile
instance, but the behaviour was unchanged.
Whether or not you get a chance to look at these captures, thank you very
much for your response.
JCIFS:
---
import java.io.*;
import jcifs.smb.*;
public class Foo {
static public void main(String args_[]) throws Exception {
String url = "smb://STORAGE-MDI/Dan/foo.txt";
NtlmPasswordAuthentication creds
= new NtlmPasswordAuthentication("ntdom", "STORAGE-MDI\\Guest", dan");
OutputStream outStream1
= new SmbFileOutputStream(new SmbFile(url, creds));
outStream1.write((byte)'a');
outStream1.close();
OutputStream outStream2
= new SmbFileOutputStream(new SmbFile(url, creds), true);
outStream2.write((byte)'b');
outStream2.close();
}
}
---
Normal Java IO:
---
import java.io.*;
import jcifs.smb.*;
public class Foo {
static public void main(String args_[]) throws Exception {
String file = "\\\\STORAGE-MDI\\Dan\\foo.txt";
OutputStream outStream1 = new FileOutputStream(file);
outStream1.write((byte)'a');
outStream1.close();
OutputStream outStream2 = new FileOutputStream(file, true);
outStream2.write((byte)'b');
outStream2.close();
}
}
---
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jcifs.pcap
Type: application/octet-stream
Size: 5709 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20080118/c0f8df46/jcifs.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: normal-java-io.pcap
Type: application/octet-stream
Size: 3631 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20080118/c0f8df46/normal-java-io.obj
More information about the jcifs
mailing list