summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/pppdata.cpp
Side-by-side diff
Diffstat (limited to 'noncore/settings/networksettings/ppp/pppdata.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/pppdata.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/ppp/pppdata.cpp b/noncore/settings/networksettings/ppp/pppdata.cpp
index 59d68c9..7a6524f 100644
--- a/noncore/settings/networksettings/ppp/pppdata.cpp
+++ b/noncore/settings/networksettings/ppp/pppdata.cpp
@@ -127,13 +127,13 @@ void PPPData::cancel() {
}
// functions to read/write date to configuration file
QString PPPData::readConfig(const QString &group, const QString &key,
const QString &defvalue = "")
{
-// qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
+ qDebug("PPPData::readConfig key >%s< group >%s<",key.latin1(), group.latin1());
QString idx = SEP.arg(group).arg(key);
if (stringEntries.find(idx) != stringEntries.end())
return stringEntries[idx];
Config cfg = config();
cfg.setGroup(group);
return cfg.readEntry(key, defvalue);
@@ -344,19 +344,21 @@ void PPPData::setpppdTimeout(int n) {
const QString PPPData::modemDevice() {
return readConfig (modemGroup(), MODEMDEV_KEY, devices[DEV_DEFAULT]);
}
bool PPPData::setModemDevice(const QString &n) {
+ qDebug("Setting modem dev to >%s<", n.latin1());
bool ret = false;
for (int i = 0; devices[i]; i++)
if (devices[i] == n){
modemDeviceGroup = i;
writeConfig(modemGroup(), MODEMDEV_KEY, n);
ret = true;
}
+ qDebug(ret?"SUCCESS":"FAILURE");
return ret;
}
const QString PPPData::flowcontrol() {
return readConfig(modemGroup(), FLOWCONTROL_KEY, "CRTSCTS");
@@ -709,19 +711,22 @@ void PPPData::setEnter(const QString &n) {
int PPPData::count() const {
return highcount + 1;
}
bool PPPData::setAccount(const QString &aname) {
+ qDebug("setting account to >%s<", aname.latin1());
for(int i = 0; i <= highcount; i++) {
setAccountbyIndex(i);
if(accname() == aname) {
caccount = i;
+ qDebug("SUCCESS");
return true;
}
}
+ qDebug("FAILURE");
return false;
}
bool PPPData::setAccountbyIndex(int i) {
if(i >= 0 && i <= highcount) {
@@ -907,12 +912,15 @@ const QString PPPData::storedUsername() {
void PPPData::setStoredUsername(const QString &b) {
writeConfig(cgroup, STORED_USERNAME_KEY, b);
}
const QString PPPData::storedPassword() {
+ qDebug("getting stored pw");
+ qDebug("g %s", cgroup.latin1() );
+ qDebug("k %s", STORED_PASSWORD_KEY);
return readConfig(cgroup, STORED_PASSWORD_KEY, "");
}
void PPPData::setStoredPassword(const QString &b) {
writeConfig(cgroup, STORED_PASSWORD_KEY, b);
@@ -1271,6 +1279,17 @@ void PPPData::setConfiguredInterfaces( QMap<QString,QString> ifaces )
cfg.writeEntry( ACOUNTS_ACC, it.data() );
}
cfg.setGroup( ACCLIST_GRP );
cfg.writeEntry( ACCOUNTS_COUNT, i );
}
+
+/**
+ * pppd's getword() function knows about escape characters.
+ * If we write the username and password to the secrets file
+ * we'll therefore have to escape back slashes.
+ */
+QString PPPData::encodeWord(const QString &s) {
+ QString r = s;
+ r.replace(QRegExp("\\"), "\\\\");
+ return r;
+}