-#ifdef KERBEROS
-try_connect:
- if (use_kerberos) {
- struct hostent *hp;
-
- /* fully qualify hostname (needed for krb_realmofhost) */
- hp = gethostbyname(host);
- if (hp != NULL && !(host = strdup(hp->h_name)))
- err(1, NULL);
-
- rem = KSUCCESS;
- errno = 0;
- if (dest_realm == NULL)
- dest_realm = krb_realmofhost(host);
-
-#ifdef CRYPT
- if (doencrypt)
- rem = krcmd_mutual(&host, sp->s_port, user, args,
- &rfd2, dest_realm, &cred, schedule);
- else
-#endif
- rem = krcmd(&host, sp->s_port, user, args, &rfd2,
- dest_realm);
- if (rem < 0) {
- use_kerberos = 0;
- sp = getservbyname("shell", "tcp");
- if (sp == NULL)
- errx(1, "shell/tcp: unknown service");
- if (errno == ECONNREFUSED)
- warning("remote host doesn't support Kerberos");
- if (errno == ENOENT)
- warning("can't provide Kerberos auth data");
- goto try_connect;
- }
- } else {
- if (doencrypt)
- errx(1, "the -x flag requires Kerberos authentication");
- rem = rcmd(&host, sp->s_port, pw->pw_name, user, args, &rfd2);
+ if (timeout) {
+ signal(SIGALRM, connect_timeout);
+ alarm(timeout);
+ }
+ rem = rcmd_af(&host, sp->s_port, pw->pw_name, user, args, &rfd2,
+ family);
+ if (timeout) {
+ signal(SIGALRM, SIG_DFL);
+ alarm(0);