• Re: Login integration

    From Ragnarok@DOCKSUD to All on Saturday, March 03, 2007 00:59:00
    Beta2K wrote:

    Ok, I'm trying to use e107 (a php based CMS) and having it pull specific aspects from SBBS's webserver, namly the messages bases. I'm trying to
    come up
    with a way of having a single login. I contemplated modifying userdat.c
    to add/remove users from a MySQL database as well as user.dat but that
    looks like
    way too much work. I've thought about doing a export from user.dat to
    MySQL once a hour or maybe more, but don't like that idea (want tighter integration.)

    Anyone got any other ideas, or some encouragement for taking on the more difficult task of doing a synchronous update of user.dat and MySQL?

    thanks,


    Beta
    ---
    ? Synchronet ? Vertrauen ? Home of Synchronet ? telnet://vert.synchro.net
    you can write a webservice with ssjs scripting or a simple auth service
    like :

    load ("sbbsdefs.js");

    var usuario;
    var pass;
    var entrada;
    var un; //user number

    log("Conexion desde:" + client.ip_address + ":" + client.port);
    writeln ("+OK bbs server");
    entrada = truncsp(readln());

    if (String(entrada).substr(0,4).toUpperCase() == "USER") {
    //obterner user y preguntar por password
    usuario = String(entrada).substr(5).toUpperCase();
    entrada = truncsp(readln());
    if (String(entrada).substr(0,4).toUpperCase() == "PASS") {
    //obtener pass y compara
    pass = String(entrada).substr(5).toUpperCase();
    if (checklogin(usuario,pass)) {
    //login ok
    writeln ("+OK login ok");
    }
    else {
    log ("error en el login");
    writeln ("-ERR login error");
    }
    }
    else {
    //error de comando
    log("deberia ser PASS");
    writeln ("-ERR secuencia invalida");
    }
    }
    else {
    // comando invadlido
    log ("comando invalida no fue USER");
    writeln ("-ERR comando invalido");
    }

    function checklogin(user,pass) {
    un = system.matchuser(truncsp(user));
    if (un >0) {
    log ("usuario encontrado!");
    usuario = new User(un);
    if(usuario.security.password == pass){
    log ("password OK");
    return true;
    }
    else {
    log ("password error");
    return false;
    }
    }
    else {
    log ("error usuario no encotrando");
    return false;
    };
    }

    this is a pop3-like auth service, you can put it in your service.ini as:

    [auth]
    port=9999
    MaxclientS=10
    options = 0
    command=auth.js

    --
    Dock Sud BBS
    http://bbs.docksud.com.ar
    telnet://bbs.docksud.com.ar

    ---
    ■ Synchronet ■ Dock Sud BBS TLD 24 HS - www.docksud.com.ar