[jcifs] jcifs-ext password change - UserManagement

Jim Klein jklein at saugus.k12.ca.us
Fri Jul 30 16:14:27 GMT 2004


When I use the following code against a samba server (RHEL 3, Samba
3.0.4,) I can change exactly 1 password. Subsequent executions against
the same user or any other user generate a RapException 86. Have also
tried using a bean and persisting the UserManagement object, rather than
creating new each time. Am guessing since there are no docs or examples
in the latest release on sourceforge (api docs also lack all comments.)
Seems as though the connection isn't clearing or something like that, as
it will not work again for some time after initial success. Any help
would be greatly appreciated.

import jcifs.smb.*;
import jcifs.rap.*;
import jcifs.rap.user.*;


public class test {

  public static void main(String args[]) {
    java.security.Security.addProvider(new
org.bouncycastle.jce.provider.BouncyCastleProvider());
    NtlmPasswordAuthentication auth = new
NtlmPasswordAuthentication(args[0], args[1], args[2]);
    try {
      new
UserManagement("127.0.0.1",auth).netUserChangePassword(args[1], args[2],
args[3]);
    } catch (Exception e) {
      e.printStackTrace();
      System.out.println(e.getMessage());
    }
  }
}

Jim Klein
Director Information Services & Technology
CNA/CNE 4-6, RHCT/RHCE 3
Saugus Union School District
661-294-5300 X 162




More information about the jcifs mailing list