• Perl on_handshake(): @me contains no valid addresses

    From Oli@21:3/102 to All on Wed Sep 8 15:17:14 2021
    Crossposting from BINKD:

    HELP! ;)
    I'm trying to use the @me array in on_handshake(), but no matter what I do I always get the error:

    "Perl on_handshake(): @me contains no valid addresses"

    even with this simple sub:

    sub on_handshake
    {
    @me;
    }

    + 08 Sep 09:45:26 [51014] incoming session with unknown
    - 08 Sep 09:45:27 [51014] VER binkd/1.1a-112/Linux binkp/1.1
    + 08 Sep 09:45:27 [51014] addr: 4000:1/1@testnet
    + 08 Sep 09:45:27 [51014] Perl on_handshake(): @me contains no valid addresses - 08 Sep 09:45:27 [51014] hiding aka 2000:1/2@fakenet

    Is this a bug or how do I use @me? The perlhooks documentation says

    5) on_handshake()
    - for server called after receiving remote addresses (before addr is sent)
    - best for hide_aka and present_aka logic :-)
    - return non-empty string to abort session with that reason
    otherwise, if @me is defined present @me as our akas


    The error message is from perlhooks.c

    if ((me = perl_get_av("me", FALSE)) != NULL) {
    FTN_ADDR addr;
    int n = 0, N = av_len(me) + 1;
    if (N > 0) state->pAddr = xalloc(N*sizeof(FTN_ADDR));
    for (i = 0; i < N; i++) {
    svp = av_fetch(me, i, FALSE);
    if (svp == NULL) continue;
    if (!parse_ftnaddress(SvPV(*svp, len), &addr, cfg->pDomains.first)) continue;
    exp_ftnaddress(&addr, cfg->pAddr, cfg->nAddr, cfg->pDomains.first);
    state->pAddr[n++] = addr;
    }
    state->nAddr = n;
    if (n == 0) Log(LL_WARN, "Perl on_handshake(): @me contains no valid addresses");
    }

    ---
    * Origin: 1995| Invention of the Cookie. The End. (21:3/102)
  • From Oli@21:3/102 to Oli on Wed Sep 8 16:17:35 2021
    Oli wrote (2021-09-08):

    Crossposting from BINKD:

    HELP! ;)
    I'm trying to use the @me array in on_handshake(), but no matter what I
    do I always get the error:

    "Perl on_handshake(): @me contains no valid addresses"

    okay, solved.

    ---
    * Origin: 1995| Invention of the Cookie. The End. (21:3/102)
  • From deon@21:2/116 to Oli on Thu Sep 9 12:34:54 2021
    Re: Perl on_handshake(): @me contains no valid addresses
    By: Oli to All on Wed Sep 08 2021 03:17 pm

    "Perl on_handshake(): @me contains no valid addresses"
    + 08 Sep 09:45:27 [51014] Perl on_handshake(): @me contains no valid addresses -
    08 Sep 09:45:27 [51014] hiding aka 2000:1/2@fakenet

    Is this a bug or how do I use @me? The perlhooks documentation says

    Are there any addresses left over after hiding some?



    ...лоеп
    --- SBBSecho 3.14-Linux
    * Origin: I'm playing with ANSI+videotex - wanna play too? (21:2/116)
  • From Oli@21:3/102 to deon on Thu Sep 9 08:48:25 2021
    deon wrote (2021-09-09):

    "Perl on_handshake(): @me contains no valid addresses"
    + 08 Sep 09:45:27 [51014] Perl on_handshake(): @me contains no valid
    addresses - 08 Sep 09:45:27 [51014] hiding aka 2000:1/2@fakenet

    Is this a bug or how do I use @me? The perlhooks documentation says

    Are there any addresses left over after hiding some?

    That wasn't the problem. It's more weird / unusual behaviour of perl and/or binkd's perlhooks. If I do something like this

    sub on_handshake
    {
    if (0) {
    @me = ("4000:1/1@testnet");
    }
    }

    I get the same error. My expectation was that the @me variable is never touched because of the if (0). But for some reason it gets initialized as an empty array, when it appears somewhere in the script. Another example:

    sub on_handshake
    {
    Log(3, "<<< on_handshake() >>>");
    }


    sub after_handshake
    {
    Log(3, "<<< after_handshake() >>> @me");
    }


    + 08:43 [1459] outgoing session with 127.0.0.1:24554
    - 08:43 [1459] <<< on_handshake() >>>
    + 08:43 [1459] Perl on_handshake(): @me contains no valid addresses
    - 08:43 [1459] OPT CRAM-MD5-fffdf8c077e8c9b94ce2e83d8da0a8ee
    [...]
    - 08:43 [1459] session in CRYPT mode
    - 08:43 [1459] <<< after_handshake() >>> 2000:1/2@fakenet 4000:1/1@testnet


    There is not even a @me in the sub on_handshake().

    ---
    * Origin: 1995| Invention of the Cookie. The End. (21:3/102)