About how to properly obtain a signature from LIBDSPAM 3.10.x

Helio Luchtenberg Jr <[email protected]> Fri, 22 Aug 2014 11:19:35 -0300
Newsgroups gmane.mail.spam.dspam.devel
Message-ID <CAPAq1=kEx1HGb1C80WvtaDqdSf6KRcrG_jQ_XwHVqS28tLZ_9g@mail.gmail.com>
--===============6250445707482447940==
Content-Type: multipart/alternative; boundary=001a11c32efadcc75805013886dd

--001a11c32efadcc75805013886dd
Content-Type: text/plain; charset=UTF-8

Hi folks,

in the documentation I have found the example04:

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
CTX = dspam_create (USERNAME, NULL, dspam_home, DSM_CLASSIFY,//DSM_PROCESS
DSF_SIGNATURE| DSF_NOISE); ( ... some more code ...) if (CTX->signature ==
NULL) { printf ("No signature provided\n"); } else { /* Copy to a safe
place */ SIG.data = malloc (CTX->signature->length); if (SIG.data != NULL)
memcpy (SIG.data, CTX->signature->data, CTX->signature->length); } SIG.
length = CTX->signature->length;
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

but when I try to print out what the signature is (as pure text, a char
array):

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

printf("Signature returned by dspam= %s",CTX->signature);

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

it prints unrecognisable characters and the strlen(CTX->signature) returns 0

How can I get the signature from DSPAM, using LIBDSPAM?

Helio Luchtenberg Junior.

--001a11c32efadcc75805013886dd
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi folks,<div><br></div><div>in the documentation I have f=
ound the example04:</div><div><br></div><div>------------------------------=
---------------------------------------------------------------------------=
---------------------------------------------------------------------------=
-----</div>
<div><table class=3D"" style=3D"border-collapse:collapse;border-spacing:0px=
;border-bottom-left-radius:3px;border-bottom-right-radius:3px;color:rgb(51,=
51,51);font-family:Helvetica,arial,freesans,clean,sans-serif,&#39;Segoe UI =
Emoji&#39;,&#39;Segoe UI Symbol&#39;;font-size:13px;line-height:18.20000076=
2939453px;background-image:initial;background-repeat:initial">
<tbody><tr></tr><tr><td id=3D"LC165" class=3D"" style=3D"padding:0px 10px;o=
verflow:visible"><font face=3D"Consolas, Liberation Mono, Menlo, Courier, m=
onospace"><span style=3D"font-size:12px;white-space:pre">  CTX =3D dspam_cr=
eate (USERNAME, NULL,  dspam_home, DSM_CLASSIFY,//DSM_PROCESS
				DSF_SIGNATURE| DSF_NOISE);
</span></font><span class=3D"" style=3D"font-family:Consolas,&#39;Liberatio=
n Mono&#39;,Menlo,Courier,monospace;font-size:12px;white-space:pre;font-wei=
ght:bold">( ... some more code ...)

