|
|
|
@ -139,7 +139,7 @@ int VPNCConfig::getFileConfig(const char *parameter, char *line) {
|
|
|
|
|
void VPNCConfig::pcfImport()
|
|
|
|
|
{
|
|
|
|
|
const TQString& pcf_file = TQString(_vpncWidget->editPCF->url());
|
|
|
|
|
printf("Asked for PCF import from file %s\n\r", pcf_file.ascii());
|
|
|
|
|
printf("Asked for PCF import from file %s\n", pcf_file.ascii());
|
|
|
|
|
|
|
|
|
|
FILE *file = fopen ( pcf_file.ascii(), "r" );
|
|
|
|
|
if ( file != NULL ) {
|
|
|
|
@ -149,33 +149,33 @@ void VPNCConfig::pcfImport()
|
|
|
|
|
// Parse the line and update global variables (current line in variable "line")
|
|
|
|
|
if (getFileConfig("Host=", line) == 0) {
|
|
|
|
|
//strdup(linedata)
|
|
|
|
|
printf("Got configuration parameter Host with data %s\n\r", linedata);
|
|
|
|
|
printf("Got configuration parameter Host with data %s\n", linedata);
|
|
|
|
|
_vpncWidget->IPSec_gateway->setText(linedata);
|
|
|
|
|
}
|
|
|
|
|
if (getFileConfig("GroupName=", line) == 0) {
|
|
|
|
|
printf("Got configuration parameter GroupName with data %s\n\r", linedata);
|
|
|
|
|
printf("Got configuration parameter GroupName with data %s\n", linedata);
|
|
|
|
|
_vpncWidget->IPSec_ID->setText(linedata);
|
|
|
|
|
}
|
|
|
|
|
// if (getFileConfig("TcpTunnelingPort=", line) == 0) {
|
|
|
|
|
// printf("Got configuration parameter TcpTunnelingPort with data %s\n\r", linedata);
|
|
|
|
|
// printf("Got configuration parameter TcpTunnelingPort with data %s\n", linedata);
|
|
|
|
|
// _vpncWidget->IPSec_ID->setText(linedata);
|
|
|
|
|
// }
|
|
|
|
|
if (getFileConfig("NTDomain=", line) == 0) {
|
|
|
|
|
if (strlen(linedata) > 0) {
|
|
|
|
|
printf("Got configuration parameter NTDomain with data %s\n\r", linedata);
|
|
|
|
|
printf("Got configuration parameter NTDomain with data %s\n", linedata);
|
|
|
|
|
_vpncWidget->Domain->setText(linedata);
|
|
|
|
|
_vpncWidget->chkUseDomain->setChecked(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (getFileConfig("GroupPwd=", line) == 0) {
|
|
|
|
|
if (strlen(linedata) > 0) {
|
|
|
|
|
printf("Got configuration parameter GroupPwd with data %s\n\r", linedata);
|
|
|
|
|
printf("Got configuration parameter GroupPwd with data %s\n", linedata);
|
|
|
|
|
KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").arg(linedata));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (getFileConfig("enc_GroupPwd=", line) == 0) {
|
|
|
|
|
if (strlen(linedata) > 0) {
|
|
|
|
|
printf("Got configuration parameter enc_GroupPwd with data %s\n\r", linedata);
|
|
|
|
|
printf("Got configuration parameter enc_GroupPwd with data %s\n", linedata);
|
|
|
|
|
|
|
|
|
|
// Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt
|
|
|
|
|
string decryptcommand="/usr/lib/vpnc/cisco-decrypt ";
|
|
|
|
@ -184,14 +184,14 @@ void VPNCConfig::pcfImport()
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
decryptcommand.append(linedata);
|
|
|
|
|
printf("Group password decrypt command: %s\n\r", decryptcommand.c_str());
|
|
|
|
|
printf("Group password decrypt command: %s\n", decryptcommand.c_str());
|
|
|
|
|
if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Group password decrypt error\n\r");
|
|
|
|
|
printf("Group password decrypt error\n");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (fgets(decrypted_result, 2048, pipe_decrypt) == NULL) {
|
|
|
|
|
printf("Error reading from decryption program\n\r");
|
|
|
|
|
printf("Error reading from decryption program\n");
|
|
|
|
|
}
|
|
|
|
|
pclose(pipe_decrypt);
|
|
|
|
|
for (i=0;i<2048;i++) {
|
|
|
|
@ -200,7 +200,7 @@ void VPNCConfig::pcfImport()
|
|
|
|
|
i=2048;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("Group password decrypt result: '%s'\n\r", decrypted_result);
|
|
|
|
|
printf("Group password decrypt result: '%s'\n", decrypted_result);
|
|
|
|
|
}
|
|
|
|
|
KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").arg(decrypted_result));
|
|
|
|
|
}
|
|
|
|
@ -210,7 +210,7 @@ void VPNCConfig::pcfImport()
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//printf("[WARN] Unable to open configuration file %s\n\r", pcf_file.ascii());
|
|
|
|
|
//printf("[WARN] Unable to open configuration file %s\n", pcf_file.ascii());
|
|
|
|
|
KMessageBox::error(this, i18n("That configuration file does not exist!"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -399,14 +399,14 @@ TDENetworkSettingsMap VPNCAuthentication::getPasswords()
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
decryptcommand.append(_vpncAuth->editGroupPassword->password());
|
|
|
|
|
printf("Group password decrypt command: %s\n\r", decryptcommand.c_str());
|
|
|
|
|
printf("Group password decrypt command: %s\n", decryptcommand.c_str());
|
|
|
|
|
if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL)
|
|
|
|
|
{
|
|
|
|
|
printf("Group password decrypt error\n\r");
|
|
|
|
|
printf("Group password decrypt error\n");
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (fgets(decrypted_result, 2048, pipe_decrypt) == NULL) {
|
|
|
|
|
printf("Error reading from decryption program\n\r");
|
|
|
|
|
printf("Error reading from decryption program\n");
|
|
|
|
|
}
|
|
|
|
|
pclose(pipe_decrypt);
|
|
|
|
|
for (i=0;i<2048;i++) {
|
|
|
|
@ -415,7 +415,7 @@ TDENetworkSettingsMap VPNCAuthentication::getPasswords()
|
|
|
|
|
i=2048;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
printf("Group password decrypt result: '%s'\n\r", decrypted_result);
|
|
|
|
|
printf("Group password decrypt result: '%s'\n", decrypted_result);
|
|
|
|
|
pwds.insert("IPSec secret", TQString(decrypted_result));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|