Author: kmachalkova Date: Mon Dec 1 13:07:40 2008 New Revision: 53762 URL: http://svn.opensuse.org/viewcvs/yast?rev=53762&view=rev Log: jreidinger's patch for multiline rules/aliases (#449768) Modified: trunk/sudo/agents/ag_etc_sudoers Modified: trunk/sudo/agents/ag_etc_sudoers URL: http://svn.opensuse.org/viewcvs/yast/trunk/sudo/agents/ag_etc_sudoers?rev=53762&r1=53761&r2=53762&view=diff ============================================================================== --- trunk/sudo/agents/ag_etc_sudoers (original) +++ trunk/sudo/agents/ag_etc_sudoers Mon Dec 1 13:07:40 2008 @@ -32,21 +32,32 @@ } my $comment = ""; + my $line = ""; while (<INFILE>) { chomp; - if (/^\s*$/ || /^#/) { + $line .= $_; + #a line is a comment + if ($line =~ m/^\s*$/ || $line =~ m/^#/) { $comment .= "$_\n"; + $line = ""; next; } + #a line is \-terminated multiline rule/alias + #save it and continue on the next line + if ($line =~ m/^(.*)\\$/){ + $line = $1; + next; + } + my $alias = ""; my @entry2 = (); - if (/^(\S+)\s+(\S+)\s*=\s*([^#]*)/) { + if ($line =~ m/^(\S+)\s+(\S+)\s*=\s*([^#]*)/) { $alias =$1; push(@entry2, $comment, $alias, $2, $3); } - elsif (/^(\S+)\s+(\S+)/) { + elsif ($line =~ m/^(\S+)\s+(\S+)/) { $alias =$1; push(@entry2, $comment, $alias, $2); } @@ -54,6 +65,7 @@ push (@data2, \@entry2); $comment = ""; + $line = ""; } close (INFILE); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org