• PATCH: getnewsgroupslist.js optional authentication

    From Ragnarok@VERT/DOCKSUD to DOVE-Net.Synchronet_Programming_C+ on Sun Jun 14 16:51:49 2020
    I have modified version of getnewsgroupslist.js with optional
    authentication support because use nntp.aioe.org server that don't need it.

    http://paste.debian.net/1152067/

    I share here because can be useful for another people

    thanks!

    --- getnewsgrouplist.js 2019-12-01 00:02:31.000000000 -0300
    +++ ../mods/getnewsgrouplist.js 2020-06-14 16:36:18.134989504 -0300
    @@ -2,21 +2,39 @@

    "use strict";

    -if(argc < 3) {
    - print("usage: " + js.exec_file + " <user> <password> <host> [port] [pattern]");
    +if(argc < 1) {
    + print("usage: " + js.exec_file + " -h <host> -p [port] -a [user:pass] -t [pattern]");
    exit(0);
    }

    +var host = "";
    +var port = 119;
    +var auth = "";
    +var name = "";
    +var pass = "";
    +var pattern = "";
    +
    +for(var i=0;i<argc;i++) {
    + switch (argv[i].toLowerCase()) {
    + case "-h":
    + host = argv[++i];
    + break;
    + case "-p":
    + port = argv[++i];
    + break;
    + case "-a":
    + auth = argv[++i];
    + break;
    + case "-t":
    + pattern = argv[++i];
    + break;
    + default:
    + // compatibilty no -params?
    + host = argv[0];
    + }
    +}
    +
    var socket = new Socket();
    -var name = argv[0];
    -var pass = argv[1];
    -var host = argv[2];
    -var port = argv[3];
    -var pattern = argv[4];
    -if(!pattern)
    - pattern = "";
    -if(!port)
    - port = 119;
    if(!socket.connect(host,port)) {
    printf("!Error %d connecting to %s port %d\r\n"
    ,socket.last_error,host,port);
    @@ -27,13 +45,25 @@ if(parseInt(resp, 10) != 200) {
    alert("Unexpected response: " + resp);
    exit();
    }
    -socket.sendline("AUTHINFO USER " + name);
    -resp = socket.recvline();
    -socket.sendline("AUTHINFO PASS " + pass);
    -resp = socket.recvline();
    -if(parseInt(resp, 10) != 281) {
    - alert("Unexpected response: " + resp);
    - exit();
    +if (auth != "") {
    + if (auth.indexOf(':') > 0) {
    + name = auth.split(':')[0];
    + pass = auth.split(':')[1];
    + }
    + else {
    + printf("!Error auth settings '%s', use -a username:password syntax\r\n", auth);
    + exit();
    + }
    +
    +
    + socket.sendline("AUTHINFO USER " + name);
    + resp = socket.recvline();
    + socket.sendline("AUTHINFO PASS " + pass);
    + resp = socket.recvline();
    + if(parseInt(resp, 10) != 281) {
    + alert("Unexpected response: " + resp);
    + exit();
    + }
    }
    socket.sendline("LIST NEWSGROUPS");
    resp = socket.recvline();
    ---
    ï¿­ Synchronet ï¿­ Dock Sud BBS TLD 24 HS - bbs.docksud.com.ar
  • From Digital Man@VERT to Ragnarok on Mon Jun 15 19:28:44 2020
    Re: PATCH: getnewsgroupslist.js optional authentication
    By: Ragnarok to DOVE-Net.Synchronet_Programming_C+ on Sun Jun 14 2020 04:51 pm

    I have modified version of getnewsgroupslist.js with optional
    authentication support because use nntp.aioe.org server that don't need it.

    http://paste.debian.net/1152067/

    I share here because can be useful for another people

    And that method is fine so long as there isn't a colon in your password. :-) A separate username and password argument would probably be better.

    digital man

    Synchronet/BBS Terminology Definition #7:
    BinkP = BinkD Protocol
    Norco, CA WX: 70.3øF, 66.0% humidity, 10 mph E wind, 0.00 inches rain/24hrs

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net