<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">This code is even wrong as crypt may
return NULL. <br>
It should read:<br>
if ( <b>cp && </b>strcmp(cp, szpass) == 0)<br>
{<br>
/* we have a winner */<br>
fclose( fp );<br>
pthread_mutex_unlock(&crypt_mutex);<br>
return TRUE;<br>
}<br>
rather than:<br>
if ( strcmp(cp, szpass) == 0)<br>
{<br>
/* we have a winner */<br>
fclose( fp );<br>
pthread_mutex_unlock(&crypt_mutex);<br>
return TRUE;<br>
}<br>
<br>
<br>
<pre class="moz-signature" cols="72">Philippe Vouters (Fontainebleau/France)
URL: <a class="moz-txt-link-freetext" href="http://vouters.dyndns.org/">http://vouters.dyndns.org/</a>
SIP: <a class="moz-txt-link-abbreviated" href="mailto:sip:Vouters@sip.linphone.org">sip:Vouters@sip.linphone.org</a></pre>
Le 07/03/2013 09:56, Philippe Vouters a écrit :<br>
</div>
<blockquote cite="mid:5138562E.9020302@laposte.net" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
#include "crypto.h" /* requires sha1.h and md5.h */<br>
#include "ike_alg.h"<br>
<br>
#include "xauth.h"<br>
#include "virtual.h"<br>
<br>
static stf_status<br>
modecfg_inI2(struct msg_digest *md);<br>
<br>
char pwdfile[PATH_MAX];<br>
<b>pthread_mutex_t crypt_mutex = PTHREAD_MUTEX_INITIALIZER;</b><br>
<br>
extern bool encrypt_message(pb_stream *pbs, struct state *st); /*
forward declaration */<br>
<br>
typedef struct<br>
{<br>
int in_use;<br>
struct state *st;<br>
sigjmp_buf jbuf;<br>
} st_jbuf_t;<br>
...<br>
<br>
{<br>
char *cp;<br>
<br>
<b>pthread_mutex_lock(&crypt_mutex);</b><br>
#if defined(__CYGWIN32__)<br>
/* password is in the clear! */<br>
cp = (char *)arg->password.ptr;<br>
#else<br>
/* keep the passwords using whatever utilities we have
*/<br>
cp = crypt( (char *)arg->password.ptr, szpass);<br>
#endif<br>
<br>
if(DBGP(DBG_CRYPT))<br>
{<br>
DBG_log("XAUTH: checking user(%s:%s) pass %s vs
%s" , szuser, szconnid, cp, szpass);<br>
}<br>
else<br>
{<br>
libreswan_log("XAUTH: checking user(%s:%s) " ,
szuser, szconnid);<br>
}<br>
<br>
/* Ok then now password check */<br>
if ( strcmp(cp, szpass) == 0)<br>
{<br>
/* we have a winner */<br>
fclose( fp );<br>
<b>pthread_mutex_unlock(&crypt_mutex);</b><br>
return TRUE;<br>
}<br>
libreswan_log("XAUTH: nope");<br>
<b>pthread_mutex_unlock(&crypt_mutex);</b><br>
}<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>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Swan mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Swan@lists.libreswan.org">Swan@lists.libreswan.org</a>
<a class="moz-txt-link-freetext" href="https://lists.libreswan.org/mailman/listinfo/swan">https://lists.libreswan.org/mailman/listinfo/swan</a>
</pre>
</blockquote>
<br>
</body>
</html>