Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit b45af31d authored by rswindell's avatar rswindell

* Eliminated the sbbs.ini [BBS] Options flag: USE_2ND_RLOGIN

- this option has been a default option flag for 10 years
- this option was introduced *before* the RLogin password capability
- Synchronet now always expects the login-ID (alias) to be the 2nd string
received during RLogin connections (called 'server-user-name' in RFC 1282.
* Now storing the complete terminal type/speed string received during RLogin
connection in the bbs.rlogin_terminal property (sbbs_t.rlogin_term in C++).
* bbs.rlogin_gate() is over-hauled:
- arguments are: address, client-user-name, server-user-name, terminal, mode
- if existing JS module assumes this to be: address, server-user-name, password
  those scripts will need to be updated to reflect the correct argument order
- all arguments beyond the first are now optional
- the terminal string can now be passed-in
* Deprecated the telnet gateway option: TG_SENDPASS (the 'password' if desired
to be sent as the 'client-user-name' can be specified as an argument and this
option sent the password as the *second* RLogin string ('server-user-name'),
which was always wrong.
* sbbs_t::telnet() can now accept the terminal string as an optional argument.
parent 805ae4be
......@@ -23,7 +23,7 @@ CFLAGS = $(CFLAGS) -DJAVASCRIPT
!ifdef JSINCLUDE
CFLAGS = $(CFLAGS) -I$(JSINCLUDE)
!else
CFLAGS = $(CFLAGS) -I$(SRC_ROOT)\..\include\mozilla\js
CFLAGS = $(CFLAGS) -I$(SRC_ROOT)\..\lib\js\win32\include\js
!endif
!ifdef NSPRINCLUDE
CFLAGS = $(CFLAGS) -I$(NSPRINCLUDE)
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2012 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2014 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -97,24 +97,24 @@ bool sbbs_t::answer()
terminal[i]=in;
}
terminal[i]=0;
truncstr(terminal,"/");
lprintf(LOG_DEBUG,"Node %d RLogin: '%.*s' / '%.*s' / '%s'"
,cfg.node_num
,LEN_ALIAS*2,str
,LEN_ALIAS*2,str2
,terminal);
SAFECOPY(rlogin_name
,startup->options&BBS_OPT_USE_2ND_RLOGIN ? str2 : str);
SAFECOPY(rlogin_pass
,startup->options&BBS_OPT_USE_2ND_RLOGIN ? str : str2);
SAFECOPY(rlogin_term, terminal);
SAFECOPY(rlogin_name, str2);
SAFECOPY(rlogin_pass, str);
/* Truncate terminal speed (e.g. "/57600") from terminal-type string
(but keep full terminal type/speed string in rlogin_term): */
truncstr(terminal,"/");
useron.number=userdatdupe(0, U_ALIAS, LEN_ALIAS, rlogin_name);
if(useron.number) {
getuserdat(&cfg,&useron);
useron.misc&=~TERM_FLAGS;
SAFEPRINTF(path,"%srlogin.cfg",cfg.ctrl_dir);
if(!findstr(client.addr,path)) {
SAFECOPY(tmp
,rlogin_pass);
SAFECOPY(tmp, rlogin_pass);
for(i=0;i<3;i++) {
if(stricmp(tmp,useron.pass)) {
badlogin(useron.alias, tmp);
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2013 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2014 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -85,6 +85,7 @@ enum {
,BBS_PROP_CONNECTION /* READ ONLY */
,BBS_PROP_RLOGIN_NAME
,BBS_PROP_RLOGIN_PASS
,BBS_PROP_RLOGIN_TERM
,BBS_PROP_CLIENT_NAME
,BBS_PROP_ALTUL
......@@ -394,6 +395,9 @@ static JSBool js_bbs_get(JSContext *cx, JSObject *obj, jsid id, jsval *vp)
case BBS_PROP_RLOGIN_PASS:
p=sbbs->rlogin_pass;
break;
case BBS_PROP_RLOGIN_TERM:
p=sbbs->rlogin_term;
break;
case BBS_PROP_CLIENT_NAME:
p=sbbs->client_name;
break;
......@@ -807,6 +811,9 @@ static JSBool js_bbs_set(JSContext *cx, JSObject *obj, jsid id, JSBool strict, j
case BBS_PROP_RLOGIN_PASS:
SAFECOPY(sbbs->rlogin_pass,p);
break;
case BBS_PROP_RLOGIN_TERM:
SAFECOPY(sbbs->rlogin_term,p);
break;
case BBS_PROP_CLIENT_NAME:
SAFECOPY(sbbs->client_name,p);
break;
......@@ -883,6 +890,7 @@ static jsSyncPropertySpec js_bbs_properties[] = {
{ "connection" ,BBS_PROP_CONNECTION ,PROP_READONLY ,310},
{ "rlogin_name" ,BBS_PROP_RLOGIN_NAME ,JSPROP_ENUMERATE ,310},
{ "rlogin_password" ,BBS_PROP_RLOGIN_PASS ,JSPROP_ENUMERATE ,315},
{ "rlogin_terminal" ,BBS_PROP_RLOGIN_TERM ,JSPROP_ENUMERATE ,316},
{ "client_name" ,BBS_PROP_CLIENT_NAME ,JSPROP_ENUMERATE ,310},
{ "alt_ul_dir" ,BBS_PROP_ALTUL ,JSPROP_ENUMERATE ,310},
{ "errorlevel" ,BBS_PROP_ERRORLEVEL ,PROP_READONLY ,312},
......@@ -2628,15 +2636,15 @@ js_telnet_gate(JSContext *cx, uintN argc, jsval *arglist)
static JSBool
js_rlogin_gate(JSContext *cx, uintN argc, jsval *arglist)
{
jsval *argv=JS_ARGV(cx, arglist);
jsval* argv=JS_ARGV(cx, arglist);
uintN argn;
char* addr;
char* alias=NULL;
char* pass=NULL;
char* client_user_name=NULL;
char* server_user_name=NULL;
char* term_type=NULL;
bool fail = false;
int32 mode = 0;
JSString* js_addr;
JSString* js_alias;
JSString* js_pass;
JSString* js_str;
sbbs_t* sbbs;
jsrefcount rc;
......@@ -2648,47 +2656,43 @@ js_rlogin_gate(JSContext *cx, uintN argc, jsval *arglist)
if((sbbs=js_GetContextPrivate(cx))==NULL)
return(JS_FALSE);
if((js_addr=JS_ValueToString(cx, argv[0]))==NULL)
if((js_str=JS_ValueToString(cx, argv[0]))==NULL)
return(JS_FALSE);
JSSTRING_TO_MSTRING(cx, js_addr, addr, NULL);
JSSTRING_TO_MSTRING(cx, js_str, addr, NULL);
if(addr==NULL)
return(JS_FALSE);
/* if remote username & password supplied */
if(argc>2) {
if((js_alias=JS_ValueToString(cx, argv[1]))==NULL) {
fail = true;
}
if((js_pass=JS_ValueToString(cx, argv[2]))==NULL) {
fail = true;
}
JSSTRING_TO_MSTRING(cx, js_alias, alias, NULL);
JSSTRING_TO_MSTRING(cx, js_pass, pass, NULL);
if(argc>3 && JSVAL_IS_NUMBER(argv[3])) {
if(!JS_ValueToInt32(cx,argv[3],&mode)) {
/* Parse optional arguments if provided */
for(argn=1; argn<argc; argn++) {
if(JSVAL_IS_STRING(argv[argn])) {
if((js_str=JS_ValueToString(cx, argv[argn]))==NULL) {
fail = true;
break;
}
if(client_user_name==NULL) {
JSSTRING_TO_MSTRING(cx, js_str, client_user_name, NULL);
} else if(server_user_name==NULL) {
JSSTRING_TO_MSTRING(cx, js_str, server_user_name, NULL);
} else if(term_type==NULL) {
JSSTRING_TO_MSTRING(cx, js_str, term_type, NULL);
}
} else if(JSVAL_IS_NUMBER(argv[argn])) {
if(!JS_ValueToInt32(cx,argv[argn],&mode)) {
fail = true;
break;
}
}
}
else if(argc>1 && JSVAL_IS_NUMBER(argv[1])) {
if(!JS_ValueToInt32(cx,argv[1],&mode)) {
fail = true;
}
}
if(!fail) {
rc=JS_SUSPENDREQUEST(cx);
sbbs->telnet_gate(addr,mode|TG_RLOGIN,alias,pass);
sbbs->telnet_gate(addr,mode|TG_RLOGIN,client_user_name,server_user_name,term_type);
JS_RESUMEREQUEST(cx, rc);
}
FREE_AND_NULL(addr);
FREE_AND_NULL(alias);
FREE_AND_NULL(pass);
FREE_AND_NULL(client_user_name);
FREE_AND_NULL(server_user_name);
FREE_AND_NULL(term_type);
return(fail ? JS_FALSE : JS_TRUE);
}
......@@ -3757,10 +3761,10 @@ static jsSyncMethodSpec js_bbs_functions[] = {
,310
},
{"telnet_gate", js_telnet_gate, 1, JSTYPE_VOID, JSDOCSTR("address [,mode=<tt>TG_NONE</tt>]")
,JSDOCSTR("external telnet/rlogin gateway (see <tt>TG_*</tt> in <tt>sbbsdefs.js</tt> for valid <i>mode</i> bits)")
,JSDOCSTR("external Telnet gateway (see <tt>TG_*</tt> in <tt>sbbsdefs.js</tt> for valid <i>mode</i> bits)")
,310
},
{"rlogin_gate", js_rlogin_gate, 1, JSTYPE_VOID, JSDOCSTR("address [,user=<tt>user.alias</tt>,pass=<tt>user.pass</tt>,mode=<tt>TG_NONE</tt>]")
{"rlogin_gate", js_rlogin_gate, 1, JSTYPE_VOID, JSDOCSTR("address [,client-user-name=<tt>user.alias</tt>, server-user-name=<tt>user.name</tt>, terminal=<tt>console.terminal</tt>] [,mode=<tt>TG_NONE</tt>]")
,JSDOCSTR("external RLogin gateway (see <tt>TG_*</tt> in <tt>sbbsdefs.js</tt> for valid <i>mode</i> bits)")
,316
},
......
......@@ -2941,6 +2941,7 @@ sbbs_t::sbbs_t(ushort node_num, SOCKADDR_IN addr, const char* name, SOCKET sd,
terminal[0]=0;
rlogin_name[0]=0;
rlogin_pass[0]=0;
rlogin_term[0]=0;
/* Init some important variables */
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2013 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2014 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -385,6 +385,7 @@ public:
smb_t smb; /* Currently open message base */
char rlogin_name[LEN_ALIAS+1];
char rlogin_pass[LEN_PASS+1];
char rlogin_term[TELNET_TERM_MAXLEN+1]; /* RLogin passed terminal type/speed (e.g. "xterm/57600") */
uint temp_dirnum;
......@@ -938,7 +939,7 @@ public:
void catsyslog(int crash);
/* telgate.cpp */
void telnet_gate(char* addr, ulong mode, char* name=NULL, char* passwd=NULL); // See TG_* for mode bits
void telnet_gate(char* addr, ulong mode, char* client_user_name=NULL, char* server_user_name=NULL, char* term_type=NULL); // See TG_* for mode bits
};
......
......@@ -778,7 +778,7 @@ enum { /* readmail and delmailidx which types */
#define TG_RLOGIN (1<<6) /* Use BSD RLogin protocol */
#define TG_NOCHKTIME (1<<7) /* Don't check time left while gated */
#define TG_NOTERMTYPE (1<<8) /* Request client "DONT TERM_TYPE" */
#define TG_SENDPASS (1<<9) /* Send password instead of real name (RLogin) */
#define TG_SENDPASS (1<<9) /* Send password instead of real name (RLogin) - DEPRECATED (it sent the password as the server user name) */
#define TG_NOLF (1<<10) /* Do not send line-feeds (opposite of TG_CRLF) */
enum { /* Values for 'mode' in listfileinfo */
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2014 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -167,7 +167,7 @@ static struct init_field {
#define BBS_OPT_DEBUG_TELNET (1<<3) /* Debug telnet commands */
#define BBS_OPT_SYSOP_AVAILABLE (1<<4) /* Available for chat */
#define BBS_OPT_ALLOW_RLOGIN (1<<5) /* Allow logins via BSD RLogin */
#define BBS_OPT_USE_2ND_RLOGIN (1<<6) /* Use 2nd username in BSD RLogin */
#define BBS_OPT_USE_2ND_RLOGIN (1<<6) /* Use 2nd username in BSD RLogin - DEPRECATED (Always enabled) */
#define BBS_OPT_NO_QWK_EVENTS (1<<7) /* Don't run QWK-related events */
#define BBS_OPT_NO_TELNET_GA (1<<8) /* Don't send periodic Telnet GAs */
#define BBS_OPT_NO_EVENTS (1<<9) /* Don't run event thread */
......@@ -191,7 +191,6 @@ static ini_bitdesc_t bbs_options[] = {
{ BBS_OPT_DEBUG_TELNET ,"DEBUG_TELNET" },
{ BBS_OPT_SYSOP_AVAILABLE ,"SYSOP_AVAILABLE" },
{ BBS_OPT_ALLOW_RLOGIN ,"ALLOW_RLOGIN" },
{ BBS_OPT_USE_2ND_RLOGIN ,"USE_2ND_RLOGIN" },
{ BBS_OPT_NO_QWK_EVENTS ,"NO_QWK_EVENTS" },
{ BBS_OPT_NO_TELNET_GA ,"NO_TELNET_GA" },
{ BBS_OPT_NO_EVENTS ,"NO_EVENTS" },
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2013 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright 2014 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
......@@ -38,7 +38,7 @@
#include "sbbs.h"
#include "telnet.h"
void sbbs_t::telnet_gate(char* destaddr, ulong mode, char* name, char* passwd)
void sbbs_t::telnet_gate(char* destaddr, ulong mode, char* client_user_name, char* server_user_name, char* term_type)
{
char* p;
uchar buf[512];
......@@ -121,17 +121,14 @@ void sbbs_t::telnet_gate(char* destaddr, ulong mode, char* name, char* passwd)
if(mode&TG_RLOGIN) {
p=(char*)buf;
*(p++)=0;
p+=sprintf(p,"%s",name==NULL ? useron.alias : name);
p+=sprintf(p,"%s",client_user_name==NULL ? useron.alias : client_user_name);
p++; // Add NULL
if(passwd!=NULL)
p+=sprintf(p,"%s",passwd);
else if(mode&TG_SENDPASS) {
p+=sprintf(p,"%s",useron.pass);
} else {
p+=sprintf(p,"%s",useron.name);
}
p+=sprintf(p,"%s",server_user_name==NULL ? useron.name : server_user_name);
p++; // Add NULL
p+=sprintf(p,"%s/57600",terminal);
if(term_type!=NULL)
p+=sprintf(p,"%s",term_type);
else
p+=sprintf(p,"%s/%u",terminal, cur_rate);
p++; // Add NULL
l=p-(char*)buf;
sendsocket(remote_socket,(char*)buf,l);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment