summaryrefslogtreecommitdiff
path: root/selftest/target
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-03-18 12:12:58 +0100
committerGünther Deschner <gd@samba.org>2010-03-18 15:08:27 +0100
commit05cad2ea2f0963e7845b451d97830528c86e2cda (patch)
tree04f39bde99b6b2ebbb23da86e052e8651d9b8600 /selftest/target
parent38a46fa32bfd8007f0fb3e2b607d0e57a012ae95 (diff)
downloadsamba-05cad2ea2f0963e7845b451d97830528c86e2cda.tar.gz
samba-05cad2ea2f0963e7845b451d97830528c86e2cda.tar.bz2
samba-05cad2ea2f0963e7845b451d97830528c86e2cda.zip
s3-selftest: make sure we do not have duplicate uids/gids in nsswrapper.
Also make sure we only add root user when needed, Jeremy please check. Guenther
Diffstat (limited to 'selftest/target')
-rw-r--r--selftest/target/Samba3.pm38
1 files changed, 33 insertions, 5 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index cc7713d18e..a3faafc984 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -549,19 +549,47 @@ sub provision($$$$$$)
## create a test account
##
+ my $max_uid, $max_gid;
+ my $uid_nobody, $uid_root;
+ my $gid_nobody, $gid_nogroup, $gid_root;
+
+ if ($unix_uid < 0xffff - 2) {
+ $max_uid = 0xffff;
+ } else {
+ $max_uid = $unix_uid;
+ }
+
+ $uid_root = $max_uid - 1;
+ $uid_nobody = $max_uid - 2;
+
+ if ($unix_gids[0] < 0xffff - 3) {
+ $max_gid = 0xffff;
+ } else {
+ $max_gid = $unix_gids[0];
+ }
+
+ $gid_nobody = $max_gid - 1;
+ $gid_nogroup = $max_gid - 2;
+ $gid_root = $max_gid - 3;
+
open(PASSWD, ">$nss_wrapper_passwd") or die("Unable to open $nss_wrapper_passwd");
- print PASSWD "nobody:x:65534:65533:nobody gecos:$prefix_abs:/bin/false
-root:x:65533:65532:root gecos:$prefix_abs:/bin/false
+ print PASSWD "nobody:x:$uid_nobody:$gid_nobody:nobody gecos:$prefix_abs:/bin/false
$unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false
";
+ if ($unix_uid != 0) {
+ print PASSWD "root:x:$uid_root:$gid_root:root gecos:$prefix_abs:/bin/false";
+ }
close(PASSWD);
open(GROUP, ">$nss_wrapper_group") or die("Unable to open $nss_wrapper_group");
- print GROUP "nobody:x:65533:
-nogroup:x:65534:nobody
-root:x:65532:
+ print GROUP "nobody:x:$gid_nobody:
+nogroup:x:$gid_nogroup:nobody
$unix_name-group:x:$unix_gids[0]:
";
+ if ($unix_gids[0] != 0) {
+ print GROUP "root:x:$gid_root:";
+ }
+
close(GROUP);
foreach my $evlog (@eventlog_list) {