From 632bda2671a8b0cf73b1a0bffa7b906c8744b14f Mon Sep 17 00:00:00 2001 From: djk Date: Thu, 30 Mar 2000 22:51:14 +0000 Subject: [PATCH] fixed connect code in client.pl so it doesn't falsely recognise /spider /src/client as a 'client' directive. Tidied up the C client a bit --- Changes | 3 ++ perl/client.pl | 4 +- src/chain.c | 106 +++++++++++++++++++++++++------------------------ src/client.c | 19 +++++---- src/sel.c | 9 ++++- 5 files changed, 79 insertions(+), 62 deletions(-) diff --git a/Changes b/Changes index 8186cb05..581d0660 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +30Mar00======================================================================= +1. altered client.pl connect code so that it doesn't falsely recognise +/spider/src/client as a 'client' instruction. 28Mar00======================================================================= 1. Added buffering to client 2. Fixed LOGIN so that you can login with an arbitrary callsign diff --git a/perl/client.pl b/perl/client.pl index 642f80c6..bc2d46c7 100755 --- a/perl/client.pl +++ b/perl/client.pl @@ -428,8 +428,8 @@ if ($connsort eq "connect") { doconnect($1, $2) if /^\s*co\w*\s+(\w+)\s+(.*)$/io; doabort($1) if /^\s*a\w*\s+(.*)/io; dotimeout($1) if /^\s*t\w*\s+(\d+)/io; - dochat($1, $2) if /\s*\'(.*)\'\s+\'(.*)\'/io; - if (/\s*cl\w+\s+(.*)/io) { + dochat($1, $2) if /^\s*\'(.*)\'\s+\'(.*)\'/io; + if (/^\s*cl\w+\s+(.*)/io) { doclient($1); last; } diff --git a/src/chain.c b/src/chain.c index d3a8be9a..89110a95 100755 --- a/src/chain.c +++ b/src/chain.c @@ -1,6 +1,10 @@ /* * routines to operate on double linked circular chains * + * In memoriam ICL George 3 + * + * Copyright (c) 1989 Dirk Koopman + * * chain_init() - initialise a chain * chain_add() - add an item after the ref provided * chain_delete() - delete the item @@ -12,50 +16,6 @@ * * $Header$ * - * $Log$ - * Revision 1.2 2000-03-26 14:22:59 djk - * removed some irrelevant log info - * - * Revision 1.1 2000/03/26 00:03:30 djk - * first cut of client - * - * Revision 1.4 1998/01/02 19:39:58 djk - * made various changes to cope with glibc - * fixed problem with extended status in etsi_router - * - * Revision 1.3 1997/01/02 18:46:46 djk - * Added conv.c from ETSI router - * Changed qerror.c to use syslog rather than qerror.log - * removed all the map27 stuff into a separate directory - * added dump.c (a debugging tool for dumping frames of data) - * - * Revision 1.1 1996/08/08 11:33:44 djk - * Initial revision - * - * Revision 1.2 1995/04/21 16:02:51 djk - * remove rcs id - * - * Revision 1.1 1995/03/04 11:46:26 djk - * Initial revision - * - * Revision 1.2 1995/01/24 15:09:39 djk - * Changed Indent to Id in rcsid - * - * Revision 1.1 1995/01/24 15:06:28 djk - * Initial revision - * - * Revision 1.3 91/03/08 13:21:56 dlp - * changed the chain broken checks to dlpabort for dlperror - * - * Revision 1.2 90/09/15 22:37:39 dlp - * checked in with -k by dirk at 91.02.20.15.53.51. - * - * Revision 1.2 90/09/15 22:37:39 dlp - * *** empty log message *** - * - * Revision 1.1 90/09/15 22:18:23 dlp - * Initial revision - * */ #include @@ -223,10 +183,54 @@ reft *chain_new() return p; } - - - - - - - +/* + * $Log$ + * Revision 1.3 2000-03-30 22:51:14 djk + * fixed connect code in client.pl so it doesn't falsely recognise /spider + * /src/client as a 'client' directive. + * Tidied up the C client a bit + * + * Revision 1.2 2000/03/26 14:22:59 djk + * removed some irrelevant log info + * + * Revision 1.1 2000/03/26 00:03:30 djk + * first cut of client + * + * Revision 1.4 1998/01/02 19:39:58 djk + * made various changes to cope with glibc + * fixed problem with extended status in etsi_router + * + * Revision 1.3 1997/01/02 18:46:46 djk + * Added conv.c from ETSI router + * Changed qerror.c to use syslog rather than qerror.log + * removed all the map27 stuff into a separate directory + * added dump.c (a debugging tool for dumping frames of data) + * + * Revision 1.1 1996/08/08 11:33:44 djk + * Initial revision + * + * Revision 1.2 1995/04/21 16:02:51 djk + * remove rcs id + * + * Revision 1.1 1995/03/04 11:46:26 djk + * Initial revision + * + * Revision 1.2 1995/01/24 15:09:39 djk + * Changed Indent to Id in rcsid + * + * Revision 1.1 1995/01/24 15:06:28 djk + * Initial revision + * + * Revision 1.3 91/03/08 13:21:56 dlp + * changed the chain broken checks to dlpabort for dlperror + * + * Revision 1.2 90/09/15 22:37:39 dlp + * checked in with -k by dirk at 91.02.20.15.53.51. + * + * Revision 1.2 90/09/15 22:37:39 dlp + * *** empty log message *** + * + * Revision 1.1 90/09/15 22:18:23 dlp + * Initial revision + * + */ diff --git a/src/client.c b/src/client.c index fb7e5c13..8c52d53f 100644 --- a/src/client.c +++ b/src/client.c @@ -46,6 +46,7 @@ #define DEFPACLEN 128 #define MAXPACLEN 236 +#define MAXCALLSIGN 9 #define DBUF 1 #define DMSG 2 @@ -91,22 +92,22 @@ int tabsize = 8; /* default tabsize for text messages */ myregex_t iscallreg[] = { /* regexes to determine whether this is a reasonable callsign */ { - "^[A-Z]+[0-9]+[A-Z]+[1-9]?$", 0 + "^[A-Z]+[0-9]+[A-Z]+[1-9]?$", 0 /* G1TLH G1TLH1 */ }, { - "^[0-9]+[A-Z]+[0-9]+[A-Z]+[1-9]?$", 0 + "^[0-9]+[A-Z]+[0-9]+[A-Z]+[1-9]?$", 0 /* 2E0AAA 2E0AAA1 */ }, { - "^[A-Z]+[0-9]+[A-Z]+[1-9]?-[1-9]$", 0 + "^[A-Z]+[0-9]+[A-Z]+-[1-9]$", 0 /* G1TLH-2 */ }, { - "^[0-9]+[A-Z]+[0-9]+[A-Z]+[1-9]?-[1-9]$", 0 + "^[0-9]+[A-Z]+[0-9]+[A-Z]+-[1-9]$", 0 /* 2E0AAA-2 */ }, { - "^[A-Z]+[0-9]+[A-Z]+[1-9]?-1[0-5]$", 0 + "^[A-Z]+[0-9]+[A-Z]+-1[0-5]$", 0 /* G1TLH-11 */ }, { - "^[0-9]+[A-Z]+[0-9]+[A-Z]+[1-9]?-1[0-5]$", 0 + "^[0-9]+[A-Z]+[0-9]+[A-Z]+-1[0-5]$", 0 /* 2E0AAA-11 */ }, { 0, 0 @@ -168,6 +169,10 @@ int xopen(char *dir, char *name, int mode) int iscallsign(char *s) { myregex_t *rp; + + if (strlen(s) > MAXCALLSIGN) + return 0; + for (rp = iscallreg; rp->in; ++rp) { if (regexec(rp->regex, s, 0, 0, 0) == 0) return 1; @@ -212,7 +217,7 @@ void send_text(fcb_t *f, char *s, int l) f->obuf = mp = cmsg_new(paclen+1, f->sort, f); } - /* ignore trailing spaces */ + /* remove trailing spaces */ while (l > 0 &&isspace(s[l-1])) --l; diff --git a/src/sel.c b/src/sel.c index e67a58d6..a15ed0ec 100755 --- a/src/sel.c +++ b/src/sel.c @@ -183,12 +183,17 @@ int sel_error(sel_t *sp, int err) int r = sp->err; if (err >= 0) sp->err = err; - return err; + return r; } /* * $Log$ - * Revision 1.2 2000-03-26 14:22:59 djk + * Revision 1.3 2000-03-30 22:51:14 djk + * fixed connect code in client.pl so it doesn't falsely recognise /spider + * /src/client as a 'client' directive. + * Tidied up the C client a bit + * + * Revision 1.2 2000/03/26 14:22:59 djk * removed some irrelevant log info * * Revision 1.1 2000/03/26 00:03:30 djk -- 2.43.0