Fix default NNTP port and allow skipping of client authentication to NNTP server

This commit is contained in:
Greg Wildman 2021-06-17 15:58:28 +02:00
parent 82835c508d
commit 432de5ad21

View File

@ -327,7 +327,7 @@ void readconfigfile(void) {
colon = strchr(cfg_server, ':'); colon = strchr(cfg_server, ':');
if (!colon) if (!colon)
nntp_port = 110; nntp_port = 119;
else { else {
nntp_port = atoi(colon + 1); nntp_port = atoi(colon + 1);
*colon = '\0'; *colon = '\0';
@ -649,19 +649,22 @@ void main(int argc, char *argv[]) {
if (expect(buf, "20")) // "200" if posting is allowed / "201" if no posting if (expect(buf, "20")) // "200" if posting is allowed / "201" if no posting
error_exit(); error_exit();
sprintf(sendbuf, "AUTHINFO USER %s\r\n", cfg_user); // Skip authentication?
if (!w5100_tcp_send_recv(sendbuf, buf, NETBUFSZ, DO_SEND, CMD_MODE)) { if (strcmp(cfg_user, "-") != 0) {
error_exit(); sprintf(sendbuf, "AUTHINFO USER %s\r\n", cfg_user);
} if (!w5100_tcp_send_recv(sendbuf, buf, NETBUFSZ, DO_SEND, CMD_MODE)) {
if (expect(buf, "381")) // Username accepted error_exit();
error_exit(); }
if (expect(buf, "381")) // Username accepted
error_exit();
sprintf(sendbuf, "AUTHINFO PASS %s\r\n", cfg_pass); sprintf(sendbuf, "AUTHINFO PASS %s\r\n", cfg_pass);
if (!w5100_tcp_send_recv(sendbuf, buf, NETBUFSZ, DO_SEND, CMD_MODE)) { if (!w5100_tcp_send_recv(sendbuf, buf, NETBUFSZ, DO_SEND, CMD_MODE)) {
error_exit(); error_exit();
}
if (expect(buf, "281")) // Authentication successful
error_exit();
} }
if (expect(buf, "281")) // Authentication successful
error_exit();
while (1) { while (1) {
msg = fscanf(newsgroupsfp, "%s %s %ld", newsgroup, mailbox, &msgnum); msg = fscanf(newsgroupsfp, "%s %s %ld", newsgroup, mailbox, &msgnum);