*** fwtk/ftp-gw/ftp-gw.c Sat Jan 18 12:05:49 1997 --- fwtk-new/ftp-gw/ftp-gw.c Wed Apr 30 16:03:20 1997 *************** *** 28,33 **** --- 28,34 ---- #include #endif /* SYSV */ #include + #include #ifndef SYSV extern char *rindex(); *************** *** 53,58 **** --- 54,60 ---- static Cfg *confp; static char **validests = (char **)0; + static char *plugdest = (char *)0; static int blockinput = 0; static int blockoutput = 0; *************** *** 521,526 **** --- 523,532 ---- { int dests = 0; + if(plugdest != (char *)0) { + syslog(LLEV,"fwtkcfgerr: config line %d: cannot specify both -plug-to and -dest",c); + } + else { if(validests == (char **)0) validests = (char **)malloc(sizeof(char *) * 2); else { *************** *** 532,537 **** --- 538,568 ---- return; validests[dests] = v; validests[dests + 1] = (char *)0; + } + } + + + static void + accept_setplug(v,c) + char *v; + int c; + { + if(plugdest == (char *)0) { + if(validests == (char **)0) { + if(gethostbyname(v) == (struct hostent *)0) { + syslog(LLEV,"fwtkcfgerr: config line %d: invalid -plug-to destination: %.100s",c,v); + } + else { + plugdest = v; + } + } + else { + syslog(LLEV,"fwtkcfgerr: config line %d: cannot specify both -plug-to and -dest",c); + } + } + else { + syslog(LLEV,"fwtkcfgerr: config line %d: cannot specify multiple -plug-to destinations",c); + } } *************** *** 585,590 **** --- 616,623 ---- op = accept_setdeny; if(!strcmp(c->argv[x],"-dest")) op = accept_setdest; + if(!strcmp(c->argv[x],"-plug-to")) + op = accept_setplug; if(op == 0) { syslog(LLEV,"fwtkcfgerr: bad option line %d: %.100s",c->ln,c->argv[x]); return(1); *************** *** 642,658 **** } ! if((p = rindex(av[1],'@')) != (char *)0) { *p++ = '\0'; dest = p; user = av[1]; ! } else { if((p = index(av[1],'!')) != (char *)0) { *p++ = '\0'; user = p; dest = av[1]; ! } else ! return(sayn(0,noad,sizeof(noad)-1)); } if(*dest == '\0') --- 675,697 ---- } ! if(plugdest != (char *)0) { ! dest = plugdest; ! user = av[1]; ! } ! else { ! if((p = rindex(av[1],'@')) != (char *)0) { *p++ = '\0'; dest = p; user = av[1]; ! } else { if((p = index(av[1],'!')) != (char *)0) { *p++ = '\0'; user = p; dest = av[1]; ! } else ! return(sayn(0,noad,sizeof(noad)-1)); ! } } if(*dest == '\0')