[jcifs] [solved] Having problem with simply connecting with
release 1.2.9
Michael B Allen
mba2000 at ioplex.com
Sun Nov 12 01:31:07 GMT 2006
Patch applied. Do you recall if this patch worked ok for you Tim?
Mike
On Mon, 24 Apr 2006 15:36:51 -0400
Michael B Allen <mba2000 at ioplex.com> wrote:
> On Mon, 24 Apr 2006 15:04:20 -0400
> Michael B Allen <mba2000 at ioplex.com> wrote:
>
> > > smbout = new PrintStream(new SmbFileOutputStream(file, true));
> > > smbout.println("This is a test - " + new java.util.Date().toString());
> > > smbout.close();
> > >
> > > But with release 1.2.9, I get:
> > >
> > > java.lang.NullPointerException
> > > at jcifs.smb.SmbComSessionSetupAndX.writeParameterWordsWireFormat(SmbComSessionSetupAndX.java:58)
>
> I found the bug. In jcifs/smb/SmbFileOutputStream.java add a catch and
> rethrow for an SmbAuthException as shown in the corrected code here:
>
> 123 SmbFileOutputStream( SmbFile file, boolean append, int openFlags ) throws SmbException, MalformedURLExc eption, UnknownHostException {
> 124 this.file = file;
> 125 this.append = append;
> 126 this.openFlags = openFlags;
> 127 if( append ) {
> 128 try {
> 129 fp = file.length();
> 130 } catch( SmbAuthException sae ) {
> 131 throw sae;
> 132 } catch( SmbException se ) {
> 133 fp = 0L;
> 134 }
>
> The problem was that if the authentication failed (e.g. incorrect
> password) and the file.length() call triggered authentication, the
> first authentication would be silently ignored causing an inappropriate
> second attempt.
>
> I'll add this to The List but for now either fix jcifs yourself, use the
> correct credentials, or add a file.length() before the SmbFileOutputStream
> constructor so that the auth is performed in advance thereby not catching
> and ignoring any failure.
>
> Thanks for the report,
> Mike
>
--
Michael B Allen
PHP Active Directory SSO
http://www.ioplex.com/
More information about the jcifs
mailing list