diff options
author | Kozlov Dmitry <dima@server> | 2009-09-25 10:52:07 +0400 |
---|---|---|
committer | Kozlov Dmitry <dima@server> | 2009-09-25 10:52:07 +0400 |
commit | 69c0f151027d7a8fb872394e7c1062d9e402b5f4 (patch) | |
tree | 7122d800224f3e2a6a64a0bcc95c16b4b7776359 /pppd_plugin | |
parent | 6fac2c05c6ad0ea9684ad8be38ae2f12687a4df2 (diff) | |
download | accel-ppp-xebd-69c0f151027d7a8fb872394e7c1062d9e402b5f4.tar.gz accel-ppp-xebd-69c0f151027d7a8fb872394e7c1062d9e402b5f4.zip |
accel-pptp 0.8.4
* supports 2.6.31 kernel
* included 430-persist.patch (theMIROn)
Diffstat (limited to 'pppd_plugin')
-rwxr-xr-x | pppd_plugin/configure | 2 | ||||
-rw-r--r-- | pppd_plugin/configure.in | 2 | ||||
-rw-r--r-- | pppd_plugin/src/pptp.c | 32 | ||||
-rw-r--r-- | pppd_plugin/src/pptp_callmgr.c | 14 |
4 files changed, 32 insertions, 18 deletions
diff --git a/pppd_plugin/configure b/pppd_plugin/configure index 4ba196c..3fecbf9 100755 --- a/pppd_plugin/configure +++ b/pppd_plugin/configure @@ -2236,7 +2236,7 @@ fi # Define the identity of the package. PACKAGE=pptp - VERSION=0.8.3 + VERSION=0.8.4 cat >>confdefs.h <<_ACEOF diff --git a/pppd_plugin/configure.in b/pppd_plugin/configure.in index 28807f9..6e0e074 100644 --- a/pppd_plugin/configure.in +++ b/pppd_plugin/configure.in @@ -1,7 +1,7 @@ AC_INIT(configure.in) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(pptp,0.8.3) +AM_INIT_AUTOMAKE(pptp,0.8.4) AC_LANG_C AC_PROG_CC diff --git a/pppd_plugin/src/pptp.c b/pppd_plugin/src/pptp.c index 79bb1d1..4df9188 100644 --- a/pppd_plugin/src/pptp.c +++ b/pppd_plugin/src/pptp.c @@ -121,14 +121,14 @@ static int pptp_start_server(void) } static int pptp_start_client(void) { - int len; + socklen_t len; struct sockaddr_pppox src_addr,dst_addr; struct hostent *hostinfo; hostinfo=gethostbyname(pptp_server); if (!hostinfo) { - fatal("PPTP: Unknown host %s\n", pptp_server); + error("PPTP: Unknown host %s\n", pptp_server); return -1; } dst_addr.sa_addr.pptp.sin_addr=*(struct in_addr*)hostinfo->h_addr; @@ -142,7 +142,8 @@ static int pptp_start_client(void) sock=socket(AF_INET,SOCK_DGRAM,0); if (connect(sock,(struct sockaddr*)&addr,sizeof(addr))) { - fatal("PPTP: connect failed (%s)\n",strerror(errno)); + close(sock); + error("PPTP: connect failed (%s)\n",strerror(errno)); return -1; } getsockname(sock,(struct sockaddr*)&addr,&len); @@ -165,14 +166,15 @@ static int pptp_start_client(void) pptp_fd=socket(AF_PPPOX,SOCK_STREAM,PX_PROTO_PPTP); if (pptp_fd<0) { - fatal("PPTP: failed to create PPTP socket (%s)\n",strerror(errno)); + error("PPTP: failed to create PPTP socket (%s)\n",strerror(errno)); return -1; } if (setsockopt(pptp_fd,0,PPTP_SO_TIMEOUT,&pptp_timeout,sizeof(pptp_timeout))) warn("PPTP: failed to setsockopt PPTP_SO_TIMEOUT (%s)\n",strerror(errno)); if (bind(pptp_fd,(struct sockaddr*)&src_addr,sizeof(src_addr))) { - fatal("PPTP: failed to bind PPTP socket (%s)\n",strerror(errno)); + close(pptp_fd); + error("PPTP: failed to bind PPTP socket (%s)\n",strerror(errno)); return -1; } len=sizeof(src_addr); @@ -184,12 +186,19 @@ static int pptp_start_client(void) * Open connection to call manager (Launch call manager if necessary.) */ callmgr_sock = open_callmgr(src_addr.sa_addr.pptp.call_id,dst_addr.sa_addr.pptp.sin_addr, pptp_phone,50); + if (callmgr_sock<0) + { + close(pptp_fd); + return -1; + } /* Exchange PIDs, get call ID */ } while (get_call_id(callmgr_sock, getpid(), getpid(), &dst_addr.sa_addr.pptp.call_id) < 0); if (connect(pptp_fd,(struct sockaddr*)&dst_addr,sizeof(dst_addr))) { - fatal("PPTP: failed to connect PPTP socket (%s)\n",strerror(errno)); + close(callmgr_sock); + close(pptp_fd); + error("PPTP: failed to connect PPTP socket (%s)\n",strerror(errno)); return -1; } @@ -211,6 +220,7 @@ static int pptp_connect(void) static void pptp_disconnect(void) { + if (pptp_server) close(callmgr_sock); close(pptp_fd); } @@ -245,7 +255,7 @@ static int open_callmgr(int call_id,struct in_addr inetaddr, char *phonenr,int w case 0: /* child */ { close (fd); - //close(pptp_fd); + close(pptp_fd); /* close the pty and gre in the call manager */ // close(pty_fd); //close(gre_fd); @@ -254,7 +264,11 @@ static int open_callmgr(int call_id,struct in_addr inetaddr, char *phonenr,int w default: /* parent */ waitpid(pid, &status, 0); if (status!= 0) - fatal("Call manager exited with error %d", status); + { + close(fd); + error("Call manager exited with error %d", status); + return -1; + } break; } sleep(1); @@ -262,7 +276,7 @@ static int open_callmgr(int call_id,struct in_addr inetaddr, char *phonenr,int w else return fd; } close(fd); - fatal("Could not launch call manager after %d tries.", i); + error("Could not launch call manager after %d tries.", i); return -1; /* make gcc happy */ } diff --git a/pppd_plugin/src/pptp_callmgr.c b/pppd_plugin/src/pptp_callmgr.c index 988e717..20bb736 100644 --- a/pppd_plugin/src/pptp_callmgr.c +++ b/pppd_plugin/src/pptp_callmgr.c @@ -84,8 +84,8 @@ void call_callback(PPTP_CONN *conn, PPTP_CALL *call, enum call_state state) vector_remove(conninfo->call_list, lci->unix_sock); close(lci->unix_sock); FD_CLR(lci->unix_sock, conninfo->call_set); - if(lci->pid[0] > 1) kill(lci->pid[0], SIGTERM); - if(lci->pid[1] > 1) kill(lci->pid[1], SIGTERM); + //if(lci->pid[0] > 1) kill(lci->pid[0], SIGTERM); + //if(lci->pid[1] > 1) kill(lci->pid[1], SIGTERM); } break; default: @@ -243,8 +243,8 @@ skip_accept: /* Step 5c: Handle socket close */ struct local_callinfo *lci = pptp_call_closure_get(conn, call); log("Closing connection (unhandled)"); - if(lci->pid[0] > 1) kill(lci->pid[0], SIGTERM); - if(lci->pid[1] > 1) kill(lci->pid[1], SIGTERM); + //if(lci->pid[0] > 1) kill(lci->pid[0], SIGTERM); + //if(lci->pid[1] > 1) kill(lci->pid[1], SIGTERM); free(lci); /* soft shutdown. Callback will do hard shutdown later */ pptp_call_close(conn, call); @@ -265,11 +265,11 @@ shutdown: /* kill all open calls */ for (i = 0; i < vector_size(call_list); i++) { PPTP_CALL *call = vector_get_Nth(call_list, i); - struct local_callinfo *lci = pptp_call_closure_get(conn, call); + //struct local_callinfo *lci = pptp_call_closure_get(conn, call); log("Closing connection (shutdown)"); pptp_call_close(conn, call); - if(lci->pid[0] > 1) kill(lci->pid[0], SIGTERM); - if(lci->pid[1] > 1) kill(lci->pid[1], SIGTERM); + //if(lci->pid[0] > 1) kill(lci->pid[0], SIGTERM); + //if(lci->pid[1] > 1) kill(lci->pid[1], SIGTERM); } /* attempt to dispatch these messages */ FD_ZERO(&read_set); |