Fixed many PVS-Studio warnings and suppressed needed overhaul
This commit is contained in:
		
							parent
							
								
									64cfc794dc
								
							
						
					
					
						commit
						4c796b042c
					
				@ -76,8 +76,8 @@ s_daemon_queue daemon_queues[] = {
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Positions of the certain queues in the 'daemon_queues' array
 | 
					 * Positions of the certain queues in the 'daemon_queues' array
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
#define MODEM_QUEUE 0
 | 
					#define MODEM_QUEUE 1
 | 
				
			||||||
#define TCPIP_QUEUE 1
 | 
					#define TCPIP_QUEUE 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static RETSIGTYPE daemon_sighandler_chld(int sig)
 | 
					static RETSIGTYPE daemon_sighandler_chld(int sig)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -116,7 +116,7 @@ static pid_t lock_read_pid(const char *lckname)
 | 
				
			|||||||
	if( len == sizeof(pid) || sscanf(buf, "%d", &pid) != 1 || pid == 0 )
 | 
						if( len == sizeof(pid) || sscanf(buf, "%d", &pid) != 1 || pid == 0 )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		/* We found binary lock file? */
 | 
							/* We found binary lock file? */
 | 
				
			||||||
		pid = *((u_int *)buf);
 | 
							pid = *((u_int *)buf); //-V1032
 | 
				
			||||||
#ifndef LOCK_BINARY
 | 
					#ifndef LOCK_BINARY
 | 
				
			||||||
		log("warning: found binary lock file %s", lckname);
 | 
							log("warning: found binary lock file %s", lckname);
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -21,7 +21,7 @@
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Local variables for logger
 | 
					 * Local variables for logger
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static FILE *log_fp = NULL;
 | 
					static FILE  *log_fp = NULL;
 | 
				
			||||||
static char  log_name[BF_MAXPATH+1] = BFORCE_LOGFILE;
 | 
					static char  log_name[BF_MAXPATH+1] = BFORCE_LOGFILE;
 | 
				
			||||||
static char  log_extension[32] = "";
 | 
					static char  log_extension[32] = "";
 | 
				
			||||||
static char  log_ident[32] = "";
 | 
					static char  log_ident[32] = "";
 | 
				
			||||||
@ -31,7 +31,7 @@ static char  log_ttyname[32] = "";
 | 
				
			|||||||
/*
 | 
					/*
 | 
				
			||||||
 * Local variables needed to make debug work
 | 
					 * Local variables needed to make debug work
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static FILE *debug_fp = NULL;
 | 
					static FILE  *debug_fp = NULL;
 | 
				
			||||||
static long  debug_current_debuglevel = BFORCE_DEBLEVEL;
 | 
					static long  debug_current_debuglevel = BFORCE_DEBLEVEL;
 | 
				
			||||||
static char  debug_name[BF_MAXPATH+1] = BFORCE_DEBFILE;
 | 
					static char  debug_name[BF_MAXPATH+1] = BFORCE_DEBFILE;
 | 
				
			||||||
static bool  debug_invalid_name = FALSE;
 | 
					static bool  debug_invalid_name = FALSE;
 | 
				
			||||||
@ -124,7 +124,7 @@ int log_open(const char *logname, const char *ext, const char *tty)
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if( log_name )
 | 
						if( log_name[0] )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		/* Open previously set log file */
 | 
							/* Open previously set log file */
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
@ -145,7 +145,7 @@ int log_close(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ASSERT(log_fp);
 | 
						ASSERT(log_fp);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if( log_fp != NULL )
 | 
						if( log_fp ) //-V0547
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		rc = fclose(log_fp); 
 | 
							rc = fclose(log_fp); 
 | 
				
			||||||
		DEB((D_INFO,"Closing log file."));
 | 
							DEB((D_INFO,"Closing log file."));
 | 
				
			||||||
@ -162,7 +162,7 @@ int log_reopen(const char *logname, const char *ext, const char *tty)
 | 
				
			|||||||
	if( log_isopened() )
 | 
						if( log_isopened() )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if( !strcmp(logname, log_name)
 | 
							if( !strcmp(logname, log_name)
 | 
				
			||||||
		 && !strcmp(log_extension ? log_extension : "", ext ? ext : "") )
 | 
							 && !strcmp(log_extension, ext ? ext : "") )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@ -464,7 +464,7 @@ int debug_open()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ASSERT(debug_fp == NULL);
 | 
						ASSERT(debug_fp == NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if( debug_name )
 | 
						if( debug_name[0] )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                char log_name[PATH_MAX];
 | 
					                char log_name[PATH_MAX];
 | 
				
			||||||
@ -518,7 +518,7 @@ int debug_close(void)
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	ASSERT(debug_fp != NULL);
 | 
						ASSERT(debug_fp != NULL);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if( debug_fp )
 | 
						if( debug_fp ) //-V0547
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		fprintf(debug_fp, "****************************************************\n");
 | 
							fprintf(debug_fp, "****************************************************\n");
 | 
				
			||||||
		fprintf(debug_fp, " Closing binkleyforce debug file at %s\n",
 | 
							fprintf(debug_fp, " Closing binkleyforce debug file at %s\n",
 | 
				
			||||||
 | 
				
			|||||||
@ -60,7 +60,7 @@ int nodelist_checkflag(const char *nodeflags, const char *flag)
 | 
				
			|||||||
	if ( nodeflags ) {
 | 
						if ( nodeflags ) {
 | 
				
			||||||
		while( p = strcasestr(searchbase, flag) ) // p - found flag 
 | 
							while( p = strcasestr(searchbase, flag) ) // p - found flag 
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if( (p == searchbase) || (p != searchbase && *(p-1) == ',') )
 | 
								if (*(p-1) == ',')
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if( (q = strchr(p, ',')) == NULL || (q - p) == strlen(flag) ) {
 | 
									if( (q = strchr(p, ',')) == NULL || (q - p) == strlen(flag) ) {
 | 
				
			||||||
					DEB((D_NODELIST, "nodelist: found flag %s", flag));
 | 
										DEB((D_NODELIST, "nodelist: found flag %s", flag));
 | 
				
			||||||
@ -619,10 +619,10 @@ int nodelist_close(s_nodelist *nlp)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ASSERT(nlp && nlp->fp_nodelist && nlp->fp_index);
 | 
						ASSERT(nlp && nlp->fp_nodelist && nlp->fp_index);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if( nlp->fp_nodelist && file_close(nlp->fp_nodelist) )
 | 
						if( nlp->fp_nodelist && file_close(nlp->fp_nodelist) )  //-V0560
 | 
				
			||||||
		logerr("cannot close nodelist \"%s\"", nlp->name_nodelist);
 | 
							logerr("cannot close nodelist \"%s\"", nlp->name_nodelist);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if( nlp->fp_index && file_close(nlp->fp_index) )
 | 
						if( nlp->fp_index && file_close(nlp->fp_index) ) //-V0560
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		logerr("cannot close nodelist index \"%s\"", nlp->name_index);
 | 
							logerr("cannot close nodelist index \"%s\"", nlp->name_index);
 | 
				
			||||||
		rc = 1;
 | 
							rc = 1;
 | 
				
			||||||
 | 
				
			|||||||
@ -362,9 +362,6 @@ int xsystem(const char *command, const char *p_input, const char *p_output)
 | 
				
			|||||||
				close(fd);
 | 
									close(fd);
 | 
				
			||||||
				exit(-1);
 | 
									exit(-1);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if( p_output )
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			close(2);
 | 
								close(2);
 | 
				
			||||||
			fd = open(p_output, O_WRONLY|O_APPEND|O_CREAT, 0600);
 | 
								fd = open(p_output, O_WRONLY|O_APPEND|O_CREAT, 0600);
 | 
				
			||||||
			if( fd != 2 )
 | 
								if( fd != 2 )
 | 
				
			||||||
 | 
				
			|||||||
@ -369,7 +369,7 @@ static int out_bsy_convert_csy_to_bsy(s_bsylist *ptrl)
 | 
				
			|||||||
	out_bsy_file_link(lockname, ".csy", lockname, ".bsy")
 | 
						out_bsy_file_link(lockname, ".csy", lockname, ".bsy")
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/* Create BSY file in 4D outbound */
 | 
						/* Create BSY file in 4D outbound */
 | 
				
			||||||
	if( !isfailed && ptrl->name_4d )
 | 
						if( ptrl->name_4d )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		switch( LINK_CSY_TO_BSY(ptrl->name_4d) ) {
 | 
							switch( LINK_CSY_TO_BSY(ptrl->name_4d) ) {
 | 
				
			||||||
		case PLOCK_OK:	locked_4d = TRUE; break;
 | 
							case PLOCK_OK:	locked_4d = TRUE; break;
 | 
				
			||||||
 | 
				
			|||||||
@ -272,7 +272,7 @@ static int out_parse_name_lbox(s_faddr *addr, const char *filename)
 | 
				
			|||||||
	ASSERT(addr && filename);
 | 
						ASSERT(addr && filename);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	memset(&tmp, '\0', sizeof(s_faddr));
 | 
						memset(&tmp, '\0', sizeof(s_faddr));
 | 
				
			||||||
	if( sscanf(filename, "%d.%d.%d.%d",
 | 
						if( sscanf(filename, "%u.%u.%u.%u",
 | 
				
			||||||
		&tmp.zone, &tmp.net, &tmp.node, &tmp.point) == 4 )
 | 
							&tmp.zone, &tmp.net, &tmp.node, &tmp.point) == 4 )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		*addr = tmp;
 | 
							*addr = tmp;
 | 
				
			||||||
@ -377,7 +377,7 @@ int out_parse_name_aso(s_faddr *addr, const char *filename)
 | 
				
			|||||||
	ASSERT(addr && filename);
 | 
						ASSERT(addr && filename);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	memset(&tmp, '\0', sizeof(s_faddr));
 | 
						memset(&tmp, '\0', sizeof(s_faddr));
 | 
				
			||||||
	if( sscanf(filename, "%d.%d.%d.%d.%*s", &tmp.zone,
 | 
						if( sscanf(filename, "%u.%u.%u.%u.%*s", &tmp.zone,
 | 
				
			||||||
	    &tmp.net, &tmp.node, &tmp.point) == 4 )
 | 
						    &tmp.net, &tmp.node, &tmp.point) == 4 )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		*addr = tmp;
 | 
							*addr = tmp;
 | 
				
			||||||
 | 
				
			|||||||
@ -186,9 +186,9 @@ int out_handle_sysqueue(s_outbound_callback_data *callback)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/* Try to found existing entry for this address */
 | 
						/* Try to found existing entry for this address */
 | 
				
			||||||
	if( (sentry = out_getsysentry((s_sysqueue*)callback->dest,
 | 
						sentry = out_getsysentry((s_sysqueue*)callback->dest,
 | 
				
			||||||
			callback->addr)) == NULL )
 | 
								callback->addr);
 | 
				
			||||||
		return -1;
 | 
						//	if (!sentry) return -1;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if( type == TYPE_NETMAIL || type == TYPE_REQUEST || type == TYPE_FILEBOX )
 | 
						if( type == TYPE_NETMAIL || type == TYPE_REQUEST || type == TYPE_FILEBOX )
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@ -283,7 +283,7 @@ void log_sysqueue(const s_sysqueue *q)
 | 
				
			|||||||
		if( q->systab[i].flavors & FLAVOR_CRASH  ) strcat(tmp, "Crash,");
 | 
							if( q->systab[i].flavors & FLAVOR_CRASH  ) strcat(tmp, "Crash,");
 | 
				
			||||||
		if( q->systab[i].flavors & FLAVOR_NORMAL ) strcat(tmp, "Normal,");
 | 
							if( q->systab[i].flavors & FLAVOR_NORMAL ) strcat(tmp, "Normal,");
 | 
				
			||||||
		if( q->systab[i].flavors & FLAVOR_HOLD   ) strcat(tmp, "Hold,");
 | 
							if( q->systab[i].flavors & FLAVOR_HOLD   ) strcat(tmp, "Hold,");
 | 
				
			||||||
		if( tmp[0] ) tmp[strlen(tmp)-1] = '\0';
 | 
							if( strlen(tmp)>0 ) tmp[strlen(tmp)-1] = '\0';
 | 
				
			||||||
		DEB((D_OUTBOUND, "log_sysqueue: \tflavors: \"%s\"", tmp));
 | 
							DEB((D_OUTBOUND, "log_sysqueue: \tflavors: \"%s\"", tmp));
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		tmp[0] = '\0';
 | 
							tmp[0] = '\0';
 | 
				
			||||||
@ -294,7 +294,7 @@ void log_sysqueue(const s_sysqueue *q)
 | 
				
			|||||||
		if( q->systab[i].types & TYPE_FILEECHO ) strcat(tmp, "fileecho,");
 | 
							if( q->systab[i].types & TYPE_FILEECHO ) strcat(tmp, "fileecho,");
 | 
				
			||||||
		if( q->systab[i].types & TYPE_FILEBOX  ) strcat(tmp, "filebox,");
 | 
							if( q->systab[i].types & TYPE_FILEBOX  ) strcat(tmp, "filebox,");
 | 
				
			||||||
		if( q->systab[i].types & TYPE_FROMFLO  ) strcat(tmp, "fromflo,");
 | 
							if( q->systab[i].types & TYPE_FROMFLO  ) strcat(tmp, "fromflo,");
 | 
				
			||||||
		if( tmp[0] ) tmp[strlen(tmp)-1] = '\0';
 | 
							if( strlen(tmp)>0 ) tmp[strlen(tmp)-1] = '\0';
 | 
				
			||||||
		DEB((D_OUTBOUND, "log_sysqueue: \ttypes: \"%s\"", tmp));
 | 
							DEB((D_OUTBOUND, "log_sysqueue: \ttypes: \"%s\"", tmp));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	DEB((D_OUTBOUND, "log_sysqueue: END"));
 | 
						DEB((D_OUTBOUND, "log_sysqueue: END"));
 | 
				
			||||||
 | 
				
			|||||||
@ -281,9 +281,9 @@ int binkp_loop(s_binkp_state *bstate) {
 | 
				
			|||||||
int binkp_outgoing(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data)
 | 
					int binkp_outgoing(s_binkp_sysinfo *local_data, s_binkp_sysinfo *remote_data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    char *p;
 | 
					    char *p;
 | 
				
			||||||
    init_keys(remote_data->keys_out, local_data->passwd ? local_data->passwd : "-");
 | 
					    init_keys(remote_data->keys_out, local_data->passwd[0] ? local_data->passwd : "-");
 | 
				
			||||||
    init_keys(remote_data->keys_in,  "-");
 | 
					    init_keys(remote_data->keys_in,  "-");
 | 
				
			||||||
    for (p=local_data->passwd ? local_data->passwd : "-"; *p; p++)
 | 
					    for (p=local_data->passwd[0] ? local_data->passwd : "-"; *p; p++)
 | 
				
			||||||
        update_keys(remote_data->keys_in, (int)*p);
 | 
					        update_keys(remote_data->keys_in, (int)*p);
 | 
				
			||||||
    s_binkp_state s;
 | 
					    s_binkp_state s;
 | 
				
			||||||
    s.mode = bmode_outgoing_handshake;
 | 
					    s.mode = bmode_outgoing_handshake;
 | 
				
			||||||
@ -1156,7 +1156,7 @@ case BINKP_BLK_DATA:
 | 
				
			|||||||
	        return 1;
 | 
						        return 1;
 | 
				
			||||||
	    }
 | 
						    }
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
        PROTO_ERROR("never should be here");
 | 
					        PROTO_ERROR("never should be here"); //-V0779
 | 
				
			||||||
default:
 | 
					default:
 | 
				
			||||||
        PROTO_ERROR("impossible block_type");
 | 
					        PROTO_ERROR("impossible block_type");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -54,7 +54,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi)
 | 
				
			|||||||
	/* local queue */
 | 
						/* local queue */
 | 
				
			||||||
	for( ptrl = q->fslist; ptrl; ptrl = ptrl->next ) {
 | 
						for( ptrl = q->fslist; ptrl; ptrl = ptrl->next ) {
 | 
				
			||||||
	        //DEB((D_OUTBOUND, "scan %s", ptrl->fname));
 | 
						        //DEB((D_OUTBOUND, "scan %s", ptrl->fname));
 | 
				
			||||||
	        if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue;
 | 
						        if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue; //-V0547
 | 
				
			||||||
		if( ptrl->status == STATUS_WILLSEND )
 | 
							if( ptrl->status == STATUS_WILLSEND )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if( pi->reqs_only )
 | 
								if( pi->reqs_only )
 | 
				
			||||||
@ -100,7 +100,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	for( ptrl = pi->filelist; ptrl; ptrl = ptrl->next ) {
 | 
						for( ptrl = pi->filelist; ptrl; ptrl = ptrl->next ) {
 | 
				
			||||||
	        if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue;
 | 
						        if (hint) if (strcmp(hint->fn, ptrl->fname) !=0 || hint->sz != ptrl->size) continue; //-V0547
 | 
				
			||||||
		if( ptrl->status == STATUS_WILLSEND )
 | 
							if( ptrl->status == STATUS_WILLSEND )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			*dest = ptrl;
 | 
								*dest = ptrl;
 | 
				
			||||||
@ -112,7 +112,7 @@ static int prot_get_next_file(s_filelist **dest, s_protinfo *pi)
 | 
				
			|||||||
	/* network queue */
 | 
						/* network queue */
 | 
				
			||||||
#ifdef NETSPOOL
 | 
					#ifdef NETSPOOL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (hint) return 1; // cannot choose
 | 
					        if (hint) return 1; //-V0547 cannot choose 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*DEB((D_OUTBOUND, log("netspool next file");*/
 | 
						/*DEB((D_OUTBOUND, log("netspool next file");*/
 | 
				
			||||||
	if(state.netspool.state == NS_NOTINIT) {
 | 
						if(state.netspool.state == NS_NOTINIT) {
 | 
				
			||||||
 | 
				
			|||||||
@ -113,13 +113,13 @@ void emsi_deinit(s_handshake_protocol *THIS)
 | 
				
			|||||||
	ASSERT(THIS->remote_data);
 | 
						ASSERT(THIS->remote_data);
 | 
				
			||||||
	ASSERT(THIS->local_data);
 | 
						ASSERT(THIS->local_data);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if( THIS->remote_data )
 | 
						if( THIS->remote_data ) //-V0547
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		memset(THIS->remote_data, '\0', sizeof(s_emsi));
 | 
							memset(THIS->remote_data, '\0', sizeof(s_emsi));
 | 
				
			||||||
		free(THIS->remote_data);
 | 
							free(THIS->remote_data);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if( THIS->local_data )
 | 
						if( THIS->local_data ) //-V0547
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		memset(THIS->local_data, '\0', sizeof(s_emsi));
 | 
							memset(THIS->local_data, '\0', sizeof(s_emsi));
 | 
				
			||||||
		free(THIS->local_data);
 | 
							free(THIS->local_data);
 | 
				
			||||||
 | 
				
			|||||||
@ -286,10 +286,11 @@ static char *hydra_putword(char *buf, int val)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static long hydra_getlong(const char *buf)
 | 
					static long hydra_getlong(const char *buf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return ( (unsigned long) ((unsigned char) buf[0])       )
 | 
						//return ( (unsigned long) ((unsigned char) buf[0])       )
 | 
				
			||||||
	     | ( (unsigned long) ((unsigned char) buf[1]) << 8  )
 | 
						//     | ( (unsigned long) ((unsigned char) buf[1]) << 8  )
 | 
				
			||||||
	     | ( (unsigned long) ((unsigned char) buf[2]) << 16 )
 | 
						//     | ( (unsigned long) ((unsigned char) buf[2]) << 16 )
 | 
				
			||||||
	     | ( (unsigned long) ((unsigned char) buf[3]) << 24 );
 | 
						//     | ( (unsigned long) ((unsigned char) buf[3]) << 24 );
 | 
				
			||||||
 | 
						return ( buf[3]<<24 | buf[2]<<16 | buf[1]<<8 | buf[0]);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int hydra_getword(const char *buf)
 | 
					static int hydra_getword(const char *buf)
 | 
				
			||||||
@ -480,7 +481,7 @@ static char *hydra_putuueblock(char *buf, char *src, size_t szsrc)
 | 
				
			|||||||
		*buf++ = HYDRA_UUENC(src[0] >> 2);
 | 
							*buf++ = HYDRA_UUENC(src[0] >> 2);
 | 
				
			||||||
		*buf++ = HYDRA_UUENC(((src[0] << 4) & 0x30) | ((src[1] >> 4) & 0x0f));
 | 
							*buf++ = HYDRA_UUENC(((src[0] << 4) & 0x30) | ((src[1] >> 4) & 0x0f));
 | 
				
			||||||
		*buf++ = HYDRA_UUENC(((src[1] << 2) & 0x3c) | ((src[2] >> 6) & 0x03));
 | 
							*buf++ = HYDRA_UUENC(((src[1] << 2) & 0x3c) | ((src[2] >> 6) & 0x03));
 | 
				
			||||||
		*buf++ = HYDRA_UUENC(src[2] & 0x3f);
 | 
							*buf++ = (HYDRA_UUENC(src[2]) & 0x3f);  //-V0578
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if( szsrc > 0 )
 | 
						if( szsrc > 0 )
 | 
				
			||||||
@ -1074,8 +1075,8 @@ static int hydra_parse_init(s_hydrainfo *hi, char *pkt, size_t pktlen)
 | 
				
			|||||||
						
 | 
											
 | 
				
			||||||
			sscanf(window, "%08lx%08lx", &txwindow, &rxwindow);
 | 
								sscanf(window, "%08lx%08lx", &txwindow, &rxwindow);
 | 
				
			||||||
						
 | 
											
 | 
				
			||||||
			if( txwindow < 0 ) txwindow = 0L;
 | 
								//if( txwindow < 0 ) txwindow = 0L;
 | 
				
			||||||
			if( rxwindow < 0 ) rxwindow = 0L;
 | 
								//if( rxwindow < 0 ) rxwindow = 0L;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			/*
 | 
								/*
 | 
				
			||||||
			 * Log other's hydra information only at 1st batch
 | 
								 * Log other's hydra information only at 1st batch
 | 
				
			||||||
@ -1594,7 +1595,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		case HPKT_START:
 | 
							case HPKT_START:
 | 
				
			||||||
			if( txstate == HTX_START || txstate == HTX_SWAIT )
 | 
								if( txstate == HTX_START || txstate == HTX_SWAIT ) //-V0560
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				txtries = 0;
 | 
									txtries = 0;
 | 
				
			||||||
				txstate = HTX_INIT;
 | 
									txstate = HTX_INIT;
 | 
				
			||||||
@ -1615,7 +1616,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		case HPKT_INITACK:
 | 
							case HPKT_INITACK:
 | 
				
			||||||
			if( txstate == HTX_INIT || txstate == HTX_INITACK )
 | 
								if( txstate == HTX_INIT || txstate == HTX_INITACK ) //-V0560
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				txtries = 0;
 | 
									txtries = 0;
 | 
				
			||||||
				txstate = HTX_RINIT;
 | 
									txstate = HTX_RINIT;
 | 
				
			||||||
@ -1709,7 +1710,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		case HPKT_FINFOACK:
 | 
							case HPKT_FINFOACK:
 | 
				
			||||||
			if( txstate == HTX_FINFO || txstate == HTX_FINFOACK )
 | 
								if( txstate == HTX_FINFO || txstate == HTX_FINFOACK ) //-V0560
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				long offs = 0L;
 | 
									long offs = 0L;
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
@ -1724,7 +1725,8 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
 | 
				
			|||||||
				{
 | 
									{
 | 
				
			||||||
					log("Hydra: got invalid FINFOACK packet (ignored)");
 | 
										log("Hydra: got invalid FINFOACK packet (ignored)");
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				else if( (offs = hydra_getlong(hi->ibuf)) == 0 )
 | 
									offs = hydra_getlong(hi->ibuf);
 | 
				
			||||||
 | 
									if( offs == 0 )
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					txlastack = 0;
 | 
										txlastack = 0;
 | 
				
			||||||
					txtries = 0;
 | 
										txtries = 0;
 | 
				
			||||||
@ -1992,7 +1994,7 @@ int hydra_batch(s_hydrainfo *hi, s_protinfo *pi)
 | 
				
			|||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			else if( rxstate == HRX_Skip || rxstate == HRX_SkipAck )
 | 
								else if( rxstate == HRX_Skip || rxstate == HRX_SkipAck ) //-V0560
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if( hi->isize < 4 )
 | 
									if( hi->isize < 4 )
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
 | 
				
			|||||||
@ -612,7 +612,7 @@ void session_traffic_log(bool incoming, s_traffic *traff)
 | 
				
			|||||||
			strcat(msg, buf);
 | 
								strcat(msg, buf);
 | 
				
			||||||
			strcat(msg, " files, ");
 | 
								strcat(msg, " files, ");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if( *msg )
 | 
							if( *msg && strlen(msg)>2 )
 | 
				
			||||||
			msg[strlen(msg)-2] = '\0';
 | 
								msg[strlen(msg)-2] = '\0';
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -150,12 +150,6 @@ static int nodelist_makeindex(s_nodelist *nlp, s_faddr addr)
 | 
				
			|||||||
				modepoint = false;
 | 
									modepoint = false;
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			case KEYWORD_REGION:
 | 
								case KEYWORD_REGION:
 | 
				
			||||||
				bni.net   = value;
 | 
					 | 
				
			||||||
				bni.node  = 0;
 | 
					 | 
				
			||||||
				bni.point = 0;
 | 
					 | 
				
			||||||
				bni.hub   = 0;
 | 
					 | 
				
			||||||
				modepoint = false;
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
			case KEYWORD_HOST:
 | 
								case KEYWORD_HOST:
 | 
				
			||||||
				bni.net   = value;
 | 
									bni.net   = value;
 | 
				
			||||||
				bni.node  = 0;
 | 
									bni.node  = 0;
 | 
				
			||||||
 | 
				
			|||||||
@ -137,6 +137,18 @@ typedef struct bni
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
s_bni;
 | 
					s_bni;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef struct pbline
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						bool inet;
 | 
				
			||||||
 | 
						bool prot_binkp;
 | 
				
			||||||
 | 
						bool prot_cico;
 | 
				
			||||||
 | 
						char *phone;
 | 
				
			||||||
 | 
						char *ina;
 | 
				
			||||||
 | 
						int  port;
 | 
				
			||||||
 | 
						struct pbline *nextline;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					s_pbline;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
typedef struct node
 | 
					typedef struct node
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	s_faddr addr;
 | 
						s_faddr addr;
 | 
				
			||||||
@ -154,6 +166,7 @@ typedef struct node
 | 
				
			|||||||
	bool do_telnet;
 | 
						bool do_telnet;
 | 
				
			||||||
	char host[BNI_MAXHOST+1];
 | 
						char host[BNI_MAXHOST+1];
 | 
				
			||||||
	s_timevec worktime;
 | 
						s_timevec worktime;
 | 
				
			||||||
 | 
						s_pbline phbook;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
s_node;
 | 
					s_node;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user