-# passwd-lib.pl
-# Common functions for the password module
+=head1 passwd-lib.pl
+
+Functions to support the change passwords module. Some example code :
+
+ foreign_require('passwd', 'passwd-lib.pl');
+ $user = passwd::find_user('joe');
+ if ($user) {
+ passwd::change_password($user, 'smeg', 0);
+ }
+
+=cut
do '../web-lib.pl';
&init_config();
do '../ui-lib.pl';
%access = &get_module_acl();
-# can_edit_passwd(&user)
+=head2 can_edit_passwd(&user)
+
+Returns 1 if the current Webmin user can change the password for the Unix
+user whose details are in the given hash ref, which is in the format returned
+by useradmin::list_users.
+
+=cut
sub can_edit_passwd
{
if ($access{'mode'} == 0) {
}
}
-# find_user(name)
-# Looks up the user structure for some name, in the useradmin, ldap-useradmin
-# and nis modules
+=head2 find_user(name)
+
+Looks up the user structure for some name, in the useradmin, ldap-useradmin
+and nis modules, and returns it.
+
+=cut
sub find_user
{
local $mod;
return undef;
}
-# change_password(&user, pass, do-others)
-# Actually update a user's password
+=head2 change_password(&user, pass, do-others)
+
+Updates a user's password. The required parameters are :
+user - A hash ref of user details, in the format supplied by find_user
+pass - The new password, in plain text
+do-others - If set to 1, the password is changed in other Webmin modules too
+
+=cut
sub change_password
{
local ($user, $pass, $others) = @_;