Author: jsuchome Date: Fri Nov 27 16:28:42 2009 New Revision: 59830 URL: http://svn.opensuse.org/viewcvs/yast?rev=59830&view=rev Log: - preserve case of keys in smb.conf (bnc#555579) - 2.19.1 Modified: trunk/samba-client/VERSION trunk/samba-client/agents/cfg_smbconf.scr trunk/samba-client/package/yast2-samba-client.changes trunk/samba-client/src/SambaConfig.pm Modified: trunk/samba-client/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/VERSION?rev=59830&r1=59829&r2=59830&view=diff ============================================================================== --- trunk/samba-client/VERSION (original) +++ trunk/samba-client/VERSION Fri Nov 27 16:28:42 2009 @@ -1 +1 @@ -2.19.0 +2.19.1 Modified: trunk/samba-client/agents/cfg_smbconf.scr URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/agents/cfg_smbconf.scr?rev=59830&r1=59829&r2=59830&view=diff ============================================================================== --- trunk/samba-client/agents/cfg_smbconf.scr (original) +++ trunk/samba-client/agents/cfg_smbconf.scr Fri Nov 27 16:28:42 2009 @@ -4,7 +4,7 @@ `ag_ini( `IniAgent("/etc/samba/smb.conf", $[ - "options" : [ "no_nested_sections", "ignore_case", "line_can_continue", "comments_last", "repeat_names" ], + "options" : [ "no_nested_sections", "ignore_case_regexps", "line_can_continue", "comments_last", "repeat_names" ], "comments": [ "^[ \t]*$", // empty line "^[ \t]+[;#].*$", // comment char is not first char Modified: trunk/samba-client/package/yast2-samba-client.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/package/yast2-samba-client.changes?rev=59830&r1=59829&r2=59830&view=diff ============================================================================== --- trunk/samba-client/package/yast2-samba-client.changes (original) +++ trunk/samba-client/package/yast2-samba-client.changes Fri Nov 27 16:28:42 2009 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Tue Nov 24 10:51:19 CET 2009 - jsuchome@suse.cz + +- preserve case of keys in smb.conf (bnc#555579) +- 2.19.1 + +------------------------------------------------------------------- Thu Nov 19 09:43:02 CET 2009 - jsuchome@suse.cz - install pam_mount if necessary (bnc#552211) Modified: trunk/samba-client/src/SambaConfig.pm URL: http://svn.opensuse.org/viewcvs/yast/trunk/samba-client/src/SambaConfig.pm?rev=59830&r1=59829&r2=59830&view=diff ============================================================================== --- trunk/samba-client/src/SambaConfig.pm (original) +++ trunk/samba-client/src/SambaConfig.pm Fri Nov 27 16:28:42 2009 @@ -35,6 +35,8 @@ my %WinbindConfig; # configuration hash for /etc/security/pam_winbind.conf +my %OriginalKeys; # saving original names of smb.conf keys + ########################################################################### # global (static) variables (constants) @@ -171,6 +173,7 @@ # forget previous configuration %Config = (); + %OriginalKeys = (); # read the complete global section my $AllAtOnce = SCR->Read(".etc.smb.all"); @@ -193,16 +196,26 @@ next if $line->{kind} ne "value"; next if $line->{type} and not $section->{type}; # commented line - if (defined $Config{$share}{$line->{name}}) { - $self->ShareAddStr($share, $line->{name}, $line->{value}); + my $key = $line->{name}; + if ($key ne lc ($key)) { + # we are lowercasing keys later for simpler comparing, now save those + # which were not in lower case before + $OriginalKeys{$share} = {} if !defined $OriginalKeys{$share}; + $OriginalKeys{$share}{lc ($key)} = $key; + y2debug ("key $key not in lowercase"); + } + + if (defined $Config{$share}{$key}) { + $self->ShareAddStr($share, $key, $line->{value}); } else { - $self->ShareSetStr($share, $line->{name}, $line->{value}); + $self->ShareSetStr($share, $key, $line->{value}); } } } $self->UnsetModified(); y2debug ("Read config: ".Dumper(\%Config)); + y2debug ("original keys: ".Dumper(\%OriginalKeys)); # configuraton already read return 1 if not $forceReRead and %WinbindConfig; @@ -354,9 +367,12 @@ if (ref ($val) ne "ARRAY") { $val = [ String($val) ]; } - SCR->Write(".etc.smb.value.global.$key", $val); + # check if key was not changed on read + my $saved_key = $key; + $saved_key = $OriginalKeys{global}{$key} if defined $OriginalKeys{global}{$key}; + SCR->Write(".etc.smb.value.global.$saved_key", $val); # ensure option is not commented - SCR->Write(".etc.smb.value_type.global.$key", [Integer(0)]); + SCR->Write(".etc.smb.value_type.global.$saved_key", [Integer(0)]); } } @@ -393,8 +409,11 @@ if (ref ($val) ne "ARRAY") { $val = [ String($val) ]; } - my $ret1 = SCR->Write(".etc.smb.value.$share.$key", $val); - my $ret = SCR->Write(".etc.smb.value_type.$share.$key", [ Integer($commentout)]); + # check if key was not changed on read + my $saved_key = $key; + $saved_key = $OriginalKeys{$share}{$key} if defined $OriginalKeys{$share}{$key}; + my $ret1 = SCR->Write(".etc.smb.value.$share.$saved_key", $val); + my $ret = SCR->Write(".etc.smb.value_type.$share.$saved_key", [ Integer($commentout)]); } }; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org