No empty .Rs/.Re
[netbsd-mini2440.git] / crypto / dist / heimdal / appl / push / push.c
blob78dc38e955f9b6228c4e4a528bd4b1c683094820
1 /*
2 * Copyright (c) 1997-2004 Kungliga Tekniska Högskolan
3 * (Royal Institute of Technology, Stockholm, Sweden).
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. Neither the name of the Institute nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
34 #include "push_locl.h"
35 __RCSID("$Heimdal: push.c 14850 2005-04-19 18:00:17Z lha $"
36 "$NetBSD$");
38 #ifdef KRB4
39 static int use_v4 = -1;
40 #endif
42 #ifdef KRB5
43 static int use_v5 = -1;
44 static krb5_context context;
45 #endif
47 static char *port_str;
48 static int verbose_level;
49 static int do_fork;
50 static int do_leave;
51 static int do_version;
52 static int do_help;
53 static int do_from;
54 static int do_count;
55 static char *header_str;
57 struct getargs args[] = {
58 #ifdef KRB4
59 { "krb4", '4', arg_flag, &use_v4, "Use Kerberos V4",
60 NULL },
61 #endif
62 #ifdef KRB5
63 { "krb5", '5', arg_flag, &use_v5, "Use Kerberos V5",
64 NULL },
65 #endif
66 { "verbose",'v', arg_counter, &verbose_level, "Verbose",
67 NULL },
68 { "fork", 'f', arg_flag, &do_fork, "Fork deleting proc",
69 NULL },
70 { "leave", 'l', arg_flag, &do_leave, "Leave mail on server",
71 NULL },
72 { "port", 'p', arg_string, &port_str, "Use this port",
73 "number-or-service" },
74 { "from", 0, arg_flag, &do_from, "Behave like from",
75 NULL },
76 { "headers", 0, arg_string, &header_str, "Headers to print", NULL },
77 { "count", 'c', arg_flag, &do_count, "Print number of messages", NULL},
78 { "version", 0, arg_flag, &do_version, "Print version",
79 NULL },
80 { "help", 0, arg_flag, &do_help, NULL,
81 NULL }
85 static void
86 usage (int ret)
88 arg_printusage (args,
89 sizeof(args) / sizeof(args[0]),
90 NULL,
91 "[[{po:username[@hostname] | hostname[:username]}] ...] "
92 "filename");
93 exit (ret);
96 static int
97 do_connect (const char *hostname, int port, int nodelay)
99 struct addrinfo *ai, *a;
100 struct addrinfo hints;
101 int error;
102 int s = -1;
103 char portstr[NI_MAXSERV];
105 memset (&hints, 0, sizeof(hints));
106 hints.ai_socktype = SOCK_STREAM;
107 hints.ai_protocol = IPPROTO_TCP;
109 snprintf (portstr, sizeof(portstr), "%u", ntohs(port));
111 error = getaddrinfo (hostname, portstr, &hints, &ai);
112 if (error)
113 errx (1, "getaddrinfo(%s): %s", hostname, gai_strerror(error));
115 for (a = ai; a != NULL; a = a->ai_next) {
116 s = socket (a->ai_family, a->ai_socktype, a->ai_protocol);
117 if (s < 0)
118 continue;
119 if (connect (s, a->ai_addr, a->ai_addrlen) < 0) {
120 warn ("connect(%s)", hostname);
121 close (s);
122 continue;
124 break;
126 freeaddrinfo (ai);
127 if (a == NULL) {
128 warnx ("failed to contact %s", hostname);
129 return -1;
132 if(setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
133 (void *)&nodelay, sizeof(nodelay)) < 0)
134 err (1, "setsockopt TCP_NODELAY");
135 return s;
138 typedef enum { INIT = 0, GREET, USER, PASS, STAT, RETR, TOP,
139 DELE, XDELE, QUIT} pop_state;
141 static char *pop_state_string[] = {
142 "INIT", "GREET", "USER", "PASS", "STAT", "RETR", "TOP",
143 "DELE", "XDELE", "QUIT"
146 #define PUSH_BUFSIZ 65536
148 #define STEP 16
150 struct write_state {
151 struct iovec *iovecs;
152 size_t niovecs, maxiovecs, allociovecs;
153 int fd;
156 static void
157 write_state_init (struct write_state *w, int fd)
159 #ifdef UIO_MAXIOV
160 w->maxiovecs = UIO_MAXIOV;
161 #else
162 w->maxiovecs = 16;
163 #endif
164 w->allociovecs = min(STEP, w->maxiovecs);
165 w->niovecs = 0;
166 w->iovecs = emalloc(w->allociovecs * sizeof(*w->iovecs));
167 w->fd = fd;
170 static void
171 write_state_add (struct write_state *w, void *v, size_t len)
173 if(w->niovecs == w->allociovecs) {
174 if(w->niovecs == w->maxiovecs) {
175 if(writev (w->fd, w->iovecs, w->niovecs) < 0)
176 err(1, "writev");
177 w->niovecs = 0;
178 } else {
179 w->allociovecs = min(w->allociovecs + STEP, w->maxiovecs);
180 w->iovecs = erealloc (w->iovecs,
181 w->allociovecs * sizeof(*w->iovecs));
184 w->iovecs[w->niovecs].iov_base = v;
185 w->iovecs[w->niovecs].iov_len = len;
186 ++w->niovecs;
189 static void
190 write_state_flush (struct write_state *w)
192 if (w->niovecs) {
193 if (writev (w->fd, w->iovecs, w->niovecs) < 0)
194 err (1, "writev");
195 w->niovecs = 0;
199 static void
200 write_state_destroy (struct write_state *w)
202 free (w->iovecs);
205 static int
206 doit(int s,
207 const char *host,
208 const char *user,
209 const char *outfilename,
210 const char *header_str,
211 int leavep,
212 int verbose,
213 int forkp)
215 int ret;
216 char out_buf[PUSH_BUFSIZ];
217 int out_len = 0;
218 char *in_buf;
219 size_t in_buf_size;
220 size_t in_len = 0;
221 char *in_ptr;
222 pop_state state = INIT;
223 unsigned count, bytes;
224 unsigned asked_for = 0, retrieved = 0, asked_deleted = 0, deleted = 0;
225 unsigned sent_xdele = 0;
226 int out_fd;
227 char from_line[128];
228 size_t from_line_length;
229 time_t now;
230 struct write_state write_state;
231 int numheaders = 1;
232 char **headers = NULL;
233 int i;
234 char *tmp = NULL;
236 in_buf = emalloc(PUSH_BUFSIZ + 1);
237 in_ptr = in_buf;
238 in_buf_size = PUSH_BUFSIZ;
240 if (do_from) {
241 char *tmp2;
243 tmp2 = tmp = estrdup(header_str);
245 out_fd = -1;
246 if (verbose)
247 fprintf (stderr, "%s@%s\n", user, host);
248 while (*tmp != '\0') {
249 tmp = strchr(tmp, ',');
250 if (tmp == NULL)
251 break;
252 tmp++;
253 numheaders++;
256 headers = emalloc(sizeof(char *) * (numheaders + 1));
257 for (i = 0; i < numheaders; i++) {
258 headers[i] = strtok_r(tmp2, ",", &tmp2);
260 headers[numheaders] = NULL;
261 } else {
262 out_fd = open(outfilename, O_WRONLY | O_APPEND | O_CREAT, 0666);
263 if (out_fd < 0)
264 err (1, "open %s", outfilename);
265 if (verbose)
266 fprintf (stderr, "%s@%s -> %s\n", user, host, outfilename);
269 now = time(NULL);
270 from_line_length = snprintf (from_line, sizeof(from_line),
271 "From %s %s", "push", ctime(&now));
272 if (from_line_length < 0 || from_line_length > sizeof(from_line))
273 errx (1, "snprintf failed");
275 out_len = snprintf (out_buf, sizeof(out_buf),
276 "USER %s\r\nPASS hej\r\nSTAT\r\n",
277 user);
278 if (out_len < 0 || out_len > sizeof(out_buf))
279 errx (1, "snprintf failed");
280 if (net_write (s, out_buf, out_len) != out_len)
281 err (1, "write");
282 if (verbose > 1)
283 fprintf (stderr, "%s", out_buf);
285 if (!do_from)
286 write_state_init (&write_state, out_fd);
288 while(state != QUIT) {
289 fd_set readset, writeset;
291 FD_ZERO(&readset);
292 FD_ZERO(&writeset);
293 if (s >= FD_SETSIZE)
294 errx (1, "fd too large");
295 FD_SET(s,&readset);
297 if (verbose > 1)
298 fprintf (stderr, "state: %s count: %d asked_for: %d "
299 "retrieved: %d asked_deleted: %d\n",
300 pop_state_string[state],
301 count, asked_for, retrieved, asked_deleted);
303 if (((state == STAT || state == RETR || state == TOP)
304 && asked_for < count)
305 || (state == XDELE && !sent_xdele)
306 || (state == DELE && asked_deleted < count))
307 FD_SET(s,&writeset);
308 ret = select (s + 1, &readset, &writeset, NULL, NULL);
309 if (ret < 0) {
310 if (errno == EAGAIN)
311 continue;
312 else
313 err (1, "select");
316 if (FD_ISSET(s, &readset)) {
317 char *beg, *p;
318 size_t rem;
319 int blank_line = 0;
321 if(in_len >= in_buf_size) {
322 char *tmp = erealloc(in_buf, in_buf_size + PUSH_BUFSIZ + 1);
323 in_ptr = tmp + (in_ptr - in_buf);
324 in_buf = tmp;
325 in_buf_size += PUSH_BUFSIZ;
328 ret = read (s, in_ptr, in_buf_size - in_len);
329 if (ret < 0)
330 err (1, "read");
331 else if (ret == 0)
332 errx (1, "EOF during read");
334 in_len += ret;
335 in_ptr += ret;
336 *in_ptr = '\0';
338 beg = in_buf;
339 rem = in_len;
340 while(rem > 1
341 && (p = strstr(beg, "\r\n")) != NULL) {
342 if (state == TOP) {
343 char *copy = beg;
345 for (i = 0; i < numheaders; i++) {
346 size_t len;
348 len = min(p - copy + 1, strlen(headers[i]));
349 if (strncasecmp(copy, headers[i], len) == 0) {
350 fprintf (stdout, "%.*s\n", (int)(p - copy), copy);
353 if (beg[0] == '.' && beg[1] == '\r' && beg[2] == '\n') {
354 if (numheaders > 1)
355 fprintf (stdout, "\n");
356 state = STAT;
357 if (++retrieved == count) {
358 state = QUIT;
359 net_write (s, "QUIT\r\n", 6);
360 if (verbose > 1)
361 fprintf (stderr, "QUIT\r\n");
364 rem -= p - beg + 2;
365 beg = p + 2;
366 } else if (state == RETR) {
367 char *copy = beg;
368 if (beg[0] == '.') {
369 if (beg[1] == '\r' && beg[2] == '\n') {
370 if(!blank_line)
371 write_state_add(&write_state, "\n", 1);
372 state = STAT;
373 rem -= p - beg + 2;
374 beg = p + 2;
375 if (++retrieved == count) {
376 write_state_flush (&write_state);
377 if (fsync (out_fd) < 0)
378 err (1, "fsync");
379 close(out_fd);
380 if (leavep) {
381 state = QUIT;
382 net_write (s, "QUIT\r\n", 6);
383 if (verbose > 1)
384 fprintf (stderr, "QUIT\r\n");
385 } else {
386 if (forkp) {
387 pid_t pid;
389 pid = fork();
390 if (pid < 0)
391 warn ("fork");
392 else if(pid != 0) {
393 if(verbose)
394 fprintf (stderr,
395 "(exiting)");
396 return 0;
400 state = XDELE;
401 if (verbose)
402 fprintf (stderr, "deleting... ");
405 continue;
406 } else
407 ++copy;
409 *p = '\n';
410 if(blank_line &&
411 strncmp(copy, "From ", min(p - copy + 1, 5)) == 0)
412 write_state_add(&write_state, ">", 1);
413 write_state_add(&write_state, copy, p - copy + 1);
414 blank_line = (*copy == '\n');
415 rem -= p - beg + 2;
416 beg = p + 2;
417 } else if (rem >= 3 && strncmp (beg, "+OK", 3) == 0) {
418 if (state == STAT) {
419 if (!do_from)
420 write_state_add(&write_state,
421 from_line, from_line_length);
422 blank_line = 0;
423 if (do_from)
424 state = TOP;
425 else
426 state = RETR;
427 } else if (state == XDELE) {
428 state = QUIT;
429 net_write (s, "QUIT\r\n", 6);
430 if (verbose > 1)
431 fprintf (stderr, "QUIT\r\n");
432 break;
433 } else if (state == DELE) {
434 if (++deleted == count) {
435 state = QUIT;
436 net_write (s, "QUIT\r\n", 6);
437 if (verbose > 1)
438 fprintf (stderr, "QUIT\r\n");
439 break;
441 } else if (++state == STAT) {
442 if(sscanf (beg + 4, "%u %u", &count, &bytes) != 2)
443 errx(1, "Bad STAT-line: %.*s", (int)(p - beg), beg);
444 if (verbose) {
445 fprintf (stderr, "%u message(s) (%u bytes). "
446 "fetching... ",
447 count, bytes);
448 if (do_from)
449 fprintf (stderr, "\n");
450 } else if (do_count) {
451 fprintf (stderr, "%u message(s) (%u bytes).\n",
452 count, bytes);
454 if (count == 0) {
455 state = QUIT;
456 net_write (s, "QUIT\r\n", 6);
457 if (verbose > 1)
458 fprintf (stderr, "QUIT\r\n");
459 break;
463 rem -= p - beg + 2;
464 beg = p + 2;
465 } else {
466 if(state == XDELE) {
467 state = DELE;
468 rem -= p - beg + 2;
469 beg = p + 2;
470 } else
471 errx (1, "Bad response: %.*s", (int)(p - beg), beg);
474 if (!do_from)
475 write_state_flush (&write_state);
477 memmove (in_buf, beg, rem);
478 in_len = rem;
479 in_ptr = in_buf + rem;
481 if (FD_ISSET(s, &writeset)) {
482 if ((state == STAT && !do_from) || state == RETR)
483 out_len = snprintf (out_buf, sizeof(out_buf),
484 "RETR %u\r\n", ++asked_for);
485 else if ((state == STAT && do_from) || state == TOP)
486 out_len = snprintf (out_buf, sizeof(out_buf),
487 "TOP %u 0\r\n", ++asked_for);
488 else if(state == XDELE) {
489 out_len = snprintf(out_buf, sizeof(out_buf),
490 "XDELE %u %u\r\n", 1, count);
491 sent_xdele++;
493 else if(state == DELE)
494 out_len = snprintf (out_buf, sizeof(out_buf),
495 "DELE %u\r\n", ++asked_deleted);
496 if (out_len < 0 || out_len > sizeof(out_buf))
497 errx (1, "snprintf failed");
498 if (net_write (s, out_buf, out_len) != out_len)
499 err (1, "write");
500 if (verbose > 1)
501 fprintf (stderr, "%s", out_buf);
504 if (verbose)
505 fprintf (stderr, "Done\n");
506 if (do_from) {
507 free (tmp);
508 free (headers);
509 } else {
510 write_state_destroy (&write_state);
512 return 0;
515 #ifdef KRB5
516 static int
517 do_v5 (const char *host,
518 int port,
519 const char *user,
520 const char *filename,
521 const char *header_str,
522 int leavep,
523 int verbose,
524 int forkp)
526 krb5_error_code ret;
527 krb5_auth_context auth_context = NULL;
528 krb5_principal server;
529 int s;
531 s = do_connect (host, port, 1);
532 if (s < 0)
533 return 1;
535 ret = krb5_sname_to_principal (context,
536 host,
537 "pop",
538 KRB5_NT_SRV_HST,
539 &server);
540 if (ret) {
541 warnx ("krb5_sname_to_principal: %s",
542 krb5_get_err_text (context, ret));
543 return 1;
546 ret = krb5_sendauth (context,
547 &auth_context,
549 "KPOPV1.0",
550 NULL,
551 server,
553 NULL,
554 NULL,
555 NULL,
556 NULL,
557 NULL,
558 NULL);
559 krb5_free_principal (context, server);
560 if (ret) {
561 warnx ("krb5_sendauth: %s",
562 krb5_get_err_text (context, ret));
563 return 1;
565 return doit (s, host, user, filename, header_str, leavep, verbose, forkp);
567 #endif
569 #ifdef KRB4
570 static int
571 do_v4 (const char *host,
572 int port,
573 const char *user,
574 const char *filename,
575 const char *header_str,
576 int leavep,
577 int verbose,
578 int forkp)
580 KTEXT_ST ticket;
581 MSG_DAT msg_data;
582 CREDENTIALS cred;
583 des_key_schedule sched;
584 int s;
585 int ret;
587 s = do_connect (host, port, 1);
588 if (s < 0)
589 return 1;
590 ret = krb_sendauth(0,
592 &ticket,
593 "pop",
594 (char *)host,
595 krb_realmofhost(host),
596 getpid(),
597 &msg_data,
598 &cred,
599 sched,
600 NULL,
601 NULL,
602 "KPOPV0.1");
603 if(ret) {
604 warnx("krb_sendauth: %s", krb_get_err_text(ret));
605 return 1;
607 return doit (s, host, user, filename, header_str, leavep, verbose, forkp);
609 #endif /* KRB4 */
611 #ifdef HESIOD
613 #ifdef HESIOD_INTERFACES
615 static char *
616 hesiod_get_pobox (const char **user)
618 void *context;
619 struct hesiod_postoffice *hpo;
620 char *ret = NULL;
622 if(hesiod_init (&context) != 0)
623 err (1, "hesiod_init");
625 hpo = hesiod_getmailhost (context, *user);
626 if (hpo == NULL) {
627 warn ("hesiod_getmailhost %s", *user);
628 } else {
629 if (strcasecmp(hpo->hesiod_po_type, "pop") != 0)
630 errx (1, "Unsupported po type %s", hpo->hesiod_po_type);
632 ret = estrdup(hpo->hesiod_po_host);
633 *user = estrdup(hpo->hesiod_po_name);
634 hesiod_free_postoffice (context, hpo);
636 hesiod_end (context);
637 return ret;
640 #else /* !HESIOD_INTERFACES */
642 static char *
643 hesiod_get_pobox (const char **user)
645 char *ret = NULL;
646 struct hes_postoffice *hpo;
648 hpo = hes_getmailhost (*user);
649 if (hpo == NULL) {
650 warn ("hes_getmailhost %s", *user);
651 } else {
652 if (strcasecmp(hpo->po_type, "pop") != 0)
653 errx (1, "Unsupported po type %s", hpo->po_type);
655 ret = estrdup(hpo->po_host);
656 *user = estrdup(hpo->po_name);
658 return ret;
661 #endif /* HESIOD_INTERFACES */
663 #endif /* HESIOD */
665 static char *
666 get_pobox (const char **user)
668 char *ret = NULL;
670 #ifdef HESIOD
671 ret = hesiod_get_pobox (user);
672 #endif
674 if (ret == NULL)
675 ret = getenv("MAILHOST");
676 if (ret == NULL)
677 errx (1, "MAILHOST not set");
678 return ret;
681 static void
682 parse_pobox (char *a0, const char **host, const char **user)
684 const char *h, *u;
685 char *p;
686 int po = 0;
688 if (a0 == NULL) {
690 *user = getenv ("USERNAME");
691 if (*user == NULL) {
692 struct passwd *pwd = getpwuid (getuid ());
694 if (pwd == NULL)
695 errx (1, "Who are you?");
696 *user = estrdup (pwd->pw_name);
698 *host = get_pobox (user);
699 return;
702 /* if the specification starts with po:, remember this information */
703 if(strncmp(a0, "po:", 3) == 0) {
704 a0 += 3;
705 po++;
707 /* if there is an `@', the hostname is after it, otherwise at the
708 beginning of the string */
709 p = strchr(a0, '@');
710 if(p != NULL) {
711 *p++ = '\0';
712 h = p;
713 } else {
714 h = a0;
716 /* if there is a `:', the username comes before it, otherwise at
717 the beginning of the string */
718 p = strchr(a0, ':');
719 if(p != NULL) {
720 *p++ = '\0';
721 u = p;
722 } else {
723 u = a0;
725 if(h == u) {
726 /* some inconsistent compatibility with various mailers */
727 if(po) {
728 h = get_pobox (&u);
729 } else {
730 u = get_default_username ();
731 if (u == NULL)
732 errx (1, "Who are you?");
735 *host = h;
736 *user = u;
740 main(int argc, char **argv)
742 int port = 0;
743 int optind = 0;
744 int ret = 1;
745 const char *host, *user, *filename = NULL;
746 char *pobox = NULL;
748 setprogname (argv[0]);
750 #ifdef KRB5
752 krb5_error_code ret;
754 ret = krb5_init_context (&context);
755 if (ret)
756 errx (1, "krb5_init_context failed: %d", ret);
758 #endif
760 if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
761 &optind))
762 usage (1);
764 argc -= optind;
765 argv += optind;
767 #if defined(KRB4) && defined(KRB5)
768 if(use_v4 == -1 && use_v5 == 1)
769 use_v4 = 0;
770 if(use_v5 == -1 && use_v4 == 1)
771 use_v5 = 0;
772 #endif
774 if (do_help)
775 usage (0);
777 if (do_version) {
778 print_version(NULL);
779 return 0;
782 if (do_from && header_str == NULL)
783 header_str = "From:";
784 else if (header_str != NULL)
785 do_from = 1;
787 if (do_from) {
788 if (argc == 0)
789 pobox = NULL;
790 else if (argc == 1)
791 pobox = argv[0];
792 else
793 usage (1);
794 } else {
795 if (argc == 1) {
796 filename = argv[0];
797 pobox = NULL;
798 } else if (argc == 2) {
799 filename = argv[1];
800 pobox = argv[0];
801 } else
802 usage (1);
805 if (port_str) {
806 struct servent *s = roken_getservbyname (port_str, "tcp");
808 if (s)
809 port = s->s_port;
810 else {
811 char *ptr;
813 port = strtol (port_str, &ptr, 10);
814 if (port == 0 && ptr == port_str)
815 errx (1, "Bad port `%s'", port_str);
816 port = htons(port);
819 if (port == 0) {
820 #ifdef KRB5
821 port = krb5_getportbyname (context, "kpop", "tcp", 1109);
822 #elif defined(KRB4)
823 port = k_getportbyname ("kpop", "tcp", htons(1109));
824 #else
825 #error must define KRB4 or KRB5
826 #endif
829 parse_pobox (pobox, &host, &user);
831 #ifdef KRB5
832 if (ret && use_v5) {
833 ret = do_v5 (host, port, user, filename, header_str,
834 do_leave, verbose_level, do_fork);
836 #endif
838 #ifdef KRB4
839 if (ret && use_v4) {
840 ret = do_v4 (host, port, user, filename, header_str,
841 do_leave, verbose_level, do_fork);
843 #endif /* KRB4 */
844 return ret;