summaryrefslogtreecommitdiff
path: root/Users
diff options
context:
space:
mode:
Diffstat (limited to 'Users')
-rw-r--r--Users/Users.pm35
1 files changed, 35 insertions, 0 deletions
diff --git a/Users/Users.pm b/Users/Users.pm
index 80f982d..8034ce8 100644
--- a/Users/Users.pm
+++ b/Users/Users.pm
@@ -779,6 +779,20 @@ sub set_logindefs
}
}
+sub get_self
+{
+ my ($uid) = @_;
+ my ($users) = &get ();
+
+ foreach $user (@$users)
+ {
+ next if ($uid != $$user[$UID]);
+ return ($$user[$COMMENT], $$user[$LOCALE]);
+ }
+
+ return ([""], "");
+}
+
sub get_user
{
my ($login) = @_;
@@ -812,6 +826,27 @@ sub set_user
}
}
+sub set_self
+{
+ my ($uid, $old_passwd, $new_passwd, @comments) = @_;
+ my ($users) = &get ();
+
+ # Make backups manually, otherwise they don't get backed up.
+ &Utils::File::do_backup ($_) foreach (@passwd_names);
+ &Utils::File::do_backup ($_) foreach (@shadow_names);
+
+ foreach $user (@$users)
+ {
+ if ($uid == $$user[$UID])
+ {
+ &change_user_chfn ($$user[$LOGIN], $$user[$COMMENT], @comments);
+ return;
+ }
+ }
+ # TODO: change password
+}
+
+
sub get_files
{
my ($arr);