Added mbtask command to update the MIB counters

This commit is contained in:
Michiel Broek
2007-04-30 19:04:15 +00:00
parent 77d8ffb751
commit 6a5eb09a43
11 changed files with 111 additions and 39 deletions

View File

@@ -76,6 +76,7 @@ extern struct sockaddr_in peeraddr;
extern int most_debug;
extern int laststat;
extern int crashme;
extern int session_state;
int gotblock = 0;
@@ -359,6 +360,8 @@ binkpend:
free(z_obuf);
#endif
rc = abs(rc);
if (rc)
session_state = STATE_BAD;
Syslog('+', "Binkp: session finished, rc=%d", rc);
return rc;
@@ -605,8 +608,11 @@ SM_STATE(WaitOk)
if (cmd) {
if (bp.rxbuf[0] == MM_OK) {
Syslog('b', "Binkp: M_OK \"%s\"", printable(bp.rxbuf +1, 0));
if (SendPass)
if (SendPass) {
bp.Secure = TRUE;
session_state = STATE_SECURE;
} else
session_state = STATE_UNSECURE;
Syslog('+', "Binkp: %s%sprotected session", bp.CRAMflag ? "MD5 ":"", bp.Secure ? "":"un");
SM_PROCEED(Opts)
@@ -902,6 +908,11 @@ SM_STATE(PwdAck)
SM_ERROR;
}
free(pw);
if (bp.Secure)
session_state = STATE_SECURE;
else
session_state = STATE_UNSECURE;
Syslog('+', "Binkp: %s%sprotected session", bp.CRAMflag ? "MD5 ":"", bp.Secure ? "":"un");
inbound_open(remote->addr, bp.Secure, TRUE);
binkp_send_command(MM_OK, "%ssecure", bp.Secure ? "":"non-");

View File

@@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -57,6 +57,7 @@ static int caller;
extern int laststat;
extern int most_debug;
extern pid_t mypid;
extern int session_state;
int emsi_local_lcodes;
int emsi_remote_lcodes;
@@ -186,6 +187,11 @@ int rx_emsi(char *data)
return 0;
}
if (protect)
session_state = STATE_SECURE;
else
session_state = STATE_UNSECURE;
IsDoing("EMSI %s inb", ascfnode(remote->addr, 0x0f));
if ((emsi_remote_opts & OPT_NRQ) == 0)
@@ -252,6 +258,7 @@ int tx_emsi(char *data)
}
IsDoing("EMSI %s out", ascfnode(remote->addr, 0x0f));
session_state = STATE_SECURE;
emsi_local_protos &= emsi_remote_protos;
if ((emsi_remote_opts & OPT_NRQ) == 0)

View File

@@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -55,7 +55,7 @@ static file_list *tosend;
extern int Loaded;
extern pid_t mypid;
extern char *tempinbound;
extern int session_state;
int rx_ftsc(void)
@@ -286,6 +286,7 @@ SM_STATE(send_req)
Syslog('x', "rxftsc SEND_REQ count=%d", count);
if (didwazoo) {
session_state = STATE_UNSECURE;
SM_SUCCESS;
}
@@ -333,11 +334,13 @@ SM_STATE(recv_req)
if (recvbark()) {
if (sentmail && rcvdmail) {
Syslog('+', "Consider session OK");
session_state = STATE_SECURE;
SM_SUCCESS;
} else {
SM_ERROR;
}
} else {
session_state = STATE_SECURE;
SM_SUCCESS;
}
@@ -462,9 +465,11 @@ SM_STATE(scan_packet)
if (ghc == 0) {
Syslog('+', "Password correct, protected FTS-0001 session");
inbound_open(remote->addr, TRUE, FALSE);
session_state = STATE_SECURE;
} else {
Syslog('+', "Unsecure FTS-0001 session");
inbound_open(remote->addr, FALSE, FALSE);
session_state = STATE_UNSECURE;
}
/*
* Move the packet to the temp inbound so the we can later

View File

@@ -4,7 +4,7 @@
* Purpose: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -73,7 +73,10 @@ char *phone;
char *flags;
extern int gotfiles;
extern int mypid;
extern unsigned int report_count;
extern int session_type;
extern int session_state;
void usage(void)
{
@@ -110,7 +113,8 @@ void free_mem(void)
void die(int onsig)
{
int total = 0;
int total = 0;
unsigned int rcvd = 0, sent = 0;
signal(onsig, SIG_IGN);
@@ -127,8 +131,16 @@ void die(int onsig)
if (total < 1)
total = 1;
Syslog('+', "Sent %lu bytes, received %lu bytes, avg %d cps", sentbytes, rcvdbytes, (sentbytes + rcvdbytes) / total);
sent = sentbytes / 1024;
if (sentbytes && !sent)
sent = 1; /* If something, at least 1 KByte */
rcvd = rcvdbytes / 1024;
if (rcvdbytes && !rcvd)
rcvd = 1;
}
SockS("MSMS:6,%d,%d,%d,%d,%d,%d;", rcvd, sent, master, session_state, session_type, report_count);
if (online)
Syslog('+', "Connected %s", str_time(online));

