<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I know nothing about C coding so I may be very wide of the mark, but
rather than accurately output an error condition, can it not be
worked round? I noticed when rebooting I got an fstab warning that
to effectively say that the last line terminated in an eof rather
than eol, but it was only a warning and the mount worked. Presumably
the condition has been coded round in the mount command.<br>
<br>
Regards,<br>
<br>
Nick<br>
<br>
<div class="moz-cite-prefix">On 08/01/2013 19:57, Philippe Vouters
wrote:<br>
</div>
<blockquote cite="mid:50EC7A0D.2000902@laposte.net" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Wes,<br>
<br>
As per Paul's suggestion, I did:<br>
[root@victor C]# ls
/etc/ipsec.d/*.conf
/etc/ipsec.d/ipsec.unmanaged.david.conf<br>
/etc/ipsec.d/ipsec.unmanaged.mumin.conf<br>
/etc/ipsec.d/ipsec.unmanaged.paulin.conf<br>
/etc/ipsec.d/vouters.conf<br>
[root@victor C]# <b>echo -n " ikelifetime=1h" >>
/etc/ipsec.d/ipsec.unmanaged.paulin.conf</b><br>
[root@victor C]# od -a
/etc/ipsec.d/ipsec.unmanaged.paulin.conf
0000000 c o n n sp p a u l i n nl sp
a u t<br>
0000020 o = a d d nl sp t y p e = t
u n n<br>
0000040 e l nl sp a u t h b y = s e
c r e<br>
0000060 t nl sp r i g h t = % a n y nl
sp l<br>
0000100 e f t = % d e f a u l t r
o u t<br>
0000120 e nl sp l e f t s u b n e t
= 1 9<br>
0000140 2 . 1 6 8 . 1 . 0 / 2 4 nl
sp l e<br>
0000160 f t s o u r c e i p = 1 9
2 . 1<br>
0000200 6 8 . 1 . 2 nl sp r i g h t
s u b<br>
0000220 n e t = 1 9 2 . 1 6 8 . 3
0 . 0<br>
0000240 / 2 4 nl sp l e f t i d = @
N i c<br>
0000260 k - P a u l nl sp i k e = a
e s 2<br>
0000300 5 6 - s h a 1 nl sp p h a s
e 2 a<br>
0000320 l g = a e s 2 5 6 nl sp d p
d t i<br>
0000340 m e o u t = 1 2 0 nl sp d p
d d e<br>
0000360 l a y = 3 0 nl sp d p d a c
t i o<br>
0000400 n = r e s t a r t _ b y _
p e e<br>
0000420 r nl sp s a l i f e t i m e
= 1 h<br>
0000440 nl sp i k e l i f e t i m e
= 1 h<br>
0000460<br>
[root@victor C]# exit<br>
exit<br>
<br>
<b>This parser.l code:</b><br>
<<EOF>> {<br>
if(parser_y_eof()) {<br>
yyterminate();<br>
}<br>
if (stacktop->file != NULL) {<br>
yyterminate();<br>
}<br>
}<br>
<b>generates:</b><br>
[philippe@victor C]$ sudo /usr/local/sbin/ipsec addconn
--autoall<br>
can not load config '/etc/ipsec.conf':
/etc/ipsec.d/vouters.conf:1: syntax error, unexpected CONN,
expecting EOL [conn]<br>
[philippe@victor C]$ <br>
[philippe@victor C]$ sudo /usr/local/sbin/ipsec addconn
--checkconfig<br>
can not load config '/etc/ipsec.conf':
/etc/ipsec.d/vouters.conf:1: syntax error, unexpected CONN,
expecting EOL [conn]<br>
[philippe@victor C]$ <br>
[philippe@victor C]$ sudo systemctl restart ipsec.service<br>
Job failed. See system journal and 'systemctl status' for
details.<br>
[philippe@victor C]$ sudo systemctl status ipsec.service<br>
ipsec.service - Internet Key Exchange (IKE) Protocol Daemon for
IPsec<br>
Loaded: loaded (/usr/lib/systemd/system/ipsec.service;
disabled)<br>
Active: inactive (dead)<br>
CGroup: name=systemd:/system/ipsec.service<br>
<br>
Jan 08 20:26:14 victor.vouters.dyndns.org pluto[26425]: | crl
list locked by ...<br>
Jan 08 20:26:14 victor.vouters.dyndns.org pluto[26425]: | crl
list unlocked b...<br>
Jan 08 20:26:14 victor.vouters.dyndns.org pluto[26425]: shutting
down interfa...<br>
Jan 08 20:26:14 victor.vouters.dyndns.org pluto[26425]: shutting
down interfa...<br>
Jan 08 20:26:14 victor.vouters.dyndns.org pluto[26425]: shutting
down interfa...<br>
Jan 08 20:26:14 victor.vouters.dyndns.org pluto[26425]: shutting
down interfa...<br>
Jan 08 20:26:14 victor.vouters.dyndns.org pluto[26425]: shutting
down interfa...<br>
Jan 08 20:26:14 victor.vouters.dyndns.org ipsec[29528]: 002
shutting down<br>
Jan 08 20:26:16 victor.vouters.dyndns.org ipsec[29557]: can not
load config '...<br>
Jan 08 20:26:16 victor.vouters.dyndns.org ipsec[29561]: can not
load config '...<br>
[philippe@victor C]$ <br>
And pluto did NOT crashed because it did not start, addcon
--checkconfig returning an execution error before.<br>
<br>
So this fix sounds sane, although the error message can
eventually be made more accurate outputting the correct file
name where the EOF at EOL condition is found.<br>
<br>
<b>Best fix that I shall git commit:</b><br>
<<EOF>> {<br>
if(parser_y_eof()) {<br>
yyterminate();<br>
}<br>
if (stacktop->file != NULL) {<br>
fprintf(stderr,"ERROR: EOF at EOL condition found in
%s\n",<br>
stacktop->fileglob.gl_pathv[stacktop->fileglobcnt]);<br>
yyterminate();<br>
}<br>
}<br>
<b>This produces:</b><br>
<br>
[philippe@victor C]$ sudo /usr/local/sbin/ipsec addconn
--checkconfig<br>
ERROR: EOF at EOL condition found in
/etc/ipsec.d/ipsec.unmanaged.paulin.conf<br>
[philippe@victor C]$ <br>
<br>
<b>So the very accurate error message.</b><br>
<br>
<pre class="moz-signature" cols="72">Philippe Vouters (Fontainebleau/France)
URL: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://vouters.dyndns.org/">http://vouters.dyndns.org/</a>
SIP: <a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:sip:Vouters@sip.linphone.org">sip:Vouters@sip.linphone.org</a></pre>
Le 08/01/2013 20:08, Paul Wouters a écrit :<br>
</div>
<blockquote
cite="mid:alpine.LFD.2.03.1301081408050.9238@nohats.ca"
type="cite">On Tue, 8 Jan 2013, Philippe Vouters wrote: <br>
<br>
<blockquote type="cite">I have been trying to create an EOF at
EOL condition. I can't succeed with /usr/bin/vi, /usr/bin/vim
and gedit. All these editors call printf("\n") at the last
line and before exiting. Which editor did you use to create
such a condition leading to your test case ? <br>
<br>
I'd like to thoroughly test my code suggestion to parser.l
before I git commit. <br>
</blockquote>
<br>
echo -n "foo" > filename <br>
<br>
Paul <br>
<br>
</blockquote>
<br>
</blockquote>
<br>
</body>
</html>