summaryrefslogtreecommitdiff
path: root/noncore/settings/usermanager/passwd.h
authorumopapisdn <umopapisdn>2002-09-24 21:21:55 (UTC)
committer umopapisdn <umopapisdn>2002-09-24 21:21:55 (UTC)
commit8854c1688dfc388e3621b7494f6338008173b20c (patch) (side-by-side diff)
tree3e6db427b24423b847d7e594f2fc9c865e0cc2ec /noncore/settings/usermanager/passwd.h
parent93be75ceab687091f76a459eb34bfd4859986116 (diff)
downloadopie-8854c1688dfc388e3621b7494f6338008173b20c.zip
opie-8854c1688dfc388e3621b7494f6338008173b20c.tar.gz
opie-8854c1688dfc388e3621b7494f6338008173b20c.tar.bz2
New Application OPIE-UserManager added.
Diffstat (limited to 'noncore/settings/usermanager/passwd.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/usermanager/passwd.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/noncore/settings/usermanager/passwd.h b/noncore/settings/usermanager/passwd.h
new file mode 100644
index 0000000..37c41dc
--- a/dev/null
+++ b/noncore/settings/usermanager/passwd.h
@@ -0,0 +1,85 @@
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef PASSWD_H
+#define PASSWD_H
+
+#include <qobject.h>
+#include <qfile.h>
+#include <qstring.h>
+#include <qstringlist.h>
+#include <qtextstream.h>
+#include <qregexp.h>
+#include <qdir.h>
+
+#include <crypt.h>
+#include <pwd.h>
+#include <grp.h>
+
+class Passwd
+{
+public:
+ QStringList passwdStringList; // List of all users (name,passwd,uid,gid,gecos,dir,shell)
+ QStringList groupStringList; // List of all groups (name,gid,mem)
+
+ // pwentry
+ QString pw_name;
+ QString pw_passwd;
+ int pw_uid;
+ int pw_gid;
+ QString pw_gecos;
+ QString pw_dir;
+ QString pw_shell;
+
+ // grentry
+ QString gr_name;
+ int gr_gid;
+ QStringList gr_mem;
+
+ Passwd(void);
+ ~Passwd(void);
+ bool open(void);
+ bool close(void);
+ char *crypt_make_salt(void);
+ void splitPasswdEntry(QString &userString);
+ void splitGroupEntry(QString &groupString);
+ bool findUser(const char *username);
+ bool findUser(int uid);
+ bool addUser(QString pw_name, QString pw_passwd, int pw_uid, int pw_gid, QString pw_gecos, QString pw_dir, QString pw_shell, bool createGroup=true);
+ bool updateUser(QString login);
+ bool delUser(const char *username, bool delGroup=true);
+ bool delUser(int uid, bool delGroup=true);
+ bool findGroup(const char *groupname);
+ bool findGroup(int gid);
+ bool addGroup(QString gr_name, int gr_gid);
+ bool updateGroup(int gid);
+ bool delGroup(const char *groupname);
+ bool delGroup(int gid);
+ bool addGroupMember(QString groupname,QString member);
+ bool delGroupMember(QString groupname,QString member);
+
+private:
+ QString userString;
+ QString groupString;
+
+ int i64c(int i);
+ bool searchUser(QRegExp &userRegExp);
+ bool deleteUser(QRegExp &userRegExp, bool delGroup);
+ bool searchGroup(QRegExp &groupRegExp);
+ bool deleteGroup(QRegExp &groupRegExp);
+ QStringList userdataStringList;
+ QStringList groupdataStringList;
+
+ QFile *passwd_file;
+ QFile *group_file;
+};
+
+extern Passwd *accounts; // Create a global object.
+
+#endif