Compare commits

..

No commits in common. "721fa8fdf1aed0150190a1bc9820877577571375" and "bcf0d456eecc0e31f0dd576e24331e8e23e8ec16" have entirely different histories.

13 changed files with 13 additions and 67 deletions

12
.gitignore vendored
View File

@ -1,12 +0,0 @@
*.o
debian/Makefile
source/Makefile
source/bin/
source/bforce/expression.c
source/config.log
source/config.status
source/include/config.h
bforce.geany

View File

@ -1 +1 @@
0.24.2
0.24.1

View File

@ -23,8 +23,6 @@
/* PID of our child process (if use fork) */
pid_t child_pid = 0;
char * mainenv[EXEC_MAX_NUM_ENVS+1];
const char *BFERR[] = {
/* 00 */ "Successfull",
/* 01 */ "Fatal error occured",
@ -255,16 +253,6 @@ int main(int argc, char *argv[], char *envp[])
int rc = 0;
int ch = 0;
opts.runmode = MODE_UNDEFINED;
int i = 0;
mainenv[0] = NULL;
i=0;
while (envp[i]) {
mainenv[i] = malloc(strlen(envp[i])+2);
strcpy(mainenv[i], envp[i]);
mainenv[++i] = NULL;
DEB((D_FREE, "Program ENV: %s\n", mainenv[(i-1)]));
}
memset(&opts, '\0', sizeof(s_bforce_opts));
@ -503,13 +491,6 @@ exit:
deinit_conf();
deinit_opts(&opts);
/* de-init sessenv */
i=0;
while(mainenv[i]) {
DEB((D_FREE, "De-init session ENV: %s\n", mainenv[(i)]));
free(mainenv[i++]);
}
/* Shutdown logging services */
if( log_isopened() ) log_close();
DEB((D_FREE, "good exit"));

View File

@ -170,7 +170,7 @@ int conf_readconf(const char *confname, int inclevel, bool earlydbg)
{
if (earlydbg)
fprintf(stderr,"BF-DEBUG: can't open config file \"%s\"\n", confname);
return(PROC_RC_ABORT);
return(PROC_RC_IGNORE);
}
if (earlydbg)
fprintf(stderr,"BF-DEBUG: start reading config \"%s\"\n", confname);

View File

@ -283,8 +283,6 @@ int logerr(const char *s, ...)
#ifdef USE_SYSLOG
bool slog_active = FALSE;
const char *log_getfilename(int whatfor)
{
const char *p = "/dev/null";
@ -293,27 +291,22 @@ const char *log_getfilename(int whatfor)
bool log_isopened(void)
{
return slog_active;
return TRUE;
}
int log_open(const char *logname, const char *ext, const char *tty)
{
char *p = "bforce ";
p = xstrcat(p, BF_VERSION);
char *p = "bforce";
int fac = conf_number(cf_syslog_facility);
if( tty && *tty )
strncpy(p, tty, sizeof(p));
openlog(p, LOG_PID, fac);
slog_active = TRUE;
return 0;
}
int log_reopen(const char *logname, const char *ext, const char *tty)
{
if ( !slog_active ) {
return (log_reopen(logname, ext, tty));
} else
return 0;
return 0;
}
int log_close(void)

View File

@ -73,18 +73,9 @@ int exec_options_parse(char *str)
void exec_options_init(s_exec_options *eopt)
{
int i = 0;
memset(eopt, '\0', sizeof(s_exec_options));
eopt->umask = EXEC_DEFAULT_UMASK;
eopt->envp[0] = NULL;
while(mainenv[i]) {
DEB((D_FREE,"EXEC: Added ENV variable: %s\n", mainenv[i]));
eopt->envp[i] = xmalloc(strlen(mainenv[i]) + 2);
strcpy(eopt->envp[i],mainenv[i]);
eopt->envp[++i] = NULL;
}
}
void exec_options_deinit(s_exec_options *eopt)

View File

@ -106,7 +106,7 @@ int binkp_loop(s_binkp_state *bstate) {
bool no_more_to_send = false;
bool no_more_read = false;
bool canread, canwrite;
int timeout = conf_number(cf_binkp_timeout);
if( timeout==0 )
timeout = 60;
@ -117,13 +117,12 @@ int binkp_loop(s_binkp_state *bstate) {
// session criterium handshake criterium
while (!bstate->complete || bstate->waiting_got) {
DEB((D_24554, ">>> BinkP loop sendcpl: %d recvcpl: %d phase: %d subphase: %d", bstate->batchsendcomplete, bstate->batchreceivecomplete,
DEB((D_24554, "loop s: %d r: %d p: %d sp: %d", bstate->batchsendcomplete, bstate->batchreceivecomplete,
bstate->phase, bstate->subphase));
if (bstate->continuesend) {
no_more_to_send = false;
bstate->continuesend = false;
}
if (have_to_write==0 && (!no_more_to_send || bstate->extracmd[0]!=-1)) {
m = binkp_getforsend(bstate, writebuf+BINKP_HEADER, &block_type, &block_length);
if(m==1 || m==3) {
@ -268,7 +267,6 @@ int binkp_loop(s_binkp_state *bstate) {
have_to_write -= n;
}
}
DEB((D_24554,"+++ BinkP Loop ended with rc=%d", bstate->rc));
return bstate->rc;
}
@ -341,7 +339,7 @@ int binkp_getforsend(s_binkp_state *bstate, char *buf, int *block_type, unsigned
int my_sf, wr_pos;
int n; // read file
if (bstate->extracmd[0]!=-1) {
DEB((D_24554, "Send cmd to remote %d %s", bstate->extracmd[0], bstate->extracmd+1));
DEB((D_24554, "send command from receiver %d %s", bstate->extracmd[0], bstate->extracmd+1));
buf[0] = bstate->extracmd[0];
strcpy(buf+1, bstate->extracmd+1);
*block_type = BINKP_BLK_CMD;
@ -627,7 +625,7 @@ case 4:
return 1;
case 5:
DEB((D_24554, "BinkP_GetForSend: nothing to send"));
DEB((D_24554, "nothing to send"));
return 2;
@ -806,7 +804,7 @@ case 0:
bstate->frs = frs_data;
return 1;
}
DEB((D_24554, "making M_GET to skip downloaded part, file: %s, size %ld, time %ld, mode 0",recvfi.fn,recvfi.sz, recvfi.tm ));
DEB((D_24554, "making M_GET to skip downloaded part"));
bstate->extracmd[0] = BPMSG_GET;
sprintf(bstate->extracmd+1, "%s %ld %ld %ld",
bstate->pi->recv->net_name, (long)bstate->pi->recv->bytes_total,

View File

@ -45,7 +45,7 @@ int binkp_parsfinfo(const char *str, s_bpfinfo *fi, bool with_offset)
return -1;
}
DEB((D_24554, "info to parse: %s", str));
r = sscanf(str, with_offset? "%s %ld %ld %ld": "%s %ld %ld", &fi->fn, &fi->sz, &fi->tm, &fi->offs);
r = sscanf(str, with_offset? "%s %d %d %d": "%s %d %d", &fi->fn, &fi->sz, &fi->tm, &fi->offs);
chkslash = fi->fn;
while (1) {
chkslash = strchr(chkslash, '/');

View File

@ -860,8 +860,6 @@ int p_rx_fopen(s_protinfo *pi, char *fn, size_t sz, time_t tm, mode_t mode)
size_t minfree = 0;
size_t needed_bytes_total = 0;
DEB((D_FREE, "P_RX_FOPEN: File: %s, Size: %ld", fn, sz));
/*
* Check. May be we are receiving this file allready
*/

View File

@ -117,7 +117,7 @@ int answ_system(e_session type, char *connstr, int inetd)
rc = session();
if( (inetd == 0) && (state.inet == FALSE) )
if( (inetd != 0) && (state.inet = FALSE) )
{
port_deinit(0, &oldtio);
port_close();

View File

@ -145,7 +145,6 @@ char *file_name_makesafe(char *filename)
char *file_getname(char *filename)
{
char *p = strrchr(filename, '/');
DEB((D_FREE, "File_getname: %s", (p ? p + 1 : filename) ));
return p ? p + 1 : filename;
}

View File

@ -181,8 +181,6 @@ typedef struct {
*/
extern const char *BFERR[];
extern char * mainenv[];
int daemon_run(const char *confname, const char *incname, bool quit);
#endif

View File

@ -19,7 +19,7 @@
#define EXEC_OPT_LOGOUT 0x04
#define EXEC_OPT_USESHELL 0x08
#define EXEC_MAX_NUM_ENVS 4095
#define EXEC_MAX_NUM_ENVS 40
#define EXEC_MAX_NUM_ARGS 20
#define EXEC_DEFAULT_UMASK ~(S_IRUSR|S_IWUSR);