[jcifs] HELP: Question about accessing Named Pipes
Amlan Chatterjee
amlanc at gmail.com
Mon May 16 19:37:30 GMT 2005
Hi
I am facing the following 2 problems accessing named pipes using jcifs. Any
help
will be much appreciated.
Case 1.
a) I created a named pipe using C:\> createnp \\.\pipe\foo /M 0x03 /P 0x06
I used callnp to connect to it and the createnp program exits saying
"Success: operation performed successfully". However the callnp says
"Error: CallNamedPipe operation failed: 87"
b) Anyway, once the pipe is created I am trying to access it using the
following code
public static void main(String[] argv) throws Exception {
byte[] b = new byte[65535];
FileInputStream fin = new FileInputStream("c:\\temp\\infile");
FileOutputStream fos = new FileOutputStream("c:\\temp\\outfile");
/* Properties file contains
* jcifs.client.username = user
* jcifs.client.password = pass
* jcifs.client.domain = workgroup
*/
Properties prop = new Properties();
prop.load(new FileInputStream("C:\\Documents and
Settings\\amlan\\IdeaProjects\\NamedPipeTest\\src\\my.prp"));
SmbNamedPipe pipe = new SmbNamedPipe("smb://mypc/IPC$/pipe/foo",
SmbNamedPipe.PIPE_TYPE_RDWR | SmbNamedPipe.PIPE_TYPE_TRANSACT);
OutputStream npos = pipe.getNamedPipeOutputStream();
InputStream npis = pipe.getNamedPipeInputStream();
try {
int n = fin.read(b);
System.out.println("Writing " + n + " bytes");
npos.write(b, 0, n);
n = npis.read(b);
System.out.println("Read in " + n + " bytes");
fos.write(b, 0, n);
} catch (Exception e) {
e.printStackTrace();
}
fin.close();
fos.close();
npos.close();
}
Result: I always get jcifs.smb.SmbAuthException: Logon failure: unknown user
name or bad password.
The user and pass I provide are valid windows xp user names and passwords
with admin privilages.
If I use the SMB url as smb://WORKGROUP\\;user:pass@mypc/IPC$/PIPE/foo it
still gives the same
exact error.
Any ideas about what am I missing ?
Case 2:
a) Created a named pipe on an UNIX (RH9) machine logging in as a regular
user using
% mkfifo -M 666 foo
b) Added
nt pipe support = yes
ntlm auth = yes
to smb.conf and restarted.
c) Using the same code as above to access this pipe with the following
changes to the URL
smb://domain.com\\;user:pass@servername/IPC$/foo
In this case I get
Exception in thread "main" jcifs.smb.SmbException: The system cannot find
the file specified.
at jcifs.smb.SmbTransport.send(SmbTransport.java:697)
at jcifs.smb.SmbSession.send(SmbSession.java:234)
at jcifs.smb.SmbTree.send(SmbTree.java:103)
at jcifs.smb.SmbFile.send(SmbFile.java:725)
at jcifs.smb.SmbFile.open0(SmbFile.java:863)
at jcifs.smb.SmbFile.open(SmbFile.java:881)
at jcifs.smb.SmbFileInputStream.<init>(SmbFileInputStream.java:68)
at jcifs.smb.TransactNamedPipeInputStream.<init>(
TransactNamedPipeInputStream.java:37)
at jcifs.smb.SmbNamedPipe.getNamedPipeInputStream(SmbNamedPipe.java:166)
at CallNamedPipe.main(CallNamedPipe.java:42)
Any ideas ?
Thanks in advance
-AMlan
--
Amlan Chatterjee
Santa Clara, CA 95050
USA
-------------- next part --------------
HTML attachment scrubbed and removed
More information about the jcifs
mailing list