[BACK]Return to oxmain.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / kxx

Diff for /OpenXM/src/kxx/oxmain.c between version 1.21 and 1.23

version 1.21, 2005/02/28 12:53:44 version 1.23, 2006/02/25 09:11:10
Line 1 
Line 1 
 /*  $OpenXM: OpenXM/src/kxx/oxmain.c,v 1.20 2004/09/17 12:32:11 takayama Exp $  */  /*  $OpenXM: OpenXM/src/kxx/oxmain.c,v 1.22 2006/02/04 10:44:22 takayama Exp $  */
 /* nullserver01 */  /* nullserver01 */
 #include <stdio.h>  #include <stdio.h>
 #include <fcntl.h>  #include <fcntl.h>
Line 6 
Line 6 
 #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>
Line 60  main(int argc, char *argv[]) {
Line 61  main(int argc, char *argv[]) {
   char *passData = NULL;    char *passData = NULL;
   int result;    int result;
   int sleepingTime = 0;    int sleepingTime = 0;
     int authEncoding=0;
     FILE *fp;
     char *stmp;
   extern int OxTerminateMode;    extern int OxTerminateMode;
   
   signal(SIGHUP,SIG_IGN);  /* ignore x of xterm */    signal(SIGHUP,SIG_IGN);  /* ignore x of xterm */
Line 119  main(int argc, char *argv[]) {
Line 123  main(int argc, char *argv[]) {
       if (i<argc) {        if (i<argc) {
         sscanf(argv[i],"%d",&sleepingTime);          sscanf(argv[i],"%d",&sleepingTime);
       }        }
       }else if (strcmp(argv[i],"-authEncoding") == 0) {
         i++;
         if (strcmp(argv[i],"file") == 0) {
           authEncoding = 1;
         }else{
           fprintf(stderr,"Unknown -authEncoding %s.\n",argv[i]);
           oxmainUsage(); exit(10);
         }
     }else {      }else {
       fprintf(stderr,"Unknown option %s.\n",argv[i]);        fprintf(stderr,"Unknown option %s.\n",argv[i]);
       oxmainUsage(); exit(10);        oxmainUsage(); exit(10);
Line 148  main(int argc, char *argv[]) {
Line 160  main(int argc, char *argv[]) {
   }    }
   
   /* Decrypt passControl and passData, here. Lookup cryptmethod. */    /* Decrypt passControl and passData, here. Lookup cryptmethod. */
     if (authEncoding == 1) {
           stmp = (char *)sGC_malloc(strlen(getenv("HOME"))+strlen(passControl)+
                                                             strlen(passData)+128);
           sprintf(stmp,"%s/.openxm/tmp.opt/%s",(char *)getenv("HOME"),passControl);
           fp = fopen(stmp,"r");
           if (fp == NULL) { fprintf(stderr,"passControl file %s is not found.\n",stmp); exit(1);}
           fgets(stmp,127,fp); passControl = stmp; fclose(fp);
   
           stmp = (char *)sGC_malloc(strlen(getenv("HOME"))+strlen(passControl)+
                                                             strlen(passData)+128);
           sprintf(stmp,"%s/.openxm/tmp.opt/%s",(char *)getenv("HOME"),passData);
           fp = fopen(stmp,"r");
           if (fp == NULL) { fprintf(stderr,"passData file %s is not found.\n",stmp); exit(1);}
           fgets(stmp,127,fp); passData = stmp; fclose(fp);
     }
   
   if (reverse) {    if (reverse) {
     /* The order is very important. */      /* The order is very important. */
     fdControl = socketConnectWithPass(sname,portControl,passControl);      fdControl = socketConnectWithPass(sname,portControl,passControl);
Line 383  void myServerExit() {
Line 410  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 422  childServerMain(int fdControl, int fdStream) {
Line 450  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 (PacketMonitor) {    if (PacketMonitor) {
     if (execle(ServerName,ServerName,"-monitor",NULL,environ)) {      if (execle(ServerName,ServerName,"-monitor",NULL,environ)) {
       fprintf(stderr,"%s cannot be executed with -monitor.\n",ServerName);        fprintf(stderr,"%s cannot be executed with -monitor.\n",ServerName);

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.23

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>