hostkey-rotate, grep and two line search pattern

Roumen Petrov openssh at roumenpetrov.info
Wed Mar 4 04:16:06 AEDT 2015


Hello,

Regression test hostkey-rotate .

After 'learn new primary' known_hosts contain both rsa keys - old and 
new one.
Function check_key_present use awk to get search pattern and script 
return two lines.
In such case Solaris grep command return error 41.
Simple test command:
$ grep '1
 > 2' /tmp/a
grep: RE error 41: No remembered search string.

It is reported in [1] with patch to change grep to fgrep.
As fgrep use "pattern as a list of fixed strings, separated by newlines" 
fgrep could be used to resolve issue.


I would like to propose another correction - change logic of 
check_key_present to search known_hosts for public key.
Attached file implement new search. It use 'fgrep ... > /dev/null'. Also 
'grep -q ..' works well.


Regards,
Roumen Petrov

[1] 
http://www.gossamer-threads.com/lists/openssh/dev/60908?do=post_view_threaded

-- 
Get SSH with X.509 certificate support
http://roumenpetrov.info/openssh/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-regress-hostkey-rotate.sh-rewrite-check_key_present-.patch
Type: text/x-diff
Size: 951 bytes
Desc: not available
URL: <http://lists.mindrot.org/pipermail/openssh-unix-dev/attachments/20150303/76eccd41/attachment-0001.bin>


More information about the openssh-unix-dev mailing list