diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | GroupsConfig.pm | 4 | ||||
-rw-r--r-- | Users/Groups.pm | 24 | ||||
-rw-r--r-- | Users/Users.pm | 20 | ||||
-rw-r--r-- | UsersConfig.pm | 4 |
5 files changed, 37 insertions, 24 deletions
@@ -1,5 +1,14 @@ 2006-09-15 Carlos Garnacho <carlosg@gnome.org> + * UsersConfig.pm, GroupsConfig.pm, Users/Users.pm, Users/Groups.pm: + add an independent identification number to users and groups, this + number should not be modified in the other communication side (GID + and UID can be changed) and new users/groups should have different ID + numbers (ideally counting from the current max ID number). Fixes the + case described in GNOME bug #342293. + +2006-09-15 Carlos Garnacho <carlosg@gnome.org> + * Init/Services.pm: code improvements to the BSD, RCng and suse init types code. diff --git a/GroupsConfig.pm b/GroupsConfig.pm index 1eb9f79..650cd43 100644 --- a/GroupsConfig.pm +++ b/GroupsConfig.pm @@ -44,8 +44,8 @@ sub new return $self; } -dbus_method ("get", [], [[ "array", [ "struct", "string", "string", "int32", [ "array", "string" ]]], "int32", "int32" ]); -dbus_method ("set", [[ "array", [ "struct", "string", "string", "int32", [ "array", "string" ]]], "int32", "int32" ], []); +dbus_method ("get", [], [[ "array", [ "struct", "uint32", "string", "string", "int32", [ "array", "string" ]]], "int32", "int32" ]); +dbus_method ("set", [[ "array", [ "struct", "uint32", "string", "string", "int32", [ "array", "string" ]]], "int32", "int32" ], []); dbus_signal ("changed", []); sub get diff --git a/Users/Groups.pm b/Users/Groups.pm index c5e912e..118ad66 100644 --- a/Users/Groups.pm +++ b/Users/Groups.pm @@ -25,10 +25,10 @@ package Users::Groups; # enum like for verbose group array positions -my $LOGIN = 0; -my $PASSWD = 1; -my $GID = 2; -my $USERS = 3; +my $LOGIN = 1; +my $PASSWD = 2; +my $GID = 3; +my $USERS = 4; # quite generic data $group_names = "/etc/group"; @@ -166,10 +166,9 @@ sub change_group sub get { my ($ifh, @groups, $group_last_modified); - my (@line, $copy, @a); - - # Find the file. + my (@line, $copy, @a, $counter); + $counter = 1; $ifh = &Utils::File::open_read_from_names($group_names); return unless ($ifh); @@ -182,13 +181,14 @@ sub get # FreeBSD allows comments in the group file. */ next if &Utils::Util::ignore_line ($_); - $_ = &Utils::XML::unquote ($_); @line = split ':', $_, -1; + unshift @line, $counter; @a = split ',', pop @line; push @line, [@a]; $copy = [@line]; push (@groups, $copy); + $counter++; } &Utils::File::close_file ($ifh); @@ -219,14 +219,14 @@ sub set foreach $i (@$config) { - $groups{$$i[$LOGIN]} |= 1; - $config_hash{$$i[$LOGIN]} = $i; + $groups{$$i[0]} |= 1; + $config_hash{$$i[0]} = $i; } foreach $i (@$old_config) { - $groups{$$i[$LOGIN]} |= 2; - $old_config_hash{$$i[$LOGIN]} = $i; + $groups{$$i[0]} |= 2; + $old_config_hash{$$i[0]} = $i; } # Delete all groups that only appeared in the old configuration diff --git a/Users/Users.pm b/Users/Users.pm index 304f1cb..edf6c98 100644 --- a/Users/Users.pm +++ b/Users/Users.pm @@ -73,13 +73,14 @@ $cmd_chfn = &Utils::File::locate_tool ("chfn"); $cmd_pw = &Utils::File::locate_tool ("pw"); # enum like for verbose group array positions -my $LOGIN = 0; -my $PASSWD = 1; -my $UID = 2; -my $GID = 3; -my $COMMENT = 4; -my $HOME = 5; -my $SHELL = 6; +my $ID = 0; +my $LOGIN = 1; +my $PASSWD = 2; +my $UID = 3; +my $GID = 4; +my $COMMENT = 5; +my $HOME = 6; +my $SHELL = 7; %login_defs_prop_map = (); %profiles_prop_map = (); @@ -373,9 +374,10 @@ sub get_logindefs sub get { my ($ifh, @users, %users_hash); - my (@line, @users); + my (@line, @users, $counter); # Find the passwd file. + $counter = 1; $ifh = &Utils::File::open_read_from_names(@passwd_names); return unless ($ifh); @@ -386,6 +388,8 @@ sub get next if &Utils::Util::ignore_line ($_); @line = split ':', $_, -1; + unshift @line, $counter; + $counter++; $login = $line[$LOGIN]; @comment = split ',', $line[$COMMENT], 5; diff --git a/UsersConfig.pm b/UsersConfig.pm index 6107cdd..3277db5 100644 --- a/UsersConfig.pm +++ b/UsersConfig.pm @@ -46,10 +46,10 @@ sub new } dbus_method ("get", [], - [[ "array", [ "struct", "string", "string", "int32", "int32", [ "array", "string"], "string", "string" ]], + [[ "array", [ "struct", "uint32", "string", "string", "int32", "int32", [ "array", "string"], "string", "string" ]], ["array", "string" ], "int32", "int32", "int32", "string", "string", "int32" ]); dbus_method ("set", - [[ "array", [ "struct", "string", "string", "int32", "int32", [ "array", "string"], "string", "string" ]], + [[ "array", [ "struct", "uint32", "string", "string", "int32", "int32", [ "array", "string"], "string", "string" ]], ["array", "string" ], "int32", "int32", "int32", "string", "string", "int32" ], []); dbus_signal ("changed", []); |