[JDEV] Using v2 queries with xdb_sql

Benoit Decaudin benoit.decaudin at terravirtual.net
Thu Sep 26 13:06:35 CDT 2002


Hello.

I'm trying to bypass the built-in v1 querydefs for "auth-set", "auth-get",
and the "0k" stuff related to these queries. I have successfully (!?)
removed the code associated with these querydefs, and I wrote to the
configuration file the new querydefs. I can now successfully login to the
server, but I encounter two issues :

- The password is always in plain text, because the server never replies the
0k tags ;
- the users are not stored in the database.

Here are the querydefs :

<querydef name="auth-get" dtd="2" type="get" namespace="jabber:iq:auth">
<text>SELECT password FROM users WHERE username = '$$user$$'</text>
<user>$$user$$</user>
<top-result>
<logon/>
</top-result>
<bindcol tag="password" offset="0"/>
</querydef>

<querydef name="auth-set" dtd="2" type="set" namespace="jabber:iq:auth">
<text>UPDATE users SET password = '$$p$$' WHERE username = '$$user$$'</text>
<user>$$user$$</user>
<bindvar attrib="password">$$p$$</bindvar>
</querydef>

<querydef name="auth-set-new" dtd="2" type="set" namespace="jabber:iq:auth">
<text>INSERT INTO users (username, password) VALUES ('$$jid$$',
'$$pass$$')</text>
<user>$$jid$$</user>
<bindvar attrib="password">$$pass$$</bindvar>
</querydef>

<querydef name="auth0k-get" dtd="2" type="get"
namespace="jabber:iq:auth:0k">
<text>SELECT hash, token, sequence FROM users0k WHERE username =
'$$username$$'</text>
<user>$$username$$</user>
<bindcol tag="hash" offset="0"/>
<bindcol tag="token" offset="1"/>
<bindcol tag="sequence" offset="2"/>
</querydef>

<querydef name="auth0k-set" dtd="2" type="set"
namespace="jabber:iq:auth:0k">
<text>INSERT INTO users0k (username, hash, token, sequence) VALUES
('$$username$$', '$$hash$$', '$$token$$', '$$sequence$$')</text>
<user>$$username$$</user>
<bindvar attrib="hash">$$hash$$</bindvar>
<bindvar attrib="token">$$token$$</bindvar>
<bindvar attrib="sequence">$$sequence$$</bindvar>
</querydef>

Any idea will be more than welcome :)

Benoît




More information about the JDev mailing list