"-w", "password",
"--noPropertiesFile",
"-f", taskFile
};
assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
Task task = getCompletedTask(taskDN);
assertNotNull(task);
assertEquals(task.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY);
assertTrue(DirectoryServer.lockdownMode());
// If the local IP isn't the loopback address, then verify that we can't
// connect using it even as a root user.
if (! isLoopback)
{
args = new String[]
{
"-h", localIP,
"-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "",
"-s", "base",
"--noPropertiesFile",
"(objectClass=*)"
};
assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
}
// Make sure that we can no longer retrieve the server's root DSE over an
// unauthenticated connection. In this case, we'll make sure to use a
// loopback connection.
args = new String[]
{
"-h", "127.0.0.1",
"-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
"-b", "",
"-s", "base",
"--noPropertiesFile",
"(objectClass=*)"
};
assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
// Make sure that we can no longer retrieve the server's root DSE over an
// authenticated connection. In this case, we'll make sure to use a
// loopback connection.
args = new String[]
{
"-h", "127.0.0.1",
"-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
"-D", "cn=Admin,o=test",
"-w", "password",
"-b", "",
"-s", "base",
"--noPropertiesFile",
"(objectClass=*)"
};
assertFalse(LDAPSearch.mainSearch(args, false, null, null) == 0);
// Make sure that we can retrieve the server's root DSE over a
// root-authenticated loopback connection.
args = new String[]
{
"-h", "127.0.0.1",
"-p", String.valueOf(TestCaseUtils.getServerLdapPort()),
"-D", "cn=Directory Manager",
"-w", "password",
"-b", "",
"-s", "base",
"--noPropertiesFile",
"(objectClass=*)"
};
assertEquals(LDAPSearch.mainSearch(args, false, null, null), 0);
// Use another task to take the server out of lockdown mode and make sure it
// works.
taskFile = TestCaseUtils.createTempFile(
"dn: ds-task-id=Leave Lockdown Mode,cn=Scheduled Tasks,cn=tasks",
"changetype: add",
"objectClass: top",
"objectClass: ds-task",
"ds-task-id: Leave Lockdown Mode",
"ds-task-class-name: org.nasutekds.server.tasks.LeaveLockdownModeTask");
taskDN = DN.decode(
"ds-task-id=Leave Lockdown Mode,cn=Scheduled Tasks,cn=tasks");
args = new String[]
{
"-h", "127.0.0.1",
"-p", String.valueOf(TestCaseUtils.getServerAdminPort()),
"-Z", "-X",
"-D", "cn=Directory Manager",
"-w", "password",
"--noPropertiesFile",
"-f", taskFile
};
assertEquals(LDAPModify.mainModify(args, false, null, System.err), 0);
task = getCompletedTask(taskDN);
assertNotNull(task);
assertEquals(task.getTaskState(), TaskState.COMPLETED_SUCCESSFULLY);
assertFalse(DirectoryServer.lockdownMode());
// Make sure that we can once again retrieve the server's root DSE over an
// anonymous connection.