if</span> <span class=3D"" style=3D"font-family:Consolas,&#39;Liberation Mo=
no&#39;,Menlo,Courier,monospace;font-size:12px;white-space:pre">(</span><sp=
an class=3D"" style=3D"font-family:Consolas,&#39;Liberation Mono&#39;,Menlo=
,Courier,monospace;font-size:12px;white-space:pre">CTX</span><span class=3D=
"" style=3D"font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,mo=
nospace;font-size:12px;white-space:pre;font-weight:bold">-&gt;</span><span =
class=3D"" style=3D"font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Co=
urier,monospace;font-size:12px;white-space:pre">signature</span> <span clas=
s=3D"" style=3D"font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courie=
r,monospace;font-size:12px;white-space:pre;font-weight:bold">=3D=3D</span> =
<span class=3D"" style=3D"font-family:Consolas,&#39;Liberation Mono&#39;,Me=
nlo,Courier,monospace;font-size:12px;white-space:pre;color:rgb(0,134,179)">=
NULL</span><span class=3D"" style=3D"font-family:Consolas,&#39;Liberation M=
ono&#39;,Menlo,Courier,monospace;font-size:12px;white-space:pre">)</span></=
td>
</tr><tr><td id=3D"L166" class=3D"" style=3D"padding:0px 9px;width:42px;fon=
t-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-he=
ight:18px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;bo=
rder-right-width:1px;border-right-style:solid;border-right-color:rgb(238,23=
8,238)">
</td><td id=3D"LC166" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible"><span class=3D"">  {</span></td></tr><tr><td i=
d=3D"L167" class=3D"" style=3D"padding:0px 9px;width:42px;font-family:Conso=
las,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-height:18px;colo=
r:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;border-right-wid=
th:1px;border-right-style:solid;border-right-color:rgb(238,238,238)">
</td><td id=3D"LC167" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">    <span class=3D"">printf</span> <span class=
=3D"">(</span><span class=3D"" style=3D"color:rgb(221,17,68)">&quot;No sign=
ature provided</span><span class=3D"" style=3D"color:rgb(221,17,68)">\n</sp=
an><span class=3D"" style=3D"color:rgb(221,17,68)">&quot;</span><span class=
=3D"">);</span></td>
</tr><tr><td id=3D"L168" class=3D"" style=3D"padding:0px 9px;width:42px;fon=
t-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-he=
ight:18px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;bo=
rder-right-width:1px;border-right-style:solid;border-right-color:rgb(238,23=
8,238)">
</td><td id=3D"LC168" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">  <span class=3D"">}</span></td></tr><tr><td i=
d=3D"L169" class=3D"" style=3D"padding:0px 9px;width:42px;font-family:Conso=
las,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-height:18px;colo=
r:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;border-right-wid=
th:1px;border-right-style:solid;border-right-color:rgb(238,238,238)">
</td><td id=3D"LC169" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">  <span class=3D"" style=3D"font-weight:bold">=
else</span></td>
</tr><tr><td id=3D"L170" class=3D"" style=3D"padding:0px 9px;width:42px;fon=
t-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-he=
ight:18px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;bo=
rder-right-width:1px;border-right-style:solid;border-right-color:rgb(238,23=
8,238)">
</td><td id=3D"LC170" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">  <span class=3D"">{</span></td></tr><tr><td i=
d=3D"L171" class=3D"" style=3D"padding:0px 9px;width:42px;font-family:Conso=
las,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-height:18px;colo=
r:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;border-right-wid=
th:1px;border-right-style:solid;border-right-color:rgb(238,238,238)">
</td><td id=3D"LC171" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">    <span class=3D"" style=3D"color:rgb(153,15=
3,136);font-style:italic">/* Copy to a safe place */</span></td>
</tr><tr><td id=3D"L172" class=3D"" style=3D"padding:0px 9px;width:42px;fon=
t-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-he=
ight:18px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;bo=
rder-right-width:1px;border-right-style:solid;border-right-color:rgb(238,23=
8,238)">
</td><td id=3D"LC172" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">
</td></tr><tr><td id=3D"L173" class=3D"" style=3D"padding:0px 9px;width:42p=
x;font-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;li=
ne-height:18px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:rig=
ht;border-right-width:1px;border-right-style:solid;border-right-color:rgb(2=
38,238,238)">
</td><td id=3D"LC173" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">    <span class=3D"">SIG</span><span class=3D"=
">.</span><span class=3D"">data</span> <span class=3D"" style=3D"font-weigh=
t:bold">=3D</span> <span class=3D"">malloc</span> <span class=3D"">(</span>=
<span class=3D"">CTX</span><span class=3D"" style=3D"font-weight:bold">-&gt=
;</span><span class=3D"">signature</span><span class=3D"" style=3D"font-wei=
ght:bold">-&gt;</span><span class=3D"">length</span><span class=3D"">);</sp=
an></td>
</tr><tr><td id=3D"L174" class=3D"" style=3D"padding:0px 9px;width:42px;fon=
t-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-he=
ight:18px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;bo=
rder-right-width:1px;border-right-style:solid;border-right-color:rgb(238,23=
8,238)">
</td><td id=3D"LC174" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">    <span class=3D"" style=3D"font-weight:bold=
">if</span> <span class=3D"">(</span><span class=3D"">SIG</span><span class=
=3D"">.</span><span class=3D"">data</span> <span class=3D"" style=3D"font-w=
eight:bold">!=3D</span> <span class=3D"" style=3D"color:rgb(0,134,179)">NUL=
L</span><span class=3D"">)</span></td>
</tr><tr><td id=3D"L175" class=3D"" style=3D"padding:0px 9px;width:42px;fon=
t-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-he=
ight:18px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;bo=
rder-right-width:1px;border-right-style:solid;border-right-color:rgb(238,23=
8,238)">
</td><td id=3D"LC175" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">      <span class=3D"">memcpy</span> <span cla=
ss=3D"">(</span><span class=3D"">SIG</span><span class=3D"">.</span><span c=
lass=3D"">data</span><span class=3D"">,</span> <span class=3D"">CTX</span><=
span class=3D"" style=3D"font-weight:bold">-&gt;</span><span class=3D"">sig=
nature</span><span class=3D"" style=3D"font-weight:bold">-&gt;</span><span =
class=3D"">data</span><span class=3D"">,</span> <span class=3D"">CTX</span>=
<span class=3D"" style=3D"font-weight:bold">-&gt;</span><span class=3D"">si=
gnature</span><span class=3D"" style=3D"font-weight:bold">-&gt;</span><span=
 class=3D"">length</span><span class=3D"">);</span></td>
