Cleanup output clutter.

pull/1/head
Darrell Anderson 12 years ago
parent 3f8b38c5f2
commit 91573227c6

@ -1060,7 +1060,7 @@ int LDAPManager::setPasswordForUser(LDAPUserInfo user, TQString *errstr) {
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
if ((prompt.endsWith(" Password:")) && (prompt.startsWith(TQString(user.name + "@")))) {
@ -1068,7 +1068,7 @@ int LDAPManager::setPasswordForUser(LDAPUserInfo user, TQString *errstr) {
kadminProc.writeLine(user.new_password, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == "");
prompt = prompt.stripWhiteSpace();
if ((prompt.endsWith(" Password:")) && (prompt.startsWith("Verify"))) {
@ -1076,7 +1076,7 @@ int LDAPManager::setPasswordForUser(LDAPUserInfo user, TQString *errstr) {
kadminProc.writeLine(user.new_password, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == "");
prompt = prompt.stripWhiteSpace();
}
@ -1101,7 +1101,7 @@ int LDAPManager::setPasswordForUser(LDAPUserInfo user, TQString *errstr) {
kadminProc.writeLine(admincreds.password, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == "");
prompt = prompt.stripWhiteSpace();
}
@ -1422,7 +1422,7 @@ int LDAPManager::obtainKerberosTicket(LDAPCredentials creds, TQString principal,
kadminProc.writeLine(creds.password, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kinit) '%s'\n\r", prompt.ascii());
printf("(kinit) '%s'\n", prompt.ascii());
} while (prompt == "");
prompt = prompt.stripWhiteSpace();
}
@ -1753,7 +1753,7 @@ int LDAPManager::addMachineInfo(LDAPMachineInfo machine, TQString *errstr) {
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
// Use all defaults
@ -1779,7 +1779,7 @@ int LDAPManager::addMachineInfo(LDAPMachineInfo machine, TQString *errstr) {
kadminProc.writeLine(admincreds.password, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == "");
prompt = prompt.stripWhiteSpace();
}
@ -1804,7 +1804,7 @@ int LDAPManager::addMachineInfo(LDAPMachineInfo machine, TQString *errstr) {
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
}
@ -1873,7 +1873,7 @@ int LDAPManager::addServiceInfo(LDAPServiceInfo service, TQString *errstr) {
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
// Use all defaults
@ -1899,7 +1899,7 @@ int LDAPManager::addServiceInfo(LDAPServiceInfo service, TQString *errstr) {
kadminProc.writeLine(admincreds.password, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == "");
prompt = prompt.stripWhiteSpace();
}
@ -1924,7 +1924,7 @@ int LDAPManager::addServiceInfo(LDAPServiceInfo service, TQString *errstr) {
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
}
@ -2583,7 +2583,7 @@ int LDAPManager::exportKeytabForPrincipal(TQString principal, TQString fileName,
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
// Use all defaults
@ -2609,7 +2609,7 @@ int LDAPManager::exportKeytabForPrincipal(TQString principal, TQString fileName,
kadminProc.writeLine(admincreds.password, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == "");
prompt = prompt.stripWhiteSpace();
}
@ -2634,7 +2634,7 @@ int LDAPManager::exportKeytabForPrincipal(TQString principal, TQString fileName,
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
}
@ -3015,11 +3015,11 @@ int LDAPManager::writeSudoersConfFile(TQString *errstr) {
}
if (chown(TDELDAP_SUDO_D_FILE, 0, 0) < 0) {
printf("ERROR: Unable to change owner of \"%s\"\n\r", TDELDAP_SUDO_D_FILE);
printf("ERROR: Unable to change owner of \"%s\"\n", TDELDAP_SUDO_D_FILE);
return -1;
}
if (chmod(TDELDAP_SUDO_D_FILE, S_IRUSR|S_IRGRP) < 0) {
printf("ERROR: Unable to change permissions of \"%s\"\n\r", TDELDAP_SUDO_D_FILE);
printf("ERROR: Unable to change permissions of \"%s\"\n", TDELDAP_SUDO_D_FILE);
return -1;
}
@ -3193,15 +3193,15 @@ int LDAPManager::generatePublicKerberosCACertificate(LDAPCertConfig certinfo) {
command = TQString("openssl req -key %1 -new -x509 -out %2 -subj \"/C=%3/ST=%4/L=%5/O=%6/OU=%7/CN=%8/emailAddress=%9\"").arg(KERBEROS_PKI_PEMKEY_FILE).arg(KERBEROS_PKI_PEM_FILE).arg(certinfo.countryName).arg(certinfo.stateOrProvinceName).arg(certinfo.localityName).arg(certinfo.organizationName).arg(certinfo.orgUnitName).arg(certinfo.commonName).arg(certinfo.emailAddress);
if (system(command) < 0) {
printf("ERROR: Execution of \"%s\" failed!\n\r", command.ascii());
printf("ERROR: Execution of \"%s\" failed!\n", command.ascii());
return -1;
}
if (chmod(KERBEROS_PKI_PEM_FILE, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) {
printf("ERROR: Unable to change permissions of \"%s\"\n\r", KERBEROS_PKI_PEM_FILE);
printf("ERROR: Unable to change permissions of \"%s\"\n", KERBEROS_PKI_PEM_FILE);
return -1;
}
if (chown(KERBEROS_PKI_PEM_FILE, 0, 0) < 0) {
printf("ERROR: Unable to change owner of \"%s\"\n\r", KERBEROS_PKI_PEM_FILE);
printf("ERROR: Unable to change owner of \"%s\"\n", KERBEROS_PKI_PEM_FILE);
return -1;
}
@ -3220,25 +3220,25 @@ int LDAPManager::generatePublicKerberosCertificate(LDAPCertConfig certinfo, LDAP
command = TQString("openssl req -new -out %1 -key %2 -subj \"/C=%3/ST=%4/L=%5/O=%6/OU=%7/CN=%8/emailAddress=%9\"").arg(kdc_reqfile).arg(kdc_keyfile).arg(certinfo.countryName).arg(certinfo.stateOrProvinceName).arg(certinfo.localityName).arg(certinfo.organizationName).arg(certinfo.orgUnitName).arg(certinfo.commonName).arg(certinfo.emailAddress);
if (system(command) < 0) {
printf("ERROR: Execution of \"%s\" failed!\n\r", command.ascii());
printf("ERROR: Execution of \"%s\" failed!\n", command.ascii());
return -1;
}
command = TQString("openssl x509 -req -in %1 -CAkey %2 -CA %3 -out %4 -extfile %5 -extensions kdc_cert -CAcreateserial").arg(kdc_reqfile).arg(KERBEROS_PKI_PEMKEY_FILE).arg(KERBEROS_PKI_PEM_FILE).arg(kdc_certfile).arg(OPENSSL_EXTENSIONS_FILE);
if (system(command) < 0) {
printf("ERROR: Execution of \"%s\" failed!\n\r", command.ascii());
printf("ERROR: Execution of \"%s\" failed!\n", command.ascii());
return -1;
}
if (chmod(kdc_certfile.ascii(), S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) {
printf("ERROR: Unable to change permissions of \"%s\"\n\r", kdc_certfile.ascii());
printf("ERROR: Unable to change permissions of \"%s\"\n", kdc_certfile.ascii());
return -1;
}
if (chown(kdc_certfile.ascii(), 0, 0) < 0) {
printf("ERROR: Unable to change owner of \"%s\"\n\r", kdc_certfile.ascii());
printf("ERROR: Unable to change owner of \"%s\"\n", kdc_certfile.ascii());
return -1;
}
if (fileExists(kdc_reqfile.ascii())) {
if (unlink(kdc_reqfile.ascii()) < 0) {
printf("ERROR: Unable to unlink \"%s\"\n\r", kdc_reqfile.ascii());
printf("ERROR: Unable to unlink \"%s\"\n", kdc_reqfile.ascii());
return -1;
}
}
@ -3258,25 +3258,25 @@ int LDAPManager::generatePublicLDAPCertificate(LDAPCertConfig certinfo, LDAPReal
command = TQString("openssl req -new -out %1 -key %2 -subj \"/C=%3/ST=%4/L=%5/O=%6/OU=%7/CN=%8/emailAddress=%9\"").arg(ldap_reqfile).arg(ldap_keyfile).arg(certinfo.countryName).arg(certinfo.stateOrProvinceName).arg(certinfo.localityName).arg(certinfo.organizationName).arg(certinfo.orgUnitName).arg(realmcfg.admin_server).arg(certinfo.emailAddress);
if (system(command) < 0) {
printf("ERROR: Execution of \"%s\" failed!\n\r", command.ascii());
printf("ERROR: Execution of \"%s\" failed!\n", command.ascii());
return -1;
}
command = TQString("openssl x509 -req -in %1 -CAkey %2 -CA %3 -out %4 -CAcreateserial").arg(ldap_reqfile).arg(KERBEROS_PKI_PEMKEY_FILE).arg(KERBEROS_PKI_PEM_FILE).arg(ldap_certfile);
if (system(command) < 0) {
printf("ERROR: Execution of \"%s\" failed!\n\r", command.ascii());
printf("ERROR: Execution of \"%s\" failed!\n", command.ascii());
return -1;
}
if (chmod(ldap_certfile.ascii(), S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH) < 0) {
printf("ERROR: Unable to change permissions of \"%s\"\n\r", ldap_certfile.ascii());
printf("ERROR: Unable to change permissions of \"%s\"\n", ldap_certfile.ascii());
return -1;
}
if (chown(ldap_certfile.ascii(), ldap_uid, ldap_gid) < 0) {
printf("ERROR: Unable to change owner of \"%s\"\n\r", ldap_certfile.ascii());
printf("ERROR: Unable to change owner of \"%s\"\n", ldap_certfile.ascii());
return -1;
}
if (fileExists(ldap_reqfile.ascii())) {
if (unlink(ldap_reqfile.ascii()) < 0) {
printf("ERROR: Unable to unlink \"%s\"\n\r", ldap_reqfile.ascii());
printf("ERROR: Unable to unlink \"%s\"\n", ldap_reqfile.ascii());
return -1;
}
}
@ -3532,14 +3532,14 @@ int LDAPManager::bondRealm(TQString adminUserName, const char * adminPassword, T
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
if (prompt.endsWith(" Password:")) {
kadminProc.writeLine(adminPassword, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == "");
prompt = prompt.stripWhiteSpace();
}
@ -3551,13 +3551,13 @@ int LDAPManager::bondRealm(TQString adminUserName, const char * adminPassword, T
else if (prompt.endsWith("Principal does not exist")) {
do { // Wait for command prompt
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == "");
command = TQCString("ank --random-key "+hoststring);
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
// Use all defaults
@ -3566,7 +3566,7 @@ int LDAPManager::bondRealm(TQString adminUserName, const char * adminPassword, T
kadminProc.writeLine(adminPassword, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == "");
prompt = prompt.stripWhiteSpace();
}
@ -3588,7 +3588,7 @@ int LDAPManager::bondRealm(TQString adminUserName, const char * adminPassword, T
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
}
@ -3597,7 +3597,7 @@ int LDAPManager::bondRealm(TQString adminUserName, const char * adminPassword, T
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
if (prompt != "kadmin>") {
@ -3650,14 +3650,14 @@ int LDAPManager::unbondRealm(LDAPRealmConfig realmcfg, TQString adminUserName, c
kadminProc.writeLine(command, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == TQString(command));
prompt = prompt.stripWhiteSpace();
if (prompt.endsWith(" Password:")) {
kadminProc.writeLine(adminPassword, true);
do { // Discard our own input
prompt = readFullLineFromPtyProcess(&kadminProc);
printf("(kadmin) '%s'\n\r", prompt.ascii());
printf("(kadmin) '%s'\n", prompt.ascii());
} while (prompt == "");
prompt = prompt.stripWhiteSpace();
}
@ -3673,7 +3673,7 @@ int LDAPManager::unbondRealm(LDAPRealmConfig realmcfg, TQString adminUserName, c
// Delete keys from keytab
command = TQString("ktutil remove -p %1").arg(hoststring+"@"+adminRealm.upper());
if (system(command) < 0) {
printf("ERROR: Execution of \"%s\" failed!\n\r", command.data());
printf("ERROR: Execution of \"%s\" failed!\n", command.data());
return 1; // Failure
}

Loading…
Cancel
Save