Allow zero byte locks from another OS
This commit is contained in:
parent
6e1d6ecc40
commit
b7755b762f
11
ChangeLog
11
ChangeLog
@ -6,15 +6,24 @@ v0.39.5 24-Dec-2003
|
||||
Added code for new binkp development, the code is disabled by
|
||||
default and can only be used with the right configure option.
|
||||
|
||||
common.a:
|
||||
Allows node locking with zero bytes lockfiles created by some
|
||||
other OS when enabled in the setup.
|
||||
|
||||
mbcico:
|
||||
Binkp code cleanup.
|
||||
Allow m_file command in binkp during file transfer in progress.
|
||||
Added two temporary binkp sourcefiles for development.
|
||||
|
||||
Fixed a segfault when a session failed.
|
||||
|
||||
mbout:
|
||||
Poll, remove poll and request failed to points which had no
|
||||
point directory in the outbound, now the directory is created.
|
||||
|
||||
mbsetup:
|
||||
Added setting in menu 1.14 to allow zero bytes lockfiles
|
||||
created by another OS.
|
||||
|
||||
script:
|
||||
Fixed NetBSD init script
|
||||
All init scripts now clean the ~/var/run directory and start
|
||||
|
@ -14,7 +14,7 @@
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<BLOCKQUOTE>
|
||||
<div align="right"><h5>Last update 09-Sep-2003</h5></div>
|
||||
<div align="right"><h5>Last update 28-Dec-2003</h5></div>
|
||||
<div align="center"><H1>MBSE BBS Setup - Global Setup</H1></div>
|
||||
|
||||
In this setup you can edit all global settings for MBSE BBS. All sections will
|
||||
@ -362,7 +362,7 @@ XX,CM and TCP/IP systems (internet) should use the XX,CM,IBN,IFC flags.
|
||||
<strong>No Zedzap </strong>Disable zedzap protocol
|
||||
<strong>No Hydra </strong>Disable Hydra protocol
|
||||
<strong>No MD5 </strong>Disable binkp MD5 passwords
|
||||
<strong>No CRC32 </strong>Disable binkp CRC32 support
|
||||
<strong>Zero Locks OK </strong>Allow zero byte lockfiles from another OS
|
||||
<strong>Phonetrans 1..40 </strong>Maximum 40 phone number translations
|
||||
<strong>Max. files </strong>Maximum files to request, 0 is unlimited
|
||||
<strong>Max. MBytes </strong>Maximum MBytes to request, 0 is unlimited
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "../config.h"
|
||||
#include "libs.h"
|
||||
#include "structs.h"
|
||||
#include "users.h"
|
||||
#include "records.h"
|
||||
#include "clcomm.h"
|
||||
#include "common.h"
|
||||
|
||||
@ -41,7 +43,7 @@ int nodelock(faddr *addr, pid_t mypid)
|
||||
char *fn, *tfn, *p, tmp[16];
|
||||
FILE *fp;
|
||||
pid_t pid;
|
||||
int tmppid, sverr;
|
||||
int tmppid, sverr, rc;
|
||||
time_t ltime, now;
|
||||
|
||||
fn = bsyname(addr);
|
||||
@ -86,9 +88,10 @@ int nodelock(faddr *addr, pid_t mypid)
|
||||
}
|
||||
|
||||
/*
|
||||
* Lock exists, check owner
|
||||
* Lock exists, check owner. If rc <> 1 then the lock may have
|
||||
* been created by another OS (zero bytes lock).
|
||||
*/
|
||||
fscanf(fp, "%d", &tmppid);
|
||||
rc = fscanf(fp, "%d", &tmppid);
|
||||
pid = tmppid;
|
||||
fclose(fp);
|
||||
|
||||
@ -106,7 +109,15 @@ int nodelock(faddr *addr, pid_t mypid)
|
||||
*/
|
||||
ltime = file_time(fn);
|
||||
now = time(NULL);
|
||||
if (kill(pid, 0) && (errno == ESRCH)) {
|
||||
if (CFG.ZeroLocks && (rc != 1) && (((unsigned long)now - (unsigned long)ltime) > 21600)) {
|
||||
Syslog('+', "Found zero byte lock older then 6 hours for %s, unlink", ascfnode(addr,0x1f));
|
||||
unlink(fn);
|
||||
} else if (CFG.ZeroLocks && (rc != 1)) {
|
||||
Syslog('+', "Node %s is locked from another OS", ascfnode(addr, 0x1f));
|
||||
unlink(tfn);
|
||||
free(tfn);
|
||||
return 1;
|
||||
} else if (kill(pid, 0) && (errno == ESRCH)) {
|
||||
Syslog('+', "Found stale bsy file for %s, unlink", ascfnode(addr,0x1f));
|
||||
unlink(fn);
|
||||
} else if (((unsigned long)now - (unsigned long)ltime) > 21600) {
|
||||
@ -139,19 +150,24 @@ int nodeulock(faddr *addr, pid_t mypid)
|
||||
char *fn;
|
||||
FILE *fp;
|
||||
pid_t pid;
|
||||
int tmppid;
|
||||
int tmppid = 0, rc;
|
||||
|
||||
fn = bsyname(addr);
|
||||
if ((fp = fopen(fn, "r")) == NULL) {
|
||||
WriteError("$Can't open lock file (%s) \"%s\"", ascfnode(addr, 0x1f), fn);
|
||||
Syslog('+', "Unlock %s failed, not locked", ascfnode(addr, 0x1f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
fscanf(fp, "%d", &tmppid);
|
||||
rc = fscanf(fp, "%d", &tmppid);
|
||||
pid = tmppid;
|
||||
fclose(fp);
|
||||
|
||||
if (pid == mypid) {
|
||||
if (CFG.ZeroLocks && (rc != 1)) {
|
||||
/*
|
||||
* Zero byte lock from another OS, leave alone.
|
||||
*/
|
||||
return 0;
|
||||
} else if (pid == mypid) {
|
||||
unlink(fn);
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -725,7 +725,7 @@ struct sysconfig {
|
||||
|
||||
unsigned xNoJanus : 1;
|
||||
unsigned NoHydra : 1; /* Don't do Hydra */
|
||||
unsigned xNoIBN : 1;
|
||||
unsigned ZeroLocks : 1; /* Allow 0 bytes locking */
|
||||
unsigned xNoITN : 1;
|
||||
unsigned xNoIFC : 1;
|
||||
|
||||
|
@ -131,11 +131,11 @@ struct binkprec bp; /* Global structure */
|
||||
/*
|
||||
* Prototypes
|
||||
*/
|
||||
int binkp_send_frame(int, char *, int); /* Send cmd/data frame */
|
||||
int binkp_send_command(int, ...); /* Send command frame */
|
||||
void binkp_settimer(int); /* Set timeout timer */
|
||||
int binkp_expired(void); /* Timer expired? */
|
||||
int binkp_banner(void); /* Send system banner */
|
||||
int binkp_send_frame(int, char *, int); /* Send cmd/data frame */
|
||||
int binkp_send_command(int, ...); /* Send command frame */
|
||||
void binkp_settimer(int); /* Set timeout timer */
|
||||
int binkp_expired(void); /* Timer expired? */
|
||||
int binkp_banner(void); /* Send system banner */
|
||||
int binkp_recv_command(char *, int *, int *); /* Receive command frame */
|
||||
void parse_m_nul(char *); /* Parse M_NUL message */
|
||||
|
||||
@ -175,17 +175,21 @@ int binkp(int role)
|
||||
|
||||
if (rc) {
|
||||
Syslog('!', "Binkp: session failed");
|
||||
goto binkperr;
|
||||
goto binkpend;
|
||||
}
|
||||
|
||||
binkperr:
|
||||
binkpend:
|
||||
/*
|
||||
* Deinit
|
||||
*/
|
||||
Syslog('b', "Binkp: deinit start");
|
||||
if (bp.MD_Challenge)
|
||||
free(bp.MD_Challenge);
|
||||
if (bp.rxbuf)
|
||||
free(bp.rxbuf);
|
||||
Syslog('b', "Binkp: deinit end");
|
||||
rc = abs(rc);
|
||||
Syslog('b', "Binkp: rc=%d", rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@ -489,6 +493,10 @@ SM_RETURN
|
||||
* Functions
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Send a binkp frame
|
||||
*/
|
||||
int binkp_send_frame(int cmd, char *buf, int len)
|
||||
{
|
||||
unsigned short header = 0;
|
||||
@ -513,6 +521,9 @@ int binkp_send_frame(int cmd, char *buf, int len)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Send a command message
|
||||
*/
|
||||
int binkp_send_command(int id, ...)
|
||||
{
|
||||
va_list args;
|
||||
@ -543,6 +554,9 @@ int binkp_send_command(int id, ...)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Set binkp master timer
|
||||
*/
|
||||
void binkp_settimer(int interval)
|
||||
{
|
||||
Timer = time((time_t*)NULL) + interval;
|
||||
@ -550,6 +564,9 @@ void binkp_settimer(int interval)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Test if master timer is expired
|
||||
*/
|
||||
int binkp_expired(void)
|
||||
{
|
||||
time_t now;
|
||||
@ -562,6 +579,9 @@ int binkp_expired(void)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Send system info to remote
|
||||
*/
|
||||
int binkp_banner(void)
|
||||
{
|
||||
time_t t;
|
||||
@ -708,5 +728,4 @@ void parse_m_nul(char *msg)
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -182,6 +182,7 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
|
||||
if (rc == 0)
|
||||
putstatus(tmpl->addr, 0, 0);
|
||||
}
|
||||
|
||||
tidy_falist(&remote);
|
||||
if (data)
|
||||
free(data);
|
||||
@ -192,9 +193,6 @@ int session(faddr *a, node *nl, int role, int tp, char *dt)
|
||||
if (emsi_remote_password)
|
||||
free(emsi_remote_password);
|
||||
|
||||
if (nlent->addr.domain)
|
||||
free(nlent->addr.domain);
|
||||
|
||||
inbound_close(rc == 0);
|
||||
return rc;
|
||||
}
|
||||
|
@ -1227,17 +1227,18 @@ void s_mailer(void)
|
||||
mvprintw(16, 2, "10. No EMSI session");
|
||||
mvprintw(17, 2, "11. No Yooho/2U2");
|
||||
|
||||
mvprintw(14,31, "12. No Zmodem");
|
||||
mvprintw(15,31, "13. No Zedzap");
|
||||
mvprintw(16,31, "14. No Hydra");
|
||||
mvprintw(17,31, "15. No MD5");
|
||||
mvprintw(13,31, "12. No Zmodem");
|
||||
mvprintw(14,31, "13. No Zedzap");
|
||||
mvprintw(15,31, "14. No Hydra");
|
||||
mvprintw(16,31, "15. No MD5");
|
||||
mvprintw(17,31, "16. Zero Locks OK");
|
||||
|
||||
mvprintw(12,59, "16. Phonetrans 1-10");
|
||||
mvprintw(13,59, "17. Phonetrans 11-20");
|
||||
mvprintw(14,59, "18. Phonetrans 21-30");
|
||||
mvprintw(15,59, "19. Phonetrans 31-40");
|
||||
mvprintw(16,59, "20. Max. files");
|
||||
mvprintw(17,59, "21. Max. MB.");
|
||||
mvprintw(12,59, "17. Phonetrans 1-10");
|
||||
mvprintw(13,59, "18. Phonetrans 11-20");
|
||||
mvprintw(14,59, "19. Phonetrans 21-30");
|
||||
mvprintw(15,59, "20. Phonetrans 31-40");
|
||||
mvprintw(16,59, "21. Max. files");
|
||||
mvprintw(17,59, "22. Max. MB.");
|
||||
}
|
||||
|
||||
|
||||
@ -1292,15 +1293,16 @@ void e_mailer(void)
|
||||
show_bool(16,23, CFG.NoEMSI);
|
||||
show_bool(17,23, CFG.NoWazoo);
|
||||
|
||||
show_bool(14,52, CFG.NoZmodem);
|
||||
show_bool(15,52, CFG.NoZedzap);
|
||||
show_bool(16,52, CFG.NoHydra);
|
||||
show_bool(17,52, CFG.NoMD5);
|
||||
show_bool(13,52, CFG.NoZmodem);
|
||||
show_bool(14,52, CFG.NoZedzap);
|
||||
show_bool(15,52, CFG.NoHydra);
|
||||
show_bool(16,52, CFG.NoMD5);
|
||||
show_bool(17,52, CFG.ZeroLocks);
|
||||
|
||||
show_int( 16,75, CFG.Req_Files);
|
||||
show_int( 17,75, CFG.Req_MBytes);
|
||||
|
||||
switch(select_menu(21)) {
|
||||
switch(select_menu(22)) {
|
||||
case 0: return;
|
||||
case 1: E_LOGL(CFG.cico_loglevel, "1.14.1", s_mailer)
|
||||
case 2: E_STR( 8,23,20,CFG.Phone, "The mailer default ^phone number^ for this system")
|
||||
@ -1314,17 +1316,18 @@ void e_mailer(void)
|
||||
case 10:E_BOOL(16,23, CFG.NoEMSI, "If set then ^EMSI handshake^ is diabled")
|
||||
case 11:E_BOOL(17,23, CFG.NoWazoo, "If set then ^YooHoo/2U2^ (FTSC-0006) is disabled")
|
||||
|
||||
case 12:E_BOOL(14,52, CFG.NoZmodem, "If set then the ^Zmodem^ protocol is disabled")
|
||||
case 13:E_BOOL(15,52, CFG.NoZedzap, "If set then the ^Zedzap^ protocol is disabled")
|
||||
case 14:E_BOOL(16,52, CFG.NoHydra, "If set then the ^Hydra^ protocol is disabled")
|
||||
case 15:E_BOOL(17,52, CFG.NoMD5, "Disable ^MD5 crypted^ passwords with binkp sessions")
|
||||
case 12:E_BOOL(13,52, CFG.NoZmodem, "If set then the ^Zmodem^ protocol is disabled")
|
||||
case 13:E_BOOL(14,52, CFG.NoZedzap, "If set then the ^Zedzap^ protocol is disabled")
|
||||
case 14:E_BOOL(15,52, CFG.NoHydra, "If set then the ^Hydra^ protocol is disabled")
|
||||
case 15:E_BOOL(16,52, CFG.NoMD5, "Disable ^MD5 crypted^ passwords with binkp sessions")
|
||||
case 16:E_BOOL(17,52, CFG.ZeroLocks, "Allow ^zero byte node lockfiles^ created by another OS")
|
||||
|
||||
case 16:e_trans(0, 17); break;
|
||||
case 17:e_trans(10, 18); break;
|
||||
case 18:e_trans(20, 19); break;
|
||||
case 19:e_trans(30, 20); break;
|
||||
case 20:E_INT(16,75, CFG.Req_Files, "Maximum ^files^ to request, 0 is unlimited")
|
||||
case 21:E_INT(17,75, CFG.Req_MBytes, "Maximum ^MBytes^ to request, 0 is unlimited")
|
||||
case 17:e_trans(0, 17); break;
|
||||
case 18:e_trans(10, 18); break;
|
||||
case 19:e_trans(20, 19); break;
|
||||
case 20:e_trans(30, 20); break;
|
||||
case 21:E_INT(16,75, CFG.Req_Files, "Maximum ^files^ to request, 0 is unlimited")
|
||||
case 22:E_INT(17,75, CFG.Req_MBytes, "Maximum ^MBytes^ to request, 0 is unlimited")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1916,6 +1919,7 @@ int global_doc(FILE *fp, FILE *toc, int page)
|
||||
fprintf(fp, " No Zedzap %s\n", getboolean(CFG.NoZedzap));
|
||||
fprintf(fp, " No Hydra %s\n", getboolean(CFG.NoHydra));
|
||||
fprintf(fp, " No MD5 passwords %s\n", getboolean(CFG.NoMD5));
|
||||
fprintf(fp, " 0 bytes locks OK %s\n", getboolean(CFG.ZeroLocks));
|
||||
fprintf(fp, " Max request files %d\n", CFG.Req_Files);
|
||||
fprintf(fp, " Max request MBytes %d\n", CFG.Req_MBytes);
|
||||
|
||||
|
Reference in New Issue
Block a user