Revision: 555
http://vde.svn.sourceforge.net/vde/?rev=555&view=rev
Author: rd235
Date: 2013-03-04 17:56:00 +0000 (Mon, 04 Mar 2013)
Log Message:
-----------
Several BugFixes (see bug-reports from "accounts")
Modified Paths:
--------------
trunk/vde-2/src/kvde_switch/consmgmt.c
trunk/vde-2/src/vde_autolink.c
trunk/vde-2/src/vde_cryptcab/cryptcab.c
trunk/vde-2/src/vde_cryptcab/vde_cryptcab_client.c
trunk/vde-2/src/vde_pcapplug.c
trunk/vde-2/src/vde_plug2tap.c
trunk/vde-2/src/vde_switch/consmgmt.c
trunk/vde-2/src/vde_switch/plugins/iplog.c
trunk/vde-2/src/wirefilter.c
Modified: trunk/vde-2/src/kvde_switch/consmgmt.c
===================================================================
--- trunk/vde-2/src/kvde_switch/consmgmt.c 2012-08-03 15:02:03 UTC (rev
554)
+++ trunk/vde-2/src/kvde_switch/consmgmt.c 2013-03-04 17:56:00 UTC (rev
555)
@@ -462,9 +462,9 @@
static void save_pidfile()
{
if(pidfile[0] != '/')
- strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path));
+ strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path)
- 1);
else
- strcpy(pidfile_path, pidfile);
+ strncpy(pidfile_path, pidfile, PATH_MAX - 1);
int fd = open(pidfile_path,
O_WRONLY | O_CREAT | O_EXCL,
@@ -575,7 +575,7 @@
/* saves current path in pidfile_path, because otherwise with
daemonize() we
* * forget it */
- if(getcwd(pidfile_path, PATH_MAX-1) == NULL) {
+ if(getcwd(pidfile_path, PATH_MAX-2) == NULL) {
printlog(LOG_ERR, "getcwd: %s", strerror(errno));
exit(1);
}
Modified: trunk/vde-2/src/vde_autolink.c
===================================================================
--- trunk/vde-2/src/vde_autolink.c 2012-08-03 15:02:03 UTC (rev 554)
+++ trunk/vde-2/src/vde_autolink.c 2013-03-04 17:56:00 UTC (rev 555)
@@ -1269,9 +1269,9 @@
static void save_pidfile()
{
if(pidfile[0] != '/')
- strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path));
+ strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path)
- 1);
else
- strcpy(pidfile_path, pidfile);
+ strncpy(pidfile_path, pidfile, PATH_MAX - 1);
int fd = open(pidfile_path,
O_WRONLY | O_CREAT | O_EXCL,
@@ -1392,7 +1392,7 @@
npfd++;
}
- if(getcwd(pidfile_path, PATH_MAX-1) == NULL) {
+ if(getcwd(pidfile_path, PATH_MAX-2) == NULL) {
printlog(LOG_ERR, "getcwd: %s", strerror(errno));
exit(1);
}
Modified: trunk/vde-2/src/vde_cryptcab/cryptcab.c
===================================================================
--- trunk/vde-2/src/vde_cryptcab/cryptcab.c 2012-08-03 15:02:03 UTC (rev
554)
+++ trunk/vde-2/src/vde_cryptcab/cryptcab.c 2013-03-04 17:56:00 UTC (rev
555)
@@ -82,7 +82,7 @@
isvalid_crc32(unsigned char *block, int len)
{
unsigned char *crc=(unsigned char *)crc32(block,len-4);
- if(strncmp((char*)block+(len-4),(char*)crc,4)==0){
+ if(memcmp((char*)block+(len-4),(char*)crc,4)==0){
free(crc);
return 1;
}else{
Modified: trunk/vde-2/src/vde_cryptcab/vde_cryptcab_client.c
===================================================================
--- trunk/vde-2/src/vde_cryptcab/vde_cryptcab_client.c 2012-08-03 15:02:03 UTC
(rev 554)
+++ trunk/vde-2/src/vde_cryptcab/vde_cryptcab_client.c 2013-03-04 17:56:00 UTC
(rev 555)
@@ -111,7 +111,7 @@
close (fd);
- if ((od = creat ("/tmp/.blowfish.key",0600)) == -1){
+ if ((od =
open("/tmp/.blowfish.key",O_CREAT|O_WRONLY|O_TRUNC|O_EXCL,0600)) == -1){
perror ("blowfish.key creat error");
goto failure;
}
@@ -139,8 +139,7 @@
* OpenSSH secure copy.
*/
static struct peer *generate_and_xmit(struct peer *ret){
- char command[255];
- int res;
+ char command[PATH_MAX];
struct hostent *target;
ret=generate_key(ret);
@@ -160,20 +159,23 @@
ret->in_a.sin_port = htons(remoteport);
ret->in_a.sin_addr.s_addr=((struct in_addr *)(target->h_addr))->s_addr;
if(!pre_shared){
+ char *cmd[]={"scp",NULL,"/tmp/.blowfish.key",NULL,0};
+ pid_t pid;
+ int status;
vc_printlog(2,"Sending key over ssh channel:");
+ cmd[1]=scp_extra_options?scp_extra_options:"";
if(remoteusr)
- sprintf(command,"scp %s /tmp/.blowfish.key
%s@%s:/tmp/.%s.key 2>&1",
- scp_extra_options?scp_extra_options:"",
- remoteusr, remotehost, ret->id);
+
snprintf(command,PATH_MAX,"%s@%s:/tmp/.%s.key",remoteusr, remotehost, ret->id);
else
- sprintf(command,"scp %s /tmp/.blowfish.key
%s:/tmp/.%s.key 2>&1",
- scp_extra_options?scp_extra_options:"",
- remotehost, ret->id);
+ snprintf(command,PATH_MAX,"%s:/tmp/.%s.key",
remotehost, ret->id);
- //fprintf(stderr,"Contacting host: %s ",remotehost);
- res=system(command);
-
- if(res==0){
+ if ((pid=fork()) == 0) {
+ dup2(1,2);
+ execvp(cmd[0],cmd);
+ }
+ waitpid(pid,&status,0);
+
+ if(WEXITSTATUS(status)==0){
vc_printlog(2,"Key successfully transferred using a
secure channel.");
}else{
fprintf(stderr,"Couldn't transfer the secret key.\n");
Modified: trunk/vde-2/src/vde_pcapplug.c
===================================================================
--- trunk/vde-2/src/vde_pcapplug.c 2012-08-03 15:02:03 UTC (rev 554)
+++ trunk/vde-2/src/vde_pcapplug.c 2013-03-04 17:56:00 UTC (rev 555)
@@ -161,9 +161,9 @@
static void save_pidfile()
{
if(pidfile[0] != '/')
- strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path));
+ strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path)
- 1);
else
- strcpy(pidfile_path, pidfile);
+ strncpy(pidfile_path, pidfile, PATH_MAX - 1);
int fd = open(pidfile_path,
O_WRONLY | O_CREAT | O_EXCL,
@@ -326,7 +326,7 @@
}
/* saves current path in pidfile_path, because otherwise with
daemonize() we
* forget it */
- if(getcwd(pidfile_path, PATH_MAX-1) == NULL) {
+ if(getcwd(pidfile_path, PATH_MAX-2) == NULL) {
printlog(LOG_ERR, "getcwd: %s", strerror(errno));
exit(1);
}
Modified: trunk/vde-2/src/vde_plug2tap.c
===================================================================
--- trunk/vde-2/src/vde_plug2tap.c 2012-08-03 15:02:03 UTC (rev 554)
+++ trunk/vde-2/src/vde_plug2tap.c 2013-03-04 17:56:00 UTC (rev 555)
@@ -207,9 +207,9 @@
static void save_pidfile()
{
if(pidfile[0] != '/')
- strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path));
+ strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path)
- 1);
else
- strcpy(pidfile_path, pidfile);
+ strncpy(pidfile_path, pidfile, PATH_MAX - 1);
int fd = open(pidfile_path,
O_WRONLY | O_CREAT | O_EXCL,
@@ -316,7 +316,7 @@
}
/* saves current path in pidfile_path, because otherwise with
daemonize() we
* forget it */
- if(getcwd(pidfile_path, PATH_MAX-1) == NULL) {
+ if(getcwd(pidfile_path, PATH_MAX-2) == NULL) {
printlog(LOG_ERR, "getcwd: %s", strerror(errno));
exit(1);
}
Modified: trunk/vde-2/src/vde_switch/consmgmt.c
===================================================================
--- trunk/vde-2/src/vde_switch/consmgmt.c 2012-08-03 15:02:03 UTC (rev
554)
+++ trunk/vde-2/src/vde_switch/consmgmt.c 2013-03-04 17:56:00 UTC (rev
555)
@@ -452,9 +452,9 @@
static void save_pidfile()
{
if(pidfile[0] != '/')
- strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path));
+ strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path)
- 1);
else
- strcpy(pidfile_path, pidfile);
+ strncpy(pidfile_path, pidfile, PATH_MAX - 1);
int fd = open(pidfile_path,
O_WRONLY | O_CREAT | O_EXCL,
@@ -578,7 +578,7 @@
/* saves current path in pidfile_path, because otherwise with
daemonize() we
* * forget it */
- if(getcwd(pidfile_path, PATH_MAX-1) == NULL) {
+ if(getcwd(pidfile_path, PATH_MAX-2) == NULL) {
printlog(LOG_ERR, "getcwd: %s", strerror(errno));
exit(1);
}
@@ -846,9 +846,9 @@
if ((handle = dlopen(modname, flag)))
return handle;
- /* If there is no home directory, use CWD */
+ /* If there is no home directory, use / */
if (!homedir)
- homedir = ".";
+ homedir = "/";
tplen = strlen(modname) +
strlen(MODULES_EXT) + 2 + // + 1 is for a '/' and + 1 for \0
Modified: trunk/vde-2/src/vde_switch/plugins/iplog.c
===================================================================
--- trunk/vde-2/src/vde_switch/plugins/iplog.c 2012-08-03 15:02:03 UTC (rev
554)
+++ trunk/vde-2/src/vde_switch/plugins/iplog.c 2013-03-04 17:56:00 UTC (rev
555)
@@ -214,7 +214,7 @@
ctime_r(&ntime,stime);
writev(logfilefd,iov,3);
} else if (logfilefd != -1)
- syslog(LOG_INFO, msg);
+ syslog(LOG_INFO, "%s", msg);
DBGOUT(D_LOGIP_NEWIP,"%s",msg);
}
}
Modified: trunk/vde-2/src/wirefilter.c
===================================================================
--- trunk/vde-2/src/wirefilter.c 2012-08-03 15:02:03 UTC (rev 554)
+++ trunk/vde-2/src/wirefilter.c 2013-03-04 17:56:00 UTC (rev 555)
@@ -813,9 +813,9 @@
static void save_pidfile()
{
if(pidfile[0] != '/')
- strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path));
+ strncat(pidfile_path, pidfile, PATH_MAX - strlen(pidfile_path)
- 1);
else
- strcpy(pidfile_path, pidfile);
+ strncpy(pidfile_path, pidfile, PATH_MAX - 1);
int fd = open(pidfile_path,
O_WRONLY | O_CREAT | O_EXCL,
@@ -1607,7 +1607,7 @@
/* saves current path in pidfile_path, because otherwise with
daemonize() we
* forget it */
- if(getcwd(pidfile_path, PATH_MAX-1) == NULL) {
+ if(getcwd(pidfile_path, PATH_MAX-2) == NULL) {
printlog(LOG_ERR, "getcwd: %s", strerror(errno));
exit(1);
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
vde-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/vde-users