[Serusers] Mysql Problem

Victor Pascual Ávila victor.pascual.avila at gmail.com
Thu May 22 22:31:24 CEST 2008


Hi,

On Thu, May 22, 2008 at 10:17 PM, vijay tiwari <vijay11tiwari at yahoo.com> wrote:
> problem is when i am  putting any other user and password which is not in
> the database that also got register. so it is normal?

Please, check if you allow only authenticated users to be registered.

Source: http://www.iptel.org/file_standard

route[REGISTRAR]
{
    # if the request is a REGISTER lets take care of it
    if (method=="REGISTER") {
        # check if the REGISTER if for one of our local domains
        if (!$t.did) {
            sl_reply("403", "Register forwarding forbidden");
            drop;
        }

        # we want only authenticated users to be registered
        if (!www_authenticate("$fd.digest_realm", "credentials")) {
            if ($? == -2) {
                sl_reply("500", "Internal Server Error");
            } else if ($? == -3) {
                sl_reply("400", "Bad Request");
            } else {
                if ($digest_challenge) {
                    append_to_reply("%$digest_challenge");
                }
                sl_reply("401", "Unauthorized");
            }
            drop;
        }

        # check if the authenticated user is the same as the target user
        if (!lookup_user("$tu.uid", "@to.uri")) {
            sl_reply("404", "Unknown user in To");
            drop;
        }

        if ($f.uid != $t.uid) {
            sl_reply("403", "Authentication and To-Header mismatch");
            drop;
        }

        # check if the authenticated user is the same as the request originator
        # you may uncomment it if you care, what uri is in From header
        #if (!lookup_user("$fu.uid", "@from.uri")) {
        #    sl_reply("404", "Unknown user in From");
        #    drop;
        #}
        #if ($fu.uid != $tu.uid) {
        #    sl_reply("403", "Authentication and From-Header mismatch");
        #    drop;
        #}

        # everyhting is fine so lets store the binding
        if (!save_contacts("location")) {
            sl_reply("400", "Invalid REGISTER Request");
            drop;
        }
        drop;
    }
}

Cheers,
-- 
Victor Pascual Ávila


More information about the sr-users mailing list