1 | #define EDITDATE "17 Mar 2003" /* Update these with each edit */ |
---|
2 | #define EDITNDATE "20030317" /* Keep them in sync */ |
---|
3 | /* Sun Mar 16 13:52:38 2003 */ |
---|
4 | |
---|
5 | /* |
---|
6 | ckcsym.h is used for for defining symbols that normally would be defined |
---|
7 | using -D or -d on the cc command line, for use with compilers that don't |
---|
8 | support this feature. Must be before any tests for preprocessor symbols. |
---|
9 | */ |
---|
10 | #include "ckcsym.h" |
---|
11 | /* |
---|
12 | Consolidated program version information (for UNIX also see ckuver.h). |
---|
13 | See makever() below for how they are used. |
---|
14 | */ |
---|
15 | /* #ifdef COMMENT */ /* Uncomment this for test version */ |
---|
16 | #ifndef OS2 |
---|
17 | #ifndef BETATEST |
---|
18 | #define BETATEST |
---|
19 | #endif /* BETATEST */ |
---|
20 | #endif /* OS2 */ |
---|
21 | /* #endif */ /* COMMENT */ |
---|
22 | |
---|
23 | #ifdef BETATEST |
---|
24 | #ifdef OS2 |
---|
25 | #ifdef __DATE__ |
---|
26 | #define BETADATE |
---|
27 | #endif /* __DATE__ */ |
---|
28 | #endif /* OS2 */ |
---|
29 | #endif /* BETATEST */ |
---|
30 | |
---|
31 | #ifndef MAC |
---|
32 | /* |
---|
33 | Note: initialize ck_s_test to "" if this is not a test version. |
---|
34 | Use (*ck_s_test != '\0') to decide whether to print test-related messages. |
---|
35 | */ |
---|
36 | #ifdef BETATEST |
---|
37 | #ifndef OS2 /* UNIX, VMS, etc... (i.e. C-Kermit) */ |
---|
38 | char *ck_s_test = ""; /* "Dev","Alpha","Beta","RC", or "" */ |
---|
39 | char *ck_s_tver = ""; /* Test version number or "" */ |
---|
40 | #else /* OS2 */ |
---|
41 | char *ck_s_test = ""; /* (i.e. K95) */ |
---|
42 | char *ck_s_tver = ""; |
---|
43 | #endif /* OS2 */ |
---|
44 | #else |
---|
45 | char *ck_s_test = "Dev"; /* Development */ |
---|
46 | char *ck_s_tver = "00"; |
---|
47 | #endif /* BETATEST */ |
---|
48 | #else /* MAC */ |
---|
49 | char *ck_s_test = "Pre-Alpha"; /* Mac Kermit is always a test... */ |
---|
50 | char *ck_s_tver = ""; |
---|
51 | #endif /* MAC */ |
---|
52 | |
---|
53 | #ifdef BETADATE /* Date of this version or edit */ |
---|
54 | char *ck_s_date = __DATE__; /* Compilation date */ |
---|
55 | #else |
---|
56 | char *ck_s_date = EDITDATE; /* See top */ |
---|
57 | |
---|
58 | #endif /* BETADATE */ |
---|
59 | char *buildid = EDITNDATE; /* See top */ |
---|
60 | |
---|
61 | #ifdef UNIX |
---|
62 | static char sccsid[] = "@(#)C-Kermit 8.0.209"; |
---|
63 | #endif /* UNIX */ |
---|
64 | |
---|
65 | char *ck_s_ver = "8.0.209"; /* C-Kermit version string */ |
---|
66 | long ck_l_ver = 800209L; /* C-Kermit version number */ |
---|
67 | |
---|
68 | #ifdef OS2 |
---|
69 | char *ck_s_xver = "2.1.4"; /* Product-specific version string */ |
---|
70 | long ck_l_xver = 2104L; /* Product-specific version number */ |
---|
71 | #else |
---|
72 | #ifdef MAC |
---|
73 | char *ck_s_xver = "0.995"; /* Product-specific version string */ |
---|
74 | long ck_l_xver = 995L; /* Product-specific version number */ |
---|
75 | #else |
---|
76 | char *ck_s_xver = ""; /* Don't touch these... */ |
---|
77 | long ck_l_xver = 0L; /* they are computed at runtime */ |
---|
78 | #endif /* MAC */ |
---|
79 | #endif /* OS2 */ |
---|
80 | |
---|
81 | #ifdef OS2 |
---|
82 | #ifdef IKSDONLY |
---|
83 | #ifdef NT |
---|
84 | char *ck_s_name = "IKS-NT"; |
---|
85 | #else /* NT */ |
---|
86 | char *ck_s_name = "IKS-OS/2"; |
---|
87 | #endif /* NT */ |
---|
88 | #else /* IKSDONLY */ |
---|
89 | char *ck_s_name = "Kermit 95"; /* Program name */ |
---|
90 | #endif /* IKSDONLY */ |
---|
91 | #else |
---|
92 | #ifdef MAC |
---|
93 | char *ck_s_name = "Mac Kermit"; |
---|
94 | #else |
---|
95 | char *ck_s_name = "C-Kermit"; |
---|
96 | #endif /* MAC */ |
---|
97 | #endif /* OS2 */ |
---|
98 | |
---|
99 | char *ck_s_who = ""; /* Where customized, "" = not. */ |
---|
100 | char *ck_patch = ""; /* Patch info, if any. */ |
---|
101 | |
---|
102 | #define CKVERLEN 128 |
---|
103 | char versiox[CKVERLEN]; /* Version string buffer */ |
---|
104 | char *versio = versiox; /* These are filled in at */ |
---|
105 | long vernum, xvernum; /* runtime from above. */ |
---|
106 | |
---|
107 | #define CKCMAI |
---|
108 | |
---|
109 | #include "ckcasc.h" /* ASCII character symbols */ |
---|
110 | #include "ckcdeb.h" /* Debug & other symbols */ |
---|
111 | |
---|
112 | char * myname = NULL; /* The name I am called by */ |
---|
113 | #ifndef OS2 |
---|
114 | char * exedir = NULL; /* Directory I was executed from */ |
---|
115 | #endif /* OS2 */ |
---|
116 | char * myhome = NULL; /* Home directory override */ |
---|
117 | |
---|
118 | /* C K C M A I -- C-Kermit Main program */ |
---|
119 | |
---|
120 | /* |
---|
121 | Author: Frank da Cruz (fdc@columbia.edu), |
---|
122 | Columbia University Academic Information Systems, New York City. |
---|
123 | |
---|
124 | COPYRIGHT NOTICE: |
---|
125 | */ |
---|
126 | |
---|
127 | #ifdef OS2 |
---|
128 | char *wiksdcpr[] = { |
---|
129 | "Windows Internet Kermit Service Daemon (WIKSD):", |
---|
130 | "Copyright (C) 1985, 2003, Trustees of Columbia University in the City of New", |
---|
131 | "York. All rights reserved.", |
---|
132 | " ", |
---|
133 | "PERMISSIONS:", |
---|
134 | " ", |
---|
135 | " The WIKSD software may be obtained directly, in binary form only, from", |
---|
136 | " the Kermit Project at Columbia University by any individual for his or", |
---|
137 | " her OWN USE, and by any company or other organization for its own", |
---|
138 | " INTERNAL DISTRIBUTION and use, including installation on servers that", |
---|
139 | " are accessed by customers or clients, WITHOUT EXPLICIT LICENSE. All", |
---|
140 | " other forms of redistribution must be licensed from the Kermit Project", |
---|
141 | " at Columbia University. These permissions apply only to the nonsecure", |
---|
142 | " version of WIKSD.", |
---|
143 | " ", |
---|
144 | "DISCLAIMER:", |
---|
145 | " ", |
---|
146 | " THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION FROM THE", |
---|
147 | " TRUSTEES OF COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK AS TO ITS", |
---|
148 | " FITNESS FOR ANY PURPOSE, AND WITHOUT WARRANTY BY THE TRUSTEES OF", |
---|
149 | " COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK OF ANY KIND, EITHER", |
---|
150 | " EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED", |
---|
151 | " WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.", |
---|
152 | " THE TRUSTEES OF COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK SHALL NOT", |
---|
153 | " BE LIABLE FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL,", |
---|
154 | " OR CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING OUT OR IN", |
---|
155 | " CONNECTION WITH THE USE OF THE SOFTWARE, EVEN IF IT HAS BEEN OR IS", |
---|
156 | " HEREAFTER ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. YOU SHALL", |
---|
157 | " INDEMNIFY AND HOLD HARMLESS THE TRUSTEES OF COLUMBIA UNIVERSITY IN", |
---|
158 | " THE CITY OF NEW YORK, ITS EMPLOYEES AND AGENTS FROM AND AGAINST ANY", |
---|
159 | " AND ALL CLAIMS, DEMANDS, LOSS, DAMAGE OR EXPENSE (INCLUDING", |
---|
160 | " ATTORNEYS' FEES) ARISING OUT OF YOUR USE OF THIS SOFTWARE.", |
---|
161 | " ", |
---|
162 | "The above copyright notice, permissions notice, and disclaimer may not be", |
---|
163 | "removed, altered, or obscured and shall be included in all copies of the", |
---|
164 | "WIKSD software. The Trustees of Columbia University in the City of", |
---|
165 | "New York reserve the right to revoke this permission if any of the terms", |
---|
166 | "of use set forth above are breached.", |
---|
167 | " ", |
---|
168 | "For further information, contact the Kermit Project, Columbia University,", |
---|
169 | "612 West 115th Street, New York NY 10025-7799, USA; Phone +1 (212) 854 3703,", |
---|
170 | "Fax +1 (212) 662 6442, kermit@columbia.edu, http://www.columbia.edu/kermit/", |
---|
171 | "" |
---|
172 | }; |
---|
173 | #endif /* OS2 */ |
---|
174 | |
---|
175 | char *copyright[] = { |
---|
176 | |
---|
177 | #ifdef pdp11 |
---|
178 | "Copyright (C) 1985, 2003, Trustees of Columbia University, NYC.", |
---|
179 | "All rights reserved.", |
---|
180 | " ", |
---|
181 | #else |
---|
182 | #ifdef OS2 |
---|
183 | "Copyright (C) 1985, 2003, Trustees of Columbia University in the City of New", |
---|
184 | "York. All rights reserved. This software is furnished under license", |
---|
185 | "and may not be reproduced without license to do so. This copyright notice", |
---|
186 | "must not be removed, altered, or obscured.", |
---|
187 | " ", |
---|
188 | " THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION FROM THE", |
---|
189 | " TRUSTEES OF COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK AS TO ITS", |
---|
190 | " FITNESS FOR ANY PURPOSE, AND WITHOUT WARRANTY BY THE TRUSTEES OF", |
---|
191 | " COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK OF ANY KIND, EITHER", |
---|
192 | " EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED", |
---|
193 | " WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.", |
---|
194 | " THE TRUSTEES OF COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK SHALL NOT", |
---|
195 | " BE LIABLE FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL,", |
---|
196 | " OR CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING OUT OR IN", |
---|
197 | " CONNECTION WITH THE USE OF THE SOFTWARE, EVEN IF IT HAS BEEN OR IS", |
---|
198 | " HEREAFTER ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. YOU SHALL", |
---|
199 | " INDEMNIFY AND HOLD HARMLESS THE TRUSTEES OF COLUMBIA UNIVERSITY IN", |
---|
200 | " THE CITY OF NEW YORK, ITS EMPLOYEES AND AGENTS FROM AND AGAINST ANY", |
---|
201 | " AND ALL CLAIMS, DEMANDS, LOSS, DAMAGE OR EXPENSE (INCLUDING", |
---|
202 | " ATTORNEYS' FEES) ARISING OUT OF YOUR USE OF THIS SOFTWARE.", |
---|
203 | " ", |
---|
204 | #else |
---|
205 | "Copyright (C) 1985, 2003,", |
---|
206 | " The Trustees of Columbia University in the City of New York.", |
---|
207 | " All rights reserved.", |
---|
208 | " ", |
---|
209 | "PERMISSIONS:", |
---|
210 | " ", |
---|
211 | "The C-Kermit software may be obtained directly from the Kermit Project at", |
---|
212 | "Columbia University (or from any source explicitly licensed by the Kermit", |
---|
213 | "Project or implicitly licensed by Clause (A) below) by any individual for", |
---|
214 | "his or her OWN USE, and by any company or other organization for its own", |
---|
215 | "INTERNAL DISTRIBUTION and use, including installation on servers that are", |
---|
216 | "accessed by customers or clients, WITHOUT EXPLICIT LICENSE.", |
---|
217 | " ", |
---|
218 | "Conditions for REDISTRIBUTION are as follows:", |
---|
219 | " ", |
---|
220 | "(A) The C-Kermit software, in source and/or binary form, may be", |
---|
221 | " included WITHOUT EXPLICIT LICENSE in distributions of OPERATING", |
---|
222 | " SYSTEMS that have OSI (Open Source Initiative, www.opensource.org)", |
---|
223 | " approved licenses, even if non-Open-Source applications (but not", |
---|
224 | " operating systems) are included in the same distribution. Such", |
---|
225 | " distributions include, but are not limited to, CD-ROM, FTP site,", |
---|
226 | " Web site, or preinstalled software on a new GENERAL-PURPOSE", |
---|
227 | " computer, as long as the primary character of the distribution is", |
---|
228 | " an Open Source operating system with accompanying utilities. The", |
---|
229 | " C-Kermit source code may not be changed without the consent of the", |
---|
230 | " Kermit Project, which will not be unreasonably withheld (this is", |
---|
231 | " simply a matter of keeping a consistent and supportable code base).", |
---|
232 | " ", |
---|
233 | "(B) Inclusion of C-Kermit software in whole or in part, in any form, in", |
---|
234 | " or with any product not covered by Clause (A), or its distribution", |
---|
235 | " by any commercial enterprise to its actual or potential customers", |
---|
236 | " or clients except as in Clause (A), requires a license from the", |
---|
237 | " Kermit Project, Columbia University; contact kermit@columbia.edu.", |
---|
238 | " ", |
---|
239 | "The name of Columbia University may not be used to endorse or promote", |
---|
240 | "products derived from or including the C-Kermit software without specific", |
---|
241 | "prior written permission.", |
---|
242 | " ", |
---|
243 | "DISCLAIMER:", |
---|
244 | " ", |
---|
245 | " THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION FROM THE", |
---|
246 | " TRUSTEES OF COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK AS TO ITS", |
---|
247 | " FITNESS FOR ANY PURPOSE, AND WITHOUT WARRANTY BY THE TRUSTEES OF", |
---|
248 | " COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK OF ANY KIND, EITHER", |
---|
249 | " EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED", |
---|
250 | " WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.", |
---|
251 | " THE TRUSTEES OF COLUMBIA UNIVERSITY IN THE CITY OF NEW YORK SHALL NOT", |
---|
252 | " BE LIABLE FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL,", |
---|
253 | " OR CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING OUT OF OR", |
---|
254 | " IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN IF IT HAS BEEN OR IS", |
---|
255 | " HEREAFTER ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. YOU SHALL", |
---|
256 | " INDEMNIFY AND HOLD HARMLESS THE TRUSTEES OF COLUMBIA UNIVERSITY IN", |
---|
257 | " THE CITY OF NEW YORK, ITS EMPLOYEES AND AGENTS FROM AND AGAINST ANY", |
---|
258 | " AND ALL CLAIMS, DEMANDS, LOSS, DAMAGE OR EXPENSE (INCLUDING", |
---|
259 | " ATTORNEYS' FEES) ARISING OUT OF YOUR USE OF THIS SOFTWARE.", |
---|
260 | " ", |
---|
261 | "The above copyright notice, permissions notice, and disclaimer may not be", |
---|
262 | "removed, altered, or obscured and shall be included in all copies of the", |
---|
263 | "C-Kermit software. The Trustees of Columbia University in the City of", |
---|
264 | "New York reserve the right to revoke this permission if any of the terms", |
---|
265 | "of use set forth above are breached.", |
---|
266 | #endif /* OS2 */ |
---|
267 | #endif /* pdp11 */ |
---|
268 | |
---|
269 | #ifdef OS2 |
---|
270 | "Portions Copyright (C) 1995, Oy Online Solutions Ltd., Jyvaskyla, Finland.", |
---|
271 | #endif /* OS2 */ |
---|
272 | |
---|
273 | #ifdef CK_AUTHENTICATION |
---|
274 | "Portions Copyright (C) 1990, Massachusetts Institute of Technology.", |
---|
275 | #ifdef CK_ENCRYPTION |
---|
276 | "Portions Copyright (C) 1991, 1993 Regents of the University of California.", |
---|
277 | "Portions Copyright (C) 1991, 1992, 1993, 1994, 1995 by AT&T.", |
---|
278 | "Portions Copyright (C) 1995, 1997, Eric Young <eay@cryptosoft.com>.", |
---|
279 | #endif /* CK_ENCRYPTION */ |
---|
280 | #ifdef CK_SRP |
---|
281 | "Portions Copyright (C) 1997, Stanford University.", |
---|
282 | #endif /* CK_SRP */ |
---|
283 | #endif /* CK_AUTHENTICATION */ |
---|
284 | |
---|
285 | #ifndef pdp11 |
---|
286 | " ", |
---|
287 | "For further information, contact the Kermit Project, Columbia University,", |
---|
288 | "612 West 115th Street, New York NY 10025-7799, USA; phone +1 (212) 854 3703,", |
---|
289 | "fax +1 (212) 663 8202 or +1 (212) 662 6442, email kermit@columbia.edu,", |
---|
290 | "Web http://www.columbia.edu/kermit/ or http://www.kermit-project.org/.", |
---|
291 | #endif /* pdp11 */ |
---|
292 | ""}; |
---|
293 | |
---|
294 | /* |
---|
295 | DOCUMENTATION: |
---|
296 | |
---|
297 | "Using C-Kermit" by Frank da Cruz and Christine M. Gianone, |
---|
298 | Digital Press / Butterworth-Heinemann, Woburn MA, USA. |
---|
299 | Second edition (1997), ISBN 1-55558-164-1. |
---|
300 | Order from Digital Press: +1 (800) 366-2665 |
---|
301 | Or from Columbia University: +1 (212) 854-3703 |
---|
302 | |
---|
303 | For Kermit 95, also: |
---|
304 | |
---|
305 | "Kermit 95" by Christine M. Gianone and Frank da Cruz, |
---|
306 | Manning Publications, Greenwich CT, USA (1998) - Online. |
---|
307 | |
---|
308 | ACKNOWLEDGMENTS: |
---|
309 | |
---|
310 | The Kermit file transfer protocol was developed at the Columbia University |
---|
311 | Center for Computing Activities (CUCCA), which was since renamed to Columbia |
---|
312 | University Academic Information Systems (AcIS). Kermit is named after |
---|
313 | Kermit the Frog, star of the television series THE MUPPET SHOW; the name is |
---|
314 | used by permission of Henson Associates, Inc. |
---|
315 | |
---|
316 | Thanks to at least the following people for their contributions to this |
---|
317 | program over the years, and apologies to anyone who was inadvertantly |
---|
318 | omitted: |
---|
319 | |
---|
320 | Chris Adie, Edinburgh U, Scotland (OS/2) |
---|
321 | Robert Adsett, University of Waterloo, Canada |
---|
322 | Larry Afrin, Clemson U |
---|
323 | Russ Allbery, Stanford U |
---|
324 | Jeffrey Altman, Columbia University |
---|
325 | Greg Andrews, Telebit Corp |
---|
326 | Barry Archer, U of Missouri |
---|
327 | Robert Andersson, International Systems A/S, Oslo, Norway |
---|
328 | Chris Armstrong, Brookhaven National Lab (OS/2) |
---|
329 | William Bader, Software Consulting Services, Nazareth, PA |
---|
330 | Fuat Baran, Columbia U |
---|
331 | Stan Barber, Rice U |
---|
332 | Jim Barbour, U of Colorado |
---|
333 | Donn Baumgartner, Dell |
---|
334 | Nelson Beebe, U of Utah |
---|
335 | Gerry Belanger, Cognitronics |
---|
336 | Karl Berry, UMB |
---|
337 | Mark Berryman, SAIC |
---|
338 | Dean W Bettinger, SUNY |
---|
339 | Gary Bilkus |
---|
340 | Peter Binderup, Denmark |
---|
341 | David Bolen, Advanced Networks and Services, Inc. |
---|
342 | Marc Boucher, U of Montreal |
---|
343 | Charles Brooks, EDN |
---|
344 | Bob Brown |
---|
345 | Mike Brown, Purdue U |
---|
346 | Jack Bryans, California State U at Long Beach |
---|
347 | Mark Buda, DEC (VMS) |
---|
348 | Fernando Cabral, Padrao iX, Brasilia |
---|
349 | Bjorn Carlsson, Stockholm University Computer Centre QZ, Sweden |
---|
350 | Bill Catchings, (formerly of) Columbia U |
---|
351 | Bob Cattani, Columbia U CS Dept |
---|
352 | Davide Cervone, Rochester U |
---|
353 | Seth Chaiklin, Denmark |
---|
354 | John Chandler, Harvard U / Smithsonian Astronomical Observatory |
---|
355 | Bernard Chen, UCLA |
---|
356 | Andrew A Chernov, RELCOM Team, Moscow |
---|
357 | John L Chmielewski, AT&T, Lisle, IL |
---|
358 | Howard Chu, U of Michigan |
---|
359 | Bill Coalson, McDonnell Douglas |
---|
360 | Bertie Coopersmith, London |
---|
361 | Chet Creider, U of Western Ontario |
---|
362 | Alan Crosswell, Columbia U |
---|
363 | Jeff Damens, (formerly of) Columbia U |
---|
364 | Mark Davies, Bath U, UK |
---|
365 | Sin-itirou Dezawa, Fujifilm, Japan |
---|
366 | Joe R. Doupnik, Utah State U |
---|
367 | Frank Dreano, Honeywell |
---|
368 | John Dunlap, U of Washington |
---|
369 | Alex Dupuy, SMART.COM |
---|
370 | David Dyck, John Fluke Mfg Co. |
---|
371 | Stefaan A. Eeckels, Eurokom, Luxembourg |
---|
372 | Nick Efthymiou |
---|
373 | Paul Eggert, Twin Sun, Inc., El Segundo, CA |
---|
374 | Bernie Eiben, DEC |
---|
375 | Peter Eichhorn, Assyst International |
---|
376 | Kristoffer Eriksson, Peridot Konsult AB, Oerebro, Sweden |
---|
377 | John R. Evans, IRS, Kansas City |
---|
378 | Glenn Everhart, RCA Labs |
---|
379 | Charlie Finan, Cray Research |
---|
380 | Herm Fischer, Encino, CA (extensive contributions to version 4.0) |
---|
381 | Carl Fongheiser, CWRU |
---|
382 | Mike Freeman, Bonneville Power Authority |
---|
383 | Marcello Frutig, Catholic University, Sao Paulo, Brazil (X.25 support) |
---|
384 | Hirofumi Fujii, Japan Nat'l Lab for High Energy Physics, Tokyo (Kanji) |
---|
385 | Chuck Fuller, Westinghouse Corporate Computer Services |
---|
386 | Andy Fyfe, Caltech |
---|
387 | Christine M. Gianone, Columbia U |
---|
388 | John Gilmore, UC Berkeley |
---|
389 | Madhusudan Giyyarpuram, HP |
---|
390 | Rainer Glaschick, Siemens AG, Paderborn |
---|
391 | William H. Glass |
---|
392 | German Goldszmidt, IBM |
---|
393 | Chuck Goodhart, NASA |
---|
394 | Alistair Gorman, New Zealand |
---|
395 | Richard Gration, ADFA, Australia |
---|
396 | Chris Green, Essex U, UK |
---|
397 | Alan Grieg, Dundee Tech, Scotland |
---|
398 | Yekta Gursel, MIT |
---|
399 | Jim Guyton, Rand Corp |
---|
400 | Michael Haertel |
---|
401 | Bruno Haible |
---|
402 | Bob Hain, UMN |
---|
403 | Marion Hakanson, ORST |
---|
404 | Richard Hamilton |
---|
405 | John Hamilston, Iowa State U |
---|
406 | Simon Hania, Netherlands |
---|
407 | Stan Hanks, Rice U. |
---|
408 | Ken Harrenstein, SRI |
---|
409 | Eugenia Harris, Data General (AOS/VS) |
---|
410 | David Harrison, Kingston Warren Corp |
---|
411 | Lucas Hart, Oregon State University |
---|
412 | James Harvey, Indiana/Purdue U (VMS) |
---|
413 | Rob Healey |
---|
414 | Chuck Hedrick, Rutgers U |
---|
415 | Ron Heiby, Technical Systems Division, Motorola Computer Group |
---|
416 | Steve Hemminger, Tektronix |
---|
417 | Christian Hemsing, RWTH Aachen, Germany (OS-9) |
---|
418 | Randolph Herber, US DOE, |
---|
419 | Andrew Herbert, Monash Univ, Australia |
---|
420 | Marcus Herbert, Germany |
---|
421 | Mike Hickey, ITI |
---|
422 | Dan Hildebrand, QNX Software Systems Inc, Kanata, ON (QNX) |
---|
423 | R E Hill |
---|
424 | Stephan Hoffman-Emden |
---|
425 | Sven Holmstrom, ABB Utilities AB, Sweden |
---|
426 | Bill Homer, Cray Research |
---|
427 | Ray Hunter, The Wollongong Group |
---|
428 | Randy Huntziger, National Library of Medicine |
---|
429 | Larry Jacobs, Transarc |
---|
430 | Steve Jenkins, Lancaster University, UK |
---|
431 | Dave Johnson, Gradient Technologies |
---|
432 | Mark B Johnson, Apple Computer |
---|
433 | Jyke Jokinen, Tampere University of Technology, Finland (QNX) |
---|
434 | Eric F Jones, AT&T |
---|
435 | Luke Jones, AT&T |
---|
436 | Peter Jones, U of Quebec Montreal |
---|
437 | Phil Julian, SAS Institute |
---|
438 | Peter Kabal, U of Quebec |
---|
439 | Mic Kaczmarczik, U of Texas at Austin |
---|
440 | Sergey Kartashoff, Inst. of Precise Mechanics & Computer Equipment, Moscow |
---|
441 | Howie Kaye, Columbia U |
---|
442 | Rob Kedoin, Linotype Co, Hauppauge, NY (OS/2) |
---|
443 | Phil Keegstra |
---|
444 | Mark Kennedy, IBM |
---|
445 | Terry Kennedy, St Peter's College, Jersey City, NJ (VMS and more) |
---|
446 | "Carlo Kid", Technical University of Delft, Netherlands |
---|
447 | Tim Kientzle |
---|
448 | Paul Kimoto, Cornell U |
---|
449 | Douglas Kingston, morgan.com |
---|
450 | Lawrence Kirby, Wiltshire, UK |
---|
451 | Tom Kloos, Sequent Computer Systems |
---|
452 | Jim Knutson, U of Texas at Austin |
---|
453 | John T. Kohl (BSDI) |
---|
454 | Scott Kramer, SRI International, Menlo Park, CA |
---|
455 | John Kraynack, US Postal Service |
---|
456 | David Kricker, Encore Computer |
---|
457 | Thomas Krueger, UWM |
---|
458 | Bo Kullmar, ABC Klubben, Stockholm, and Central Bank of Sweden, Kista |
---|
459 | R. Brad Kummer, AT&T Bell Labs, Atlanta, GA |
---|
460 | John Kunze, UC Berkeley |
---|
461 | David Lane, BSSI / BellSouth (Stratus VOS, X.25) |
---|
462 | Bob Larson, USC (OS-9) |
---|
463 | Bert Laverman, Groningen U, Netherlands |
---|
464 | Steve Layton |
---|
465 | David Lawyer, UC Irvine |
---|
466 | David LeVine, National Semiconductor Corporation |
---|
467 | Daniel S. Lewart, UIUC |
---|
468 | S.O. Lidie, Lehigh U |
---|
469 | Tor Lillqvist, Helsinki U, Finland |
---|
470 | David-Michael Lincke, U of St Gallen, Switzerland |
---|
471 | Robert Lipe (for SCO makefile entries & advice) |
---|
472 | Dean Long |
---|
473 | Mike Long, Analog Devices, Norwood MA |
---|
474 | Kevin Lowey, U of Saskatchewan (OS/2) |
---|
475 | Andy Lowry, Columbia U |
---|
476 | James Lummel, Caprica Telecomputing Resources (QNX) |
---|
477 | David MacKenzie, Environmental Defense Fund, U of Maryland |
---|
478 | John Mackin, University of Sidney, Australia |
---|
479 | Martin Maclaren, Bath U, UK |
---|
480 | Chris Maio, Columbia U CS Dept |
---|
481 | Montserrat Mane, HP, Grenoble, France |
---|
482 | Fulvio Marino, Olivetti, Ivrea, Italy |
---|
483 | Arthur Marsh, dircsa.org.au |
---|
484 | Peter Mauzey, Lucent Technologies |
---|
485 | Tye McQueen, Utah State U |
---|
486 | Ted Medin |
---|
487 | Hellmuth Michaelis, Hanseatischer Computerservice GmbH, Hamburg, Germany |
---|
488 | Leslie Mikesell, American Farm Bureau |
---|
489 | Todd Miller, Courtesan Consulting |
---|
490 | Martin Minow, DEC (VMS) |
---|
491 | Pawan Misra, Bellcore |
---|
492 | Ken Mizialko, IBM, Manassas, VA |
---|
493 | Wolfgang Moeller, DECUS Germany |
---|
494 | Ray Moody, Purdue U |
---|
495 | Bruce J Moore, Allen-Bradley Co, Highland Heights, OH (Atari ST) |
---|
496 | Steve Morley, Convex |
---|
497 | Peter Mossel, Columbia U |
---|
498 | Tony Movshon, NYU |
---|
499 | Lou Muccioli, Swanson Analysis Systems |
---|
500 | Dan Murphy |
---|
501 | Neal P. Murphy, Harsof Systems, Wonder Lake IL |
---|
502 | Gary Mussar |
---|
503 | John Nall, FSU |
---|
504 | Jack Nelson, U of Pittsburgh |
---|
505 | Jim Noble, Planning Research Corporation (Macintosh) |
---|
506 | Ian O'Brien, Bath U, UK |
---|
507 | Melissa O'Neill, SFU |
---|
508 | John Owens |
---|
509 | Thomas Pinkl, Health Business Systems Inc. |
---|
510 | Michael Pins, Iowa Computer Aided Engineering Network |
---|
511 | Andre' Pirard, University of Liege, Belgium |
---|
512 | Paul Placeway, Ohio State U |
---|
513 | Piet W. Plomp, ICCE, Groningen University, Netherlands |
---|
514 | Ken Poulton, HP Labs |
---|
515 | Manfred Prange, Oakland U |
---|
516 | Christopher Pratt, APV Baker, UK |
---|
517 | Frank Prindle, NADC |
---|
518 | Tony Querubin, U of Hawaii |
---|
519 | Jean-Pierre Radley |
---|
520 | Anton Rang |
---|
521 | Scott Ribe |
---|
522 | Alan Robiette, Oxford University, UK |
---|
523 | Michel Robitaille, U of Montreal (Mac) |
---|
524 | Huw Rogers, Schweizerische Kreditanstalt, Zuerich |
---|
525 | Nigel Roles, Cambridge, England |
---|
526 | Kai Uwe Rommel, Technische Universitaet Muenchen (OS/2) |
---|
527 | Larry Rosenman (Amiga) |
---|
528 | Jay Rouman, U of Michigan |
---|
529 | Jack Rouse, SAS Institute (Data General and/or Apollo) |
---|
530 | Stew Rubenstein, Harvard U (VMS) |
---|
531 | Gerhard Rueckle, FH Darmstadt, Fb. E/Automatisierungstechnik |
---|
532 | John Santos, EG&H |
---|
533 | Bill Schilit, Columbia U |
---|
534 | Ulli Schlueter, RWTH Aachen, Germany (OS-9, etc) |
---|
535 | Michael Schmidt, U of Paderborn, Germany |
---|
536 | Eric Schnoebelen, Convex |
---|
537 | Benn Schreiber, DEC |
---|
538 | Dan Schullman, DEC (modems, DIAL command, etc) |
---|
539 | John Schultz, 3M |
---|
540 | Steven Schultz, Contel (PDP-11) |
---|
541 | APPP Scorer, Leeds Polytechnic, UK |
---|
542 | Gordon Scott, Micro Focus, Newbury UK |
---|
543 | Gisbert W. Selke, WIdO, Bonn, Germany |
---|
544 | David Singer, IBM Almaden Research Labs |
---|
545 | David Sizeland, U of London Medical School |
---|
546 | Fridrik Skulason, Iceland |
---|
547 | Rick Sladkey (Linux) |
---|
548 | Dave Slate |
---|
549 | Bradley Smith, UCLA |
---|
550 | Fred Smith, Merk / Computrition |
---|
551 | Richard S Smith, Cal State |
---|
552 | Ryan Stanisfer, UNT |
---|
553 | Bertil Stenstroem, Stockholm University Computer Centre (QZ), Sweden |
---|
554 | James Sturdevant, CAP GEMENI AMERICA, Minneapolis |
---|
555 | Peter Svanberg, Royal Techn. HS, Sweden |
---|
556 | James R. Swenson, Accu-Weather, Inc. |
---|
557 | Ted T'so, MIT (Linux) |
---|
558 | Andy Tanenbaum, Vrije U, Amsterdam, Netherlands |
---|
559 | Glen Thobe |
---|
560 | Markku Toijala, Helsinki U of Technology |
---|
561 | Teemu Torma, Helsinki U of Technology |
---|
562 | Linus Torvalds, Helsinki |
---|
563 | Rick Troxel, NIH |
---|
564 | Warren Tucker, Tridom Corp, Mountain Park, GA |
---|
565 | Dave Tweten, AMES-NAS |
---|
566 | G Uddeborg, Sweden |
---|
567 | Walter Underwood, Ford Aerospace |
---|
568 | Pieter Van Der Linden, Centre Mondial, Paris |
---|
569 | Ge van Geldorp, Netherlands |
---|
570 | Fred van Kempen, MINIX User Group, Voorhout, Netherlands |
---|
571 | Wayne Van Pelt, GE/CRD |
---|
572 | Mark Vasoll, Oklahoma State U (V7 UNIX) |
---|
573 | Konstantin Vinogradov, ICSTI, Moscow |
---|
574 | Paul Vixie, DEC |
---|
575 | Bernie Volz, Process Software |
---|
576 | Eduard Vopicka, Prague University of Economics, Czech Republic |
---|
577 | Dimitri Vulis, CUNY |
---|
578 | Roger Wallace, Raytheon |
---|
579 | Stephen Walton, Calif State U, Northridge (Amiga) |
---|
580 | Jamie Watson, Adasoft, Switzerland (AIX) |
---|
581 | Rick Watson, U of Texas (Macintosh) |
---|
582 | Scott Weikart (Association for Progressive Communications) |
---|
583 | Robert Weiner, Programming Plus, New York City |
---|
584 | Lauren Weinstein, Vortex Technlogy |
---|
585 | David Wexelblat, AT&T |
---|
586 | Clark Wierda, Illuminati Online |
---|
587 | Joachim Wiesel, U of Karlsruhe |
---|
588 | Lon Willett, U of Utah |
---|
589 | Michael Williams, UCLA |
---|
590 | Nate Williams, U of Montana |
---|
591 | David Wilson |
---|
592 | Joellen Windsor, U of Arizona |
---|
593 | Patrick Wolfe, Kuck & Associates, Inc. |
---|
594 | Gregg Wonderly, Oklahoma State U (V7 UNIX) |
---|
595 | Farrell Woods, Concurrent (formerly Masscomp) |
---|
596 | Dave Woolley, CAP Communication Systems, London |
---|
597 | Jack Woolley, SCT Corp |
---|
598 | Frank Wortner |
---|
599 | Ken Yap, formerly of U of Rochester |
---|
600 | John Zeeff, Ann Arbor, MI |
---|
601 | */ |
---|
602 | |
---|
603 | #include "ckcker.h" /* Kermit symbols */ |
---|
604 | #include "ckcnet.h" /* Network symbols */ |
---|
605 | |
---|
606 | #ifdef CK_SSL |
---|
607 | #include "ck_ssl.h" |
---|
608 | #endif /* CK_SSL */ |
---|
609 | |
---|
610 | #ifndef NOSPL |
---|
611 | #include "ckuusr.h" |
---|
612 | #endif /* NOSPL */ |
---|
613 | |
---|
614 | #ifdef OS2ONLY |
---|
615 | #define INCL_VIO /* Needed for ckocon.h */ |
---|
616 | #include <os2.h> |
---|
617 | #undef COMMENT |
---|
618 | #endif /* OS2ONLY */ |
---|
619 | |
---|
620 | #ifdef NT |
---|
621 | #include <windows.h> |
---|
622 | #include <tapi.h> |
---|
623 | #include "ckntap.h" |
---|
624 | #endif /* NT */ |
---|
625 | |
---|
626 | #ifndef NOSERVER |
---|
627 | /* Text message definitions.. each should be 256 chars long, or less. */ |
---|
628 | #ifdef MINIX |
---|
629 | char *srvtxt = "\r\n\ |
---|
630 | Entering server mode.\r\n\0"; |
---|
631 | #else |
---|
632 | #ifdef OLDMSG |
---|
633 | /* |
---|
634 | It seems there was a large installation that was using C-Kermit 5A(165) |
---|
635 | or thereabouts, which had deployed thousands of MS-DOS Kermit scripts in |
---|
636 | scattered locations that looked for strings in the old server message, |
---|
637 | which changed in 5A(183), August 1992. |
---|
638 | */ |
---|
639 | char *srvtxt = "\r\n\ |
---|
640 | C-Kermit server starting. Return to your local machine by typing\r\n\ |
---|
641 | its escape sequence for closing the connection, and issue further\r\n\ |
---|
642 | commands from there. To shut down the C-Kermit server, issue the\r\n\ |
---|
643 | FINISH or BYE command and then reconnect.\n\ |
---|
644 | \r\n\0"; |
---|
645 | #else |
---|
646 | #ifdef OSK |
---|
647 | char *srvtxt = "\r\012\ |
---|
648 | Entering server mode. If your local Kermit software is menu driven, use\r\012\ |
---|
649 | the menus to send commands to the server. Otherwise, enter the escape\r\012\ |
---|
650 | sequence to return to your local Kermit prompt and issue commands from\r\012\ |
---|
651 | there. Use SEND and GET for file transfer. Use REMOTE HELP for a list of\r\012\ |
---|
652 | other available services. Use BYE or FINISH to end server mode.\r\012\0"; |
---|
653 | #else /* UNIX, VMS, AOS/VS, and all others */ |
---|
654 | char *srvtxt = "\r\n\ |
---|
655 | Entering server mode. If your local Kermit software is menu driven, use\r\n\ |
---|
656 | the menus to send commands to the server. Otherwise, enter the escape\r\n\ |
---|
657 | sequence to return to your local Kermit prompt and issue commands from\r\n\ |
---|
658 | there. Use SEND and GET for file transfer. Use REMOTE HELP for a list of\r\n\ |
---|
659 | other available services. Use BYE or FINISH to end server mode.\r\n\0"; |
---|
660 | #endif /* OSK */ |
---|
661 | #endif /* OLDMSG */ |
---|
662 | #endif /* MINIX */ |
---|
663 | #else /* server mode disabled */ |
---|
664 | char *srvtxt = ""; |
---|
665 | #endif /* NOSERVER */ |
---|
666 | |
---|
667 | int initflg = 0; /* sysinit() has executed... */ |
---|
668 | int howcalled = I_AM_KERMIT; /* How I was called */ |
---|
669 | int hmtopline = 0; |
---|
670 | int quitting = 0; /* I'm in the act of quitting */ |
---|
671 | |
---|
672 | #ifdef IKSDCONF |
---|
673 | char * iksdconf = IKSDCONF; /* IKSD configuration file */ |
---|
674 | int iksdcf = 0; /* Has IKSD c.f. been processed? */ |
---|
675 | #endif /* IKSDCONF */ |
---|
676 | |
---|
677 | int srvcdmsg = 0; /* [Server] CD message */ |
---|
678 | char * cdmsgfile[8] = { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }; |
---|
679 | char * cdmsgstr = NULL; |
---|
680 | char * ckcdpath = NULL; |
---|
681 | |
---|
682 | #ifdef NLCHAR /* Text-file line terminator */ |
---|
683 | CHAR feol = NLCHAR; |
---|
684 | #else |
---|
685 | CHAR feol = 0; |
---|
686 | #endif /* NLCHAR */ |
---|
687 | |
---|
688 | int fblksiz = DBLKSIZ; /* File blocksize */ |
---|
689 | int frecl = DLRECL; /* File record length */ |
---|
690 | int frecfm = XYFF_S; /* File record format (default = stream) */ |
---|
691 | int forg = XYFO_S; /* File organization (sequential) */ |
---|
692 | int fcctrl = XYFP_N; /* File carriage control (ctrl chars) */ |
---|
693 | int filecase = FILECASE; /* Case matters in filenames */ |
---|
694 | int stathack = 1; /* Fast directory lookups by default */ |
---|
695 | |
---|
696 | char uidbuf[UIDBUFLEN] = { NUL, NUL }; /* User ID buffer */ |
---|
697 | int cfilef = 0; /* Application ("kerbang") file flag */ |
---|
698 | char cmdfil[CKMAXPATH + 1] = { NUL, NUL }; /* Application file name */ |
---|
699 | int haveurl = 0; /* URL given on command line */ |
---|
700 | |
---|
701 | #ifndef NOXFER |
---|
702 | /* Multi-protocol support */ |
---|
703 | |
---|
704 | struct ck_p ptab[NPROTOS] = { /* Initialize the Kermit part ... */ |
---|
705 | { "Kermit", |
---|
706 | DRPSIZ, /* Receive packet size */ |
---|
707 | DSPSIZ, /* Send packet size */ |
---|
708 | 0, /* Send-packet-size-set flag */ |
---|
709 | DFWSIZ, /* Window size */ |
---|
710 | |
---|
711 | #ifdef NEWDEFAULTS |
---|
712 | PX_CAU, /* Control char unprefixing... */ |
---|
713 | #else |
---|
714 | PX_ALL, |
---|
715 | #endif /* NEWDEFAULTS */ |
---|
716 | |
---|
717 | #ifdef VMS /* Default filename collision action */ |
---|
718 | XYFX_X, /* REPLACE for VAX/VMS */ |
---|
719 | #else |
---|
720 | XYFX_B, /* BACKUP for everybody else */ |
---|
721 | #endif /* VMS */ |
---|
722 | |
---|
723 | #ifdef OS2 /* Flag for file name conversion */ |
---|
724 | XYFN_L, /* Literal for OS2 */ |
---|
725 | #else |
---|
726 | XYFN_C, /* Converted for others */ |
---|
727 | #endif /* OS2 */ |
---|
728 | |
---|
729 | PATH_OFF, /* Send pathnames OFF */ |
---|
730 | PATH_AUTO, /* Receive pathnames AUTO */ |
---|
731 | NULL, /* Host receive initiation string (binary) */ |
---|
732 | NULL, /* Host receive initiation string (text) */ |
---|
733 | NULL, /* Host server string */ |
---|
734 | NULL, /* External protocol send command (binary) */ |
---|
735 | NULL, /* External protocol send command (text) */ |
---|
736 | NULL, /* External protocol receive command (bin) */ |
---|
737 | NULL } /* External protocol receive command (txt) */ |
---|
738 | #ifdef CK_XYZ |
---|
739 | , |
---|
740 | {"XMODEM", 128,128,-1,-1, 1,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, |
---|
741 | {"XMODEM-CRC",128,128,-1,-1, -1,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, |
---|
742 | {"YMODEM", -1, -1,-1,-1, -1,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, |
---|
743 | {"YMODEM-g", -1, -1,-1,-1, -1,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, |
---|
744 | {"ZMODEM", -1, -1,-1,-1,PX_WIL,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL}, |
---|
745 | {"Other", -1, -1,-1,-1, -1,-1,-1,0,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL} |
---|
746 | #endif /* CK_XYZ */ |
---|
747 | }; |
---|
748 | |
---|
749 | /* Declarations for Send-Init Parameters */ |
---|
750 | |
---|
751 | int spsiz = DSPSIZ, /* Current packet size to send */ |
---|
752 | spmax = DSPSIZ, /* Biggest packet size we can send */ |
---|
753 | lastspmax = DSPSIZ, /* Send-packet size last used */ |
---|
754 | spsizr = DSPSIZ, /* Send-packet size requested */ |
---|
755 | spsizf = 0, /* Flag to override size negotiation */ |
---|
756 | rpsiz = DRPSIZ, /* Biggest we want to receive */ |
---|
757 | urpsiz = DRPSIZ, /* User-requested receive pkt size */ |
---|
758 | maxrps = MAXRP, /* Maximum incoming long packet size */ |
---|
759 | maxsps = MAXSP, /* Maximum outbound l.p. size */ |
---|
760 | maxtry = MAXTRY, /* Maximum retries per packet */ |
---|
761 | wslots = 1, /* Window size currently in use */ |
---|
762 | wslotr = DFWSIZ, /* Window size from SET WINDOW */ |
---|
763 | wslotn = 1, /* Window size negotiated in S-pkt */ |
---|
764 | timeouts = 0, /* For statistics reporting */ |
---|
765 | spackets = 0, /* ... */ |
---|
766 | rpackets = 0, /* ... */ |
---|
767 | retrans = 0, /* ... */ |
---|
768 | crunched = 0, /* ... */ |
---|
769 | wmax = 0, /* ... */ |
---|
770 | wcur = 0, /* ... */ |
---|
771 | srvidl = 0, /* Server idle timeout */ |
---|
772 | srvdis = 1, /* Server file xfer display */ |
---|
773 | srvtim = DSRVTIM, /* Server command wait timeout */ |
---|
774 | srvping = 1, /* Server keepalive */ |
---|
775 | /* |
---|
776 | timint is the timeout interval I use when waiting for a packet. |
---|
777 | pkttim is the SET RECEIVE TIMEOUT value, sent to the other Kermit. |
---|
778 | rtimo is the SET SEND TIMEOUT value. rtimo is the initial value of |
---|
779 | timint. timint is changed by the value in the incoming negotiation |
---|
780 | packet unless a SET SEND TIMEOUT command was given. |
---|
781 | */ |
---|
782 | timint = DMYTIM, /* Timeout interval I use */ |
---|
783 | pkttim = URTIME, /* Timeout I want you to use */ |
---|
784 | rtimo = DMYTIM, /* Normal packet wait timeout */ |
---|
785 | timef = 0, /* Flag to override what you ask */ |
---|
786 | #ifdef CK_TIMERS |
---|
787 | rttflg = 1, /* Use dynamic round-trip timers */ |
---|
788 | #else |
---|
789 | rttflg = 0, /* Use fixed timer */ |
---|
790 | #endif /* CK_TIMERS */ |
---|
791 | mintime = 1, /* Minimum timeout */ |
---|
792 | maxtime = 0, /* Maximum timeout */ |
---|
793 | |
---|
794 | npad = MYPADN, /* How much padding to send */ |
---|
795 | mypadn = MYPADN, /* How much padding to ask for */ |
---|
796 | bctr = DFBCT, /* Block check type requested */ |
---|
797 | bctu = 1, /* Block check type used */ |
---|
798 | bctl = 1, /* Block check length */ |
---|
799 | c_save = -1, /* Block check saving and restoring */ |
---|
800 | ss_save = -1, /* Slow-start saving and restoring */ |
---|
801 | ebq = MYEBQ, /* 8th bit prefix */ |
---|
802 | ebqflg = 0, /* 8th-bit quoting flag */ |
---|
803 | rqf = -1, /* Flag used in 8bq negotiation */ |
---|
804 | rq = 0, /* Received 8bq bid */ |
---|
805 | sq = 'Y', /* Sent 8bq bid */ |
---|
806 | rpt = 0, /* Repeat count */ |
---|
807 | rptq = MYRPTQ, /* Repeat prefix */ |
---|
808 | rptflg = 0, /* Repeat processing flag */ |
---|
809 | rptena = 1, /* Repeat processing enabled */ |
---|
810 | xfrcan = 1, /* Transfer cancellation enabled */ |
---|
811 | xfrint = 1, /* Transfer interruption enabled */ |
---|
812 | xfrchr = 3, /* Transfer cancel char = Ctrl-C */ |
---|
813 | xfrnum = 3, /* Need three of them by default */ |
---|
814 | g_xfrxla = -1; |
---|
815 | char * xfrmsg = NULL; /* Message for f.t. display screen */ |
---|
816 | #endif /* NOXFER */ |
---|
817 | |
---|
818 | #ifdef NOCSETS |
---|
819 | int xfrxla = 0; /* Character-set translation */ |
---|
820 | #else |
---|
821 | int xfrxla = 1; /* enabled or disabled */ |
---|
822 | #endif /* NOCSETS */ |
---|
823 | |
---|
824 | #ifndef NOXFER |
---|
825 | int epktflg = 0; /* E-PACKET command active */ |
---|
826 | |
---|
827 | int capas = 9, /* Position of Capabilities */ |
---|
828 | lpcapb = 2, /* Long Packet capability */ |
---|
829 | lpcapr = 1, /* requested */ |
---|
830 | lpcapu = 0, /* used */ |
---|
831 | swcapb = 4, /* Sliding Window capability */ |
---|
832 | swcapr = 1, /* requested (allowed) */ |
---|
833 | swcapu = 0, /* used */ |
---|
834 | atcapb = 8, /* Attribute capability */ |
---|
835 | atcapr = 1, /* requested */ |
---|
836 | atcapu = 0, /* used */ |
---|
837 | rscapb = 16, /* RESEND capability */ |
---|
838 | rscapr = 1, /* requested by default */ |
---|
839 | rscapu = 0, /* used */ |
---|
840 | lscapb = 32, /* Locking Shift capability */ |
---|
841 | lscapr = 1, /* requested by default */ |
---|
842 | lscapu = 0; /* used */ |
---|
843 | |
---|
844 | /* Flags for whether to use particular attributes */ |
---|
845 | |
---|
846 | int atenci = 1, /* Encoding in */ |
---|
847 | atenco = 1, /* Encoding out */ |
---|
848 | atdati = 1, /* Date in */ |
---|
849 | atdato = 1, /* Date out */ |
---|
850 | atdisi = 1, /* Disposition in/out */ |
---|
851 | atdiso = 1, |
---|
852 | atleni = 1, /* Length in/out (both kinds) */ |
---|
853 | atleno = 1, |
---|
854 | atblki = 1, /* Blocksize in/out */ |
---|
855 | atblko = 1, |
---|
856 | attypi = 1, /* File type in/out */ |
---|
857 | attypo = 1, |
---|
858 | atsidi = 1, /* System ID in/out */ |
---|
859 | atsido = 1, |
---|
860 | atsysi = 1, /* System-dependent parameters in/out */ |
---|
861 | atsyso = 1; |
---|
862 | |
---|
863 | int dispos = 0; /* Disposition */ |
---|
864 | |
---|
865 | #ifdef CK_PERMS |
---|
866 | int atlpri = 1, |
---|
867 | atlpro = 1, |
---|
868 | atgpri = 1, |
---|
869 | atgpro = 1; |
---|
870 | #endif /* CK_PERMS */ |
---|
871 | |
---|
872 | int atfrmi = 1, /* Record Format in/out */ |
---|
873 | atfrmo = 1; |
---|
874 | |
---|
875 | #ifdef STRATUS |
---|
876 | int atcrei = 1, /* Creator ID in/out */ |
---|
877 | atcreo = 1, |
---|
878 | atacti = 1, /* Account in/out */ |
---|
879 | atacto = 1; |
---|
880 | #endif /* STRATUS */ |
---|
881 | |
---|
882 | int sprmlen = -1; /* Send/Receive protocol parameter */ |
---|
883 | int rprmlen = -1; /* string length limits */ |
---|
884 | int sendipkts = 1; /* Send I packets */ |
---|
885 | |
---|
886 | CHAR padch = MYPADC, /* Padding character to send */ |
---|
887 | mypadc = MYPADC, /* Padding character to ask for */ |
---|
888 | seol = MYEOL, /* End-Of-Line character to send */ |
---|
889 | eol = MYEOL, /* End-Of-Line character to look for */ |
---|
890 | ctlq = CTLQ, /* Control prefix in incoming data */ |
---|
891 | myctlq = CTLQ, /* Outbound control character prefix */ |
---|
892 | myrptq = MYRPTQ; /* Repeat prefix I want to use */ |
---|
893 | |
---|
894 | int rptmin = 3; /* Repeat-count minimum */ |
---|
895 | |
---|
896 | int usepipes = 0, /* Used for xfer to/from pipes */ |
---|
897 | g_usepipes = -1; |
---|
898 | |
---|
899 | char * filefile = NULL; /* File containing list of filenames */ |
---|
900 | /* CD message filename list */ |
---|
901 | |
---|
902 | char whoareu[16] = { NUL, NUL }; /* System ID of other Kermit */ |
---|
903 | int sysindex = -1; /* and index to its system ID struct */ |
---|
904 | int myindex = -1; |
---|
905 | int wearealike = 0; /* 2 Kermits have compatible sysids */ |
---|
906 | char * cksysid = /* My system ID */ |
---|
907 | #ifdef UNIX |
---|
908 | "U1" |
---|
909 | #else |
---|
910 | #ifdef VMS |
---|
911 | "D7" |
---|
912 | #else |
---|
913 | #ifdef OSK |
---|
914 | "UD" |
---|
915 | #else |
---|
916 | #ifdef AMIGA |
---|
917 | "L3" |
---|
918 | #else |
---|
919 | #ifdef MAC |
---|
920 | "A3" |
---|
921 | #else |
---|
922 | #ifdef OS2 |
---|
923 | #ifdef NT |
---|
924 | "UN" |
---|
925 | #else /* NT */ |
---|
926 | "UO" |
---|
927 | #endif /* NT */ |
---|
928 | #else /* OS2 */ |
---|
929 | #ifdef datageneral |
---|
930 | "F3" |
---|
931 | #else |
---|
932 | #ifdef GEMDOS |
---|
933 | "K2" |
---|
934 | #else |
---|
935 | #ifdef STRATUS |
---|
936 | "MV" |
---|
937 | #else |
---|
938 | "" |
---|
939 | #endif /* STRATUS */ |
---|
940 | #endif /* GEMDOS */ |
---|
941 | #endif /* datageneral */ |
---|
942 | #endif /* OS2 */ |
---|
943 | #endif /* MAC */ |
---|
944 | #endif /* AMIGA */ |
---|
945 | #endif /* OSK */ |
---|
946 | #endif /* VMS */ |
---|
947 | #endif /* UNIX */ |
---|
948 | ; |
---|
949 | |
---|
950 | int oopts = -1; /* O-Packet Options */ |
---|
951 | int omode = -1; /* O-Packet Transfer Mode */ |
---|
952 | int oname = -1; /* O-Packet Filename Options */ |
---|
953 | int opath = -1; /* O-Packet Pathname Options */ |
---|
954 | |
---|
955 | struct zattr iattr; /* Incoming file attributes */ |
---|
956 | |
---|
957 | #ifdef VMS |
---|
958 | /* VMS labeled file default options - name only. */ |
---|
959 | int lf_opts = LBL_NAM; |
---|
960 | #else |
---|
961 | #ifdef OS2 |
---|
962 | /* OS/2 labeled file default options, all attributes but archived. */ |
---|
963 | unsigned long int lf_opts = LBL_EXT|LBL_HID|LBL_RO|LBL_SYS; |
---|
964 | #else |
---|
965 | int lf_opts = 0; |
---|
966 | #endif /* OS2 */ |
---|
967 | #endif /* VMS */ |
---|
968 | |
---|
969 | /* Packet-related variables */ |
---|
970 | |
---|
971 | int pktnum = 0, /* Current packet number */ |
---|
972 | sndtyp = 0, /* Type of packet just sent */ |
---|
973 | rcvtyp = 0, /* Type of packet just received */ |
---|
974 | rsn, /* Received packet sequence number */ |
---|
975 | rln, /* Received packet length */ |
---|
976 | size, /* Current size of output pkt data */ |
---|
977 | osize, /* Previous output packet data size */ |
---|
978 | maxsize, /* Max size for building data field */ |
---|
979 | spktl = 0, /* Length packet being sent */ |
---|
980 | rpktl = 0, /* Length of packet just received */ |
---|
981 | pktpaus = 0, /* Interpacket pause interval, msec */ |
---|
982 | rprintf, /* REMOTE PRINT flag */ |
---|
983 | rmailf, /* MAIL flag */ |
---|
984 | xferstat = -1, /* Status of last transaction */ |
---|
985 | filestatus = 0; /* Status of last file transfer */ |
---|
986 | |
---|
987 | CHAR pktmsgbuf[PKTMSGLEN+1]; |
---|
988 | CHAR *epktmsg = pktmsgbuf; |
---|
989 | |
---|
990 | #ifdef pdp11 |
---|
991 | int srvcmdlen = MAXRP; /* srvcmd buffer length */ |
---|
992 | #else |
---|
993 | #ifdef DYNAMIC |
---|
994 | int srvcmdlen = MAXRP; |
---|
995 | #else |
---|
996 | int srvcmdlen = 0; |
---|
997 | #endif /* DYNAMIC */ |
---|
998 | #endif /* pdp11 */ |
---|
999 | |
---|
1000 | CHAR |
---|
1001 | #ifdef pdp11 |
---|
1002 | srvcmdbuf[MAXRP+4], |
---|
1003 | *srvcmd = srvcmdbuf, |
---|
1004 | #else |
---|
1005 | #ifdef DYNAMIC |
---|
1006 | *srvcmd = (CHAR *)0, /* Where to decode server command */ |
---|
1007 | #else |
---|
1008 | srvcmdbuf[MAXRP+4], |
---|
1009 | *srvcmd = srvcmdbuf, |
---|
1010 | #endif /* DYNAMIC */ |
---|
1011 | #endif /* pdp11 */ |
---|
1012 | padbuf[96], /* Buffer for send-padding */ |
---|
1013 | *recpkt, |
---|
1014 | *rdatap, /* Pointer to received packet data */ |
---|
1015 | *data = (CHAR *)0, /* Pointer to send-packet data */ |
---|
1016 | *srvptr, /* Pointer to srvcmd */ |
---|
1017 | mystch = SOH, /* Outbound packet-start character */ |
---|
1018 | stchr = SOH; /* Incoming packet-start character */ |
---|
1019 | |
---|
1020 | /* File-related variables */ |
---|
1021 | |
---|
1022 | #ifndef NOMSEND /* Multiple SEND */ |
---|
1023 | struct filelist * filehead = NULL; /* SEND list */ |
---|
1024 | struct filelist * filetail = NULL; |
---|
1025 | struct filelist * filenext = NULL; |
---|
1026 | int addlist = 0; |
---|
1027 | #endif /* NOMSEND */ |
---|
1028 | |
---|
1029 | char filnam[CKMAXPATH + 1]; /* Name of current file. */ |
---|
1030 | char ofilnam[CKMAXPATH + 1]; /* Original name. */ |
---|
1031 | |
---|
1032 | int pipesend = 0; /* Nonzero if sending from pipe */ |
---|
1033 | #ifdef PIPESEND |
---|
1034 | char * sndfilter = NULL; /* Send and receive filters */ |
---|
1035 | char * rcvfilter = NULL; |
---|
1036 | #endif /* PIPESEND */ |
---|
1037 | |
---|
1038 | char ** sndarray = NULL; /* SEND /ARRAY pointer and range */ |
---|
1039 | #ifndef NOSPL |
---|
1040 | int sndxlo = -1, sndxhi = -1, sndxin = -1; |
---|
1041 | #endif /* NOSPL */ |
---|
1042 | #endif /* NOXFER */ |
---|
1043 | |
---|
1044 | #ifndef NOSERVER |
---|
1045 | int ngetpath = 0; /* GET search path */ |
---|
1046 | int fromgetpath = 0; |
---|
1047 | char * getpath[MAXGETPATH]; |
---|
1048 | char * x_user = NULL; /* Server login information */ |
---|
1049 | char * x_passwd = NULL; |
---|
1050 | char * x_acct = NULL; |
---|
1051 | #endif /* NOSERVER */ |
---|
1052 | |
---|
1053 | int x_login = 0; /* Login required */ |
---|
1054 | int x_logged = 0; /* User is logged in */ |
---|
1055 | |
---|
1056 | extern int timelimit; |
---|
1057 | |
---|
1058 | #ifdef CK_LOGIN |
---|
1059 | int logintimo = 300; /* Login timeout */ |
---|
1060 | char * userfile = NULL; /* Forbidden user file */ |
---|
1061 | #endif /* CK_LOGIN */ |
---|
1062 | #ifdef IKSD |
---|
1063 | char * anonfile = NULL; /* Anonymous login init file */ |
---|
1064 | char * anonroot = NULL; /* Anonymous file-system root */ |
---|
1065 | int iks_timo = 300; /* 5 minutes idle timo */ |
---|
1066 | int iks_retry = 3; /* 3 attempts at login */ |
---|
1067 | #endif /* IKSD */ |
---|
1068 | |
---|
1069 | #ifdef CKSYSLOG |
---|
1070 | extern VOID zsyslog(); |
---|
1071 | extern int ckxlogging, ckxsyslog; |
---|
1072 | #endif /* CKSYSLOG */ |
---|
1073 | |
---|
1074 | int nzxopts = 0; /* Options for nzxpand() */ |
---|
1075 | int nfils = 0; /* Number of files in file group */ |
---|
1076 | long fsize = 0L; /* Size of current file */ |
---|
1077 | #ifdef UNIX |
---|
1078 | int wildxpand = 0; /* Who expands wildcards */ |
---|
1079 | #else /* UNIX */ |
---|
1080 | #ifdef STRATUS |
---|
1081 | int wildxpand = 1; |
---|
1082 | #endif /* STRATUS */ |
---|
1083 | #endif /* UNIX */ |
---|
1084 | #ifdef UNIXOROSK |
---|
1085 | int matchdot = 0; /* Whether to match dot files */ |
---|
1086 | #else |
---|
1087 | int matchdot = 1; |
---|
1088 | #endif /* UNIXOROSK */ |
---|
1089 | int matchfifo = 0; /* Whether to match FIFO "files" */ |
---|
1090 | int clfils = 0; /* Flag for command-line files */ |
---|
1091 | int stayflg = 0; /* Flag for "stay", i.e. "-S" */ |
---|
1092 | int xfinish = 0; /* Flag for FINISH = EXIT */ |
---|
1093 | long ztusec = -1L; /* Used with ztime() */ |
---|
1094 | long ztmsec = -1L; /* Ditto */ |
---|
1095 | |
---|
1096 | /* Communication device / connection variables */ |
---|
1097 | |
---|
1098 | char ttname[TTNAMLEN+1]; /* Name of communication device */ |
---|
1099 | |
---|
1100 | #ifdef MAC |
---|
1101 | int connected = 0; /* True if connected */ |
---|
1102 | int startconnected; /* initial state of connected */ |
---|
1103 | #endif /* MAC */ |
---|
1104 | |
---|
1105 | long speed = -1L; /* Communication device speed */ |
---|
1106 | int wasclosed = 0; /* Connection was just closed */ |
---|
1107 | int whyclosed = WC_REMO; /* why it was closed */ |
---|
1108 | int qnxportlock = 0; /* QNX port locking on/off */ |
---|
1109 | |
---|
1110 | #ifndef CLSONDISC |
---|
1111 | #define CLSONDISC 0 |
---|
1112 | #endif /* CLSONDISC */ |
---|
1113 | |
---|
1114 | int cxflow[CXT_MAX+1]; /* See initflow() */ |
---|
1115 | |
---|
1116 | #ifndef NOSHOW |
---|
1117 | char * floname[] = { /* Flow control names */ |
---|
1118 | "none", "xon/xoff", "rts/cts", "dtr/cd", "etx/ack", "string", |
---|
1119 | "xxx1", "xxx2", "dtr/cts", "keep", "auto" |
---|
1120 | }; |
---|
1121 | int nfloname = (sizeof(floname) / sizeof(char *)); |
---|
1122 | |
---|
1123 | char * cxname[] = { /* Connection type names */ |
---|
1124 | "remote", "direct-serial", "modem", "tcp/ip", "x.25", "decnet", |
---|
1125 | "lat", "netbios", "named-pipe", "ssh", "pipe" |
---|
1126 | }; |
---|
1127 | int ncxname = (sizeof(cxname) / sizeof(char *)); |
---|
1128 | #endif /* NOSHOW */ |
---|
1129 | |
---|
1130 | int parity = DEFPAR, /* Parity specified, 0,'e','o',etc */ |
---|
1131 | hwparity = 0, /* Hardware parity for serial port */ |
---|
1132 | stopbits = -1, /* Stop bits for serial port */ |
---|
1133 | clsondisc = CLSONDISC, /* Serial port close on disconnect */ |
---|
1134 | autopar = 0, /* Automatic parity change flag */ |
---|
1135 | sosi = 0, /* Shift-In/Out flag */ |
---|
1136 | flow = 0, /* Flow control (see initflow()) */ |
---|
1137 | autoflow = 1, /* Automatic flow control */ |
---|
1138 | turn = 0, /* Line turnaround handshake flag */ |
---|
1139 | turnch = XON, /* Line turnaround character */ |
---|
1140 | duplex = 0, /* Duplex, full by default */ |
---|
1141 | escape = DFESC, /* Escape character for connect */ |
---|
1142 | ckdelay = DDELAY, /* Initial delay before sending */ |
---|
1143 | tnlm = 0; /* Terminal newline mode */ |
---|
1144 | |
---|
1145 | /* Networks for SET HOST */ |
---|
1146 | |
---|
1147 | #ifdef BIGBUFOK |
---|
1148 | #define MYHOSTL 1024 |
---|
1149 | #else |
---|
1150 | #define MYHOSTL 100 |
---|
1151 | #endif /* BIGBUFOK */ |
---|
1152 | |
---|
1153 | char myhost[MYHOSTL]; /* Local host name */ |
---|
1154 | int network = 0; /* Network vs serial connection */ |
---|
1155 | int inserver = 0; /* Running as an Internet server */ |
---|
1156 | int isguest = 0; /* User is anonymous */ |
---|
1157 | char * clienthost = NULL; /* Peer host name or address */ |
---|
1158 | int tcp_incoming = 0; /* Incoming TCP connection? */ |
---|
1159 | |
---|
1160 | #ifdef NETCONN |
---|
1161 | #ifdef TCPSOCKET |
---|
1162 | int nettype = NET_TCPB; /* Default network type */ |
---|
1163 | #else |
---|
1164 | #ifdef SUNX25 |
---|
1165 | int nettype = NET_SX25; |
---|
1166 | #else |
---|
1167 | #ifdef IBMX25 |
---|
1168 | int nettype = NET_IX25; |
---|
1169 | #else |
---|
1170 | #ifdef HPX25 |
---|
1171 | int nettype = NET_HX25; |
---|
1172 | #else |
---|
1173 | #ifdef STRATUSX25 |
---|
1174 | int nettype = NET_VX25; |
---|
1175 | #else |
---|
1176 | #ifdef DECNET |
---|
1177 | int nettype = NET_DEC; |
---|
1178 | #else |
---|
1179 | #ifdef SUPERLAT |
---|
1180 | int nettype = NET_SLAT; |
---|
1181 | #else |
---|
1182 | int nettype = NET_NONE; |
---|
1183 | #endif /* SUPERLAT */ |
---|
1184 | #endif /* DECNET */ |
---|
1185 | #endif /* STRATUSX25 */ |
---|
1186 | #endif /* HPX25 */ |
---|
1187 | #endif /* IBMX25 */ |
---|
1188 | #endif /* SUNX25 */ |
---|
1189 | #endif /* TCPSOCKET */ |
---|
1190 | #else /* NETCONN */ |
---|
1191 | int nettype = NET_NONE; |
---|
1192 | #endif /* NETCONN */ |
---|
1193 | |
---|
1194 | #ifdef ANYX25 |
---|
1195 | int revcall = 0; /* X.25 reverse call not selected */ |
---|
1196 | int closgr = -1; /* X.25 closed user group */ |
---|
1197 | int cudata = 0; /* X.25 call user data not specified */ |
---|
1198 | char udata[MAXCUDATA]; /* X.25 call user data */ |
---|
1199 | |
---|
1200 | #ifdef IBMX25 |
---|
1201 | /* |
---|
1202 | I was unable to find any pre-defined MAX values for x25 addresses - the |
---|
1203 | addresses that I've seen have been around 10-12 characters 32 is probably |
---|
1204 | enough, 64 is hopefully safe for everyone. |
---|
1205 | */ |
---|
1206 | x25addr_t local_nua = {'\0'}; /* local x.25 address */ |
---|
1207 | x25addr_t remote_nua = {'\0'}; /* remote x.25 address */ |
---|
1208 | char x25name[32] = {'\0'}; /* x25 device name, sx25a0 or sx25a1 */ |
---|
1209 | char x25dev[64] = "/dev/x25pkt"; /* x25 device in /dev */ |
---|
1210 | int x25port = 0; /* port used for X.25 - AIX only */ |
---|
1211 | #endif /* IBMX25 */ |
---|
1212 | |
---|
1213 | #ifndef IBMX25 |
---|
1214 | /* |
---|
1215 | This condition is unrelated to the above IBMX25 condition. |
---|
1216 | IBM X.25 doesn't have PAD support. |
---|
1217 | */ |
---|
1218 | CHAR padparms[MAXPADPARMS+1]; /* X.3 parameters */ |
---|
1219 | #endif /* IBMX25 */ |
---|
1220 | #endif /* ANYX25 */ |
---|
1221 | |
---|
1222 | /* Other items */ |
---|
1223 | |
---|
1224 | int isinterrupted = 0; /* Used in exception handling */ |
---|
1225 | int what = W_INIT; /* What I am doing */ |
---|
1226 | int lastxfer = 0; /* Last transfer (send or receive) */ |
---|
1227 | |
---|
1228 | extern int mdmtyp; /* Modem (/network) type */ |
---|
1229 | |
---|
1230 | #ifdef NT |
---|
1231 | extern int StartedFromDialer; |
---|
1232 | #ifdef NTSIG |
---|
1233 | extern int TlsIndex; |
---|
1234 | #endif /* NTSIG */ |
---|
1235 | #ifdef NTASM |
---|
1236 | unsigned long ESPToRestore; /* Ditto */ |
---|
1237 | #endif /* NTASM */ |
---|
1238 | #endif /* NT */ |
---|
1239 | |
---|
1240 | #ifdef OS2PM |
---|
1241 | int os2pm = 0; /* OS/2 Presentation Manager flag */ |
---|
1242 | #endif /* OS2PM */ |
---|
1243 | |
---|
1244 | /* Terminal screen size, if known, -1 means unknown. */ |
---|
1245 | |
---|
1246 | #ifdef OS2 |
---|
1247 | #include "ckocon.h" |
---|
1248 | #ifdef KUI |
---|
1249 | int tt_rows[VNUM] = {24,24,25,1}; /* Rows (height) */ |
---|
1250 | int tt_cols[VNUM] = {80,80,80,80}; /* Columns (width) */ |
---|
1251 | int cmd_rows = 24, cmd_cols = 80; /* Command/console screen dimensions */ |
---|
1252 | #else /* KUI */ |
---|
1253 | int tt_rows[VNUM] = {-1,24,25,1}; /* Rows (height) */ |
---|
1254 | int tt_cols[VNUM] = {-1,80,80,80}; /* Columns (width) */ |
---|
1255 | int cmd_rows = -1, cmd_cols = -1; /* Command/console screen dimensions */ |
---|
1256 | #endif /* KUI */ |
---|
1257 | int k95stdio = 0; /* Stdio threads */ |
---|
1258 | int tt_bell = XYB_AUD | XYB_SYS; /* BELL AUDIBLE (system sounds) */ |
---|
1259 | #else /* OS2 */ |
---|
1260 | int tt_rows = -1; /* Rows (height) */ |
---|
1261 | int tt_cols = -1; /* Columns (width) */ |
---|
1262 | int cmd_rows = 24, cmd_cols = 80; /* Command/console screen dimensions */ |
---|
1263 | int tt_bell = XYB_AUD; /* BELL ON */ |
---|
1264 | #endif /* OS2 */ |
---|
1265 | |
---|
1266 | int tt_print = 0; /* Transparent print disabled */ |
---|
1267 | int tt_escape = 1; /* Escaping back is enabled */ |
---|
1268 | int tt_scroll = 1; /* Scrolling operations are enabled */ |
---|
1269 | |
---|
1270 | int tn_exit = 0; /* Exit on disconnect */ |
---|
1271 | |
---|
1272 | int exitonclose = 0; /* Exit on close */ |
---|
1273 | int exithangup = 1; /* Hangup on exit */ |
---|
1274 | int haveline = 0; /* SET LINE or SET HOST in effect */ |
---|
1275 | int tlevel = -1; /* Take-file command level */ |
---|
1276 | int hints = 1; /* Whether to give hints */ |
---|
1277 | |
---|
1278 | #ifdef NOLOCAL |
---|
1279 | int remonly = 1; /* Remote-mode-only advisory (-R) */ |
---|
1280 | int nolocal = 1; /* Remote-only strictly enforced */ |
---|
1281 | #else |
---|
1282 | int remonly = 0; |
---|
1283 | int nolocal = 0; |
---|
1284 | int cx_status = 0; /* CONNECT return status */ |
---|
1285 | #endif /* NOLOCAL */ |
---|
1286 | |
---|
1287 | #ifndef NOSPL |
---|
1288 | extern int cmdlvl; /* Command level */ |
---|
1289 | extern int maclvl; /* Macro invocation level */ |
---|
1290 | #endif /* NOSPL */ |
---|
1291 | |
---|
1292 | int protocol = PROTO_K; /* File transfer protocol = Kermit */ |
---|
1293 | |
---|
1294 | #ifdef NEWDEFAULTS |
---|
1295 | int prefixing = PX_CAU; |
---|
1296 | #else |
---|
1297 | int prefixing = PX_ALL; |
---|
1298 | #endif /* NEWDEFAULTS */ |
---|
1299 | |
---|
1300 | extern short ctlp[]; /* Control-prefix table */ |
---|
1301 | |
---|
1302 | int carrier = CAR_AUT; /* Pay attention to carrier signal */ |
---|
1303 | int cdtimo = 0; /* Carrier wait timeout */ |
---|
1304 | int xitsta = GOOD_EXIT; /* Program exit status */ |
---|
1305 | |
---|
1306 | #ifdef VMS /* Default filename collision action */ |
---|
1307 | int fncact = XYFX_X; /* REPLACE for VMS */ |
---|
1308 | #else |
---|
1309 | int fncact = XYFX_B; /* BACKUP for everybody else */ |
---|
1310 | #endif /* VMS */ |
---|
1311 | |
---|
1312 | int fncsav = -1; /* For saving & restoring the above */ |
---|
1313 | int bgset = -1; /* BACKGROUND mode set explicitly */ |
---|
1314 | |
---|
1315 | int cmdint = 1; /* Interrupts are allowed */ |
---|
1316 | #ifdef UNIX |
---|
1317 | int xsuspend = DFSUSP; /* Whether SUSPEND command, etc, */ |
---|
1318 | #else /* is to be allowed. */ |
---|
1319 | int xsuspend = 0; |
---|
1320 | #endif /* UNIX */ |
---|
1321 | |
---|
1322 | /* Statistics variables */ |
---|
1323 | |
---|
1324 | long filcnt, /* Number of files in transaction */ |
---|
1325 | filrej, /* Number of files rejected in transaction */ |
---|
1326 | flci, /* Characters from line, current file */ |
---|
1327 | flco, /* Chars to line, current file */ |
---|
1328 | tlci, /* Chars from line in transaction */ |
---|
1329 | tlco, /* Chars to line in transaction */ |
---|
1330 | ffc, /* Chars to/from current file */ |
---|
1331 | tfc, /* Chars to/from files in transaction */ |
---|
1332 | cps = 0L, /* Chars/sec last transfer */ |
---|
1333 | peakcps = 0L, /* Peak chars/sec last transfer */ |
---|
1334 | ccu, /* Control chars unprefixed in transaction */ |
---|
1335 | ccp, /* Control chars prefixed in transaction */ |
---|
1336 | rptn; /* Repeated characters compressed */ |
---|
1337 | |
---|
1338 | int tsecs = 0; /* Seconds for transaction */ |
---|
1339 | int fsecs = 0; /* Per-file timer */ |
---|
1340 | |
---|
1341 | #ifdef GFTIMER |
---|
1342 | CKFLOAT |
---|
1343 | fpfsecs = 0.0, /* Floating point per-file timer */ |
---|
1344 | fptsecs = 0.0; /* and per-transaction timer */ |
---|
1345 | #endif /* GFTIMER */ |
---|
1346 | |
---|
1347 | /* Flags */ |
---|
1348 | |
---|
1349 | int deblog = 0, /* Debug log is open */ |
---|
1350 | debok = 1, /* Debug log is not disabled */ |
---|
1351 | debxlen = 54, /* Default length for debug strings */ |
---|
1352 | debses = 0, /* Flag for DEBUG SESSION */ |
---|
1353 | debtim = 0, /* Include timestamp in debug log */ |
---|
1354 | pktlog = 0, /* Flag for packet logging */ |
---|
1355 | seslog = 0, /* Session logging */ |
---|
1356 | dialog = 0, /* DIAL logging */ |
---|
1357 | tralog = 0, /* Transaction logging */ |
---|
1358 | tlogfmt = 1, /* Transaction log format (verbose) */ |
---|
1359 | tlogsep = (int)',', /* Transaction log field separator */ |
---|
1360 | displa = 0, /* File transfer display on/off */ |
---|
1361 | stdouf = 0, /* Flag for output to stdout */ |
---|
1362 | stdinf = 0, /* Flag for input from stdin */ |
---|
1363 | xflg = 0, /* Flag for X instead of F packet */ |
---|
1364 | hcflg = 0, /* Doing Host command */ |
---|
1365 | dest = DEST_D, /* Destination for packet data */ |
---|
1366 | zchkod = 0, /* zchko() should work for dirs too? */ |
---|
1367 | zchkid = 0, /* zchki() should work for dirs too? */ |
---|
1368 | |
---|
1369 | /* If you change this, also see struct ptab above... */ |
---|
1370 | |
---|
1371 | #ifdef OS2 /* Flag for file name conversion */ |
---|
1372 | fncnv = XYFN_L, /* Default is Literal in OS/2, */ |
---|
1373 | f_save = XYFN_L, /* (saved copy of same) */ |
---|
1374 | #else |
---|
1375 | fncnv = XYFN_C, /* elsewhere Convert them */ |
---|
1376 | f_save = XYFN_C, /* (ditto) */ |
---|
1377 | #endif /* OS2 */ |
---|
1378 | |
---|
1379 | fnspath = PATH_OFF, /* Send file path */ |
---|
1380 | fnrpath = PATH_AUTO, /* Receive file path */ |
---|
1381 | fackpath = 1, /* Send back path in ACK to F */ |
---|
1382 | binary = XYFT_B, /* Default file transfer mode */ |
---|
1383 | b_save = XYFT_B, /* Saved file mode */ |
---|
1384 | eofmethod = 0, /* EOF detection method (length) */ |
---|
1385 | |
---|
1386 | #ifdef OS2 |
---|
1387 | cursor_save = -1, /* Cursor state */ |
---|
1388 | #endif /* OS2 */ |
---|
1389 | |
---|
1390 | xfermode = XMODE_A, /* Transfer mode, manual or auto */ |
---|
1391 | xfiletype = -1, /* Transfer only text (or binary) */ |
---|
1392 | recursive = 0, /* Recursive directory traversal */ |
---|
1393 | nolinks = 2, /* Don't follow symbolic links */ |
---|
1394 | skipbup = 0, /* Skip backup files when sending */ |
---|
1395 | sendmode = SM_SEND, /* Which type of SEND operation */ |
---|
1396 | slostart = 1, /* Slow start (grow packet lengths) */ |
---|
1397 | cmask = 0377, /* CONNECT (terminal) byte mask */ |
---|
1398 | fmask = 0377, /* File byte mask */ |
---|
1399 | ckwarn = 0, /* Flag for file warning */ |
---|
1400 | quiet = 0, /* Be quiet during file transfer */ |
---|
1401 | local = 0, /* 1 = local mode, 0 = remote mode */ |
---|
1402 | cxtype = CXT_REMOTE, /* Connection type */ |
---|
1403 | server = 0, /* Flag for I Am Server */ |
---|
1404 | query = 0, /* Flag for Query active */ |
---|
1405 | justone = 0, /* Server should do Just One command */ |
---|
1406 | urserver = 0, /* Flag for You Are Server */ |
---|
1407 | bye_active = 0, /* Flag for BYE command active */ |
---|
1408 | diractive = 0, /* Flag for DIRECTORY command active */ |
---|
1409 | cdactive = 0, /* Flag for CD command active */ |
---|
1410 | cflg = 0, /* Connect before transaction */ |
---|
1411 | cnflg = 0, /* Connect after transaction */ |
---|
1412 | cxseen = 0, /* Flag for cancelling a file */ |
---|
1413 | czseen = 0, /* Flag for cancelling file group */ |
---|
1414 | fatalio = 0, /* Flag for fatal i/o error */ |
---|
1415 | discard = 0, /* Flag for file to be discarded */ |
---|
1416 | keep = SET_AUTO, /* Keep incomplete files = AUTO */ |
---|
1417 | unkcs = 1, /* Keep file w/unknown character set */ |
---|
1418 | #ifdef VMS |
---|
1419 | filepeek = 0, /* Inspection of files */ |
---|
1420 | #else |
---|
1421 | #ifdef datgeneral |
---|
1422 | filepeek = 0, |
---|
1423 | #else |
---|
1424 | filepeek = 1, |
---|
1425 | #endif /* datageneral */ |
---|
1426 | #endif /* VMS */ |
---|
1427 | nakstate = 0, /* In a state where we can send NAKs */ |
---|
1428 | dblchar = -1, /* Character to double when sending */ |
---|
1429 | moving = 0, /* MOVE = send, then delete */ |
---|
1430 | reliable = SET_AUTO, /* Nonzero if transport is reliable */ |
---|
1431 | xreliable = -1, |
---|
1432 | setreliable = 0, |
---|
1433 | urclear = 0, /* Nonzero for clear channel to you */ |
---|
1434 | clearrq = SET_AUTO, /* SET CLEARCHANEL value */ |
---|
1435 | cleared = 0, |
---|
1436 | streaming = 0, /* Nonzero if streaming is active */ |
---|
1437 | streamok = 0, /* Nonzero if streaming negotiated */ |
---|
1438 | streamrq = SET_AUTO, /* SET STREAMING value */ |
---|
1439 | streamed = -1; /* Whether we streamed last time */ |
---|
1440 | |
---|
1441 | char * snd_move = NULL; /* Move file after sending it */ |
---|
1442 | char * snd_rename = NULL; /* Rename file after sending it */ |
---|
1443 | char * rcv_move = NULL; /* Move file after receiving it */ |
---|
1444 | char * rcv_rename = NULL; /* Rename file after receiving it */ |
---|
1445 | |
---|
1446 | char * g_snd_move = NULL; |
---|
1447 | char * g_snd_rename = NULL; |
---|
1448 | char * g_rcv_move = NULL; |
---|
1449 | char * g_rcv_rename = NULL; |
---|
1450 | |
---|
1451 | long sendstart = 0L; /* SEND start position */ |
---|
1452 | long calibrate = 0L; /* Nonzero if calibration run */ |
---|
1453 | |
---|
1454 | #ifdef CK_TRIGGER |
---|
1455 | char *tt_trigger[TRIGGERS] = { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }; |
---|
1456 | CHAR *tt_trmatch[TRIGGERS] = { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL }; |
---|
1457 | char *triggerval = NULL; |
---|
1458 | #endif /* CK_TRIGGER */ |
---|
1459 | |
---|
1460 | int ckxlogging = 0; /* Flag for syslogging active */ |
---|
1461 | int ikdbopen = 0; /* Flag for IKSD database active */ |
---|
1462 | int dbinited = 0; /* Flag for IKSDB record init'd */ |
---|
1463 | #ifndef CKSYSLOG |
---|
1464 | int ckxsyslog = 0; /* Logging level 0 */ |
---|
1465 | #else |
---|
1466 | #ifdef SYSLOGLEVEL |
---|
1467 | int ckxsyslog = SYSLOGLEVEL; /* Logging level specified */ |
---|
1468 | #else |
---|
1469 | int ckxsyslog = SYSLG_DF; /* Default logging level */ |
---|
1470 | #endif /* SYSLOGLEVEL */ |
---|
1471 | #endif /* CKSYSLOG */ |
---|
1472 | |
---|
1473 | #ifndef NOHELP |
---|
1474 | #ifndef NOCMDL |
---|
1475 | _PROTOTYP( VOID iniopthlp, (void) ); /* Command-line help initializer */ |
---|
1476 | #endif /* NOCMDL */ |
---|
1477 | #endif /* NOHELP */ |
---|
1478 | |
---|
1479 | _PROTOTYP( VOID getexedir, (void) ); |
---|
1480 | _PROTOTYP( int putnothing, (char) ); |
---|
1481 | |
---|
1482 | #ifdef IKSD |
---|
1483 | _PROTOTYP( VOID doiksdinit, (void) ); |
---|
1484 | _PROTOTYP( VOID iksdinit, (void) ); |
---|
1485 | _PROTOTYP( VOID doiklog, (void) ); |
---|
1486 | _PROTOTYP( int dbinit, (void) ); |
---|
1487 | #endif /* IKSD */ |
---|
1488 | |
---|
1489 | /* Variables passed from command parser to protocol module */ |
---|
1490 | |
---|
1491 | #ifndef NOSPL |
---|
1492 | #ifndef NOICP |
---|
1493 | #ifdef CK_APC |
---|
1494 | _PROTOTYP( VOID apconect, (void) ); |
---|
1495 | #endif /* CK_APC */ |
---|
1496 | #ifdef OS2 |
---|
1497 | extern int initvik; |
---|
1498 | #endif /* OS2 */ |
---|
1499 | #endif /* NOICP */ |
---|
1500 | #endif /* NOSPL */ |
---|
1501 | char *clcmds = NULL; /* Pointer to command-line commands */ |
---|
1502 | |
---|
1503 | #ifndef NOSETKEY |
---|
1504 | extern KEY *keymap; |
---|
1505 | extern MACRO *macrotab; |
---|
1506 | #endif /* NOSETKEY */ |
---|
1507 | |
---|
1508 | #ifndef NOPUSH |
---|
1509 | int nopush = 0; /* PUSH enabled */ |
---|
1510 | #else |
---|
1511 | int nopush = 1; /* PUSH disabled */ |
---|
1512 | #endif /* NOPUSH */ |
---|
1513 | |
---|
1514 | CHAR sstate = (CHAR) 0; /* Starting state for automaton */ |
---|
1515 | CHAR zstate = (CHAR) 0; /* For remembering sstate */ |
---|
1516 | char * printername = NULL; /* NULL if printer not redirected */ |
---|
1517 | int printpipe = 0; /* For SET PRINTER */ |
---|
1518 | int noprinter = 0; |
---|
1519 | |
---|
1520 | #ifndef NOXFER |
---|
1521 | char *cmarg = ""; /* Pointer to command data */ |
---|
1522 | char *cmarg2 = ""; /* Pointer to 2nd command data */ |
---|
1523 | char **cmlist; /* Pointer to file list in argv */ |
---|
1524 | |
---|
1525 | #ifdef CK_AUTODL /* Autodownload */ |
---|
1526 | int autodl = 1; /* Enabled by default */ |
---|
1527 | #else |
---|
1528 | int autodl = 0; /* (or if not implemented). */ |
---|
1529 | #endif /* CK_AUTODL */ |
---|
1530 | int adl_err = 1; /* 1 = stop on error */ |
---|
1531 | #ifdef KUI |
---|
1532 | int adl_ask = 1; /* 1 = file dialog on autodownload */ |
---|
1533 | #else |
---|
1534 | int adl_ask = 0; /* 0 = no file dialog */ |
---|
1535 | #endif /* KUI */ |
---|
1536 | #ifdef OS2 /* AUTODOWNLOAD parameters */ |
---|
1537 | int adl_kmode = ADL_PACK, /* Match Packet to signal download */ |
---|
1538 | adl_zmode = ADL_PACK; |
---|
1539 | char * adl_kstr = NULL; /* KERMIT Download String */ |
---|
1540 | char * adl_zstr = NULL; /* ZMODEM Download String */ |
---|
1541 | #endif /* OS2 */ |
---|
1542 | |
---|
1543 | int remfile = 0, rempipe = 0, remappd = 0; /* REMOTE output redirection */ |
---|
1544 | char * remdest = NULL; |
---|
1545 | |
---|
1546 | #ifndef NOSERVER |
---|
1547 | /* |
---|
1548 | Server services: |
---|
1549 | 0 = disabled |
---|
1550 | 1 = enabled in local mode |
---|
1551 | 2 = enabled in remote mode |
---|
1552 | 3 = enabled in both local and remote modes |
---|
1553 | only as initial (default) values. |
---|
1554 | */ |
---|
1555 | int en_xit = 2; /* EXIT */ |
---|
1556 | int en_cwd = 3; /* CD/CWD */ |
---|
1557 | int en_cpy = 3; /* COPY */ |
---|
1558 | int en_del = 2; /* DELETE */ |
---|
1559 | int en_mkd = 3; /* MKDIR */ |
---|
1560 | int en_rmd = 2; /* RMDIR */ |
---|
1561 | int en_dir = 3; /* DIRECTORY */ |
---|
1562 | int en_fin = 3; /* FINISH */ |
---|
1563 | int en_get = 3; /* GET */ |
---|
1564 | #ifndef NOPUSH |
---|
1565 | int en_hos = 2; /* HOST enabled */ |
---|
1566 | #else |
---|
1567 | int en_hos = 0; /* HOST disabled */ |
---|
1568 | #endif /* NOPUSH */ |
---|
1569 | int en_ren = 3; /* RENAME */ |
---|
1570 | int en_sen = 3; /* SEND */ |
---|
1571 | int en_set = 3; /* SET */ |
---|
1572 | int en_spa = 3; /* SPACE */ |
---|
1573 | int en_typ = 3; /* TYPE */ |
---|
1574 | int en_who = 3; /* WHO */ |
---|
1575 | #ifdef datageneral |
---|
1576 | /* Data General AOS/VS can't do this */ |
---|
1577 | int en_bye = 0; /* BYE */ |
---|
1578 | #else |
---|
1579 | int en_bye = 2; /* PCs in local mode... */ |
---|
1580 | #endif /* datageneral */ |
---|
1581 | int en_asg = 3; /* ASSIGN */ |
---|
1582 | int en_que = 3; /* QUERY */ |
---|
1583 | int en_ret = 2; /* RETRIEVE */ |
---|
1584 | int en_mai = 3; /* MAIL */ |
---|
1585 | int en_pri = 3; /* PRINT */ |
---|
1586 | int en_ena = 3; /* ENABLE */ |
---|
1587 | #else |
---|
1588 | int en_xit = 0, en_cwd = 0, en_cpy = 0, en_del = 0, en_mkd = 0, en_rmd = 0, |
---|
1589 | en_dir = 0, en_fin = 0, en_get = 0, en_hos = 0, en_ren = 0, en_sen = 0, |
---|
1590 | en_set = 0, en_spa = 0, en_typ = 0, en_who = 0, en_bye = 0, en_asg = 0, |
---|
1591 | en_que = 0, en_ret = 0, en_mai = 0, en_pri = 0, en_ena = 0; |
---|
1592 | #endif /* NOSERVER */ |
---|
1593 | #endif /* NOXFER */ |
---|
1594 | |
---|
1595 | /* Miscellaneous */ |
---|
1596 | |
---|
1597 | char **xargv; /* Global copies of argv */ |
---|
1598 | int xargc; /* and argc */ |
---|
1599 | int xargs; /* an immutable copy of argc */ |
---|
1600 | char *xarg0; /* and of argv[0] */ |
---|
1601 | char *pipedata; /* Pointer to -P (pipe) data */ |
---|
1602 | |
---|
1603 | extern char *dftty; /* Default tty name from ck?tio.c */ |
---|
1604 | extern int dfloc; /* Default location: remote/local */ |
---|
1605 | extern int dfprty; /* Default parity */ |
---|
1606 | extern int dfflow; /* Default flow control */ |
---|
1607 | |
---|
1608 | #ifdef TNCODE |
---|
1609 | extern int tn_deb; |
---|
1610 | #endif /* TNCODE */ |
---|
1611 | /* |
---|
1612 | Buffered file input and output buffers. See getpkt() in ckcfns.c |
---|
1613 | and zoutdump() in the system-dependent file i/o module (usually ck?fio.c). |
---|
1614 | */ |
---|
1615 | #ifndef DYNAMIC |
---|
1616 | /* Now we allocate them dynamically, see getiobs() below. */ |
---|
1617 | char zinbuffer[INBUFSIZE], zoutbuffer[OBUFSIZE]; |
---|
1618 | #endif /* DYNAMIC */ |
---|
1619 | char *zinptr, *zoutptr; |
---|
1620 | int zincnt, zoutcnt; |
---|
1621 | int zobufsize = OBUFSIZE; |
---|
1622 | int zofbuffer = 1; |
---|
1623 | int zofblock = 1; |
---|
1624 | |
---|
1625 | #ifdef SESLIMIT |
---|
1626 | int seslimit = 0; |
---|
1627 | #endif /* SESLIMIT */ |
---|
1628 | |
---|
1629 | #ifdef CK_AUTHENTICATION |
---|
1630 | #include "ckuath.h" |
---|
1631 | #endif /* CK_AUTHENTICATION */ |
---|
1632 | |
---|
1633 | _PROTOTYP( int getiobs, (VOID) ); |
---|
1634 | |
---|
1635 | /* M A I N -- C-Kermit main program */ |
---|
1636 | |
---|
1637 | #include <signal.h> |
---|
1638 | |
---|
1639 | #ifndef NOCCTRAP |
---|
1640 | #include <setjmp.h> |
---|
1641 | #include "ckcsig.h" |
---|
1642 | ckjmpbuf cmjbuf; |
---|
1643 | #ifdef GEMDOS /* Special for Atari ST */ |
---|
1644 | cc_clean(); /* This can't be right? */ |
---|
1645 | #endif /* GEMDOS */ |
---|
1646 | #endif /* NOCCTRAP */ |
---|
1647 | |
---|
1648 | #ifndef NOXFER |
---|
1649 | /* Info associated with a system ID */ |
---|
1650 | |
---|
1651 | struct sysdata sysidlist[] = { /* Add others as needed... */ |
---|
1652 | { "0", "anonymous", 0, NUL, 0, 0, 0 }, |
---|
1653 | { "A1", "Apple II", 0, NUL, 0, 0, 3 }, /* fix this */ |
---|
1654 | { "A3", "Macintosh", 1, ':', 0, 2, 1 }, |
---|
1655 | { "D7", "VMS", 0, ']', 1, 0, 0 }, |
---|
1656 | { "DA", "RSTS/E", 0, ']', 1, 0, 3 }, /* (i think...) */ |
---|
1657 | { "DB", "RT11", 0, NUL, 1, 0, 3 }, /* (maybe...) */ |
---|
1658 | { "F3", "AOS/VS", 1, ':', 0, 0, 2 }, |
---|
1659 | { "I1", "VM/CMS", 0, NUL, 0, 0, 0 }, |
---|
1660 | { "I2", "MVS/TSO", 0, NUL, 0, 0, 0 }, |
---|
1661 | { "I4", "MUSIC", 0, NUL, 0, 0, 0 }, |
---|
1662 | { "I7", "CICS", 0, NUL, 0, 0, 0 }, |
---|
1663 | { "I9", "MVS/ROSCOE", 0, NUL, 0, 0, 0 }, |
---|
1664 | { "K2", "Atari ST", 1, '\\', 1, 0, 3 }, |
---|
1665 | { "L3", "Amiga", 1, '/', 1, 0, 2 }, |
---|
1666 | { "MV", "Stratus VOS", 1, '>', 0, 1, 0 }, |
---|
1667 | { "N3", "Apollo Aegis", 1, '/', 0, 3, 2 }, |
---|
1668 | { "U1", "UNIX", 1, '/', 0, 3, 2 }, |
---|
1669 | { "U8", "MS-DOS", 1, '\\', 1, 0, 3 }, |
---|
1670 | { "UD", "OS-9", 1, '/', 0, 3, 2 }, |
---|
1671 | { "UN", "Windows-32", 1, '\\', 1, 2, 3 }, |
---|
1672 | { "UO", "OS/2", 1, '\\', 1, 2, 3 } |
---|
1673 | }; |
---|
1674 | static int nxxsysids = (sizeof(sysidlist) / sizeof(struct sysdata)); |
---|
1675 | |
---|
1676 | /* Given a Kermit system ID code, return the associated name string */ |
---|
1677 | /* and some properties of the filenames... */ |
---|
1678 | |
---|
1679 | char * |
---|
1680 | getsysid(s) char * s; { /* Get system-type name */ |
---|
1681 | int i; |
---|
1682 | if (!s) return(""); |
---|
1683 | for (i = 0; i < nxxsysids; i++) |
---|
1684 | if (!strcmp(sysidlist[i].sid_code,s)) |
---|
1685 | return(sysidlist[i].sid_name); |
---|
1686 | return(s); |
---|
1687 | } |
---|
1688 | |
---|
1689 | int |
---|
1690 | getsysix(s) char *s; { /* Get system-type index */ |
---|
1691 | int i; |
---|
1692 | if (!s) return(-1); |
---|
1693 | for (i = 0; i < nxxsysids; i++) |
---|
1694 | if (!strcmp(sysidlist[i].sid_code,s)) |
---|
1695 | return(i); |
---|
1696 | return(-1); |
---|
1697 | } |
---|
1698 | #endif /* NOXFER */ |
---|
1699 | |
---|
1700 | /* Tell if a pathname is absolute (versus relative) */ |
---|
1701 | /* This should be parceled out to each of the ck*fio.c modules... */ |
---|
1702 | int |
---|
1703 | isabsolute(path) char * path; { |
---|
1704 | int rc = 0; |
---|
1705 | int x; |
---|
1706 | if (!path) |
---|
1707 | return(0); |
---|
1708 | if (!*path) |
---|
1709 | return(0); |
---|
1710 | x = (int) strlen(path); |
---|
1711 | debug(F111,"isabsolute",path,x); |
---|
1712 | #ifdef VMS |
---|
1713 | rc = 0; |
---|
1714 | x = ckindex("[",path,0,0,0); /* 1-based */ |
---|
1715 | if (!x) |
---|
1716 | x = ckindex("<",path,0,0,0); |
---|
1717 | debug(F111,"isabsolute left bracket",path,x); |
---|
1718 | if (!x) { |
---|
1719 | x = ckindex(":",path,-1,1,1); |
---|
1720 | if (x) |
---|
1721 | debug(F111,"isabsolute logical",path,x); |
---|
1722 | } |
---|
1723 | if (x > 0) |
---|
1724 | if (path[x] != '.') /* 0-based */ |
---|
1725 | rc = 1; |
---|
1726 | #else |
---|
1727 | #ifdef UNIX |
---|
1728 | if (*path == '/' |
---|
1729 | #ifdef DTILDE |
---|
1730 | || *path == '~' |
---|
1731 | #endif /* DTILDE */ |
---|
1732 | ) |
---|
1733 | rc = 1; |
---|
1734 | #else |
---|
1735 | #ifdef OS2 |
---|
1736 | if (*path == '/' || *path == '\\') |
---|
1737 | rc = 1; |
---|
1738 | else if (isalpha(*path) && x > 2) |
---|
1739 | if (*(path+1) == ':' && (*(path +2) == '/' || *(path+2) == '\\')) |
---|
1740 | rc = 1; |
---|
1741 | #else |
---|
1742 | #ifdef AMIGA |
---|
1743 | if (*path == '/' |
---|
1744 | #ifdef DTILDE |
---|
1745 | || *path == '~' |
---|
1746 | #endif /* DTILDE */ |
---|
1747 | ) |
---|
1748 | rc = 1; |
---|
1749 | #else |
---|
1750 | #ifdef OSK |
---|
1751 | if (*path == '/' |
---|
1752 | #ifdef DTILDE |
---|
1753 | || *path == '~' |
---|
1754 | #endif /* DTILDE */ |
---|
1755 | ) |
---|
1756 | rc = 1; |
---|
1757 | #else |
---|
1758 | #ifdef datageneral |
---|
1759 | if (*path == ':') |
---|
1760 | rc = 1; |
---|
1761 | #else |
---|
1762 | #ifdef MAC |
---|
1763 | rc = 0; /* Fill in later... */ |
---|
1764 | #else |
---|
1765 | #ifdef STRATUS |
---|
1766 | rc = 0; /* Fill in later... */ |
---|
1767 | #else |
---|
1768 | #ifdef GEMDOS |
---|
1769 | if (*path == '/' || *path == '\\') |
---|
1770 | rc = 1; |
---|
1771 | else if (isalpha(*path) && x > 1) |
---|
1772 | if (*(path+1) == ':') |
---|
1773 | rc = 1; |
---|
1774 | #endif /* GEMDOS */ |
---|
1775 | #endif /* STRATUS */ |
---|
1776 | #endif /* MAC */ |
---|
1777 | #endif /* datageneral */ |
---|
1778 | #endif /* OSK */ |
---|
1779 | #endif /* AMIGA */ |
---|
1780 | #endif /* OS2 */ |
---|
1781 | #endif /* UNIX */ |
---|
1782 | #endif /* VMS */ |
---|
1783 | debug(F101,"isabsolute rc","",rc); |
---|
1784 | return(rc); |
---|
1785 | } |
---|
1786 | |
---|
1787 | /* See if I have direct access to the keyboard */ |
---|
1788 | |
---|
1789 | int |
---|
1790 | is_a_tty(n) int n; { |
---|
1791 | #ifdef UNIX |
---|
1792 | extern int ttfdflg; |
---|
1793 | if (ttfdflg > 0) |
---|
1794 | return(1); |
---|
1795 | #endif /* UNIX */ |
---|
1796 | #ifdef KUI |
---|
1797 | return 1; |
---|
1798 | #else /* KUI */ |
---|
1799 | #ifdef NT |
---|
1800 | if (isWin95()) |
---|
1801 | return(1); |
---|
1802 | else |
---|
1803 | return(_isatty(n)); |
---|
1804 | #else |
---|
1805 | #ifdef IKSD |
---|
1806 | if (inserver) |
---|
1807 | return(1); |
---|
1808 | else |
---|
1809 | #endif /* IKSD */ |
---|
1810 | return(isatty(n)); |
---|
1811 | #endif /* NT */ |
---|
1812 | #endif /* KUI */ |
---|
1813 | } |
---|
1814 | |
---|
1815 | #ifndef NOXFER |
---|
1816 | VOID |
---|
1817 | initxlist() { |
---|
1818 | extern char * sndexcept[], * rcvexcept[]; |
---|
1819 | int i; |
---|
1820 | for (i = 0; i < NSNDEXCEPT; i++) { |
---|
1821 | sndexcept[i] = NULL; |
---|
1822 | rcvexcept[i] = NULL; |
---|
1823 | } |
---|
1824 | } |
---|
1825 | #endif /* NOXFER */ |
---|
1826 | |
---|
1827 | /* Initialize flow control table */ |
---|
1828 | |
---|
1829 | VOID |
---|
1830 | initflow() { /* Default values for flow control */ |
---|
1831 | #ifdef VMS /* for each kind of connection. */ |
---|
1832 | /* The VMS telnet terminal driver treats "none" as request to lose chars */ |
---|
1833 | cxflow[CXT_REMOTE] = FLO_XONX; /* Remote mode... */ |
---|
1834 | #else |
---|
1835 | #ifdef HPUX |
---|
1836 | /* Ditto for HP-UX */ |
---|
1837 | cxflow[CXT_REMOTE] = FLO_XONX; /* Remote mode... */ |
---|
1838 | #else |
---|
1839 | /* The temptation is to make this one FLO_KEEP but don't!!! */ |
---|
1840 | /* It totally wrecks binary-file transfer when coming in via Telnet. */ |
---|
1841 | /* In UNIX at least... */ |
---|
1842 | cxflow[CXT_REMOTE] = FLO_NONE; |
---|
1843 | #endif /* HPUX */ |
---|
1844 | #endif /* VMS */ |
---|
1845 | |
---|
1846 | #ifdef VMS |
---|
1847 | cxflow[CXT_DIRECT] = FLO_XONX; /* Direct serial connections... */ |
---|
1848 | #else |
---|
1849 | cxflow[CXT_DIRECT] = FLO_NONE; |
---|
1850 | #endif /* VMS */ |
---|
1851 | |
---|
1852 | #ifdef CK_RTSCTS |
---|
1853 | cxflow[CXT_MODEM] = FLO_RTSC; /* Modem connections... */ |
---|
1854 | #else |
---|
1855 | #ifdef VMS |
---|
1856 | cxflow[CXT_MODEM] = FLO_XONX; |
---|
1857 | #else |
---|
1858 | cxflow[CXT_MODEM] = FLO_NONE; |
---|
1859 | #endif /* VMS */ |
---|
1860 | #endif /* CK_RTSCTS */ |
---|
1861 | |
---|
1862 | #ifdef VMS |
---|
1863 | cxflow[CXT_TCPIP] = FLO_XONX; /* TCP/IP connections... */ |
---|
1864 | #else |
---|
1865 | cxflow[CXT_TCPIP] = FLO_NONE; |
---|
1866 | #endif /* VMS */ |
---|
1867 | |
---|
1868 | cxflow[CXT_SSH] = FLO_NONE; |
---|
1869 | cxflow[CXT_X25] = FLO_NONE; /* Other kinds of networks... */ |
---|
1870 | cxflow[CXT_DECNET] = FLO_XONX; |
---|
1871 | cxflow[CXT_LAT] = FLO_XONX; |
---|
1872 | cxflow[CXT_NETBIOS] = FLO_NONE; |
---|
1873 | cxflow[CXT_NPIPE] = FLO_NONE; |
---|
1874 | cxflow[CXT_PIPE] = FLO_NONE; |
---|
1875 | flow = cxflow[cxtype]; /* Initial flow setting. */ |
---|
1876 | debug(F101,"initflow","",flow); |
---|
1877 | } |
---|
1878 | |
---|
1879 | #ifndef NOXFER |
---|
1880 | /* Initialize file transfer protocols */ |
---|
1881 | |
---|
1882 | VOID |
---|
1883 | initproto(y, upbstr, uptstr, srvstr, sndbstr, sndtstr, rcvbstr, rcvtstr) |
---|
1884 | int y; |
---|
1885 | char * upbstr, * uptstr, * srvstr, * sndbstr, * sndtstr, * rcvbstr, |
---|
1886 | * rcvtstr; |
---|
1887 | /* initproto */ { |
---|
1888 | |
---|
1889 | if (upbstr) /* Convert null strings */ |
---|
1890 | if (!*upbstr) /* to null pointers */ |
---|
1891 | upbstr = NULL; |
---|
1892 | |
---|
1893 | if (uptstr) /* Convert null strings */ |
---|
1894 | if (!*uptstr) /* to null pointers */ |
---|
1895 | uptstr = NULL; |
---|
1896 | |
---|
1897 | if (sndbstr) |
---|
1898 | if (!*sndbstr) |
---|
1899 | sndbstr = NULL; |
---|
1900 | |
---|
1901 | if (sndtstr) |
---|
1902 | if (!*sndtstr) |
---|
1903 | sndtstr = NULL; |
---|
1904 | |
---|
1905 | if (rcvbstr) |
---|
1906 | if (!*rcvbstr) |
---|
1907 | rcvbstr = NULL; |
---|
1908 | |
---|
1909 | if (rcvtstr) |
---|
1910 | if (!*rcvtstr) |
---|
1911 | rcvtstr = NULL; |
---|
1912 | |
---|
1913 | if (srvstr) |
---|
1914 | if (!*srvstr) |
---|
1915 | srvstr = NULL; |
---|
1916 | |
---|
1917 | protocol = y; /* Set protocol */ |
---|
1918 | |
---|
1919 | if (ptab[protocol].rpktlen > -1) |
---|
1920 | urpsiz = ptab[protocol].rpktlen; |
---|
1921 | if (ptab[protocol].spktflg > -1) |
---|
1922 | spsizf = ptab[protocol].spktflg; |
---|
1923 | if (ptab[protocol].spktlen > -1) { |
---|
1924 | spsiz = ptab[protocol].spktlen; |
---|
1925 | debug(F101,"initproto spsiz","",spsiz); |
---|
1926 | if (spsizf) { |
---|
1927 | spsizr = spmax = spsiz; |
---|
1928 | debug(F101,"initproto spsizr","",spsizr); |
---|
1929 | } |
---|
1930 | } |
---|
1931 | if (ptab[protocol].winsize > -1) |
---|
1932 | wslotr = ptab[protocol].winsize; |
---|
1933 | if (ptab[protocol].prefix > -1) |
---|
1934 | prefixing = ptab[protocol].prefix; |
---|
1935 | if (ptab[protocol].fnca > -1) |
---|
1936 | fncact = ptab[protocol].fnca; |
---|
1937 | if (ptab[protocol].fncn > -1) |
---|
1938 | fncnv = ptab[protocol].fncn; |
---|
1939 | if (ptab[protocol].fnsp > -1) |
---|
1940 | fnspath = ptab[protocol].fnsp; |
---|
1941 | if (ptab[protocol].fnrp > -1) |
---|
1942 | fnrpath = ptab[protocol].fnrp; |
---|
1943 | |
---|
1944 | makestr(&(ptab[protocol].h_b_init),upbstr); |
---|
1945 | makestr(&(ptab[protocol].h_t_init),uptstr); |
---|
1946 | makestr(&(ptab[protocol].h_x_init),srvstr); |
---|
1947 | makestr(&(ptab[protocol].p_b_scmd),sndbstr); |
---|
1948 | makestr(&(ptab[protocol].p_t_scmd),sndtstr); |
---|
1949 | makestr(&(ptab[protocol].p_b_rcmd),rcvbstr); |
---|
1950 | makestr(&(ptab[protocol].p_t_rcmd),rcvtstr); |
---|
1951 | } |
---|
1952 | #endif /* NOXFER */ |
---|
1953 | |
---|
1954 | #ifndef NOCMDL |
---|
1955 | VOID |
---|
1956 | #ifdef CK_ANSIC |
---|
1957 | docmdline(void * threadinfo) |
---|
1958 | #else /* CK_ANSIC */ |
---|
1959 | docmdline(threadinfo) VOID * threadinfo; |
---|
1960 | #endif /* CK_ANSIC */ |
---|
1961 | { |
---|
1962 | #ifdef NTSIG |
---|
1963 | setint(); |
---|
1964 | if (threadinfo) { /* Thread local storage... */ |
---|
1965 | TlsSetValue(TlsIndex,threadinfo); |
---|
1966 | debug( F100, "docmdline called with threadinfo block", "", 0 ); |
---|
1967 | } else |
---|
1968 | debug( F100, "docmdline threadinfo is NULL","",0); |
---|
1969 | #endif /* NTSIG */ |
---|
1970 | #ifdef CK_LOGIN |
---|
1971 | #ifdef NT |
---|
1972 | #ifdef IKSD |
---|
1973 | if (inserver) |
---|
1974 | setntcreds(); |
---|
1975 | #endif /* IKSD */ |
---|
1976 | #endif /* NT */ |
---|
1977 | #endif /* CK_LOGIN */ |
---|
1978 | proto(); /* Take any requested action, then */ |
---|
1979 | if (!quiet) /* put cursor back at left margin, */ |
---|
1980 | conoll(""); |
---|
1981 | #ifndef NOLOCAL |
---|
1982 | if (cnflg) { /* Re-connect if requested */ |
---|
1983 | cnflg = 0; |
---|
1984 | doconect(0,0); |
---|
1985 | if (ttchk() < 0) |
---|
1986 | dologend(); |
---|
1987 | } |
---|
1988 | #endif /* NOLOCAL */ |
---|
1989 | |
---|
1990 | #ifdef NTSIG |
---|
1991 | ckThreadEnd(threadinfo); |
---|
1992 | #endif /* NTSIG */ |
---|
1993 | return; |
---|
1994 | } |
---|
1995 | |
---|
1996 | void |
---|
1997 | ikslogin() { |
---|
1998 | if (sstelnet |
---|
1999 | #ifdef IKSD |
---|
2000 | || inserver /* Internet server */ |
---|
2001 | #endif /* IKSD */ |
---|
2002 | ) { |
---|
2003 | char *s; |
---|
2004 | extern int fdispla; /* File-transfer display format */ |
---|
2005 | extern char * ikprompt; /* IKSD prompt */ |
---|
2006 | |
---|
2007 | #ifdef IKSD |
---|
2008 | #ifdef CK_LOGIN |
---|
2009 | if (inserver) { |
---|
2010 | x_login = 1; /* Login required */ |
---|
2011 | x_logged = 0; /* Not logged in yet */ |
---|
2012 | cmsetp(ikprompt); /* Set up IKSD's prompt */ |
---|
2013 | #ifndef NOSERVER |
---|
2014 | en_mai = 0; /* MAIL is disabled */ |
---|
2015 | en_who = 0; /* REMOTE WHO is disabled */ |
---|
2016 | en_hos = 0; /* REMOTE HOST is disabled */ |
---|
2017 | en_pri = 0; /* PRINT is disabled */ |
---|
2018 | #endif /* NOSERVER */ |
---|
2019 | } else { |
---|
2020 | x_login = 0; /* Login not required */ |
---|
2021 | x_logged = 1; /* Already logged in */ |
---|
2022 | } |
---|
2023 | #endif /* CK_LOGIN */ |
---|
2024 | #endif /* IKSD */ |
---|
2025 | nolocal = 1; /* SET LINE/HOST not allowed */ |
---|
2026 | fdispla = XYFD_N; /* No file-transfer display */ |
---|
2027 | #ifdef NETCONN |
---|
2028 | clienthost = ckgetpeer(); /* Get client's hostname */ |
---|
2029 | debug(F110,"ikslogin clienthost",clienthost,0); |
---|
2030 | #endif /* NETCONN */ |
---|
2031 | ztime(&s); /* Get current date and time */ |
---|
2032 | |
---|
2033 | #ifdef CK_LOGIN |
---|
2034 | #ifdef CK_AUTHENTICATION |
---|
2035 | if (x_login) { |
---|
2036 | x_logged = ck_tn_auth_valid(); /* Did Telnet Auth succeed? */ |
---|
2037 | debug(F111,"ikslogin","x_logged",x_logged); |
---|
2038 | |
---|
2039 | #ifdef NT |
---|
2040 | /* On Windows 9x, we do not have the ability in */ |
---|
2041 | /* zvuser() at present to determine if the name */ |
---|
2042 | /* approved in a Kerberos principal is really a */ |
---|
2043 | /* an account in the Windows Access Control List */ |
---|
2044 | if (isWin95() && x_logged == AUTH_VALID |
---|
2045 | && (ck_tn_authenticated() != AUTHTYPE_NTLM) |
---|
2046 | #ifdef CK_SRP |
---|
2047 | && (ck_tn_authenticated() != AUTHTYPE_SRP) |
---|
2048 | #endif /* CK_SRP */ |
---|
2049 | ) { |
---|
2050 | auth_finished(AUTH_USER); |
---|
2051 | x_logged = AUTH_USER; |
---|
2052 | printf("WARNING:\r\n"); |
---|
2053 | printf( |
---|
2054 | " The Telnet authentication method used cannot provide for automated\r\n"); |
---|
2055 | printf( |
---|
2056 | " login to Windows 95 or Windows 98. A password must be entered\r\n"); |
---|
2057 | printf( |
---|
2058 | " locally to validate your userid. Telnet authentication (and encryption)\r\n" |
---|
2059 | ); |
---|
2060 | printf( |
---|
2061 | " can be used to validate the host (and protect the privacy of your password.)\ |
---|
2062 | \r\n" |
---|
2063 | ); |
---|
2064 | } |
---|
2065 | #endif /* NT */ |
---|
2066 | |
---|
2067 | if (x_logged == AUTH_VALID) { |
---|
2068 | #ifdef CK_SSL |
---|
2069 | if ((ssl_active_flag || tls_active_flag) && |
---|
2070 | (!TELOPT_U(TELOPT_AUTHENTICATION) || |
---|
2071 | ck_tn_authenticated() == AUTHTYPE_NULL || |
---|
2072 | ck_tn_authenticated() == AUTHTYPE_AUTO) |
---|
2073 | ) { |
---|
2074 | #ifdef SSL_KRB5 |
---|
2075 | if (tls_is_krb5(0)) { |
---|
2076 | printf("Authenticated using Kerberos 5\r\n"); |
---|
2077 | #ifdef CKSYSLOG |
---|
2078 | if (ckxsyslog >= SYSLG_LI && ckxlogging) { |
---|
2079 | extern char szUserNameAuthenticated[]; |
---|
2080 | cksyslog(SYSLG_LI, 1, "AUTH_VALID", |
---|
2081 | "Kerberos 5", |
---|
2082 | szUserNameAuthenticated |
---|
2083 | ); |
---|
2084 | } |
---|
2085 | #endif /* CKSYSLOG */ |
---|
2086 | } else |
---|
2087 | #endif /* SSL_KRB5 */ |
---|
2088 | { |
---|
2089 | printf("Authenticated using X.509 certificate\r\n"); |
---|
2090 | #ifdef CKSYSLOG |
---|
2091 | if (ckxsyslog >= SYSLG_LI && ckxlogging) { |
---|
2092 | extern char szUserNameAuthenticated[]; |
---|
2093 | cksyslog(SYSLG_LI, 1, "AUTH_VALID", |
---|
2094 | "X.509 certificate", |
---|
2095 | szUserNameAuthenticated |
---|
2096 | ); |
---|
2097 | } |
---|
2098 | #endif /* CKSYSLOG */ |
---|
2099 | } |
---|
2100 | } else |
---|
2101 | #endif /* CK_SSL */ |
---|
2102 | { |
---|
2103 | printf("Authenticated using %s\r\n", |
---|
2104 | AUTHTYPE_NAME(ck_tn_authenticated())); |
---|
2105 | #ifdef CKSYSLOG |
---|
2106 | if (ckxsyslog >= SYSLG_LI && ckxlogging) { |
---|
2107 | extern char szUserNameAuthenticated[]; |
---|
2108 | cksyslog(SYSLG_LI, 1, "AUTH_VALID", |
---|
2109 | AUTHTYPE_NAME(ck_tn_authenticated()), |
---|
2110 | szUserNameAuthenticated |
---|
2111 | ); |
---|
2112 | } |
---|
2113 | #endif /* CKSYSLOG */ |
---|
2114 | } |
---|
2115 | zvuser(uidbuf); |
---|
2116 | if (zvpass("") == 0) |
---|
2117 | x_logged = 0; |
---|
2118 | } else if (x_logged == AUTH_USER && !strcmp(uidbuf,"anonymous")) { |
---|
2119 | extern char szUserNameAuthenticated[]; |
---|
2120 | zvuser(uidbuf); |
---|
2121 | debug(F110,"szUserNameAuthenticated", |
---|
2122 | szUserNameAuthenticated,0); |
---|
2123 | if (zvpass(szUserNameAuthenticated) == 0) { |
---|
2124 | /* Anonymous login failed. Force a username prompt. */ |
---|
2125 | x_logged = 0; |
---|
2126 | uidbuf[0] = '\0'; |
---|
2127 | } else { |
---|
2128 | #ifdef CK_SSL |
---|
2129 | if ((ssl_active_flag || tls_active_flag) && |
---|
2130 | (!TELOPT_U(TELOPT_AUTHENTICATION) || |
---|
2131 | ck_tn_authenticated() == AUTHTYPE_NULL || |
---|
2132 | ck_tn_authenticated() == AUTHTYPE_AUTO)) { |
---|
2133 | printf("Authenticated using X.509 certificate\r\n"); |
---|
2134 | #ifdef CKSYSLOG |
---|
2135 | if (ckxsyslog >= SYSLG_LI && ckxlogging) { |
---|
2136 | extern char szUserNameAuthenticated[]; |
---|
2137 | cksyslog(SYSLG_LI, 1, "AUTH_USER", |
---|
2138 | "X.509 certificate", |
---|
2139 | szUserNameAuthenticated |
---|
2140 | ); |
---|
2141 | } |
---|
2142 | #endif /* CKSYSLOG */ |
---|
2143 | } else |
---|
2144 | #endif /* CK_SSL */ |
---|
2145 | { |
---|
2146 | printf("Authenticated using %s\r\n", |
---|
2147 | AUTHTYPE_NAME(ck_tn_authenticated()) |
---|
2148 | ); |
---|
2149 | #ifdef CKSYSLOG |
---|
2150 | if (ckxsyslog >= SYSLG_LI && ckxlogging) { |
---|
2151 | cksyslog(SYSLG_LI, 1, "AUTH_USER", |
---|
2152 | AUTHTYPE_NAME(ck_tn_authenticated()), |
---|
2153 | szUserNameAuthenticated |
---|
2154 | ); |
---|
2155 | } |
---|
2156 | #endif /* CKSYSLOG */ |
---|
2157 | } |
---|
2158 | } |
---|
2159 | } else { |
---|
2160 | #ifdef CKSYSLOG |
---|
2161 | if (ckxsyslog >= SYSLG_LI && ckxlogging && |
---|
2162 | x_logged == AUTH_USER) { |
---|
2163 | extern char szUserNameAuthenticated[]; |
---|
2164 | cksyslog(SYSLG_LI, 1, "AUTH_USER", |
---|
2165 | AUTHTYPE_NAME(ck_tn_authenticated()), |
---|
2166 | szUserNameAuthenticated |
---|
2167 | ); |
---|
2168 | } |
---|
2169 | #endif /* CKSYSLOG */ |
---|
2170 | x_logged = 0; |
---|
2171 | if (!strcmp("(unknown)",uidbuf) |
---|
2172 | #ifdef NT |
---|
2173 | || !stricmp("administrator",uidbuf) |
---|
2174 | #ifdef UNIX |
---|
2175 | || !strcmp("root",uidbuf) |
---|
2176 | #else |
---|
2177 | #ifdef Plan9 |
---|
2178 | || !strcmp("root",uidbuf) |
---|
2179 | #else |
---|
2180 | #ifdef OSK |
---|
2181 | || !strcmp("root",uidbuf) |
---|
2182 | #endif /* OSK */ |
---|
2183 | #endif /* Plan9 */ |
---|
2184 | #endif /* UNIX */ |
---|
2185 | #endif /* NT */ |
---|
2186 | ) |
---|
2187 | uidbuf[0] = '\0'; |
---|
2188 | } |
---|
2189 | } |
---|
2190 | #endif /* CK_AUTHENTICATION */ |
---|
2191 | #endif /* CK_LOGIN */ |
---|
2192 | |
---|
2193 | #ifdef IKSD |
---|
2194 | if (inserver) |
---|
2195 | printf("\r\nInternet Kermit Service ready at %s%s\r\n",s,versio); |
---|
2196 | else |
---|
2197 | #endif /* IKSD */ |
---|
2198 | printf("\r\nC-Kermit ready at %s%s\r\n",s,versio); |
---|
2199 | if (*myhost) |
---|
2200 | printf("%s\r\n", myhost); |
---|
2201 | printf("\r\n"); |
---|
2202 | } |
---|
2203 | #ifdef CK_LOGIN |
---|
2204 | #ifdef IKSD |
---|
2205 | if (inserver) { |
---|
2206 | int i; |
---|
2207 | extern int arg_x; /* Flag for '-x' on command line */ |
---|
2208 | #ifndef NOSPL |
---|
2209 | extern struct mtab *mactab; /* For ON_LOGIN macro. */ |
---|
2210 | extern int nmac; |
---|
2211 | #endif /* NOSPL */ |
---|
2212 | |
---|
2213 | debug(F110,"MAIN clienthost",clienthost,0); |
---|
2214 | srvidl = timelimit = logintimo; /* For interactive login */ |
---|
2215 | rtimer(); /* Reset timer */ |
---|
2216 | for (i = 0; i < iks_retry && !x_logged; i++) { /* Count retries */ |
---|
2217 | if (gtimer() > logintimo) |
---|
2218 | break; |
---|
2219 | #ifdef TNCODE |
---|
2220 | tn_wait("login loop"); |
---|
2221 | tn_push(); |
---|
2222 | #endif /* TNCODE */ |
---|
2223 | debug(F101,"MAIN LOGIN try","",i); |
---|
2224 | what = W_NOTHING; /* Because proto() changes this */ |
---|
2225 | |
---|
2226 | #ifdef IKS_OPTION |
---|
2227 | debug(F111,"MAIN LOGIN", |
---|
2228 | "TELOPT_SB(TELOPT_KERMIT).kermit.me_start", |
---|
2229 | TELOPT_SB(TELOPT_KERMIT).kermit.me_start |
---|
2230 | ); |
---|
2231 | /* Kermit server negotiated */ |
---|
2232 | if (TELOPT_SB(TELOPT_KERMIT).kermit.me_start) { |
---|
2233 | debug(F101,"IKSD starting in server mode","",0); |
---|
2234 | arg_x = 1; /* Enter server mode */ |
---|
2235 | sstate = 'x'; |
---|
2236 | #ifdef IKSDPOPBACK |
---|
2237 | justone = 1; /* Execute one command at a time. */ |
---|
2238 | #endif /* IKSDPOPBACK */ |
---|
2239 | proto(); /* Enter protocol if requested. */ |
---|
2240 | #ifdef NTSIG |
---|
2241 | ck_ih(); |
---|
2242 | #endif /* NTSIG */ |
---|
2243 | if (x_logged) /* Logged in */ |
---|
2244 | break; |
---|
2245 | } else { /* Not in client/server mode */ |
---|
2246 | #endif /* IKS_OPTION */ |
---|
2247 | debug(F101,"IKSD starting with Username prompt","",0); |
---|
2248 | x_logged = ckxlogin((CHAR *)uidbuf,NULL,NULL,1); |
---|
2249 | if (sstate) { /* Received a packet at prompt */ |
---|
2250 | #ifdef IKSDPOPBACK |
---|
2251 | justone = 1; /* Go handle it */ |
---|
2252 | #endif /* IKSDPOPBACK */ |
---|
2253 | proto(); |
---|
2254 | } |
---|
2255 | if (!x_logged) { /* In case we are at the prompt... */ |
---|
2256 | printf("Access denied.\n"); |
---|
2257 | uidbuf[0] = '\0'; /* Forget the name if we have one */ |
---|
2258 | } |
---|
2259 | #ifdef IKS_OPTION |
---|
2260 | } |
---|
2261 | #endif /* IKS_OPTION */ |
---|
2262 | } |
---|
2263 | srvidl = timelimit = iks_timo; /* Reset command timelimit */ |
---|
2264 | debug(F101,"MAIN LOGIN","",x_logged); |
---|
2265 | if (!x_logged) { /* Logins failed. */ |
---|
2266 | if (TELOPT_SB(TELOPT_KERMIT).kermit.me_start) |
---|
2267 | errpkt((CHAR *)"Login Timeout"); |
---|
2268 | msleep(500); |
---|
2269 | doexit(BAD_EXIT,0); |
---|
2270 | } |
---|
2271 | what = W_NOTHING; /* Stay in known state */ |
---|
2272 | #ifndef NOSERVER |
---|
2273 | if (isguest) { |
---|
2274 | en_pri = 0; /* No printing for anonymous users */ |
---|
2275 | en_mai = 0; /* No email for anonymous users */ |
---|
2276 | en_mkd = 0; /* Or directory creation */ |
---|
2277 | en_rmd = 0; /* Or directory removal */ |
---|
2278 | en_ena = 0; /* Or ENABLing DISABLEd items */ |
---|
2279 | } |
---|
2280 | #endif /* NOSERVER */ |
---|
2281 | |
---|
2282 | #ifndef NOSPL |
---|
2283 | /* |
---|
2284 | If a macro named "on_login" is defined, execute it. Also remove it from the |
---|
2285 | macro table so the user cannot see what it does. Execute it as part of the |
---|
2286 | iksd.conf file. |
---|
2287 | */ |
---|
2288 | if (nmac) { /* Any macros defined? */ |
---|
2289 | int k; /* Yes */ |
---|
2290 | char * cmd = "on_login"; /* MSVC 2.x compiler error */ |
---|
2291 | k = mlook(mactab,cmd,nmac); /* Look up "on_exit" */ |
---|
2292 | if (k >= 0) { /* If found, */ |
---|
2293 | #ifdef IKSDCONF |
---|
2294 | int saved = iksdcf; |
---|
2295 | iksdcf = 0; |
---|
2296 | #endif /* IKSDCONF */ |
---|
2297 | if (dodo(k,"",0) > -1) /* set it up, */ |
---|
2298 | parser(1); /* execute it */ |
---|
2299 | #ifdef IKSDCONF |
---|
2300 | iksdcf = saved; |
---|
2301 | #endif /* IKSDCONF */ |
---|
2302 | delmac(cmd,1); /* and delete it */ |
---|
2303 | } |
---|
2304 | } |
---|
2305 | #endif /* NOSPL */ |
---|
2306 | } /* if (inserver) */ |
---|
2307 | #else /* CK_LOGIN */ |
---|
2308 | if (inserver) |
---|
2309 | srvidl = timelimit = iks_timo; /* Set idle limits for IKS */ |
---|
2310 | #endif /* CK_LOGIN */ |
---|
2311 | #endif /* IKSD */ |
---|
2312 | } |
---|
2313 | |
---|
2314 | VOID |
---|
2315 | #ifdef CK_ANSIC |
---|
2316 | failcmdline(void * foo) |
---|
2317 | #else /* CK_ANSIC */ |
---|
2318 | failcmdline(foo) VOID * foo; |
---|
2319 | #endif /* CK_ANSIC */ |
---|
2320 | { |
---|
2321 | #ifdef GEMDOS |
---|
2322 | cc_clean(); |
---|
2323 | #endif /* GEMDOS */ |
---|
2324 | #ifndef NOLOCAL |
---|
2325 | if (cnflg) doconect(0,0); /* connect again if requested. */ |
---|
2326 | if (ttchk() < 0) |
---|
2327 | dologend(); |
---|
2328 | #endif /* NOLOCAL */ |
---|
2329 | } |
---|
2330 | #endif /* NOCMDL */ |
---|
2331 | |
---|
2332 | #ifndef NOICP |
---|
2333 | VOID |
---|
2334 | #ifdef CK_ANSIC |
---|
2335 | dotakeini(void * threadinfo) /* Execute init file. */ |
---|
2336 | #else /* CK_ANSIC */ |
---|
2337 | dotakeini(threadinfo) VOID * threadinfo; /* Execute init file. */ |
---|
2338 | #endif /* CK_ANSIC */ |
---|
2339 | /* dotakeini */ { |
---|
2340 | #ifdef NTSIG |
---|
2341 | setint(); |
---|
2342 | if (threadinfo) { /* Thread local storage... */ |
---|
2343 | TlsSetValue(TlsIndex,threadinfo); |
---|
2344 | debug(F100, "dotakeini called with threadinfo block","", 0); |
---|
2345 | } else |
---|
2346 | debug(F100, "dotakeini - threadinfo is NULL", "", 0); |
---|
2347 | #endif /* NTSIG */ |
---|
2348 | #ifdef CK_LOGIN |
---|
2349 | #ifdef NT |
---|
2350 | #ifdef IKSD |
---|
2351 | if (inserver) |
---|
2352 | setntcreds(); |
---|
2353 | #endif /* IKSD */ |
---|
2354 | #endif /* NT */ |
---|
2355 | #endif /* CK_LOGIN */ |
---|
2356 | cmdini(); /* Sets tlevel */ |
---|
2357 | |
---|
2358 | debug(F111,"dotakeini","inserver",inserver); |
---|
2359 | debug(F111,"dotakeini","sstelnet",sstelnet); |
---|
2360 | |
---|
2361 | #ifdef COMMENT |
---|
2362 | /* Wrong place for this... */ |
---|
2363 | #ifndef NOXFER |
---|
2364 | #ifdef CK_FAST |
---|
2365 | dofast(); /* By now FAST defaults should be OK */ |
---|
2366 | #endif /* CK_FAST */ |
---|
2367 | #endif /* NOXFER */ |
---|
2368 | #endif /* COMMENT */ |
---|
2369 | |
---|
2370 | doinit(); /* Now do the initialization file */ |
---|
2371 | debug(F101,"main executing init file","",tlevel); |
---|
2372 | while (tlevel > -1) { |
---|
2373 | sstate = (CHAR) parser(1); /* Execute one command at a time. */ |
---|
2374 | if (sstate) proto(); /* Enter protocol if requested. */ |
---|
2375 | #ifdef NTSIG |
---|
2376 | ck_ih(); |
---|
2377 | #endif /* NTSIG */ |
---|
2378 | } |
---|
2379 | debug(F101,"main exits init file","",tlevel); |
---|
2380 | |
---|
2381 | #ifdef NTSIG |
---|
2382 | ckThreadEnd(threadinfo); |
---|
2383 | #endif /* NTSIG */ |
---|
2384 | return; |
---|
2385 | } |
---|
2386 | |
---|
2387 | VOID |
---|
2388 | #ifdef CK_ANSIC |
---|
2389 | failtakeini(void * threadinfo) |
---|
2390 | #else /* CK_ANSIC */ |
---|
2391 | failtakeini(threadinfo) VOID * threadinfo; |
---|
2392 | #endif /* CK_ANSIC */ |
---|
2393 | /* failtakeini */ { |
---|
2394 | #ifdef GEMDOS |
---|
2395 | cc_clean(); /* Atari: Clean up after ^C-trap. */ |
---|
2396 | #endif /* GEMDOS */ |
---|
2397 | if (!cfilef) { |
---|
2398 | conoll("Interrupt during initialization or command-line processing."); |
---|
2399 | conoll("C-Kermit quitting..."); |
---|
2400 | } |
---|
2401 | doexit(BAD_EXIT,-1); /* Exit with bad status. */ |
---|
2402 | } |
---|
2403 | |
---|
2404 | VOID |
---|
2405 | #ifdef CK_ANSIC |
---|
2406 | doicp(void * threadinfo) |
---|
2407 | #else /* CK_ANSIC */ |
---|
2408 | doicp(threadinfo) VOID * threadinfo; |
---|
2409 | #endif /* CK_ANSIC */ |
---|
2410 | /* doicp */ { |
---|
2411 | #ifdef NTSIG |
---|
2412 | setint(); |
---|
2413 | if (threadinfo) { /* Thread local storage... */ |
---|
2414 | if (!TlsSetValue(TlsIndex,threadinfo)) |
---|
2415 | debug(F101,"doicp TlsSetValue failed","",GetLastError()); |
---|
2416 | debug(F101, "doicp a threadinfo block - TlsIndex", "", TlsIndex); |
---|
2417 | } else { |
---|
2418 | debug(F100, "doicp received a null threadinfo", "", 0); |
---|
2419 | } |
---|
2420 | #endif /* NTSIG */ |
---|
2421 | #ifdef CK_LOGIN |
---|
2422 | #ifdef NT |
---|
2423 | #ifdef IKSD |
---|
2424 | if (inserver) |
---|
2425 | setntcreds(); |
---|
2426 | #endif /* IKSD */ |
---|
2427 | #endif /* NT */ |
---|
2428 | #endif /* CK_LOGIN */ |
---|
2429 | #ifdef MAC |
---|
2430 | while (1) { |
---|
2431 | extern char *lfiles; /* Fake pointer cast */ |
---|
2432 | |
---|
2433 | if (connected) { |
---|
2434 | debug(F100, "doicp: calling macparser", "", 0); |
---|
2435 | sstate = newparser(1, 1, 0L); |
---|
2436 | |
---|
2437 | /* ignore null command state */ |
---|
2438 | if (sstate == 'n') |
---|
2439 | sstate = '\0'; |
---|
2440 | |
---|
2441 | if (sstate) |
---|
2442 | proto(); |
---|
2443 | } else { |
---|
2444 | /* |
---|
2445 | * process take files the finder gave us. |
---|
2446 | */ |
---|
2447 | if ((tlevel == -1) && lfiles) |
---|
2448 | startlfile(); |
---|
2449 | |
---|
2450 | debug(F100, "doicp: calling parser", "", 0); |
---|
2451 | sstate = (CHAR) parser(0); |
---|
2452 | if (sstate == 'c') /* if MAC connect */ |
---|
2453 | sstate = 0; |
---|
2454 | if (sstate) |
---|
2455 | proto(); |
---|
2456 | } |
---|
2457 | } |
---|
2458 | #else /* Not MAC */ |
---|
2459 | |
---|
2460 | #ifndef NOSPL |
---|
2461 | /* |
---|
2462 | If interactive commands were given on the command line (using the |
---|
2463 | -C "command, command, ..." option), assign them to a macro called |
---|
2464 | "cl_commands", then execute the macro and leave it defined for |
---|
2465 | subsequent re-execution if desired. |
---|
2466 | */ |
---|
2467 | if (clcmds) { /* Check for -C commands */ |
---|
2468 | int x; |
---|
2469 | x = addmac("cl_commands",clcmds); /* Put macro in table */ |
---|
2470 | if (x > -1) { /* If successful, */ |
---|
2471 | dodo(x,NULL,CF_CMDL); /* set up for macro execution */ |
---|
2472 | while (maclvl > -1) { /* Loop getting macro commands. */ |
---|
2473 | sstate = (CHAR) parser(1); |
---|
2474 | if (sstate) proto(); /* Enter protocol if requested. */ |
---|
2475 | #ifdef NTSIG |
---|
2476 | ck_ih(); |
---|
2477 | #endif /* NTSIG */ |
---|
2478 | } |
---|
2479 | } |
---|
2480 | debug(F100,"doicp calling herald","",0); |
---|
2481 | herald(); |
---|
2482 | } |
---|
2483 | #endif /* NOSPL */ |
---|
2484 | while(1) { /* Loop getting commands. */ |
---|
2485 | sstate = (CHAR) parser(0); |
---|
2486 | if (sstate) proto(); /* Enter protocol if requested. */ |
---|
2487 | #ifdef NTSIG |
---|
2488 | ck_ih(); |
---|
2489 | #endif /* NTSIG */ |
---|
2490 | } |
---|
2491 | #ifdef NTSIG |
---|
2492 | ckThreadEnd(threadinfo); |
---|
2493 | #endif /* NTSIG */ |
---|
2494 | #endif /* MAC */ |
---|
2495 | } |
---|
2496 | |
---|
2497 | VOID |
---|
2498 | #ifdef CK_ANSIC |
---|
2499 | failicp(void * threadinfo) |
---|
2500 | #else /* CK_ANSIC */ |
---|
2501 | failicp(threadinfo) VOID * threadinfo; |
---|
2502 | #endif /* CK_ANSIC */ |
---|
2503 | { |
---|
2504 | #ifdef GEMDOS |
---|
2505 | cc_clean(); |
---|
2506 | #endif /* GEMDOS */ |
---|
2507 | fixcmd(); /* Pop command stacks, etc. */ |
---|
2508 | clcmds = NULL; |
---|
2509 | debug(F100,"ckcmai got interrupt","",0); |
---|
2510 | } |
---|
2511 | #endif /* NOICP */ |
---|
2512 | |
---|
2513 | #ifndef NOICP |
---|
2514 | VOID |
---|
2515 | #ifdef CK_ANSIC |
---|
2516 | docmdfile(void * threadinfo) /* Execute application file */ |
---|
2517 | #else /* CK_ANSIC */ |
---|
2518 | docmdfile(threadinfo) VOID * threadinfo; |
---|
2519 | #endif /* CK_ANSIC */ |
---|
2520 | /* docmdfile */ { |
---|
2521 | #ifdef NTSIG |
---|
2522 | concb((char)escape); |
---|
2523 | setint(); |
---|
2524 | if (threadinfo) { /* Thread local storage... */ |
---|
2525 | TlsSetValue(TlsIndex,threadinfo); |
---|
2526 | debug(F100, "docmdfile called with threadinfo block","", 0); |
---|
2527 | } else debug(F100, "docmdfile - threadinfo is NULL", "", 0); |
---|
2528 | #endif /* NTSIG */ |
---|
2529 | #ifdef CK_LOGIN |
---|
2530 | #ifdef IKSD |
---|
2531 | #ifdef NT |
---|
2532 | if (inserver) |
---|
2533 | setntcreds(); |
---|
2534 | #endif /* NT */ |
---|
2535 | #endif /* IKSD */ |
---|
2536 | #endif /* CK_LOGIN */ |
---|
2537 | debug(F110,"main cmdfil",cmdfil,0); |
---|
2538 | #ifndef NOSPL |
---|
2539 | addmac("\\%0",cmdfil); |
---|
2540 | #endif /* NOSPL */ |
---|
2541 | dotake(cmdfil); /* execute it */ |
---|
2542 | while (tlevel > -1) { /* until it runs out. */ |
---|
2543 | sstate = parser(1); /* Loop getting commands. */ |
---|
2544 | if (sstate) proto(); /* Enter protocol if requested. */ |
---|
2545 | #ifdef NTSIG |
---|
2546 | ck_ih(); |
---|
2547 | #endif /* NTSIG */ |
---|
2548 | } |
---|
2549 | cfilef = 1; /* Remember we did this */ |
---|
2550 | |
---|
2551 | #ifdef NTSIG |
---|
2552 | ckThreadEnd(threadinfo); |
---|
2553 | #endif /* NTSIG */ |
---|
2554 | return; |
---|
2555 | } |
---|
2556 | |
---|
2557 | VOID |
---|
2558 | #ifdef CK_ANSIC |
---|
2559 | failcmdfile(void * threadinfo) |
---|
2560 | #else /* CK_ANSIC */ |
---|
2561 | failcmdfile(threadinfo) VOID * threadinfo; |
---|
2562 | #endif /* CK_ANSIC */ |
---|
2563 | /* failcmdfile */ { |
---|
2564 | #ifdef GEMDOS |
---|
2565 | cc_clean(); /* Atari: Clean up after ^C-trap. */ |
---|
2566 | #endif /* GEMDOS */ |
---|
2567 | if (!cfilef) { |
---|
2568 | conoll("Interrupt during initialization or command-line processing."); |
---|
2569 | conoll("C-Kermit quitting..."); |
---|
2570 | } |
---|
2571 | doexit(BAD_EXIT,-1); /* Exit with bad status. */ |
---|
2572 | } |
---|
2573 | #endif /* NOICP */ |
---|
2574 | |
---|
2575 | #ifndef NOXFER |
---|
2576 | VOID |
---|
2577 | setprefix(z) int z; { /* Initial control-char prefixing */ |
---|
2578 | #ifdef CK_SPEED |
---|
2579 | int i, val; |
---|
2580 | |
---|
2581 | prefixing = z; |
---|
2582 | ptab[protocol].prefix = prefixing; |
---|
2583 | debug(F101,"setprefix","",prefixing); |
---|
2584 | switch (z) { |
---|
2585 | case PX_ALL: /* All */ |
---|
2586 | #ifdef COMMENT |
---|
2587 | /* Don't let Clear-Channel be dependent on prefixing */ |
---|
2588 | clearrq = 0; /* Turn off clearchannel, fall thru */ |
---|
2589 | #endif /* COMMENT */ |
---|
2590 | case PX_NON: /* None */ |
---|
2591 | val = (z == PX_ALL) ? 1 : 0; |
---|
2592 | for (i = |
---|
2593 | #ifdef UNPREFIXZERO |
---|
2594 | 0 |
---|
2595 | #else |
---|
2596 | 1 |
---|
2597 | #endif /* UNPREFIXZERO */ |
---|
2598 | ; i < 32; i++) |
---|
2599 | ctlp[i] = val; |
---|
2600 | for (i = 127; i < 160; i++) ctlp[i] = val; |
---|
2601 | ctlp[(unsigned)255] = val; |
---|
2602 | if (z == PX_NON) { /* These are never safe */ |
---|
2603 | if (network) { /* Assume network = telnet or rlogin */ |
---|
2604 | ctlp[CR] = 1; /* Prefix CR because of NVT rules */ |
---|
2605 | ctlp[XON] = ctlp[XOFF] = 1; /* Because of Telnet server */ |
---|
2606 | ctlp[127] = ctlp[255] = 1; /* Telnet IAC */ |
---|
2607 | ctlp[mystch] = ctlp[mystch+128] = 1; /* Kermit packet start */ |
---|
2608 | } else { |
---|
2609 | ctlp[CR] = ctlp[255] = ctlp[mystch] = ctlp[mystch+128] = 1; |
---|
2610 | if (flow == FLO_XONX) /* Xon/Xoff forces prefixing */ |
---|
2611 | ctlp[XON] = ctlp[XOFF] = ctlp[XON+128] = ctlp[XOFF+128] = 1; |
---|
2612 | } |
---|
2613 | } |
---|
2614 | break; |
---|
2615 | |
---|
2616 | case PX_CAU: /* Cautious or Minimal */ |
---|
2617 | #ifdef COMMENT |
---|
2618 | /* Don't let CLEAR-CHANNEL be dependent on Prefixing */ |
---|
2619 | clearrq = 0; /* Turn off clearchannel */ |
---|
2620 | #endif /* COMMENT */ |
---|
2621 | case PX_WIL: /* Minimal ("wild") */ |
---|
2622 | ctlp[0] = 1; /* Does not include 0 */ |
---|
2623 | for (i = 1; i < 32; i++) |
---|
2624 | ctlp[i] = 0; |
---|
2625 | for (i = 127; i < 160; i++) |
---|
2626 | ctlp[i] = 0; |
---|
2627 | ctlp[mystch] = ctlp[mystch+128] = 1; /* Kermit start of packet */ |
---|
2628 | if (seol != 13) |
---|
2629 | ctlp[seol] = ctlp[seol+128] = 1; /* Kermit end */ |
---|
2630 | ctlp[13] = ctlp[141] = 1; /* In case of TELNET (NVT rules) */ |
---|
2631 | ctlp[(unsigned)255] = 1; /* Ditto */ |
---|
2632 | |
---|
2633 | /* ^D, ^J, ^M, or ^U followed by tilde trigger Rlogin escape */ |
---|
2634 | |
---|
2635 | ctlp[4] = ctlp[4+128] = 1; /* In case of RLOGIN */ |
---|
2636 | ctlp[10] = ctlp[10+128] = 1; /* In case of RLOGIN */ |
---|
2637 | ctlp[21] = ctlp[21+128] = 1; /* In case of RLOGIN */ |
---|
2638 | |
---|
2639 | if (flow == FLO_XONX || /* Xon/Xoff forces prefixing these */ |
---|
2640 | prefixing == PX_CAU || /* So does CAUTIOUS */ |
---|
2641 | network) /* Networks too... */ |
---|
2642 | ctlp[XON] = ctlp[XOFF] = ctlp[XON+128] = ctlp[XOFF+128] = 1; |
---|
2643 | if (prefixing == PX_CAU) { /* Cautious - add some more */ |
---|
2644 | #ifdef UNPREFIXZERO |
---|
2645 | ctlp[0] = 1; |
---|
2646 | #endif /* UNPREFIXZERO */ |
---|
2647 | ctlp[3] = ctlp[16] = 1; /* ^C, DLE */ |
---|
2648 | ctlp[14] = ctlp[15] = 1; /* SO/SI */ |
---|
2649 | ctlp[24] = ctlp[25] = 1; /* VMS might need these */ |
---|
2650 | ctlp[26] = ctlp[26+128] = 1; /* UNIX suspend */ |
---|
2651 | ctlp[28] = ctlp[29] = ctlp[30] = 1; /* Assorted esc chars */ |
---|
2652 | ctlp[131] = ctlp[141] = ctlp[144] = 1; /* and 8-bit versions */ |
---|
2653 | ctlp[(unsigned)255] = ctlp[156] = ctlp[157] = ctlp[158] = 1; |
---|
2654 | } |
---|
2655 | break; |
---|
2656 | } |
---|
2657 | #endif /* CK_SPEED */ |
---|
2658 | } |
---|
2659 | #endif /* NOXFER */ |
---|
2660 | |
---|
2661 | VOID |
---|
2662 | makever() { /* Make version string from pieces */ |
---|
2663 | int x, y; |
---|
2664 | #ifndef OS2 |
---|
2665 | #ifndef MAC |
---|
2666 | ck_s_xver = ck_s_ver; /* Fill in C-Kermit version number */ |
---|
2667 | ck_l_xver = ck_l_ver; /* for UNIX, VMS, etc. */ |
---|
2668 | #endif /* MAC */ |
---|
2669 | #endif /* OS2 */ |
---|
2670 | x = strlen(ck_s_name); |
---|
2671 | y = strlen(ck_s_xver); |
---|
2672 | if (y + x + 1 < CKVERLEN) { |
---|
2673 | ckmakmsg(versio,CKVERLEN,ck_s_name," ",ck_s_xver,NULL); |
---|
2674 | } else { |
---|
2675 | ckstrncpy(versio,"C-Kermit",CKVERLEN); |
---|
2676 | return; |
---|
2677 | } |
---|
2678 | x += y + 1; |
---|
2679 | if (*ck_s_who) { |
---|
2680 | y = strlen(ck_s_who); |
---|
2681 | if (CKVERLEN < x + y + 1) |
---|
2682 | return; |
---|
2683 | ckstrncat(versio,"-",CKVERLEN); |
---|
2684 | ckstrncat(versio,ck_s_who,CKVERLEN); |
---|
2685 | } |
---|
2686 | x += y + 1; |
---|
2687 | y = strlen(ck_s_test); |
---|
2688 | if (y > 0 && y + x + 1 < CKVERLEN) { |
---|
2689 | ckstrncat(versio," ",CKVERLEN); |
---|
2690 | ckstrncat(versio,ck_s_test,CKVERLEN); |
---|
2691 | x += y + 1; |
---|
2692 | y = strlen(ck_s_tver); |
---|
2693 | if (y > 0 && y + x + 1 < CKVERLEN) { |
---|
2694 | ckstrncat(versio,".",CKVERLEN); |
---|
2695 | ckstrncat(versio,ck_s_tver,CKVERLEN); |
---|
2696 | x += y + 1; |
---|
2697 | } |
---|
2698 | } |
---|
2699 | y = strlen(ck_s_date); |
---|
2700 | if (y > 0 && y + x + 2 < CKVERLEN) { |
---|
2701 | ckstrncat(versio,", ",CKVERLEN); |
---|
2702 | ckstrncat(versio,ck_s_date,CKVERLEN); |
---|
2703 | } |
---|
2704 | vernum = ck_l_ver; |
---|
2705 | xvernum = ck_l_xver; |
---|
2706 | debug(F110,"Kermit version",versio,0); |
---|
2707 | } |
---|
2708 | |
---|
2709 | union ck_short shortbytes; /* For determining byte order */ |
---|
2710 | int byteorder = 0; /* 0 = Big Endian; 1 = Little Endian */ |
---|
2711 | int bigendian = 1; |
---|
2712 | /* NOTE: MUST BE 0 or 1 - nothing else */ |
---|
2713 | |
---|
2714 | #ifdef NETCONN |
---|
2715 | #ifndef NOCMDL |
---|
2716 | #ifndef NOURL |
---|
2717 | VOID |
---|
2718 | dourl() { |
---|
2719 | int rc = 0; |
---|
2720 | char * port = NULL; |
---|
2721 | extern int ttnproto; |
---|
2722 | extern struct urldata g_url; |
---|
2723 | |
---|
2724 | #ifdef COMMENT |
---|
2725 | extern char *g_url.por; |
---|
2726 | printf("URL: %s\n",g_url.sav ? g_url.sav : "(none)"); |
---|
2727 | printf("Type: %s\n",g_url.svc ? g_url.svc : "(none)"); |
---|
2728 | printf("User: %s\n",g_url.usr ? g_url.usr : "(none)"); |
---|
2729 | printf("Pass: %s\n",g_url.psw ? g_url.psw : "(none)"); |
---|
2730 | printf("Host: %s\n",g_url.hos ? g_url.hos : "(none)"); |
---|
2731 | printf("Port: %s\n",g_url.por ? g_url.por : "(none)"); |
---|
2732 | printf("Path: %s\n",g_url.pth ? g_url.pth : "(none)"); |
---|
2733 | #endif /* COMMENT */ |
---|
2734 | |
---|
2735 | if (!ckstrcmp(g_url.svc,"iksd",-1,0) || |
---|
2736 | !ckstrcmp(g_url.svc,"kermit",-1,0)) { |
---|
2737 | extern char pwbuf[]; |
---|
2738 | extern int pwflg; |
---|
2739 | #ifdef OS2 |
---|
2740 | extern int pwcrypt; |
---|
2741 | #endif /* OS2 */ |
---|
2742 | |
---|
2743 | if (!g_url.hos) { |
---|
2744 | printf("?Incomplete IKSD URL\n"); |
---|
2745 | doexit(BAD_EXIT,1); |
---|
2746 | } |
---|
2747 | if (!g_url.usr) |
---|
2748 | makestr(&g_url.usr,"anonymous"); |
---|
2749 | if (!g_url.psw) { |
---|
2750 | char * tmpbuf = NULL; |
---|
2751 | if (!(tmpbuf = (char *)malloc(1024))) |
---|
2752 | fatal("dourl: out of memory"); |
---|
2753 | |
---|
2754 | if (!ckstrcmp(g_url.usr,"anonymous",-1,0)) { |
---|
2755 | ckmakmsg(tmpbuf,1024,uidbuf,"@",myhost,NULL); |
---|
2756 | makestr(&g_url.psw,tmpbuf); |
---|
2757 | } else { |
---|
2758 | readpass(" Password:",tmpbuf,1024); |
---|
2759 | makestr(&g_url.psw,tmpbuf); |
---|
2760 | } |
---|
2761 | |
---|
2762 | free(tmpbuf); |
---|
2763 | } |
---|
2764 | port = "kermit"; |
---|
2765 | ttnproto = NP_TELNET; |
---|
2766 | nettype = NET_TCPB; |
---|
2767 | mdmtyp = -nettype; |
---|
2768 | local = -1; |
---|
2769 | ckstrncpy(uidbuf,g_url.usr,UIDBUFLEN); |
---|
2770 | if (g_url.psw) { |
---|
2771 | ckstrncpy(pwbuf,g_url.psw,PWBUFL); |
---|
2772 | pwflg = 1; |
---|
2773 | #ifdef OS2 |
---|
2774 | pwcrypt = 0; |
---|
2775 | #endif /* OS2 */ |
---|
2776 | } |
---|
2777 | ckmakmsg(ttname, |
---|
2778 | TTNAMLEN, |
---|
2779 | g_url.hos, |
---|
2780 | ":", |
---|
2781 | g_url.por ? g_url.por : port, |
---|
2782 | NULL |
---|
2783 | ); |
---|
2784 | rc = ttopen(ttname,&local,mdmtyp,0); |
---|
2785 | if (rc > -1) { |
---|
2786 | network = 1; |
---|
2787 | exitonclose = 1; |
---|
2788 | #ifdef CKLOGDIAL |
---|
2789 | dolognet(); |
---|
2790 | #endif /* CKLOGDIAL */ |
---|
2791 | } else { |
---|
2792 | printf("?Connection failed: %s\n",g_url.sav); |
---|
2793 | doexit(BAD_EXIT,1); |
---|
2794 | } |
---|
2795 | /* Also need to check here for secure authentication already done */ |
---|
2796 | |
---|
2797 | #ifdef NOSPL |
---|
2798 | cflg = 1; |
---|
2799 | #else |
---|
2800 | if (!g_url.pth) { |
---|
2801 | cflg = 1; |
---|
2802 | } else { |
---|
2803 | char * line = NULL; |
---|
2804 | if (!(line = (char *)malloc(10240))) |
---|
2805 | fatal("dourl: out of memory"); |
---|
2806 | if (!g_url.pth) { /* Write the appropriate script */ |
---|
2807 | ckmakxmsg(line,10240, |
---|
2808 | "remote login ", /* No path */ |
---|
2809 | g_url.usr, /* Just log in and CONNECT */ |
---|
2810 | " ", |
---|
2811 | g_url.psw, |
---|
2812 | ", if fail exit 1 IKSD login failed", |
---|
2813 | ", connect", |
---|
2814 | NULL,NULL,NULL,NULL,NULL,NULL); |
---|
2815 | } else { |
---|
2816 | /* does the path specify a file or a directory? */ |
---|
2817 | int len = strlen(g_url.pth); |
---|
2818 | if (ISDIRSEP(g_url.pth[len-1])) |
---|
2819 | ckmakxmsg(line,10240, /* Directory name given */ |
---|
2820 | "remote login ", |
---|
2821 | g_url.usr, |
---|
2822 | " ", |
---|
2823 | g_url.psw, |
---|
2824 | ", if fail exit 1 IKSD login failed", |
---|
2825 | ", set xfer displ brief", |
---|
2826 | ", set xfer bell off", |
---|
2827 | ", remote cd ", |
---|
2828 | g_url.pth, |
---|
2829 | ", lineout directory", |
---|
2830 | ", connect", |
---|
2831 | NULL |
---|
2832 | ); |
---|
2833 | else |
---|
2834 | ckmakxmsg(line,10240, /* Path given, try to GET */ |
---|
2835 | "remote login ", |
---|
2836 | g_url.usr, |
---|
2837 | " ", |
---|
2838 | g_url.psw, |
---|
2839 | ", if fail exit 1 IKSD login failed", |
---|
2840 | ", set xfer displ brief", |
---|
2841 | ", set xfer bell off", |
---|
2842 | ", get ", |
---|
2843 | g_url.pth, |
---|
2844 | ", .rc := \\v(status)", |
---|
2845 | ", bye", |
---|
2846 | ", exit \\m(rc)" |
---|
2847 | ); |
---|
2848 | } |
---|
2849 | clcmds = line; /* Make this our -C cmdline macro */ |
---|
2850 | debug(F110,"dourl clcmds",clcmds,0); |
---|
2851 | debug(F101,"dourl haveurl","",haveurl); |
---|
2852 | } |
---|
2853 | #endif /* NOSPL */ |
---|
2854 | } else { |
---|
2855 | if (ckstrcmp(g_url.svc,"telnet",-1,0) && |
---|
2856 | #ifdef SSHBUILTIN |
---|
2857 | ckstrcmp(g_url.svc,"ssh",-1,0) && |
---|
2858 | #endif /* SSHBUILTIN */ |
---|
2859 | ckstrcmp(g_url.svc,"ftp",-1,0)) { |
---|
2860 | printf("?Sorry, %s URLs not supported\n", |
---|
2861 | g_url.svc ? g_url.svc : ""); |
---|
2862 | doexit(BAD_EXIT,1); |
---|
2863 | } |
---|
2864 | } |
---|
2865 | } |
---|
2866 | #endif /* NOCMDL */ |
---|
2867 | #endif /* NETCONN */ |
---|
2868 | #endif /* NOURL */ |
---|
2869 | |
---|
2870 | /* |
---|
2871 | main()... |
---|
2872 | |
---|
2873 | If you get complaints about "main: return type is not blah", |
---|
2874 | define MAINTYPE on the CC command line, e.g. "CFLAGS=-DMAINTYPE=blah" |
---|
2875 | (where "blah" is int, long, or whatever). |
---|
2876 | |
---|
2877 | If the complaint is "Attempt to return a value from a function of type void" |
---|
2878 | then add -DMAINISVOID. |
---|
2879 | */ |
---|
2880 | #ifndef MAINTYPE |
---|
2881 | #ifndef MAINISVOID |
---|
2882 | #define MAINTYPE int |
---|
2883 | #endif /* MAINISVOID */ |
---|
2884 | #endif /* MAINTYPE */ |
---|
2885 | |
---|
2886 | #ifdef MAINISVOID |
---|
2887 | #ifndef MAINTYPE |
---|
2888 | #define MAINTYPE void |
---|
2889 | #endif /* MAINTYPE */ |
---|
2890 | #endif /* MAINISVOID */ |
---|
2891 | |
---|
2892 | #ifdef aegis |
---|
2893 | /* On the Apollo, intercept main to insert a cleanup handler */ |
---|
2894 | int |
---|
2895 | ckcmai(argc,argv) int argc; char **argv; |
---|
2896 | #else |
---|
2897 | #ifdef MAC /* Macintosh */ |
---|
2898 | int |
---|
2899 | main (void) |
---|
2900 | #else |
---|
2901 | #ifdef __GNUC__ /* GCC compiler */ |
---|
2902 | int |
---|
2903 | main(argc,argv) int argc; char **argv; |
---|
2904 | #else |
---|
2905 | #ifdef __DECC /* DEC Alpha with DEC C compiler */ |
---|
2906 | #ifdef __ALPHA |
---|
2907 | int |
---|
2908 | main(argc,argv) int argc; char **argv; |
---|
2909 | #else /* DEC C compiler, not Alpha */ |
---|
2910 | #define MAINISVOID |
---|
2911 | VOID |
---|
2912 | main(argc,argv) int argc; char **argv; |
---|
2913 | #endif /* __ALPHA */ |
---|
2914 | #else |
---|
2915 | #ifdef STRATUS /* Stratus VOS */ |
---|
2916 | int |
---|
2917 | main(argc,argv) int argc; char **argv; |
---|
2918 | #else /* K-95 */ |
---|
2919 | #ifdef OS2 |
---|
2920 | #ifdef KUI |
---|
2921 | #define MAINISVOID |
---|
2922 | void |
---|
2923 | Main( int argc, char ** argv ) |
---|
2924 | #else /* KUI */ |
---|
2925 | #define MAINISVOID |
---|
2926 | VOID |
---|
2927 | main(argc,argv) int argc; char **argv; |
---|
2928 | #endif /* KUI */ |
---|
2929 | #else /* Not K95 */ |
---|
2930 | MAINTYPE /* All others... */ |
---|
2931 | main(argc,argv) int argc; char **argv; |
---|
2932 | #endif /* OS2 */ |
---|
2933 | #endif /* STRATUS */ |
---|
2934 | #endif /* __DECC */ |
---|
2935 | #endif /* __GNUC__ */ |
---|
2936 | #endif /* MAC */ |
---|
2937 | #endif /* aegis */ |
---|
2938 | |
---|
2939 | /* main */ { |
---|
2940 | |
---|
2941 | char *p; |
---|
2942 | |
---|
2943 | #ifndef NOSETKEY |
---|
2944 | int i; |
---|
2945 | #endif /* NOSETKEY */ |
---|
2946 | |
---|
2947 | #ifdef datageneral |
---|
2948 | short *pfha = 016000000036; /* Get around LANG_RT problem */ |
---|
2949 | *pfha = (short) 0; /* No user protection fault handler */ |
---|
2950 | #endif /* datageneral */ |
---|
2951 | |
---|
2952 | /* Do some initialization */ |
---|
2953 | |
---|
2954 | #ifndef MAC |
---|
2955 | xargc = xargs = argc; /* Make global copies of argc */ |
---|
2956 | xargv = argv; /* ...and argv. */ |
---|
2957 | xarg0 = argv[0]; |
---|
2958 | #ifdef NT |
---|
2959 | setOSVer(); |
---|
2960 | #endif /* NT */ |
---|
2961 | zstrip(argv[0],&p); /* Get name we were invoked with */ |
---|
2962 | makestr(&myname,p); |
---|
2963 | if (!ckstrcmp(myname,"telnet",-1,0)) howcalled = I_AM_TELNET; |
---|
2964 | #ifdef CK_KERBEROS |
---|
2965 | else if (!ckstrcmp(myname,"ktelnet",-1,0)) howcalled = I_AM_TELNET; |
---|
2966 | #endif /* CK_KERBEROS */ |
---|
2967 | else if (!ckstrcmp(myname,"rlogin",-1,0)) howcalled = I_AM_RLOGIN; |
---|
2968 | else if (!ckstrcmp(myname,"iksd",-1,0)) howcalled = I_AM_IKSD; |
---|
2969 | #ifdef NEWFTP |
---|
2970 | else if (!ckstrcmp(myname,"ftp",-1,0)) howcalled = I_AM_FTP; |
---|
2971 | #endif /* NEWFTP */ |
---|
2972 | #ifndef NOHTTP |
---|
2973 | else if (!ckstrcmp(myname,"http",-1,0)) howcalled = I_AM_HTTP; |
---|
2974 | #endif /* NOHTTP */ |
---|
2975 | #ifdef OS2 |
---|
2976 | else if (!ckstrcmp(myname,"telnet.exe",-1,0)) howcalled = I_AM_TELNET; |
---|
2977 | #ifdef SSHBUILTIN |
---|
2978 | else if (!ckstrcmp(myname,"ssh",-1,0)) howcalled = I_AM_SSH; |
---|
2979 | else if (!ckstrcmp(myname,"ssh.exe",-1,0)) howcalled = I_AM_SSH; |
---|
2980 | #endif /* SSHBUILTIN */ |
---|
2981 | #ifdef CK_KERBEROS |
---|
2982 | else if (!ckstrcmp(myname,"ktelnet.exe",-1,0)) howcalled = I_AM_TELNET; |
---|
2983 | #endif /* CK_KERBEROS */ |
---|
2984 | else if (!ckstrcmp(myname,"rlogin.exe",-1,0)) howcalled = I_AM_RLOGIN; |
---|
2985 | #ifdef NT |
---|
2986 | else if (!ckstrcmp(myname,"iksdnt",-1,0)) howcalled = I_AM_IKSD; |
---|
2987 | else if (!ckstrcmp(myname,"iksdnt.exe",-1,0)) howcalled = I_AM_IKSD; |
---|
2988 | #endif /* NT */ |
---|
2989 | #ifdef NEWFTP |
---|
2990 | else if (!ckstrcmp(myname,"ftp.exe",-1,0)) howcalled = I_AM_FTP; |
---|
2991 | #endif /* NEWFTP */ |
---|
2992 | #ifndef NOHTTP |
---|
2993 | else if (!ckstrcmp(myname,"http.exe",-1,0)) howcalled = I_AM_HTTP; |
---|
2994 | #endif /* NOHTTP */ |
---|
2995 | #endif /* OS2 */ |
---|
2996 | else if (!ckstrcmp(myname,"kermit-sshsub",-1,0)) howcalled = I_AM_SSHSUB; |
---|
2997 | |
---|
2998 | #ifndef NOICP |
---|
2999 | cmdini(); /* Must come before prescan */ |
---|
3000 | debug(F100,"main cmdini() done","",0); |
---|
3001 | #endif /* NOICP */ |
---|
3002 | prescan(0); /* Pre-Check for debugging, etc */ |
---|
3003 | #endif /* MAC */ |
---|
3004 | debug(F101,"MAIN feol","",feol); |
---|
3005 | makever(); /* Put together version strings */ |
---|
3006 | #ifndef NOSETKEY /* Allocate & initialize the keymap */ |
---|
3007 | /* This code has been moved to before sysinit() for K95G */ |
---|
3008 | if (!(keymap = (KEY *) malloc(sizeof(KEY)*KMSIZE))) |
---|
3009 | fatal("main: no memory for keymap"); |
---|
3010 | if (!(macrotab = (MACRO *) malloc(sizeof(MACRO)*KMSIZE))) |
---|
3011 | fatal("main: no memory for macrotab"); |
---|
3012 | for (i = 0; i < KMSIZE; i++) { |
---|
3013 | keymap[i] = (KEY) i; |
---|
3014 | macrotab[i] = NULL; |
---|
3015 | } |
---|
3016 | #endif /* NOSETKEY */ |
---|
3017 | |
---|
3018 | shortbytes.x_short = 0xABCD; /* Get Endianness */ |
---|
3019 | if (shortbytes.x_char[0] == 0xCD) { /* 0 = Big Endian */ |
---|
3020 | byteorder = 1; /* 1 = Little Endian */ |
---|
3021 | bigendian = 0; /* (for clarity in programming) */ |
---|
3022 | } else { |
---|
3023 | byteorder = 0; /* Big Endian */ |
---|
3024 | bigendian = 1; |
---|
3025 | } |
---|
3026 | if (sysinit() < 0) /* System-dependent initialization. */ |
---|
3027 | fatal("Can't initialize!"); |
---|
3028 | else |
---|
3029 | initflg = 1; /* Remember we did. */ |
---|
3030 | debug(F111,"ckcmai myname",myname,howcalled); |
---|
3031 | |
---|
3032 | #ifdef UNIX |
---|
3033 | getexedir(); /* Compute exedir variable */ |
---|
3034 | #endif /* UNIX */ |
---|
3035 | |
---|
3036 | #ifdef CKSYSLOG |
---|
3037 | #ifdef SYSLOGLEVEL |
---|
3038 | /* |
---|
3039 | If built with -DSYSLOGLEVEL on cc command line, this means we always |
---|
3040 | do syslogging at the indicated level. |
---|
3041 | */ |
---|
3042 | zsyslog(); /* Open syslog */ |
---|
3043 | #else /* SYSLOGLEVEL */ |
---|
3044 | #ifdef IKSD |
---|
3045 | if (inserver) |
---|
3046 | zsyslog(); /* Open syslog */ |
---|
3047 | #endif /* IKSD */ |
---|
3048 | #endif /* SYSLOGLEVEL */ |
---|
3049 | #endif /* CKSYSLOG */ |
---|
3050 | |
---|
3051 | #ifdef CK_KERBEROS |
---|
3052 | ini_kerb(); /* Initialize Kerberos data */ |
---|
3053 | #endif /* CK_KERBEROS */ |
---|
3054 | #ifdef CK_SSL |
---|
3055 | ssl_once_init(); |
---|
3056 | #endif /* CK_SSL */ |
---|
3057 | #ifdef TNCODE |
---|
3058 | tn_set_modes(); /* Init Telnet Option tables */ |
---|
3059 | #endif /* TNCODE */ |
---|
3060 | |
---|
3061 | #ifdef CK_TTGWSIZ /* Initialize screen dimensions */ |
---|
3062 | #ifdef OS2 |
---|
3063 | ttgcwsz(); |
---|
3064 | #else /* OS2 */ |
---|
3065 | if (ttgwsiz() > 0) { |
---|
3066 | if (tt_rows > 0 && tt_cols > 0) { |
---|
3067 | cmd_rows = tt_rows; |
---|
3068 | cmd_cols = tt_cols; |
---|
3069 | } |
---|
3070 | } |
---|
3071 | #endif /* OS2 */ |
---|
3072 | #endif /* CK_TTGWSIZ */ |
---|
3073 | |
---|
3074 | #ifndef OS2 |
---|
3075 | #ifdef TCPSOCKET |
---|
3076 | #ifdef CK_SOCKS |
---|
3077 | SOCKSinit(argv[0]); /* Internet relay package... */ |
---|
3078 | #endif /* CK_SOCKS */ |
---|
3079 | #endif /* TCPSOCKET */ |
---|
3080 | #endif /* OS2 */ |
---|
3081 | |
---|
3082 | initflow(); /* Initialize flow-control table */ |
---|
3083 | |
---|
3084 | #ifndef NOICP |
---|
3085 | #ifdef CKFLOAT |
---|
3086 | initfloat(); /* Deduce floating-point precision */ |
---|
3087 | #endif /* CKFLOAT */ |
---|
3088 | #endif /* NOICP */ |
---|
3089 | |
---|
3090 | #ifndef NOXFER |
---|
3091 | initxlist(); /* Init exception lists */ |
---|
3092 | |
---|
3093 | #ifdef CK_XYZ /* Initialize protocols... */ |
---|
3094 | |
---|
3095 | #ifdef XYZ_INTERNAL /* XYZMODEM are internal ... */ |
---|
3096 | |
---|
3097 | #ifdef COMMENT |
---|
3098 | /* Can't do this for XMODEM because if filename contains a "C" etc... */ |
---|
3099 | initproto(PROTO_X, "rx %s","rx %s", NULL, NULL, NULL, NULL, NULL); |
---|
3100 | initproto(PROTO_XC,"rc %s","rc %s", NULL, NULL, NULL, NULL, NULL); |
---|
3101 | #else /* COMMENT */ |
---|
3102 | initproto(PROTO_X, NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
---|
3103 | initproto(PROTO_XC,NULL, NULL, NULL, NULL, NULL, NULL, NULL); |
---|
3104 | #endif /* COMMENT */ |
---|
3105 | initproto(PROTO_Y, "rb","rb", NULL, NULL, NULL, NULL, NULL); |
---|
3106 | initproto(PROTO_G, "rb","rb", NULL, NULL, NULL, NULL, NULL); |
---|
3107 | initproto(PROTO_Z, "rz","rz", NULL, NULL, NULL, NULL, NULL); |
---|
3108 | initproto(PROTO_K,"kermit -ir","kermit -r","kermit -x",NULL,NULL,NULL,NULL); |
---|
3109 | /* Kermit Must be last */ |
---|
3110 | |
---|
3111 | #else /* XYZMODEM are external protocols ... */ |
---|
3112 | |
---|
3113 | /* s1 s2 s3 s4 s5 s6 s7 */ |
---|
3114 | initproto(PROTO_X, "rx %s","rx %s",NULL,"sx %s","sx -a %s","rx %s", "rx %s"); |
---|
3115 | initproto(PROTO_XC,"rc %s","rc %s",NULL,"sx %s","sx -a %s","rc %s", "rc %s"); |
---|
3116 | initproto(PROTO_Y, "rb", "rb", NULL,"sb %s","sb -a %s","rb", "rb" ); |
---|
3117 | initproto(PROTO_G, "rb", "rb", NULL,"sb %s","sb -a %s","rb", "rb" ); |
---|
3118 | initproto(PROTO_Z, "rz", "rz", NULL,"sz %s","sz -a %s","rz", "rz" ); |
---|
3119 | initproto(PROTO_K, "kermit -ir","kermit -r","kermit -x",NULL,NULL,NULL,NULL); |
---|
3120 | /* Kermit must be last */ |
---|
3121 | |
---|
3122 | #endif /* XYZ_INTERNAL */ |
---|
3123 | |
---|
3124 | #else /* No XYZMODEM support */ |
---|
3125 | |
---|
3126 | initproto(PROTO_K,"kermit -ir","kermit -r","kermit -x",NULL,NULL,NULL,NULL); |
---|
3127 | |
---|
3128 | #endif /* CK_XYZ */ |
---|
3129 | #endif /* NOXFER */ |
---|
3130 | |
---|
3131 | connoi(); /* Console interrupts off */ |
---|
3132 | |
---|
3133 | #ifndef NOXFER |
---|
3134 | #ifdef OS2 |
---|
3135 | /* Initialize Kermit and Zmodem Auto-Download Strings */ |
---|
3136 | adl_kstr = strdup("KERMIT READY TO SEND..."); |
---|
3137 | adl_zstr = strdup("rz\r"); |
---|
3138 | #endif /* OS2 */ |
---|
3139 | |
---|
3140 | #ifdef PATTERNS |
---|
3141 | initpat(); /* Initialize filename patterns */ |
---|
3142 | #endif /* PATTERNS */ |
---|
3143 | #endif /* NOXFER */ |
---|
3144 | |
---|
3145 | #ifndef NOCSETS |
---|
3146 | initcsets(); /* Initialize character sets */ |
---|
3147 | #endif /* NOCSETS */ |
---|
3148 | |
---|
3149 | #ifndef NOICP |
---|
3150 | #ifdef DFCDMSG |
---|
3151 | makestr(&cdmsgstr,DFCDMSG); |
---|
3152 | makelist(cdmsgstr,cdmsgfile,8); /* Initialize CD message filenames */ |
---|
3153 | #endif /* DFCDMSG */ |
---|
3154 | #endif /* NOICP */ |
---|
3155 | |
---|
3156 | sstate = 0; /* No default start state. */ |
---|
3157 | #ifdef DYNAMIC |
---|
3158 | if (getiobs() < 0) |
---|
3159 | fatal("Can't allocate i/o buffers!"); |
---|
3160 | #endif /* DYNAMIC */ |
---|
3161 | |
---|
3162 | #ifndef NOSPL |
---|
3163 | #ifndef NORANDOM |
---|
3164 | { |
---|
3165 | char stackdata[256]; |
---|
3166 | unsigned int c = 1234, n; |
---|
3167 | /* try to make a random unsigned int to feed srand() */ |
---|
3168 | #ifndef VMS |
---|
3169 | /* time.h and MultiNet do not get along */ |
---|
3170 | c = time(NULL); |
---|
3171 | #endif /* VMS */ |
---|
3172 | c *= getpid(); |
---|
3173 | /* Referenced before set... DELIBERATELY */ |
---|
3174 | for (n = 0; n < sizeof(stackdata); n++) /* IGNORE WARNING */ |
---|
3175 | c += stackdata[n]; /* DELIBERATELY USED BEFORE SET */ |
---|
3176 | srand((unsigned int)c); |
---|
3177 | } |
---|
3178 | #endif /* NORANDOM */ |
---|
3179 | #endif /* NOSPL */ |
---|
3180 | |
---|
3181 | ckhost(myhost,MYHOSTL); /* Name of local host */ |
---|
3182 | debug(F110,"main ckhost",myhost,0); |
---|
3183 | #ifdef IKSD |
---|
3184 | if (!inserver) { |
---|
3185 | #endif /* IKSD */ |
---|
3186 | ckstrncpy(ttname,dftty,TTNAMLEN); /* Set up default tty name. */ |
---|
3187 | local = nolocal ? 0 : dfloc; /* And whether it's local or remote. */ |
---|
3188 | parity = dfprty; /* Set initial parity, */ |
---|
3189 | #ifndef NOXFER |
---|
3190 | myindex = getsysix(cksysid); /* System index */ |
---|
3191 | #endif /* NOXFER */ |
---|
3192 | if (local) if (ttopen(ttname,&local,0,0) < 0) { |
---|
3193 | #ifndef OS2 |
---|
3194 | conol("Can't open device: "); |
---|
3195 | conoll(ttname); |
---|
3196 | #endif /* OS2 */ |
---|
3197 | local = 0; |
---|
3198 | ckstrncpy(ttname,CTTNAM,TTNAMLEN); |
---|
3199 | } |
---|
3200 | setflow(); /* Set appropriate flow control */ |
---|
3201 | speed = ttgspd(); /* Get transmission speed. */ |
---|
3202 | #ifdef IKSD |
---|
3203 | } |
---|
3204 | #endif /* IKSD */ |
---|
3205 | |
---|
3206 | #ifdef ANYX25 /* All X.25 implementations */ |
---|
3207 | #ifndef IBMX25 /* except IBM have PAD support */ |
---|
3208 | initpad(); /* Initialize X.25 PAD */ |
---|
3209 | #endif /* IBMX25 */ |
---|
3210 | #endif /* ANYX25 */ |
---|
3211 | |
---|
3212 | #ifndef NOXFER |
---|
3213 | if (inibufs(SBSIZ,RBSIZ) < 0) /* Allocate packet buffers */ |
---|
3214 | fatal("Can't allocate packet buffers!"); |
---|
3215 | #ifndef NOCKSPEED |
---|
3216 | setprefix(prefixing); /* Set up control char prefixing */ |
---|
3217 | #endif /* NOCKSPEED */ |
---|
3218 | #endif /* NOXFER */ |
---|
3219 | |
---|
3220 | #ifndef NOICP |
---|
3221 | if (sstelnet |
---|
3222 | #ifdef IKSD |
---|
3223 | || inserver |
---|
3224 | #endif /* IKSD */ |
---|
3225 | ) { |
---|
3226 | int on = 1, x = 0; |
---|
3227 | extern int ckxech, ttnet, ttnproto, cmdmsk; |
---|
3228 | #ifdef SO_SNDBUF |
---|
3229 | extern int tcp_sendbuf; |
---|
3230 | #endif |
---|
3231 | #ifdef SO_RCVBUF |
---|
3232 | extern int tcp_recvbuf; |
---|
3233 | #endif |
---|
3234 | #ifdef SO_KEEPALIVE |
---|
3235 | extern int tcp_keepalive; |
---|
3236 | #endif |
---|
3237 | #ifdef SO_LINGER |
---|
3238 | extern int tcp_linger, tcp_linger_tmo; |
---|
3239 | #endif /* SO_LINGER */ |
---|
3240 | #ifdef SO_DONTROUTE |
---|
3241 | extern int tcp_dontroute; |
---|
3242 | #endif /* SO_DONTROUTE */ |
---|
3243 | #ifdef TCP_NODELAY |
---|
3244 | extern int tcp_nodelay; |
---|
3245 | #endif /* TCP_NODELAY */ |
---|
3246 | #ifdef IKSD |
---|
3247 | extern int iklogopen; |
---|
3248 | #endif /* IKSD */ |
---|
3249 | extern int ttmdm; |
---|
3250 | |
---|
3251 | #ifdef UNIX |
---|
3252 | if (isatty(0)) |
---|
3253 | fatal("Internet Kermit Service cannot be started at a terminal."); |
---|
3254 | #endif /* UNIX */ |
---|
3255 | |
---|
3256 | reliable = xreliable = SET_ON; /* IKSD has reliable connection */ |
---|
3257 | #ifndef VMS |
---|
3258 | flow = 0; /* No flow control needed */ |
---|
3259 | #endif /* VMS */ |
---|
3260 | bgset = 0; /* Not in background */ |
---|
3261 | nopush = 1; /* No external processes */ |
---|
3262 | parity = 0; /* 8 bits ... */ |
---|
3263 | cmdmsk = 0xff; /* all the way */ |
---|
3264 | cmask = 0xff; |
---|
3265 | |
---|
3266 | #ifdef IKSD |
---|
3267 | if (inserver) { /* If IKSD */ |
---|
3268 | doiksdinit(); /* Execute IKSD configuration file */ |
---|
3269 | while (tlevel > -1) |
---|
3270 | parser(1); /* (Ignore any file-xfer commands) */ |
---|
3271 | iksdcf = 1; /* IKSD c.f. has been processed */ |
---|
3272 | } |
---|
3273 | if (!iklogopen) (VOID) doiklog(); /* Open Kermit-specific log */ |
---|
3274 | #endif /* IKSD */ |
---|
3275 | |
---|
3276 | #ifdef UNIX |
---|
3277 | setbuf(stdout,NULL); /* Don't buffer the output */ |
---|
3278 | ckstrncpy(ttname,"0",TTNAMLEN); /* not "/dev/tty"... */ |
---|
3279 | #endif /* UNIX */ |
---|
3280 | local = 0; /* We are in remote mode */ |
---|
3281 | ckxech = 1; /* We will echo */ |
---|
3282 | #ifdef OS2 |
---|
3283 | nettype = NET_TCPB; /* So ttopen() treats the connection */ |
---|
3284 | mdmtyp = -nettype; /* as a network */ |
---|
3285 | #endif /* OS2 */ |
---|
3286 | debug(F100,"main about to call ttopen() inserver","",0); |
---|
3287 | if (ttopen(ttname,&local,mdmtyp,0) < 0) { /* Open comm channel */ |
---|
3288 | fatal("can't initialize i/o"); |
---|
3289 | } |
---|
3290 | #ifdef OS2 |
---|
3291 | local = 0; |
---|
3292 | network = 1; /* Does use networking code */ |
---|
3293 | #else /* OS2 */ |
---|
3294 | network = 0; /* Does not use networking code */ |
---|
3295 | #endif /* OS2 */ |
---|
3296 | ttmdm = -1; /* Does not use a modem */ |
---|
3297 | sstelnet = 1; /* Do server-side Telnet negotations */ |
---|
3298 | debug(F111,"MAIN","sstelnet",sstelnet); |
---|
3299 | ttnet = NET_TCPB; /* Network type is TCP sockets */ |
---|
3300 | ttnproto = NP_TELNET; /* Netword protocol is Telnet */ |
---|
3301 | #ifdef IKSDB |
---|
3302 | dbinit(); /* Initialize database record */ |
---|
3303 | #endif /* IKSDB */ |
---|
3304 | #ifndef OS2 |
---|
3305 | #ifdef CK_AUTHENTICATION |
---|
3306 | /* Before initializating Telnet/Rlogin negotiations, init Kerberos */ |
---|
3307 | ck_auth_init(ckgetpeer(),"","",0); |
---|
3308 | #endif /* CK_AUTHENTICATION */ |
---|
3309 | |
---|
3310 | #ifdef NON_BLOCK_IO |
---|
3311 | on = 1; |
---|
3312 | x = socket_ioctl(0,FIONBIO,&on); |
---|
3313 | debug(F101,"main FIONBIO","",x); |
---|
3314 | #endif /* NON_BLOCK_IO */ |
---|
3315 | #ifdef SO_OOBINLINE |
---|
3316 | on = 1; |
---|
3317 | x = setsockopt(0, SOL_SOCKET, SO_OOBINLINE, (char *)&on, sizeof(on)); |
---|
3318 | debug(F101,"main SO_OOBINLINE","",x); |
---|
3319 | #endif /* SO_OOBINLINE */ |
---|
3320 | |
---|
3321 | #ifndef NOTCPOPTS |
---|
3322 | #ifndef datageneral |
---|
3323 | #ifdef SOL_SOCKET |
---|
3324 | #ifdef TCP_NODELAY |
---|
3325 | no_delay(0,tcp_nodelay); |
---|
3326 | #endif /* TCP_NODELAY */ |
---|
3327 | #ifdef SO_KEEPALIVE |
---|
3328 | keepalive(0,tcp_keepalive); |
---|
3329 | #endif /* SO_KEEPALIVE */ |
---|
3330 | #ifdef SO_LINGER |
---|
3331 | ck_linger(0,tcp_linger, tcp_linger_tmo); |
---|
3332 | #endif /* SO_LINGER */ |
---|
3333 | #ifdef SO_DONTROUTE |
---|
3334 | dontroute(0,tcp_dontroute); |
---|
3335 | #endif /* SO_DONTROUTE */ |
---|
3336 | #ifdef SO_SNDBUF |
---|
3337 | sendbuf(0,tcp_sendbuf); |
---|
3338 | #endif /* SO_SNDBUF */ |
---|
3339 | #ifdef SO_RCVBUF |
---|
3340 | recvbuf(0,tcp_recvbuf); |
---|
3341 | #endif /* SO_RCVBUF */ |
---|
3342 | #endif /* SOL_SOCKET */ |
---|
3343 | #endif /* datageneral */ |
---|
3344 | #endif /* NOTCPOPTS */ |
---|
3345 | |
---|
3346 | #ifdef CK_SSL |
---|
3347 | if (ck_ssleay_is_installed()) { |
---|
3348 | if (!ssl_tn_init(SSL_SERVER)) { |
---|
3349 | if (bio_err != NULL) { |
---|
3350 | BIO_printf(bio_err,"do_ssleay_init() failed\r\n"); |
---|
3351 | ERR_print_errors(bio_err); |
---|
3352 | } else { |
---|
3353 | fflush(stderr); |
---|
3354 | fprintf(stderr,"do_ssleay_init() failed\r\n"); |
---|
3355 | ERR_print_errors_fp(stderr); |
---|
3356 | } |
---|
3357 | switch (ttnproto) { |
---|
3358 | case NP_SSL: |
---|
3359 | case NP_TLS: |
---|
3360 | case NP_SSL_TELNET: |
---|
3361 | case NP_TLS_TELNET: |
---|
3362 | doexit(BAD_EXIT,1); |
---|
3363 | } |
---|
3364 | /* otherwise we will continue to accept the connection */ |
---|
3365 | /* without SSL or TLS support unless required. */ |
---|
3366 | if ( TELOPT_DEF_S_ME_MODE(TELOPT_START_TLS) != TN_NG_MU ) |
---|
3367 | TELOPT_DEF_S_ME_MODE(TELOPT_START_TLS) = TN_NG_RF; |
---|
3368 | if ( TELOPT_DEF_S_U_MODE(TELOPT_START_TLS) != TN_NG_MU ) |
---|
3369 | TELOPT_DEF_S_U_MODE(TELOPT_START_TLS) = TN_NG_RF; |
---|
3370 | if ( TELOPT_DEF_C_ME_MODE(TELOPT_START_TLS) != TN_NG_MU ) |
---|
3371 | TELOPT_DEF_C_ME_MODE(TELOPT_START_TLS) = TN_NG_RF; |
---|
3372 | if ( TELOPT_DEF_C_U_MODE(TELOPT_START_TLS) != TN_NG_MU ) |
---|
3373 | TELOPT_DEF_C_U_MODE(TELOPT_START_TLS) = TN_NG_RF; |
---|
3374 | } else { |
---|
3375 | if ( ck_ssl_incoming(0) < 0 ) { |
---|
3376 | doexit(BAD_EXIT,1); |
---|
3377 | } |
---|
3378 | } |
---|
3379 | } |
---|
3380 | #endif /* CK_SSL */ |
---|
3381 | |
---|
3382 | #ifdef TNCODE |
---|
3383 | tn_ini(); /* Start Telnet negotiation now */ |
---|
3384 | #endif /* TNCODE */ |
---|
3385 | #endif /* OS2 */ |
---|
3386 | } |
---|
3387 | debug(F101,"main argc after prescan()","",argc); |
---|
3388 | |
---|
3389 | /* Now process any relevant environment variables */ |
---|
3390 | |
---|
3391 | #ifndef NODIAL |
---|
3392 | getdialenv(); /* Dialing */ |
---|
3393 | #ifdef NETCONN |
---|
3394 | ndinit(); /* Initialize network directory info */ |
---|
3395 | getnetenv(); /* Network directories */ |
---|
3396 | #endif /* NETCONN */ |
---|
3397 | #endif /* NODIAL */ |
---|
3398 | |
---|
3399 | #ifndef NOXFER |
---|
3400 | #ifdef CK_FAST |
---|
3401 | dofast(); /* By now FAST defaults should be OK */ |
---|
3402 | #endif /* CK_FAST */ |
---|
3403 | #endif /* NOXFER */ |
---|
3404 | |
---|
3405 | #ifndef NOCMDL |
---|
3406 | ikslogin(); /* IKSD Login and other stuff */ |
---|
3407 | #ifdef NT |
---|
3408 | if ( inserver ) |
---|
3409 | setntcreds(); |
---|
3410 | #endif /* NT */ |
---|
3411 | #endif /* NOCMDL */ |
---|
3412 | |
---|
3413 | if (howcalled == I_AM_SSHSUB) { |
---|
3414 | reliable = 1; /* We say the connection is reliable */ |
---|
3415 | xreliable = 1; /* And that we said it was */ |
---|
3416 | setreliable = 1; /* And pretend the "user" did too */ |
---|
3417 | xfinish = 1; /* For REMOTE HELP response */ |
---|
3418 | mdmtyp = 0; /* For ttopen() */ |
---|
3419 | ckstrncpy(ttname,"0",TTNAMLEN+1); /* Use file descriptor 0 */ |
---|
3420 | local = 0; /* And force remote mode */ |
---|
3421 | ttopen(ttname,&local,mdmtyp,0); /* Open the "connection" */ |
---|
3422 | sstate = 'x'; /* Initial state is Server */ |
---|
3423 | proto(); /* Enter protocol */ |
---|
3424 | doexit(GOOD_EXIT,xitsta); /* Exit when done */ |
---|
3425 | } |
---|
3426 | debug(F111,"howcalled",myname,howcalled); |
---|
3427 | |
---|
3428 | #ifdef NOCCTRAP |
---|
3429 | dotakeini(0); |
---|
3430 | #else /* NOCCTRAP */ |
---|
3431 | debug(F100,"main about to cc_execute","",0); |
---|
3432 | setint(); |
---|
3433 | cc_execute( ckjaddr(cmjbuf), dotakeini, failtakeini ); |
---|
3434 | #endif /* NOCCTRAP */ |
---|
3435 | |
---|
3436 | debug(F111,"main 2 cfilef",cmdfil,cfilef); |
---|
3437 | if (cmdfil[0]) { /* If we got one (see prescan())... */ |
---|
3438 | #ifdef NOCCTRAP |
---|
3439 | docmdfile(0); /* execute it. */ |
---|
3440 | #else /* NOCCTRAP */ |
---|
3441 | setint(); |
---|
3442 | cc_execute( ckjaddr(cmjbuf), docmdfile, failcmdfile ); |
---|
3443 | #endif /* NOCCTRAP */ |
---|
3444 | } |
---|
3445 | #ifndef OS2 /* Preserve name so we can delete it */ |
---|
3446 | *cmdfil = '\0'; /* Done, nullify the file name */ |
---|
3447 | #endif /* OS2 */ |
---|
3448 | #endif /* NOICP */ |
---|
3449 | |
---|
3450 | #ifndef NOCMDL |
---|
3451 | /* Look for a UNIX-style command line... */ |
---|
3452 | |
---|
3453 | what = W_NOTHING; |
---|
3454 | |
---|
3455 | debug(F101,"main argc","",argc); |
---|
3456 | #ifndef NOHELP |
---|
3457 | iniopthlp(); /* Initialize cmdline arg help */ |
---|
3458 | #endif /* NOHELP */ |
---|
3459 | if ( |
---|
3460 | #ifdef COMMENT |
---|
3461 | !cfilef && |
---|
3462 | #endif /* COMMENT */ |
---|
3463 | argc > 1) { /* Command line arguments? */ |
---|
3464 | sstate = (CHAR) cmdlin(); /* Yes, parse. */ |
---|
3465 | #ifdef NETCONN |
---|
3466 | #ifndef NOURL |
---|
3467 | if (haveurl) { /* Was a URL given? */ |
---|
3468 | dourl(); /* if so, do it. */ |
---|
3469 | } |
---|
3470 | #endif /* NOURL */ |
---|
3471 | #endif /* NETCONN */ |
---|
3472 | #ifndef NOXFER |
---|
3473 | zstate = sstate; /* Remember sstate around protocol */ |
---|
3474 | debug(F101,"main zstate","",zstate); |
---|
3475 | #endif /* NOXFER */ |
---|
3476 | |
---|
3477 | #ifndef NOLOCAL |
---|
3478 | if (cflg) { /* Connect first if requested */ |
---|
3479 | doconect(0,0); |
---|
3480 | if (ttchk() < 0) |
---|
3481 | dologend(); |
---|
3482 | cflg = 0; |
---|
3483 | } |
---|
3484 | #endif /* NOLOCAL */ |
---|
3485 | |
---|
3486 | #ifndef NOXFER |
---|
3487 | if (sstate) { |
---|
3488 | #ifndef NOLOCAL |
---|
3489 | if (displa) concb((char)escape); /* (for console "interrupts") */ |
---|
3490 | #endif /* NOLOCAL */ |
---|
3491 | #ifdef NOCCTRAP |
---|
3492 | docmdline(1); |
---|
3493 | #else /* NOCCTRAP */ |
---|
3494 | setint(); |
---|
3495 | cc_execute( ckjaddr(cmjbuf), docmdline, failcmdline ); |
---|
3496 | #endif /* NOCCTRAP */ |
---|
3497 | } |
---|
3498 | #endif /* NOXFER */ |
---|
3499 | |
---|
3500 | #ifndef NOICP |
---|
3501 | /* |
---|
3502 | If a command-line action argument was given and -S ("stay") was not given, |
---|
3503 | exit now. |
---|
3504 | */ |
---|
3505 | if ((cflg || cnflg || zstate) && !stayflg) |
---|
3506 | #endif /* NOICP */ |
---|
3507 | doexit(GOOD_EXIT,xitsta); /* Exit with good status */ |
---|
3508 | |
---|
3509 | #ifndef NOLOCAL |
---|
3510 | #ifndef NOICP |
---|
3511 | if (local) { |
---|
3512 | #ifdef NETCONN |
---|
3513 | if ((cflg || cnflg) && tn_exit && ttchk() < 0) |
---|
3514 | doexit(GOOD_EXIT,xitsta); /* Exit with good status */ |
---|
3515 | #endif /* NETCONN */ |
---|
3516 | if (exitonclose && !network && |
---|
3517 | (carrier != CAR_OFF && (ttgmdm() & BM_DCD) == 0)) |
---|
3518 | doexit(GOOD_EXIT,xitsta); /* Exit with good status */ |
---|
3519 | if (exitonclose && network && ttchk() < 0) |
---|
3520 | doexit(GOOD_EXIT,xitsta); /* Exit with good status */ |
---|
3521 | } |
---|
3522 | #endif /* NOICP */ |
---|
3523 | #endif /* NOLOCAL */ |
---|
3524 | } |
---|
3525 | #endif /* NOCMDL */ |
---|
3526 | |
---|
3527 | #ifdef NOICP /* No interactive command parser */ |
---|
3528 | #ifndef NOCMDL |
---|
3529 | else { |
---|
3530 | |
---|
3531 | /* Command-line-only version */ |
---|
3532 | fatal("?No command-line options given - type 'kermit -h' for help"); |
---|
3533 | } |
---|
3534 | #else /* Neither one! */ |
---|
3535 | sstate = 'x'; |
---|
3536 | justone = 0; |
---|
3537 | proto(); /* So go into server mode */ |
---|
3538 | doexit(GOOD_EXIT,xitsta); /* exit with good status */ |
---|
3539 | |
---|
3540 | #endif /* NOCMDL */ |
---|
3541 | #else /* not NOICP */ |
---|
3542 | /* |
---|
3543 | If no action requested on command line, or if -S ("stay") was included, |
---|
3544 | enter the interactive command parser. |
---|
3545 | */ |
---|
3546 | if (!clcmds) |
---|
3547 | herald(); /* Display program herald. */ |
---|
3548 | |
---|
3549 | #ifdef NOCCTRAP |
---|
3550 | debug(F100,"main NOCCTRAP setting interrupt trap","",0); |
---|
3551 | setint(); /* Set up command interrupt traps */ |
---|
3552 | doicp(NULL); |
---|
3553 | #else /* NOCCTRAP */ |
---|
3554 | while (1) { |
---|
3555 | debug(F100,"main setting interrupt trap","",0); |
---|
3556 | setint(); /* Set up command interrupt traps */ |
---|
3557 | if (!cc_execute(ckjaddr(cmjbuf), doicp, failicp)) |
---|
3558 | break; |
---|
3559 | } |
---|
3560 | #endif /* NOCCTRAP */ |
---|
3561 | #endif /* NOICP */ |
---|
3562 | #ifndef MAINISVOID |
---|
3563 | return(1); |
---|
3564 | #endif /* MAINISVOID */ |
---|
3565 | } |
---|
3566 | |
---|
3567 | #ifdef DYNAMIC |
---|
3568 | /* Allocate file i/o buffers */ |
---|
3569 | |
---|
3570 | char *zinbuffer = NULL, *zoutbuffer = NULL; |
---|
3571 | |
---|
3572 | int |
---|
3573 | getiobs() { |
---|
3574 | zinbuffer = (char *)malloc(INBUFSIZE); |
---|
3575 | if (!zinbuffer) return(-1); |
---|
3576 | zoutbuffer = (char *)malloc(zobufsize); |
---|
3577 | debug(F101,"zoutbuffer malloc","",zobufsize); |
---|
3578 | if (!zoutbuffer) return(-1); |
---|
3579 | debug(F100,"getiobs ok","",0); |
---|
3580 | return(0); |
---|
3581 | } |
---|
3582 | #endif /* DYNAMIC */ |
---|