View File

@@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer - respond to filerequests
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -56,7 +56,7 @@ static void attach_report(file_list**);
static void add_report(char *, ...);
static char *report_text = NULL;
static unsigned int report_total = 0L;
static unsigned int report_count = 0L;
unsigned int report_count = 0L;
static int no_more = FALSE;

View File

@@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -58,7 +58,9 @@ int laststat = 0; /* Last session status with remote */
int tx_define_type(void);
int rx_define_type(void);
static int type;
int session_type = SESSION_UNKNOWN;
int session_state = STATE_BAD;
static char *data=NULL;
struct sockaddr_in peeraddr;
@@ -86,7 +88,7 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
pid_t ipid, opid;
session_flags = 0;
type = tp;
session_type = tp;
nlent = nl;
if (getpeername(0,(struct sockaddr*)&peeraddr,&addrlen) == 0) {
@@ -220,10 +222,10 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
remote_flags=SESSION_FNC;
if (role) {
if (type == SESSION_UNKNOWN)
if (session_type == SESSION_UNKNOWN)
(void)tx_define_type();
Syslog('+', "Start outbound %s session with %s", typestr(type), ascfnode(a,0x1f));
switch(type) {
Syslog('+', "Start outbound %s session with %s", typestr(session_type), ascfnode(a,0x1f));
switch(session_type) {
case SESSION_UNKNOWN: rc = MBERR_UNKNOWN_SESSION; break;
case SESSION_FTSC: rc = tx_ftsc(); break;
case SESSION_YOOHOO: rc = tx_yoohoo(); break;
@@ -231,12 +233,12 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
case SESSION_BINKP: rc = binkp(role); break;
}
} else {
if (type == SESSION_FTSC)
if (session_type == SESSION_FTSC)
session_flags |= FTSC_XMODEM_CRC;
if (type == SESSION_UNKNOWN)
if (session_type == SESSION_UNKNOWN)
(void)rx_define_type();
Syslog('+', "Start inbound %s session", typestr(type));
switch(type) {
Syslog('+', "Start inbound %s session", typestr(session_type));
switch(session_type) {
case SESSION_UNKNOWN: rc = MBERR_UNKNOWN_SESSION; break;
case SESSION_FTSC: rc = rx_ftsc(); break;
case SESSION_YOOHOO: rc = rx_yoohoo(); break;
@@ -257,6 +259,9 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
putstatus(tmpl->addr, 0, 0);
}
if (rc)
session_state = STATE_BAD;
/*
* If the socket for the telnet filter is open, close it so that the telnet filters exit.
* After that wait a little while to let the filter childs die before the main program
@@ -312,7 +317,7 @@ SM_EDECL
int maybeftsc=0;
int maybeyoohoo=0;
type = SESSION_UNKNOWN;
session_type = SESSION_UNKNOWN;
ebuf[0] = '\0';
ep = ebuf;
buf[0] = '\0';
@@ -382,12 +387,12 @@ SM_STATE(nextchar)
maybeyoohoo++;
if (((localoptions & NOWAZOO) == 0) && (maybeyoohoo > 1)) {
type = SESSION_YOOHOO;
session_type = SESSION_YOOHOO;
SM_SUCCESS;
}
if (maybeftsc > 1) {
type = SESSION_FTSC;
session_type = SESSION_FTSC;
SM_SUCCESS;
}
@@ -441,7 +446,7 @@ SM_STATE(checkintro)
Syslog('i', "Check \"%s\" for being EMSI request",ebuf);
if (((localoptions & NOEMSI) == 0) && (strncasecmp(ebuf,"EMSI_REQA77E",12) == 0)) {
type = SESSION_EMSI;
session_type = SESSION_EMSI;
data = xstrcpy((char *)"**EMSI_REQA77E");
Syslog('i', "Sending **EMSI_INQC816 (2 times)");
PUTSTR((char *)"\r**EMSI_INQC816\r**EMSI_INQC816\r\021");
@@ -495,7 +500,7 @@ SM_EDECL
int standby=0;
int datasize;
type=SESSION_UNKNOWN;
session_type=SESSION_UNKNOWN;
session_flags|=FTSC_XMODEM_CRC;
ebuf[0]='\0';
ep=ebuf;
@@ -581,7 +586,7 @@ SM_STATE(nextchar)
ep = ebuf;
ebuf[0] = '\0';
if (++maybeftsc > 1) {
type = SESSION_FTSC;
session_type = SESSION_FTSC;
SM_SUCCESS;
} else {
SM_PROCEED(waitchar);
@@ -591,7 +596,7 @@ SM_STATE(nextchar)
ep = ebuf;
ebuf[0] = '\0';
if (++maybeyoohoo > 1) {
type = SESSION_YOOHOO;
session_type = SESSION_YOOHOO;
SM_SUCCESS;
} else {
SM_PROCEED(waitchar);
@@ -637,7 +642,7 @@ SM_STATE(checkemsi)
}
if (strncasecmp(ebuf, "EMSI_INQC816", 12) == 0) {
type = SESSION_EMSI;
session_type = SESSION_EMSI;
data = xstrcpy((char *)"**EMSI_INQC816");
SM_SUCCESS;
} else if (strncasecmp(ebuf, "EMSI_HBT", 8) == 0) {
@@ -676,7 +681,7 @@ SM_STATE(getdat)
Syslog('+', "Error while reading EMSI_DAT from the caller");
SM_ERROR;
}
type = SESSION_EMSI;
session_type = SESSION_EMSI;
SM_SUCCESS;
SM_END

View File

@@ -17,6 +17,10 @@
#define SESSION_SLAVE 0
#define SESSION_MASTER 1
#define STATE_SECURE 0
#define STATE_UNSECURE 1
#define STATE_BAD 2
extern node *nlent;
extern fa_list *remote;

View File

@@ -4,7 +4,7 @@
* Purpose ...............: Fidonet mailer
*
*****************************************************************************
* Copyright (C) 1997-2005
* Copyright (C) 1997-2007
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@@ -115,6 +115,8 @@ typedef struct _Hello {
extern int Loaded;
extern pid_t mypid;
extern int laststat;
extern int session_state;
Hello hello2;
Hello gethello2(unsigned char[]);
@@ -214,6 +216,11 @@ int rx_yoohoo(void)
IsDoing("Inbound %s", ascfnode(remote->addr, 0x0f));
if (protect)
session_state = STATE_SECURE;
else
session_state = STATE_UNSECURE;
session_flags |= SESSION_WAZOO;
if (localcaps & DOES_HYDRA)
return hydra(0);
@@ -282,6 +289,7 @@ int tx_yoohoo(void)
return MBERR_YOOHOO;
IsDoing("Outbound %s", ascfnode(remote->addr, 0x0f));
session_state = STATE_SECURE;
session_flags |= SESSION_WAZOO;
if (capabilities & DOES_HYDRA)