summaryrefslogtreecommitdiff
path: root/selftest
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2010-03-19 10:23:39 +0100
committerGünther Deschner <gd@samba.org>2010-03-19 10:23:39 +0100
commit20d73f768d002faf62f760f99c608f139b229491 (patch)
tree257a0648ddcdaf339db3b4988e0f4f0979520e35 /selftest
parentf06779629db8f810f1ff8ad8f16ac2b580052b2c (diff)
downloadsamba-20d73f768d002faf62f760f99c608f139b229491.tar.gz
s3-selftest: rearrange uid/gid calculation to achieve correct membership.
Guenther
Diffstat (limited to 'selftest')
-rw-r--r--selftest/target/Samba3.pm58
1 files changed, 33 insertions, 25 deletions
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 18e3483d32a..94c2f951357 100644
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -443,6 +443,37 @@ sub provision($$$$$$)
my @eventlog_list = ("dns server", "application");
+ ##
+ ## calculate uids and gids
+ ##
+
+ 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;
+
+ ##
+ ## create conffile
+ ##
+
open(CONF, ">$conffile") or die("Unable to open $conffile");
print CONF "
[global]
@@ -468,9 +499,9 @@ sub provision($$$$$$)
time server = yes
- add user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u
+ add user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u --gid $gid_nogroup
add group script = $nss_wrapper_pl --group_path $nss_wrapper_group --type group --action add --name %g
- add machine script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u
+ add machine script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action add --name %u --gid $gid_nogroup
add user to group script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type member --action add --member %u --name %g --group_path $nss_wrapper_group
delete user script = $nss_wrapper_pl --passwd_path $nss_wrapper_passwd --type passwd --action delete --name %u
delete group script = $nss_wrapper_pl --group_path $nss_wrapper_group --type group --action delete --name %g
@@ -549,29 +580,6 @@ 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:$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