-sub batch {
- local($name, $groups, $fullname, $password) = @_;
- local($sh);
-
- $defaultshell = &shell_default_valid($defaultshell);
- return 0 unless $home = &home_partition_valid($home);
- return 0 if $dotdir ne &dotdir_default_valid($dotdir);
- $send_message = &message_default;
-
- return 0 if $name ne &new_users_name_valid($name);
- $sh = $shell{$defaultshell};
- ($u_id, $g_id) = &next_id($name);
- $group_login = &new_users_grplogin_batch($name, $defaultgroup);
- return 0 unless $group_login;
- $g_id = $groupname{$group_login} if (defined($groupname{$group_login}));
- ($flag, $new_groups) = &new_users_groups_valid($groups);
- return 0 if $flag;
-
- $cryptpwd = "";
- $cryptpwd = crypt($password, &salt) if $password ne "";
- # obskure perl bug
- $new_entry = "$name\:" . "$cryptpwd" .
- "\:$u_id\:$g_id\::0:0:$fullname:$home/$name:$sh";
- &append_file($etc_passwd, "$new_entry");
- &new_users_pwdmkdb("$new_entry");
- &new_users_group_update;
- &new_users_passwd_update; print "Added user ``$name''\n";
- &sendmessage($name, @message_buffer) if $send_message ne "no";
- &adduser_log("$name:*:$u_id:$g_id($group_login):$fullname");
- &home_create($name, $group_login);
-}
-