author | umopapisdn <umopapisdn> | 2002-09-28 06:36:30 (UTC) |
---|---|---|
committer | umopapisdn <umopapisdn> | 2002-09-28 06:36:30 (UTC) |
commit | 8a95ca149ff5eedc9215bb012c8d7d09cdcaf96c (patch) (unidiff) | |
tree | 50aed468fa8888266c589ce47131d0acaf7f82b7 /noncore/settings/usermanager/passwd.cpp | |
parent | 996c0d02d16c185acc3190baa5b4a1fc934e730c (diff) | |
download | opie-8a95ca149ff5eedc9215bb012c8d7d09cdcaf96c.zip opie-8a95ca149ff5eedc9215bb012c8d7d09cdcaf96c.tar.gz opie-8a95ca149ff5eedc9215bb012c8d7d09cdcaf96c.tar.bz2 |
Now actually makes the homedirectories owned by the user they belong to. :)
Diffstat (limited to 'noncore/settings/usermanager/passwd.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/usermanager/passwd.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/settings/usermanager/passwd.cpp b/noncore/settings/usermanager/passwd.cpp index 310cef8..5063661 100644 --- a/noncore/settings/usermanager/passwd.cpp +++ b/noncore/settings/usermanager/passwd.cpp | |||
@@ -11,6 +11,7 @@ | |||
11 | 11 | ||
12 | // Needed for crypt_make_salt(); | 12 | // Needed for crypt_make_salt(); |
13 | #include <sys/types.h> | 13 | #include <sys/types.h> |
14 | #include <sys/stat.h> | ||
14 | #include <unistd.h> | 15 | #include <unistd.h> |
15 | #include <time.h> | 16 | #include <time.h> |
16 | 17 | ||
@@ -139,7 +140,7 @@ bool Passwd::findUser(int uid) { | |||
139 | return searchUser(userRegExp); | 140 | return searchUser(userRegExp); |
140 | } | 141 | } |
141 | 142 | ||
142 | bool Passwd::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) { | 143 | bool Passwd::addUser(QString pw_name, QString pw_passwd, int pw_uid, int pw_gid, QString pw_gecos,QString pw_dir, QString pw_shell, bool createGroup) { |
143 | QString tempString; | 144 | QString tempString; |
144 | if((createGroup) && (!(findGroup(pw_gid)))) addGroup(pw_name,pw_gid); | 145 | if((createGroup) && (!(findGroup(pw_gid)))) addGroup(pw_name,pw_gid); |
145 | pw_passwd = crypt(pw_passwd, crypt_make_salt()); | 146 | pw_passwd = crypt(pw_passwd, crypt_make_salt()); |
@@ -149,6 +150,8 @@ bool Passwd::addUser(QString pw_name, QString pw_passwd, int pw_uid, int pw_gid, | |||
149 | QDir d; | 150 | QDir d; |
150 | if(!(d.exists(pw_dir))) { | 151 | if(!(d.exists(pw_dir))) { |
151 | d.mkdir(pw_dir); | 152 | d.mkdir(pw_dir); |
153 | chown(pw_dir,pw_uid,pw_gid); | ||
154 | chmod(pw_dir,S_IRUSR|S_IWUSR|S_IXUSR); | ||
152 | } | 155 | } |
153 | return 1; | 156 | return 1; |
154 | } | 157 | } |