<br><div class="gmail_quote">Hi Dan,<br><div class="HOEnZb"><div class="h5"><div class="gmail_quote"><br>Thanks a lot for your reply. I dont need to implement a email server. I just need to wirte my own mechanism just like PLAIN. For this I renamed mech name to something like "sample-mech" and compiled it added the corresponding .so files in /usr/lib64/sasl2. I gave the command "sasl2-shared-mechlist" i get Available mechanisms: sample-mech. <b>Everything is ok till now.</b><br>
<br><span style="background-color:rgb(255,0,0)">A small change I tried the above editing plain.c and the below explanation is about my own file (sample-mech.c).</span><br>
<br><b>I tried creating a sample-mech.c and compiled it and copied the .so file to /usr/lib64/sasl2, now when I give the command "sasl2-shared-mechlist". Now the mechanism name is not getting listed as above. What might be the reason for this? Do I need to anything extra while adding a mechanism like this? </b>Please suggest..!<div>
<div><br>
<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 20, 2012 at 11:02 AM, Dan White <span dir="ltr"><<a href="mailto:dwhite@olp.net" target="_blank">dwhite@olp.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On 11/20/12 10:20 +0530, Mathew iprocessor wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
I need to implement SASL in my email client. I downloaded Cyrus-SASL and<br>
installed it. When the client sends the "UserName" and "Password", my<br>
server needs to verify the "UserName" and "Password" and Authenticate it.<br>
The below are some of my doubts, Please clarify.<br>
</blockquote>
<br></div>
See:<br>
<a href="http://www.cyrussasl.org/docs/cyrus-sasl/2.1.25/programming.php" target="_blank">http://www.cyrussasl.org/docs/<u></u>cyrus-sasl/2.1.25/programming.<u></u>php</a><br>
<br>
Within your email client, after you have captured the user's username and<br>
password, you provide a callback to libsasl2 in which you provide that<br>
information to the library, and you will not need to know the details of<br>
how each of the existing mechanisms are implemented, such as PLAIN or<br>
DIGEST-MD5.<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
1) The "sasl2-sample-client" and "sasl2-sample-server" in the "bin"<br>
directories and the "sample-client" and "sample-server" in "sample"<br>
response are different. Where can I get the source code for<br>
"sasl2-sample-server"?<br>
</blockquote>
<br></div>
There are two sets of sample/client applications distributed within the<br>
/sample directory of the source code. To compile both:<br>
<br>
./configure [options]<br>
cd sample<br>
make<br>
make sample-server<br>
make sample-client<div><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2) Once the "Username" and "Password" is passed from client to server, the<br>
server needs to verify the "UserName" and "Password" and authenticate the<br>
client. How to do this in server side? Does "sasl_checkpass" do this or can<br>
you suggest some other best way to achieve the above? CAN YOU PROVIDE SOME<br>
CODE SNIPPETS FOR THIS?<br>
</blockquote>
<br></div>
That depends on the mechanism that was negotiated between the client and<br>
the server. For some mechanisms, such as DIGEST-MD5 and SCRAM, the username<br>
and password are not sent over the wire.<br>
<br>
For the PLAIN and LOGIN mechanisms (and the older user/pass<br>
style of authentication), where the username and password are sent, then<br>
authentication is performed using the configured 'pwcheck_method'. See:<br>
<br>
<a href="http://www.cyrussasl.org/docs/cyrus-sasl/2.1.25/options.php" target="_blank">http://www.cyrussasl.org/docs/<u></u>cyrus-sasl/2.1.25/options.php</a><br>
<br>
Are you also attempting to write an email server?<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
3) I tried testing "sample-client" and "sample-server" and I get the below<br>
response, how to solve this?<br>
<br></div>
*Server Terminal:<div><br>
*<br>
<br>
[root@localhost sample]# ./sample-server -p 8000 -s rcmd -m PLAIN<br>
Forcing use of mechanism PLAIN<br>
Sending list of 1 mechanism(s)<br>
S: UExBSU4=<br>
Waiting for client mechanism...<br>
<br></div>
*Client Terminal:<div><br>
<br>
*<br>
<br>
[root@localhost sample]# ./sample-client -s rcmd -p 8000 -m PLAIN -n<br>
127.0.0.1<br>
service=rcmd<br>
Waiting for mechanism list from server...<br></div>
S: UExBSU4*= Pasted<br>
server Response*<div><br>
recieved 5 byte message<br>
Forcing use of mechanism PLAIN<br>
Choosing best mechanism from: PLAIN<br>
lt-sample-client: SASL Other: No worthy mechs found<br>
error was SASL(-4): no mechanism available: No worthy mechs found<br>
lt-sample-client: Starting SASL negotiation: no mechanism available<br>
</div></blockquote>
<br>
You may not have the appropriate plugins installed. Use 'pluginviewer' or<br>
'saslpluginviewer' on your system to list the available plugins. If you are<br>
missing PLAIN, then you're likely missing some relevant packages (or you've<br>
compiled something wrong).<span><font color="#888888"><br>
<br>
-- <br>
Dan White<br>
</font></span></blockquote></div><br></div>
</div></div></div><br>
</div></div></div><br>