Compare commits

...

7 Commits

Author SHA1 Message Date
bcf0d456ee Revert all except warning fixes 2024-05-14 23:45:29 +03:00
39dd885dd0 fx README 2024-05-14 22:33:51 +03:00
8b10d9f48a fx README 2024-05-14 22:33:05 +03:00
27b4c624b3 env init probe 2024-05-14 21:30:43 +03:00
c2e418676b minor fix README.md 2024-05-14 18:45:35 +03:00
0b2630f624 . 2024-05-14 00:52:05 +03:00
097b39faa7 Minor fixes of Wunused_var, environment copy on subprocess creation 2024-05-14 00:00:37 +03:00
6 changed files with 48 additions and 16 deletions

View File

@ -26,12 +26,17 @@ New Versions
https://prj.zxalexis.ru/gitea/zx/bforce https://prj.zxalexis.ru/gitea/zx/bforce
Older Sources
-------------
https://github.com/zotrix/binkleyforce/
https://sourceforge.net/projects/binkforce/
Copyright (c) 1998-2000 Alexander Belkin, Moscow, Russia. Copyright <br>
(c) 2004-2007 Evgeniy Kozhuhovskiy 2:450/256, 2:450/267 > (c) 1998-2000 Alexander Belkin, Moscow, Russia.<br>
(c) 2005 Andrey Slusar > (c) 2004-2007 Evgeniy Kozhuhovskiy 2:450/256, 2:450/267<br>
(c) 2006-2016 Max N. Boyarov > (c) 2005 Andrey Slusar<br>
(c) 2007-2008 Sergey Babitch > (c) 2006-2016 Max N. Boyarov<br>
(c) 2011-2014 Sergey Dorofeev > (c) 2007-2008 Sergey Babitch<br>
(c) 2014 Alexander Skovpen > (c) 2011-2014 Sergey Dorofeev<br>
(c) 2024 Alexey Khromov > (c) 2014 Alexander Skovpen<br>
> (c) 2024 Alexey Khromov<br>

View File

@ -146,6 +146,7 @@ clean:
rm -f ./bin/core rm -f ./bin/core
clean-am: clean-am:
rm -f ./Makefile rm -f ./Makefile
rm -f ../debian/Makefile
rm -f ./include/config.h rm -f ./include/config.h
rm -f ./config.log rm -f ./config.log
rm -f ./config.status rm -f ./config.status

View File

@ -453,7 +453,7 @@ int main(int argc, char *argv[], char *envp[])
/* Reopen log file if it was defined in config */ /* Reopen log file if it was defined in config */
if( log_reopen(log_getfilename(LOG_FILE_SESSION), NULL, NULL) ) if( log_reopen(log_getfilename(LOG_FILE_SESSION), NULL, NULL) )
{ {
log("can't continue without logging"); DEB((D_CONFIG, "can't continue without logging"));
gotoexit(BFERR_FATALERROR); gotoexit(BFERR_FATALERROR);
} }

View File

@ -755,6 +755,7 @@ int daemon_pidfile(int cmd)
pid_t hispid, mypid = getpid(); pid_t hispid, mypid = getpid();
FILE *pf; FILE *pf;
struct stat sb; struct stat sb;
int res;
if( !pidfile ) if( !pidfile )
return 0; return 0;
@ -768,7 +769,12 @@ int daemon_pidfile(int cmd)
return -1; return -1;
} }
fscanf(pf, "%d", &hispid); res = fscanf(pf, "%d", &hispid);
if (res != 1) {
log("daemon pidfile: not readable");
return -1;
}
fclose(pf); fclose(pf);
if( hispid ) { if( hispid ) {
@ -807,7 +813,12 @@ int daemon_pidfile(int cmd)
return -1; return -1;
} }
fscanf(pf, "%d", &hispid); res = fscanf(pf, "%d", &hispid);
if (res != 1) {
log("daemon pidfile: not readable");
return -1;
}
fclose(pf); fclose(pf);
if( !hispid || (hispid == mypid) ) { if( !hispid || (hispid == mypid) ) {
@ -831,7 +842,12 @@ int daemon_pidfile(int cmd)
return -1; return -1;
} }
fscanf(pf, "%d", &hispid); res = fscanf(pf, "%d", &hispid);
if (res != 1) {
log("daemon pidfile: not readable");
return -1;
}
fclose(pf); fclose(pf);
unlink(pidfile); unlink(pidfile);

View File

@ -311,6 +311,7 @@ int session_set_inbound(void)
{ {
struct stat st; struct stat st;
char *p_inb; char *p_inb;
int res;
p_inb = conf_string(cf_inbound_directory); p_inb = conf_string(cf_inbound_directory);
if( !p_inb ) { if( !p_inb ) {
@ -342,7 +343,11 @@ int session_set_inbound(void)
log("inbound: %s", buf); log("inbound: %s", buf);
state.inbound = (char*)xstrcpy(buf); state.inbound = (char*)xstrcpy(buf);
snprintf( buf, PATH_MAX+30, "/bin/mkdir -p -m 700 %s", state.inbound ); /* 30 additional chars allowed */ snprintf( buf, PATH_MAX+30, "/bin/mkdir -p -m 700 %s", state.inbound ); /* 30 additional chars allowed */
system( buf ); res = system( buf );
if (res != 0) {
log("Inbound create error: %d", res);
return -1;
}
} }
else else
{ {

View File

@ -70,12 +70,14 @@ static char *session_stat_get_stsfile(s_faddr *addr, int linenum)
static int session_stat_read_stsfile(FILE *fp, s_sess_stat *stat) static int session_stat_read_stsfile(FILE *fp, s_sess_stat *stat)
{ {
int res;
if( fseek(fp, 0, SEEK_SET) == -1 ) if( fseek(fp, 0, SEEK_SET) == -1 )
return -1; return -1;
memset(stat, '\0', sizeof(s_sess_stat)); memset(stat, '\0', sizeof(s_sess_stat));
fscanf(fp, "%u %u %u %u %u %u %lu %lu %lu %lu", res = fscanf(fp, "%u %u %u %u %u %u %lu %lu %lu %lu",
(unsigned int *) &stat->tries, (unsigned int *) &stat->tries,
(unsigned int *) &stat->tries_noconn, (unsigned int *) &stat->tries_noconn,
(unsigned int *) &stat->tries_noansw, (unsigned int *) &stat->tries_noansw,
@ -86,7 +88,10 @@ static int session_stat_read_stsfile(FILE *fp, s_sess_stat *stat)
(unsigned long *) &stat->hold_freqs, (unsigned long *) &stat->hold_freqs,
(unsigned long *) &stat->last_success_out, (unsigned long *) &stat->last_success_out,
(unsigned long *) &stat->last_success_in); (unsigned long *) &stat->last_success_in);
if (res == 0) {
log("Read STS unsuccessfull...");
return -1;
}
/* Set last successfull session time */ /* Set last successfull session time */
stat->last_success = MAX(stat->last_success_out, stat->last_success_in); stat->last_success = MAX(stat->last_success_out, stat->last_success_in);