summaryrefslogtreecommitdiff
authorumopapisdn <umopapisdn>2003-03-28 13:12:09 (UTC)
committer umopapisdn <umopapisdn>2003-03-28 13:12:09 (UTC)
commitb271d575fa05cf570a1a829136517761bd47e69b (patch) (side-by-side diff)
treee82c8e348b3b926fb365c42454d12a56dda0adc6
parent8e8803488d2c11b12449e785802da4a5a9adad0f (diff)
downloadopie-b271d575fa05cf570a1a829136517761bd47e69b.zip
opie-b271d575fa05cf570a1a829136517761bd47e69b.tar.gz
opie-b271d575fa05cf570a1a829136517761bd47e69b.tar.bz2
Bugfix: (bug #0000765) Lines in /etc/passwd & /etc/group starting with a "#" are comments and should not be editable.
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/usermanager/opie-usermanager.control2
-rw-r--r--noncore/settings/usermanager/passwd.cpp9
-rw-r--r--noncore/settings/usermanager/userdialog.cpp2
-rw-r--r--noncore/settings/usermanager/usermanager.cpp4
4 files changed, 14 insertions, 3 deletions
diff --git a/noncore/settings/usermanager/opie-usermanager.control b/noncore/settings/usermanager/opie-usermanager.control
index f971fdc..e1c7762 100644
--- a/noncore/settings/usermanager/opie-usermanager.control
+++ b/noncore/settings/usermanager/opie-usermanager.control
@@ -6,4 +6,4 @@ Depends: opie-base
Architecture: arm
Maintainer: Ted Parnefors <zaurus@bredband.net>
License: GPL
-Description: User/Group manager for OPIE.
+Description: User/Group manager for Opie.
diff --git a/noncore/settings/usermanager/passwd.cpp b/noncore/settings/usermanager/passwd.cpp
index 1e98778..f8e6d17 100644
--- a/noncore/settings/usermanager/passwd.cpp
+++ b/noncore/settings/usermanager/passwd.cpp
@@ -207,11 +207,16 @@ bool Passwd::searchGroup(QRegExp &groupRegExp) {
if((tempStringList.isEmpty())) {
return false;
} else {
- groupString=(*(tempStringList.begin()));
+ for(QStringList::Iterator it=tempStringList.begin(); it!=tempStringList.end(); it++) {
+ groupString=*it;
+ if(!groupString.find(QRegExp("^#"),0)) { // Skip commented lines.
splitGroupEntry(groupString);
- }
return true;
}
+ }
+ }
+ return false;
+}
// Find a group by groupname.
bool Passwd::findGroup(const char *groupname) {
diff --git a/noncore/settings/usermanager/userdialog.cpp b/noncore/settings/usermanager/userdialog.cpp
index 0d2122b..c06f639 100644
--- a/noncore/settings/usermanager/userdialog.cpp
+++ b/noncore/settings/usermanager/userdialog.cpp
@@ -44,9 +44,11 @@ UserDialog::UserDialog(int viewmode, QWidget* parent, const char* name, bool mod
// And also fill the listview & the combobox with all available groups.
for( QStringList::Iterator it = accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) {
accounts->splitGroupEntry(*it);
+ if(accounts->gr_name.find(QRegExp("^#"),0)) { // Skip commented lines.
new QCheckListItem(groupsListView,accounts->gr_name,QCheckListItem::CheckBox);
groupComboBox->insertItem(accounts->gr_name);
}
+ }
showMaximized();
}
diff --git a/noncore/settings/usermanager/usermanager.cpp b/noncore/settings/usermanager/usermanager.cpp
index 57efa71..1946013 100644
--- a/noncore/settings/usermanager/usermanager.cpp
+++ b/noncore/settings/usermanager/usermanager.cpp
@@ -126,6 +126,7 @@ void UserConfig::getUsers() {
availableUID=500;
for(QStringList::Iterator it=accounts->passwdStringList.begin(); it!=accounts->passwdStringList.end(); ++it) {
accounts->splitPasswdEntry(*it); // Split the string into it's components and store in variables in the accounts object. ("pr_name" and so on.)
+ if(accounts->pw_name.find(QRegExp("^#"),0)) { // Skip commented lines.
new QListViewItem(usersListView,QString::number(accounts->pw_uid),accounts->pw_name,accounts->pw_gecos);
if((accounts->pw_uid>=500) && (accounts->pw_uid<65000)) { // Is this user a "normal" user ?
mytext=QString(accounts->pw_name)+" - ("+QString(accounts->pw_gecos)+")"; // The string displayed next to the icon.
@@ -137,6 +138,7 @@ void UserConfig::getUsers() {
}
if((accounts->pw_uid>=availableUID) && (accounts->pw_uid<65000)) availableUID=accounts->pw_uid+1; // Increase 1 to the latest know UID to get a free uid.
}
+ }
usersIconView->sort();
}
@@ -216,10 +218,12 @@ void UserConfig::getGroups() {
availableGID=500; // We need to find the next free GID, and are only interested in values between 500 & 65000.
for(QStringList::Iterator it=accounts->groupStringList.begin(); it!=accounts->groupStringList.end(); ++it) { // Split the list into lines.
accounts->splitGroupEntry(*it); // Split the line into its components and fill the variables of 'accounts'. (gr_name, gr_uid & gr_mem).
+ if(accounts->gr_name.find(QRegExp("^#"),0)) { // Skip commented lines.
new QListViewItem(groupsListView,QString::number(accounts->gr_gid),accounts->gr_name);
if((accounts->gr_gid>=availableGID) && (accounts->gr_gid<65000)) availableGID=accounts->gr_gid+1; // Maybe a new free GID.
}
}
+}
void UserConfig::addGroup() {
if(GroupDialog::addGroup(availableGID)) getGroups(); // Bring up the add group dialog.