diff -Nur -x '*.orig' -x '*.rej' e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/group-merged mezzanine_patched_e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/group-merged --- e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/group-merged 2003-05-20 12:59:27.000000000 -0600 +++ mezzanine_patched_e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/group-merged 2007-01-26 13:20:11.000000000 -0700 @@ -55,3 +55,4 @@ tester:x:5001: testgroup:x:5002:admin,www test:x:5003: +vita-weat$:x:5004: diff -Nur -x '*.orig' -x '*.rej' e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/group-restored mezzanine_patched_e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/group-restored --- e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/group-restored 2003-05-16 16:12:26.000000000 -0600 +++ mezzanine_patched_e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/group-restored 2007-01-26 13:22:44.000000000 -0700 @@ -45,3 +45,4 @@ tester:x:5001: testgroup:x:5002:admin,www test:x:5003: +vita-weat$:x:5004: diff -Nur -x '*.orig' -x '*.rej' e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/passwd-merged mezzanine_patched_e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/passwd-merged --- e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/passwd-merged 2003-05-16 15:32:48.000000000 -0600 +++ mezzanine_patched_e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/passwd-merged 2007-01-26 13:20:35.000000000 -0700 @@ -47,3 +47,4 @@ tester:x:5001:5001:t t:/home/e-smith/files/users/tester:/bin/sshell testgroup:x:5002:5002:for testing.:/home/e-smith:/bin/false test:x:5003:5003:test:/home/e-smith/files/ibays/test/files:/bin/false +vita-weat$:x:5004:5004:Hostname account for vita-weat$:/noexistingpath:/bin/false diff -Nur -x '*.orig' -x '*.rej' e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/passwd-restored mezzanine_patched_e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/passwd-restored --- e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/passwd-restored 2003-05-16 15:39:11.000000000 -0600 +++ mezzanine_patched_e-smith-backup-1.14.0/root/etc/e-smith/tests/10e-smith-backup/passwd-restored 2007-01-26 13:22:20.000000000 -0700 @@ -37,3 +37,4 @@ tester:x:5001:5001:t t:/home/e-smith/files/users/tester:/bin/sshell testgroup:x:5002:5002:for testing.:/home/e-smith:/bin/false test:x:5003:5003:test:/home/e-smith/files/ibays/test/files:/bin/false +vita-weat$:x:5004:5004:Hostname account for vita-weat$:/noexistingpath:/bin/false diff -Nur -x '*.orig' -x '*.rej' e-smith-backup-1.14.0/root/usr/lib/perl5/site_perl/esmith/Backup.pm mezzanine_patched_e-smith-backup-1.14.0/root/usr/lib/perl5/site_perl/esmith/Backup.pm --- e-smith-backup-1.14.0/root/usr/lib/perl5/site_perl/esmith/Backup.pm 2005-08-09 10:37:45.000000000 -0600 +++ mezzanine_patched_e-smith-backup-1.14.0/root/usr/lib/perl5/site_perl/esmith/Backup.pm 2007-01-26 13:27:51.000000000 -0700 @@ -1,5 +1,5 @@ #---------------------------------------------------------------------- -# Copyright 1999-2003 Mitel Networks Corporation +# Copyright 1999-2007 Mitel Networks Corporation # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. #---------------------------------------------------------------------- @@ -101,8 +101,8 @@ =item * Add back any users in the restored passwd file with home -directories under /home/e-smith, or /noexistingpath (Samba -machine accounts) +directories under directories which contain user or +machine accounts =item * Log any other missing users or UID/GID mismatches @@ -162,7 +162,7 @@ { my @details = $merge_into->user($user); - if ( $merge_from->home($user) =~ m:^/(home/e-smith|noexistingpath): ) + if ( _homedir_ok($merge_from->home($user)) ) { unless ( defined $details[0] ) { @@ -211,10 +211,9 @@ =item * Add back any group in the restored group file for which -there are corresponding users with with home -directories under /home/e-smith. These users are checked -from the passwd file specified in the environment variable -ESMITH_BACKUP_PASSWD_FILE, or /etc/passwd. +there are corresponding users with valid home directories. +These users are checked from the passwd file specified in the environment +variable ESMITH_BACKUP_PASSWD_FILE, or /etc/passwd. =item * Log any other missing groups or GID mismatches @@ -284,7 +283,7 @@ { my @details = $merge_into->group($group); - if ( $passwd->user($group) and ( $passwd->home($group) =~ m:^/home/e-smith: ) ) + if ( $passwd->user($group) and _homedir_ok($passwd->home($group)) ) { unless ( defined $details[0] ) { @@ -443,6 +442,21 @@ } +=head2 _homedir_ok + +Returns true if the given directory is one we want to +restore: /home/e-smith for user accounts or +/noexistingpath for machine accounts + +=cut + +sub _homedir_ok +{ + my $dir = shift or return; + + return $dir =~ m:^/(home/e-smith|noexistingpath): ; +} + =head1 AUTHOR SME Server Developers