author | zecke <zecke> | 2004-07-10 12:40:06 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-07-10 12:40:06 (UTC) |
commit | e18cb7bddb3461a40ae1e8810ef408ceef101d38 (patch) (unidiff) | |
tree | dd5a6b1607f3d2a331c484f07b7dd367ee00f24d | |
parent | 38152afc18715fefc238040ff806d1e3a93e021e (diff) | |
download | opie-e18cb7bddb3461a40ae1e8810ef408ceef101d38.zip opie-e18cb7bddb3461a40ae1e8810ef408ceef101d38.tar.gz opie-e18cb7bddb3461a40ae1e8810ef408ceef101d38.tar.bz2 |
On OE '*' is not for shadow passwords but is a hint that we
could set the password. So use this hint
-rw-r--r-- | core/opie-login/passworddialogimpl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/opie-login/passworddialogimpl.cpp b/core/opie-login/passworddialogimpl.cpp index 951c4e1..852708e 100644 --- a/core/opie-login/passworddialogimpl.cpp +++ b/core/opie-login/passworddialogimpl.cpp | |||
@@ -166,66 +166,67 @@ void PasswordDialogImpl::writePassword() { | |||
166 | #error "Can't write Shadow Passwords fixme" | 166 | #error "Can't write Shadow Passwords fixme" |
167 | #endif | 167 | #endif |
168 | } | 168 | } |
169 | 169 | ||
170 | /** | 170 | /** |
171 | * Raise an error. Delete input and set the focus after showing | 171 | * Raise an error. Delete input and set the focus after showing |
172 | * the error to the user | 172 | * the error to the user |
173 | */ | 173 | */ |
174 | void PasswordDialogImpl::error( const QString& caption, const QString& text ) { | 174 | void PasswordDialogImpl::error( const QString& caption, const QString& text ) { |
175 | m_isSet = false; | 175 | m_isSet = false; |
176 | QMessageBox::critical(this,caption, text, | 176 | QMessageBox::critical(this,caption, text, |
177 | QMessageBox::Ok, QMessageBox::NoButton ); | 177 | QMessageBox::Ok, QMessageBox::NoButton ); |
178 | 178 | ||
179 | m_pass->setText(""); | 179 | m_pass->setText(""); |
180 | m_pass->setFocus(); | 180 | m_pass->setFocus(); |
181 | 181 | ||
182 | m_confirm->setText(""); | 182 | m_confirm->setText(""); |
183 | } | 183 | } |
184 | 184 | ||
185 | void PasswordDialogImpl::slotToggleEcho( bool b ) { | 185 | void PasswordDialogImpl::slotToggleEcho( bool b ) { |
186 | m_pass-> setEchoMode( b ? QLineEdit::Normal : QLineEdit::Password ); | 186 | m_pass-> setEchoMode( b ? QLineEdit::Normal : QLineEdit::Password ); |
187 | m_confirm->setEchoMode( b ? QLineEdit::Normal : QLineEdit::Password ); | 187 | m_confirm->setEchoMode( b ? QLineEdit::Normal : QLineEdit::Password ); |
188 | } | 188 | } |
189 | 189 | ||
190 | ///////////////////////// | 190 | ///////////////////////// |
191 | /// static functions | 191 | /// static functions |
192 | /// | 192 | /// |
193 | 193 | ||
194 | /** | 194 | /** |
195 | * Ask whether or not we need to show the dialog. It returns true if | 195 | * Ask whether or not we need to show the dialog. It returns true if |
196 | * no root password is set so that the user will be able to set one. | 196 | * no root password is set so that the user will be able to set one. |
197 | */ | 197 | */ |
198 | bool PasswordDialogImpl::needDialog() { | 198 | bool PasswordDialogImpl::needDialog() { |
199 | /* | 199 | /* |
200 | * This can cope with no password and shadow passwords | 200 | * This can cope with no password and shadow passwords |
201 | * Let us go through the user database until we find 'root' and then | 201 | * Let us go through the user database until we find 'root' and then |
202 | * see if it is 'shadow' and see if shadow is empty or see if the password is empty | 202 | * see if it is 'shadow' and see if shadow is empty or see if the password is empty |
203 | */ | 203 | */ |
204 | bool need = false; | 204 | bool need = false; |
205 | struct passwd *pwd; | 205 | struct passwd *pwd; |
206 | ::setpwent(); | 206 | ::setpwent(); |
207 | 207 | ||
208 | while((pwd = ::getpwent() ) ) { | 208 | while((pwd = ::getpwent() ) ) { |
209 | /* found root */ | 209 | /* found root */ |
210 | if( pwd->pw_uid == 0 ) { | 210 | if( pwd->pw_uid == 0 ) { |
211 | QString str = QString::fromLatin1(pwd->pw_passwd ); | 211 | QString str = QString::fromLatin1(pwd->pw_passwd ); |
212 | 212 | ||
213 | /* | 213 | /* |
214 | * If str is really empty it is passwordless anyway... | 214 | * If str is really empty it is passwordless anyway... or '*' is a hint to set one |
215 | * on OE/Familiar | ||
215 | * else it is shadow based | 216 | * else it is shadow based |
216 | */ | 217 | */ |
217 | if(str.isEmpty() ) | 218 | if(str.isEmpty() || str == '*' ) |
218 | need = true; | 219 | need = true; |
219 | else if ( str == '*' || str == 'x' ) | 220 | else if ( str == 'x' ) |
220 | #ifdef OPIE_LOGIN_SHADOW_PW | 221 | #ifdef OPIE_LOGIN_SHADOW_PW |
221 | need = QString::fromLatin1( ::getspnam( pwd->pw_name )->sp_pwdp ).isEmpty(); | 222 | need = QString::fromLatin1( ::getspnam( pwd->pw_name )->sp_pwdp ).isEmpty(); |
222 | #else | 223 | #else |
223 | ; | 224 | ; |
224 | #endif | 225 | #endif |
225 | break; | 226 | break; |
226 | } | 227 | } |
227 | } | 228 | } |
228 | ::endpwent(); | 229 | ::endpwent(); |
229 | 230 | ||
230 | return need; | 231 | return need; |
231 | } | 232 | } |