Handle hostnames with upper-case letters
[webmin.git] / sshd / useradmin_update.pl
1
2 do 'sshd-lib.pl';
3
4 # useradmin_create_user(&details)
5 # Setup SSH and GNUPG for new users
6 sub useradmin_create_user
7 {
8 if ($config{'sync_create'} && &has_command($config{'keygen_path'}) &&
9     -d $_[0]->{'home'} && !-d "$_[0]->{'home'}/.ssh") {
10         local $cmd;
11         local $type = $config{'sync_type'} ? "-t $config{'sync_type'}" :
12                       $version{'type'} eq 'openssh' &&
13                        $version{'number'} >= 3.2 ? "-t rsa1" : "";
14         if ($config{'sync_pass'} && $_[0]->{'passmode'} == 3) {
15                 $cmd = "$config{'keygen_path'} $type -P \"$_[0]->{'plainpass'}\"";
16                 }
17         else {
18                 $cmd = "$config{'keygen_path'} $type -P \"\"";
19                 }
20         &system_logged("echo '' | su $_[0]->{'user'} -c '$cmd' >/dev/null 2>&1");
21         if ($config{'sync_auth'}) {
22                 if (-r "$_[0]->{'home'}/.ssh/identity.pub") {
23                         &system_logged("cp $_[0]->{'home'}/.ssh/identity.pub $_[0]->{'home'}/.ssh/authorized_keys");
24                         }
25                 else {
26                         &system_logged("cp $_[0]->{'home'}/.ssh/id_dsa.pub $_[0]->{'home'}/.ssh/authorized_keys");
27                         }
28                 &system_logged("chown $_[0]->{'uid'}:$_[0]->{'gid'} $_[0]->{'home'}/.ssh/authorized_keys");
29                 }
30         }
31 }
32
33 # useradmin_delete_user(&details)
34 sub useradmin_delete_user
35 {
36 }
37
38 # useradmin_modify_user(&details)
39 sub useradmin_modify_user
40 {
41 }
42
43 1;
44