version 1.22, 2006/02/04 10:44:22 |
version 1.24, 2006/06/05 00:25:50 |
|
|
/* $OpenXM: OpenXM/src/kxx/oxmain.c,v 1.21 2005/02/28 12:53:44 takayama Exp $ */ |
/* $OpenXM: OpenXM/src/kxx/oxmain.c,v 1.23 2006/02/25 09:11:10 takayama Exp $ */ |
/* nullserver01 */ |
/* nullserver01 */ |
#include <stdio.h> |
#include <stdio.h> |
#include <fcntl.h> |
#include <fcntl.h> |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
#include <sys/socket.h> |
#include <sys/socket.h> |
#include <sys/time.h> |
#include <sys/time.h> |
|
#include <sys/resource.h> |
#include <netinet/in.h> |
#include <netinet/in.h> |
#include <netdb.h> |
#include <netdb.h> |
#include <signal.h> |
#include <signal.h> |
|
|
int LocalMode = 1; |
int LocalMode = 1; |
int NotifyPortnumber = 0; |
int NotifyPortnumber = 0; |
int Do_not_use_control_stream_to_tell_no_server = 1; |
int Do_not_use_control_stream_to_tell_no_server = 1; |
|
int IgnoreSIGINT = 1; |
static void errorToStartEngine(void); |
static void errorToStartEngine(void); |
static int findOxServer(char *server); |
static int findOxServer(char *server); |
static void couldNotFind(char *s); |
static void couldNotFind(char *s); |
Line 130 main(int argc, char *argv[]) { |
|
Line 132 main(int argc, char *argv[]) { |
|
fprintf(stderr,"Unknown -authEncoding %s.\n",argv[i]); |
fprintf(stderr,"Unknown -authEncoding %s.\n",argv[i]); |
oxmainUsage(); exit(10); |
oxmainUsage(); exit(10); |
} |
} |
|
}else if (strcmp(argv[i],"-ignoreSIGINT") == 0) { |
|
i++; |
|
if (i<argc) { |
|
IgnoreSIGINT = argv[i]; |
|
} |
}else { |
}else { |
fprintf(stderr,"Unknown option %s.\n",argv[i]); |
fprintf(stderr,"Unknown option %s.\n",argv[i]); |
oxmainUsage(); exit(10); |
oxmainUsage(); exit(10); |
|
|
fprintf(stderr,"Usage: \n"); |
fprintf(stderr,"Usage: \n"); |
fprintf(stderr," ox [-ox serverprogram -host name -data portnum -control portnum -monitor]\n"); |
fprintf(stderr," ox [-ox serverprogram -host name -data portnum -control portnum -monitor]\n"); |
fprintf(stderr," [-insecure -portfile fname -reverse -passControl xxxyyyzzz -passData pppqqqrrr]"); |
fprintf(stderr," [-insecure -portfile fname -reverse -passControl xxxyyyzzz -passData pppqqqrrr]"); |
fprintf(stderr," [-finish]"); |
fprintf(stderr," [-finish] [-wait seconds] [-authEncoding [file]]"); |
|
fprintf(stderr," [-ignoreSIGINT [1|0]]"); |
fprintf(stderr,"\n"); |
fprintf(stderr,"\n"); |
fprintf(stderr,"-reverse: ox server connects to the client.\n"); |
fprintf(stderr,"-reverse: ox server connects to the client.\n"); |
fprintf(stderr," The client must give a one time password to ox server to connect to the client with -pass* option.\n"); |
fprintf(stderr," The client must give a one time password to ox server to connect to the client with -pass* option.\n"); |
Line 409 void myServerExit() { |
|
Line 417 void myServerExit() { |
|
|
|
childServerMain(int fdControl, int fdStream) { |
childServerMain(int fdControl, int fdStream) { |
int i; |
int i; |
|
struct rlimit res; |
close(fdControl); /* close(0); dup(fdStream); */ |
close(fdControl); /* close(0); dup(fdStream); */ |
dup2(fdStream,3); |
dup2(fdStream,3); |
dup2(fdStream,4); |
dup2(fdStream,4); |
Line 448 childServerMain(int fdControl, int fdStream) { |
|
Line 457 childServerMain(int fdControl, int fdStream) { |
|
putenv(s); |
putenv(s); |
} |
} |
} |
} |
|
getrlimit(RLIMIT_STACK,&res); |
|
if (res.rlim_cur < 65536000) { |
|
fprintf(stderr,"RLIMIT_STACK is increased to 65Mbytes by setrlimit.\n"); |
|
res.rlim_cur = 65536000; |
|
setrlimit(RLIMIT_STACK,&res); |
|
} |
|
|
|
if (IgnoreSIGINT) signal(SIGINT, SIG_IGN); |
|
|
if (PacketMonitor) { |
if (PacketMonitor) { |
if (execle(ServerName,ServerName,"-monitor",NULL,environ)) { |
if (execle(ServerName,ServerName,"-monitor",NULL,environ)) { |