Fix for newsserver authorisation
This commit is contained in:
parent
39dbfe3daa
commit
57868f7093
@ -22,6 +22,10 @@ v0.39.5 24-Dec-2003
|
||||
Poll, remove poll and request failed to points which had no
|
||||
point directory in the outbound, now the directory is created.
|
||||
|
||||
mbfido:
|
||||
With scannews after a GROUP command when authorisation was
|
||||
asked we did not perform a login.
|
||||
|
||||
mbsetup:
|
||||
Added setting in menu 1.14 to allow zero bytes lockfiles
|
||||
created by another OS.
|
||||
|
2
TODO
2
TODO
@ -156,6 +156,8 @@ mbnewusr:
|
||||
-- Currently no access to my old Sun Sparcstation.
|
||||
|
||||
mbsetup:
|
||||
N: Add check for reasonable settings for message split.
|
||||
|
||||
N: Add a check for double areatag names.
|
||||
|
||||
N: Use some sort of sorting for the system aka's and make sure the
|
||||
|
@ -1,6 +1,7 @@
|
||||
#ifndef _MBINET_H
|
||||
#define _MBINET_H
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
int smtp_connect(void);
|
||||
int smtp_send(char *);
|
||||
@ -13,6 +14,7 @@ int nntp_send(char *);
|
||||
char *nntp_receive(void);
|
||||
int nntp_close(void);
|
||||
int nntp_cmd(char *, int);
|
||||
int nntp_auth(void);
|
||||
|
||||
int pop3_connect(void);
|
||||
int pop3_send(char *);
|
||||
@ -21,4 +23,3 @@ int pop3_close(void);
|
||||
int pop3_cmd(char *);
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: MBSE BBS Internet Library
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -44,7 +44,6 @@ struct sockaddr_in nntp_loc; /* For local socket address */
|
||||
struct sockaddr_in nntp_rem; /* For remote socket address */
|
||||
|
||||
|
||||
int nntp_auth(void);
|
||||
|
||||
|
||||
int nntp_connect(void)
|
||||
|
@ -164,6 +164,7 @@ struct binkprec {
|
||||
unsigned long nethold; /* Netmail on hold */
|
||||
unsigned long mailhold; /* Packed mail on hold */
|
||||
|
||||
int batchnr;
|
||||
int msgs_on_queue; /* Messages on the queue */
|
||||
};
|
||||
|
||||
@ -192,7 +193,7 @@ char *binkp2unix(char *); /* Unix -> Binkp escape */
|
||||
void fill_binkp_list(binkp_list **, file_list *, off_t); /* Build pending files */
|
||||
void debug_binkp_list(binkp_list **); /* Debug pending files list */
|
||||
int binkp_pendingfiles(void); /* Count pending files */
|
||||
|
||||
void binkp_clear_filelist(void); /* Clear current filelist */
|
||||
|
||||
static int orgbinkp(void); /* Originate session state */
|
||||
static int ansbinkp(void); /* Answer session state */
|
||||
@ -814,9 +815,8 @@ SM_RETURN
|
||||
*/
|
||||
int file_transfer(void)
|
||||
{
|
||||
int rc = 0, complete = FALSE;
|
||||
int rc = 0;
|
||||
TrType Trc = Ok;
|
||||
binkp_list *tmp;
|
||||
|
||||
for (;;) {
|
||||
Syslog('B', "Binkp: FileTransfer state %s", ftstate[bp.FtState]);
|
||||
@ -830,10 +830,6 @@ int file_transfer(void)
|
||||
break;
|
||||
|
||||
case Switch: if ((bp.RxState == RxDone) && (bp.TxState == TxDone)) {
|
||||
complete = TRUE;
|
||||
}
|
||||
|
||||
if (complete) {
|
||||
Syslog('+', "Binkp: file transfer complete rc=%d", bp.rc);
|
||||
bp.FtState = DeinitTransfer;
|
||||
break;
|
||||
@ -844,9 +840,16 @@ int file_transfer(void)
|
||||
*/
|
||||
rc = binkp_poll_frame();
|
||||
if (rc == -1) {
|
||||
if (bp.local_EOB && bp.remote_EOB) {
|
||||
Syslog('b', "Binkp: ignore TCP error in EOB state");
|
||||
} else {
|
||||
/*
|
||||
* Only check if not in EOB state
|
||||
*/
|
||||
bp.rc = rc;
|
||||
bp.FtState = DeinitTransfer;
|
||||
break;
|
||||
}
|
||||
} else if (rc == 1) {
|
||||
bp.FtState = Receive;
|
||||
break;
|
||||
@ -898,20 +901,7 @@ int file_transfer(void)
|
||||
case DeinitTransfer:/*
|
||||
* In case of a transfer error the filelist is not yet cleared
|
||||
*/
|
||||
if (tosend != NULL) {
|
||||
Syslog('b', "Clear current filelist");
|
||||
for (tmp = bll; bll; bll = tmp) {
|
||||
tmp = bll->next;
|
||||
if (bll->local)
|
||||
free(bll->local);
|
||||
if (bll->remote)
|
||||
free(bll->remote);
|
||||
free(bll);
|
||||
}
|
||||
|
||||
tidy_filelist(tosend, TRUE);
|
||||
tosend = NULL;
|
||||
}
|
||||
binkp_clear_filelist();
|
||||
if (bp.rc)
|
||||
return MBERR_FTRANSFER;
|
||||
else
|
||||
@ -964,8 +954,20 @@ TrType binkp_receiver(void)
|
||||
return Ok;
|
||||
} else if (bcmd == MM_EOB) {
|
||||
Syslog('+', "Binkp: got M_EOB");
|
||||
if ((bp.Major == 1) && (bp.Minor != 0) && bp.local_EOB && bp.remote_EOB && ((bp.local_msgs + bp.remote_msgs) > 2)) {
|
||||
Syslog('b', "Binkp: 1.1 mode, stay in RxWaitF");
|
||||
bp.batchnr++;
|
||||
bp.local_EOB = FALSE;
|
||||
bp.remote_EOB = FALSE;
|
||||
bp.local_msgs = 0;
|
||||
bp.remote_msgs = 0;
|
||||
bp.TxState = TxGNF;
|
||||
bp.RxState = RxWaitF;
|
||||
Syslog('+', "Binkp: start batch %d", bp.batchnr + 1);
|
||||
binkp_clear_filelist();
|
||||
return Ok;
|
||||
}
|
||||
bp.RxState = RxEOB;
|
||||
bp.remote_EOB = TRUE;
|
||||
return Ok;
|
||||
} else if (bcmd == MM_FILE) {
|
||||
bp.RxState = RxAccF;
|
||||
@ -1168,6 +1170,7 @@ TrType binkp_receiver(void)
|
||||
bp.RxState = RxDone;
|
||||
return Failure;
|
||||
}
|
||||
|
||||
} else if (bp.RxState == RxDone) {
|
||||
return Ok;
|
||||
}
|
||||
@ -1226,12 +1229,14 @@ TrType binkp_transmitter(void)
|
||||
}
|
||||
debug_binkp_list(&bll);
|
||||
|
||||
if ((bp.nethold || bp.mailhold) || (bp.batchnr == 0)) {
|
||||
Syslog('+', "Binkp: mail %ld, files %ld bytes", bp.nethold, bp.mailhold);
|
||||
if ((rc = binkp_send_command(MM_NUL, "TRF %ld %ld", bp.nethold, bp.mailhold))) {
|
||||
bp.TxState = TxDone;
|
||||
return Failure;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (tmp = bll; tmp; tmp = tmp->next) {
|
||||
if (tmp->state == NoState) {
|
||||
@ -1285,11 +1290,9 @@ TrType binkp_transmitter(void)
|
||||
/*
|
||||
* No more files
|
||||
*/
|
||||
|
||||
Syslog('+', "Binkp: sending M_EOB");
|
||||
rc = binkp_send_command(MM_EOB, "");
|
||||
bp.TxState = TxWLA;
|
||||
bp.local_EOB = TRUE;
|
||||
if (rc)
|
||||
return Failure;
|
||||
else
|
||||
@ -1359,38 +1362,61 @@ TrType binkp_transmitter(void)
|
||||
|
||||
} else if (bp.TxState == TxWLA) {
|
||||
|
||||
if ((bp.msgs_on_queue == 0) && (binkp_pendingfiles() == 0) && (bp.RxState >= RxEOB)) {
|
||||
Syslog('b', "The queue is empty and RxState >= RxEOB");
|
||||
if ((bp.msgs_on_queue == 0) && (binkp_pendingfiles() == 0)) {
|
||||
|
||||
if ((bp.RxState >= RxEOB) && (bp.Major == 1) && (bp.Minor == 0)) {
|
||||
bp.TxState = TxDone;
|
||||
Syslog('+', "Binkp: there were %d messages sent", bp.local_msgs);
|
||||
Syslog('+', "Binkp: there were %d messages received", bp.remote_msgs);
|
||||
if (bp.local_EOB && bp.remote_EOB) {
|
||||
Syslog('b', "Binkp: transmitter puts receiver state to RxDone");
|
||||
Syslog('b', "Binkp: binkp/1.0 session seems complete");
|
||||
bp.RxState = RxDone; /* Not in FSP-1018 rev.1 */
|
||||
}
|
||||
if (tosend != NULL) {
|
||||
Syslog('b', "Clear current filelist");
|
||||
|
||||
for (tmp = bll; bll; bll = tmp) {
|
||||
tmp = bll->next;
|
||||
if (bll->local)
|
||||
free(bll->local);
|
||||
if (bll->remote)
|
||||
free(bll->remote);
|
||||
free(bll);
|
||||
}
|
||||
|
||||
tidy_filelist(tosend, TRUE);
|
||||
tosend = NULL;
|
||||
}
|
||||
binkp_clear_filelist();
|
||||
return Ok;
|
||||
}
|
||||
|
||||
if ((bp.msgs_on_queue == 0) && (binkp_pendingfiles() == 0) && (bp.RxState < RxEOB)) {
|
||||
if ((bp.RxState < RxEOB) && (bp.Major == 1) && (bp.Minor == 0)) {
|
||||
bp.TxState = TxWLA;
|
||||
return Ok;
|
||||
}
|
||||
|
||||
if ((bp.Major == 1) && (bp.Minor != 0)) {
|
||||
Syslog('b', "Binkp: 1.1 check local_EOB=%s remote_EOB=%s local_msgs=%d remote_msgs=%d",
|
||||
bp.local_EOB?"True":"False", bp.remote_EOB?"True":"False", bp.local_msgs, bp.remote_msgs);
|
||||
|
||||
if (bp.local_EOB && bp.remote_EOB) {
|
||||
/*
|
||||
* We did send EOB and got a EOB
|
||||
*/
|
||||
if ((bp.local_msgs < 2) && (bp.remote_msgs < 2)) {
|
||||
/*
|
||||
* Nothing sent anymore, finish
|
||||
*/
|
||||
Syslog('b', "Binkp: binkp/1.1 session seems complete");
|
||||
bp.RxState = RxDone;
|
||||
bp.TxState = TxDone;
|
||||
} else {
|
||||
/*
|
||||
* Start new batch
|
||||
*/
|
||||
bp.batchnr++;
|
||||
bp.local_EOB = FALSE;
|
||||
bp.remote_EOB = FALSE;
|
||||
bp.local_msgs = 0;
|
||||
bp.remote_msgs = 0;
|
||||
bp.TxState = TxGNF;
|
||||
bp.RxState = RxWaitF;
|
||||
Syslog('+', "Binkp: start batch %d", bp.batchnr + 1);
|
||||
binkp_clear_filelist();
|
||||
return Continue;
|
||||
}
|
||||
}
|
||||
|
||||
binkp_clear_filelist();
|
||||
return Ok;
|
||||
}
|
||||
}
|
||||
|
||||
if (bp.msgs_on_queue) {
|
||||
if (binkp_process_messages()) {
|
||||
return Failure;
|
||||
@ -1429,6 +1455,9 @@ int binkp_send_frame(int cmd, char *buf, int len)
|
||||
if (cmd) {
|
||||
header = ((BINKP_CONTROL_BLOCK + len) & 0xffff);
|
||||
bp.local_msgs++;
|
||||
if (buf[0] == MM_EOB) {
|
||||
bp.local_EOB = TRUE;
|
||||
}
|
||||
} else {
|
||||
header = ((BINKP_DATA_BLOCK + len) & 0xffff);
|
||||
}
|
||||
@ -1704,6 +1733,9 @@ int binkp_poll_frame(void)
|
||||
bp.remote_msgs++;
|
||||
bcmd = bp.rxbuf[0];
|
||||
Syslog('b', "Binkp: got %s %s", bstate[bcmd], printable(bp.rxbuf+1, 0));
|
||||
if (bcmd == MM_EOB) {
|
||||
bp.remote_EOB = TRUE;
|
||||
}
|
||||
}
|
||||
rc = 1;
|
||||
break;
|
||||
@ -2060,4 +2092,30 @@ void debug_binkp_list(binkp_list **bkll)
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Clear current filelist
|
||||
*/
|
||||
void binkp_clear_filelist(void)
|
||||
{
|
||||
binkp_list *tmp;
|
||||
|
||||
if (tosend != NULL) {
|
||||
Syslog('b', "Clear current filelist");
|
||||
|
||||
for (tmp = bll; bll; bll = tmp) {
|
||||
tmp = bll->next;
|
||||
if (bll->local)
|
||||
free(bll->local);
|
||||
if (bll->remote)
|
||||
free(bll->remote);
|
||||
free(bll);
|
||||
}
|
||||
|
||||
tidy_filelist(tosend, TRUE);
|
||||
tosend = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/* protocol version */
|
||||
#define PRTCLNAME "binkp"
|
||||
#define PRTCLVER "1.0"
|
||||
#define PRTCLVER "1.1"
|
||||
|
||||
#define MAX_BLKSIZE 0x7fff /* Don't change! */
|
||||
#define BLK_HDR_SIZE 2 /* 2 bytes header */
|
||||
|
@ -4,7 +4,7 @@
|
||||
* Purpose ...............: Scan for new News
|
||||
*
|
||||
*****************************************************************************
|
||||
* Copyright (C) 1997-2002
|
||||
* Copyright (C) 1997-2004
|
||||
*
|
||||
* Michiel Broek FIDO: 2:280/2802
|
||||
* Beekmansbos 10
|
||||
@ -262,6 +262,19 @@ int do_one_group(List **art, char *grpname, char *ftntag, int maxarticles)
|
||||
nntp_send(temp);
|
||||
resp = nntp_receive();
|
||||
retval = atoi(strtok(resp, " "));
|
||||
if (retval == 480) {
|
||||
/*
|
||||
* We must login
|
||||
*/
|
||||
if (nntp_auth() == FALSE) {
|
||||
WriteError("Authorisation failure");
|
||||
nntp_close();
|
||||
return RETVAL_NOAUTH;
|
||||
}
|
||||
nntp_send(temp);
|
||||
resp = nntp_receive();
|
||||
retval = atoi(strtok(resp, " "));
|
||||
}
|
||||
if (retval != 211) {
|
||||
if (retval == 411) {
|
||||
WriteError("No such newsgroup: %s", grpname);
|
||||
|
Reference in New Issue
Block a user