author | llornkcor <llornkcor> | 2002-04-23 17:40:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-04-23 17:40:10 (UTC) |
commit | 7200c56e4ccc6aa83d1a3ef86ddda9470492ab52 (patch) (unidiff) | |
tree | efa9dd4bc86ea8a452c2338caea0a63d02756d0d | |
parent | adf10e0e160b18fe329b6baccf5dc666d612fe8e (diff) | |
download | opie-7200c56e4ccc6aa83d1a3ef86ddda9470492ab52.zip opie-7200c56e4ccc6aa83d1a3ef86ddda9470492ab52.tar.gz opie-7200c56e4ccc6aa83d1a3ef86ddda9470492ab52.tar.bz2 |
default of 192.168.129.0/24 wasn't showing on first time
-rw-r--r-- | core/settings/security/security.cpp | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/core/settings/security/security.cpp b/core/settings/security/security.cpp index f4116b0..6c1931a 100644 --- a/core/settings/security/security.cpp +++ b/core/settings/security/security.cpp | |||
@@ -36,25 +36,25 @@ Security::Security( QWidget* parent, const char* name, WFlags fl ) | |||
36 | cfg.setGroup("Passcode"); | 36 | cfg.setGroup("Passcode"); |
37 | passcode = cfg.readEntry("passcode"); | 37 | passcode = cfg.readEntry("passcode"); |
38 | passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); | 38 | passcode_poweron->setChecked(cfg.readBoolEntry("passcode_poweron",FALSE)); |
39 | cfg.setGroup("Sync"); | 39 | cfg.setGroup("Sync"); |
40 | int auth_peer = cfg.readNumEntry("auth_peer",0xc0a80100); | 40 | int auth_peer = cfg.readNumEntry("auth_peer",0xc0a88100);//new default 192.168.129.0/24 |
41 | int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); | 41 | int auth_peer_bits = cfg.readNumEntry("auth_peer_bits",24); |
42 | selectNet(auth_peer,auth_peer_bits); | 42 | selectNet(auth_peer,auth_peer_bits); |
43 | connect(syncnet, SIGNAL(textChanged(const QString&)), | 43 | connect(syncnet, SIGNAL(textChanged(const QString&)), |
44 | this, SLOT(setSyncNet(const QString&))); | 44 | this, SLOT(setSyncNet(const QString&))); |
45 | 45 | ||
46 | /* | 46 | /* |
47 | cfg.setGroup("Remote"); | 47 | cfg.setGroup("Remote"); |
48 | if ( telnetAvailable() ) | 48 | if ( telnetAvailable() ) |
49 | telnet->setChecked(cfg.readEntry("allow_telnet")); | 49 | telnet->setChecked(cfg.readEntry("allow_telnet")); |
50 | else | 50 | else |
51 | telnet->hide(); | 51 | telnet->hide(); |
52 | 52 | ||
53 | if ( sshAvailable() ) | 53 | if ( sshAvailable() ) |
54 | ssh->setChecked(cfg.readEntry("allow_ssh")); | 54 | ssh->setChecked(cfg.readEntry("allow_ssh")); |
55 | else | 55 | else |
56 | ssh->hide(); | 56 | ssh->hide(); |
57 | */ | 57 | */ |
58 | 58 | ||
59 | connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); | 59 | connect(changepasscode,SIGNAL(clicked()), this, SLOT(changePassCode())); |
60 | connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); | 60 | connect(clearpasscode,SIGNAL(clicked()), this, SLOT(clearPassCode())); |
@@ -72,9 +72,9 @@ void Security::updateGUI() | |||
72 | { | 72 | { |
73 | bool empty = passcode.isEmpty(); | 73 | bool empty = passcode.isEmpty(); |
74 | 74 | ||
75 | changepasscode->setText( empty ? tr("Set passcode" ) | 75 | changepasscode->setText( empty ? tr("Set passcode" ) |
76 | : tr("Change passcode" ) ); | 76 | : tr("Change passcode" ) ); |
77 | passcode_poweron->setEnabled( !empty ); | 77 | passcode_poweron->setEnabled( !empty ); |
78 | clearpasscode->setEnabled( !empty ); | 78 | clearpasscode->setEnabled( !empty ); |
79 | } | 79 | } |
80 | 80 | ||
@@ -84,20 +84,20 @@ void Security::show() | |||
84 | valid=FALSE; | 84 | valid=FALSE; |
85 | setEnabled(FALSE); | 85 | setEnabled(FALSE); |
86 | SecurityBase::show(); | 86 | SecurityBase::show(); |
87 | if ( passcode.isEmpty() ) { | 87 | if ( passcode.isEmpty() ) { |
88 | // could insist... | 88 | // could insist... |
89 | //changePassCode(); | 89 | //changePassCode(); |
90 | //if ( passcode.isEmpty() ) | 90 | //if ( passcode.isEmpty() ) |
91 | //reject(); | 91 | //reject(); |
92 | } else { | 92 | } else { |
93 | QString pc = enterPassCode(tr("Enter passcode")); | 93 | QString pc = enterPassCode(tr("Enter passcode")); |
94 | if ( pc != passcode ) { | 94 | if ( pc != passcode ) { |
95 | QMessageBox::critical(this, tr("Passcode incorrect"), | 95 | QMessageBox::critical(this, tr("Passcode incorrect"), |
96 | tr("The passcode entered is incorrect.\nAccess denied")); | 96 | tr("The passcode entered is incorrect.\nAccess denied")); |
97 | reject(); | 97 | reject(); |
98 | return; | 98 | return; |
99 | } | 99 | } |
100 | } | 100 | } |
101 | setEnabled(TRUE); | 101 | setEnabled(TRUE); |
102 | valid=TRUE; | 102 | valid=TRUE; |
103 | } | 103 | } |
@@ -117,46 +117,46 @@ void Security::done(int r) | |||
117 | void Security::selectNet(int auth_peer,int auth_peer_bits) | 117 | void Security::selectNet(int auth_peer,int auth_peer_bits) |
118 | { | 118 | { |
119 | QString sn; | 119 | QString sn; |
120 | if ( auth_peer_bits == 0 && auth_peer == 0 ) { | 120 | if ( auth_peer_bits == 0 && auth_peer == 0 ) { |
121 | sn = tr("Any"); | 121 | sn = tr("Any"); |
122 | } else if ( auth_peer_bits == 32 && auth_peer == 0 ) { | 122 | } else if ( auth_peer_bits == 32 && auth_peer == 0 ) { |
123 | sn = tr("None"); | 123 | sn = tr("None"); |
124 | } else { | 124 | } else { |
125 | sn = | 125 | sn = |
126 | QString::number((auth_peer>>24)&0xff) + "." | 126 | QString::number((auth_peer>>24)&0xff) + "." |
127 | + QString::number((auth_peer>>16)&0xff) + "." | 127 | + QString::number((auth_peer>>16)&0xff) + "." |
128 | + QString::number((auth_peer>>8)&0xff) + "." | 128 | + QString::number((auth_peer>>8)&0xff) + "." |
129 | + QString::number((auth_peer>>0)&0xff) + "/" | 129 | + QString::number((auth_peer>>0)&0xff) + "/" |
130 | + QString::number(auth_peer_bits); | 130 | + QString::number(auth_peer_bits); |
131 | } | 131 | } |
132 | for (int i=0; i<syncnet->count(); i++) { | 132 | for (int i=0; i<syncnet->count(); i++) { |
133 | if ( syncnet->text(i).left(sn.length()) == sn ) { | 133 | if ( syncnet->text(i).left(sn.length()) == sn ) { |
134 | syncnet->setCurrentItem(i); | 134 | syncnet->setCurrentItem(i); |
135 | return; | 135 | return; |
136 | } | 136 | } |
137 | } | 137 | } |
138 | qDebug("No match for \"%s\"",sn.latin1()); | 138 | qDebug("No match for \"%s\"",sn.latin1()); |
139 | } | 139 | } |
140 | 140 | ||
141 | void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) | 141 | void Security::parseNet(const QString& sn,int& auth_peer,int& auth_peer_bits) |
142 | { | 142 | { |
143 | auth_peer=0; | 143 | auth_peer=0; |
144 | if ( sn == tr("Any") ) { | 144 | if ( sn == tr("Any") ) { |
145 | auth_peer = 0; | 145 | auth_peer = 0; |
146 | auth_peer_bits = 0; | 146 | auth_peer_bits = 0; |
147 | } else if ( sn == tr("None") ) { | 147 | } else if ( sn == tr("None") ) { |
148 | auth_peer = 0; | 148 | auth_peer = 0; |
149 | auth_peer_bits = 32; | 149 | auth_peer_bits = 32; |
150 | } else { | 150 | } else { |
151 | int x=0; | 151 | int x=0; |
152 | for (int i=0; i<4; i++) { | 152 | for (int i=0; i<4; i++) { |
153 | int nx = sn.find(QChar(i==3 ? '/' : '.'),x); | 153 | int nx = sn.find(QChar(i==3 ? '/' : '.'),x); |
154 | auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt(); | 154 | auth_peer = (auth_peer<<8)|sn.mid(x,nx-x).toInt(); |
155 | x = nx+1; | 155 | x = nx+1; |
156 | } | 156 | } |
157 | uint n = (uint)sn.find(' ',x)-x; | 157 | uint n = (uint)sn.find(' ',x)-x; |
158 | auth_peer_bits = sn.mid(x,n).toInt(); | 158 | auth_peer_bits = sn.mid(x,n).toInt(); |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | void Security::setSyncNet(const QString& sn) | 162 | void Security::setSyncNet(const QString& sn) |
@@ -168,27 +168,27 @@ void Security::setSyncNet(const QString& sn) | |||
168 | 168 | ||
169 | void Security::applySecurity() | 169 | void Security::applySecurity() |
170 | { | 170 | { |
171 | if ( valid ) { | 171 | if ( valid ) { |
172 | Config cfg("Security"); | 172 | Config cfg("Security"); |
173 | cfg.setGroup("Passcode"); | 173 | cfg.setGroup("Passcode"); |
174 | cfg.writeEntry("passcode",passcode); | 174 | cfg.writeEntry("passcode",passcode); |
175 | cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked()); | 175 | cfg.writeEntry("passcode_poweron",passcode_poweron->isChecked()); |
176 | cfg.setGroup("Sync"); | 176 | cfg.setGroup("Sync"); |
177 | int auth_peer=0; | 177 | int auth_peer=0; |
178 | int auth_peer_bits; | 178 | int auth_peer_bits; |
179 | QString sn = syncnet->currentText(); | 179 | QString sn = syncnet->currentText(); |
180 | parseNet(sn,auth_peer,auth_peer_bits); | 180 | parseNet(sn,auth_peer,auth_peer_bits); |
181 | cfg.writeEntry("auth_peer",auth_peer); | 181 | cfg.writeEntry("auth_peer",auth_peer); |
182 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); | 182 | cfg.writeEntry("auth_peer_bits",auth_peer_bits); |
183 | /* | 183 | /* |
184 | cfg.setGroup("Remote"); | 184 | cfg.setGroup("Remote"); |
185 | if ( telnetAvailable() ) | 185 | if ( telnetAvailable() ) |
186 | cfg.writeEntry("allow_telnet",telnet->isChecked()); | 186 | cfg.writeEntry("allow_telnet",telnet->isChecked()); |
187 | if ( sshAvailable() ) | 187 | if ( sshAvailable() ) |
188 | cfg.writeEntry("allow_ssh",ssh->isChecked()); | 188 | cfg.writeEntry("allow_ssh",ssh->isChecked()); |
189 | // ### write ssh/telnet sys config files | 189 | // ### write ssh/telnet sys config files |
190 | */ | 190 | */ |
191 | } | 191 | } |
192 | } | 192 | } |
193 | 193 | ||
194 | void Security::changePassCode() | 194 | void Security::changePassCode() |
@@ -196,14 +196,14 @@ void Security::changePassCode() | |||
196 | QString new1; | 196 | QString new1; |
197 | QString new2; | 197 | QString new2; |
198 | 198 | ||
199 | do { | 199 | do { |
200 | new1 = enterPassCode("Enter new passcode"); | 200 | new1 = enterPassCode("Enter new passcode"); |
201 | if ( new1.isNull() ) | 201 | if ( new1.isNull() ) |
202 | return; | 202 | return; |
203 | new2 = enterPassCode("Re-enter new passcode"); | 203 | new2 = enterPassCode("Re-enter new passcode"); |
204 | if ( new2.isNull() ) | 204 | if ( new2.isNull() ) |
205 | return; | 205 | return; |
206 | } while (new1 != new2); | 206 | } while (new1 != new2); |
207 | 207 | ||
208 | passcode = new1; | 208 | passcode = new1; |
209 | updateGUI(); | 209 | updateGUI(); |