</tr><tr><td id=3D"L176" class=3D"" style=3D"padding:0px 9px;width:42px;fon=
t-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-he=
ight:18px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;bo=
rder-right-width:1px;border-right-style:solid;border-right-color:rgb(238,23=
8,238)">
</td><td id=3D"LC176" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">  <span class=3D"">}</span></td></tr><tr><td i=
d=3D"L177" class=3D"" style=3D"padding:0px 9px;width:42px;font-family:Conso=
las,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-height:18px;colo=
r:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;border-right-wid=
th:1px;border-right-style:solid;border-right-color:rgb(238,238,238)">
</td><td id=3D"LC177" class=3D"" style=3D"padding:0px 10px;font-family:Cons=
olas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;font-size:12px;white=
-space:pre;overflow:visible">  <span class=3D"">SIG</span><span class=3D"">=
.</span><span class=3D"">length</span> <span class=3D"" style=3D"font-weigh=
t:bold">=3D</span> <span class=3D"">CTX</span><span class=3D"" style=3D"fon=
t-weight:bold">-&gt;</span><span class=3D"">signature</span><span class=3D"=
" style=3D"font-weight:bold">-&gt;</span><span class=3D"">length</span><spa=
n class=3D"">;</span></td>
</tr><tr><td id=3D"L178" class=3D"" style=3D"padding:0px 9px;width:42px;fon=
t-family:Consolas,&#39;Liberation Mono&#39;,Menlo,Courier,monospace;line-he=
ight:18px;color:rgba(0,0,0,0.298039);vertical-align:top;text-align:right;bo=
rder-right-width:1px;border-right-style:solid;border-right-color:rgb(238,23=
8,238)">
</td></tr></tbody></table><br></div><div>----------------------------------=
---------------------------------------------------------------------------=
---------------------------------------------------------------------------=
-<br>
</div><div><br></div><div>but when I try to print out what the signature is=
 (as pure text, a char array):</div><div><br></div><div>-------------------=
---------------------------------------------------------------------------=
---------------------------------------------------------------------------=
----------------<br>
</div><div><br></div><div>printf(&quot;Signature returned by dspam=3D %s&qu=
ot;,CTX-&gt;signature);<br></div><div><br></div><div>----------------------=
---------------------------------------------------------------------------=
---------------------------------------------------------------------------=
-------------<br>
</div><div><br></div><div>it prints unrecognisable characters and the strle=
n(CTX-&gt;signature) returns 0</div><div><br></div><div>How can I get the s=
ignature from DSPAM, using LIBDSPAM?</div><div><br></div><div>Helio Luchten=
berg Junior.</div>
</div>

--001a11c32efadcc75805013886dd--


--===============6250445707482447940==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
--===============6250445707482447940==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Dspam-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspam-devel

--===============6250445707482447940==--