diff options
author | Ezra Peisach <epeisach@mit.edu> | 1995-11-02 21:18:58 +0000 |
---|---|---|
committer | Ezra Peisach <epeisach@mit.edu> | 1995-11-02 21:18:58 +0000 |
commit | c3cf075a1673640ad9d31f02ff6a1b2e14dc86ce (patch) | |
tree | b7fe74f7d6bcf908c012d42fe769c80eb2a9812b /src/appl/bsd/krcp.c | |
parent | a94eba01951fee60833ef2d42f3e224ba23cc2dc (diff) | |
download | krb5-c3cf075a1673640ad9d31f02ff6a1b2e14dc86ce.tar.gz krb5-c3cf075a1673640ad9d31f02ff6a1b2e14dc86ce.tar.xz krb5-c3cf075a1673640ad9d31f02ff6a1b2e14dc86ce.zip |
If invoked with the -D port option, do not die if proper entry is missing
from /etc/services...
This is for the dejagnu suite running on a machine following the installation
instructions - i.e. make, make check.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7010 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/appl/bsd/krcp.c')
-rw-r--r-- | src/appl/bsd/krcp.c | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c index c5e0c8afc..42bb65591 100644 --- a/src/appl/bsd/krcp.c +++ b/src/appl/bsd/krcp.c @@ -117,7 +117,7 @@ int pflag; int forcenet; struct passwd *pwd; int userid; -int port; +int port = 0; struct buffer { int cnt; @@ -153,25 +153,12 @@ main(argc, argv) int euid; char **orig_argv = save_argv(argc, argv); - sp = getservbyname("kshell", "tcp"); krb5_init_context(&bsd_context); krb5_init_ets(bsd_context); desinbuf.data = des_inbuf; desoutbuf.data = des_outbuf; /* Set up des buffers */ -#else - sp = getservbyname("shell", "tcp"); -#endif /* KERBEROS */ - - if (sp == NULL) { -#ifdef KERBEROS - fprintf(stderr, "rcp: kshell/tcp: unknown service\n"); - try_normal(orig_argv); -#else - fprintf(stderr, "rcp: shell/tcp: unknown service\n"); - exit(1); -#endif /* KERBEROS */ - } - port = sp->s_port; +#endif + pwd = getpwuid(userid = getuid()); if (pwd == 0) { fprintf(stderr, "who are you?\n"); @@ -271,6 +258,27 @@ main(argc, argv) if (argc > 2) targetshouldbedirectory = 1; rem = -1; + + + if (port == 0) { +#ifdef KERBEROS + sp = getservbyname("kshell", "tcp"); +#else + sp = getservbyname("shell", "tcp"); +#endif /* KERBEROS */ + + if (sp == NULL) { +#ifdef KERBEROS + fprintf(stderr, "rcp: kshell/tcp: unknown service\n"); + try_normal(orig_argv); +#else + fprintf(stderr, "rcp: shell/tcp: unknown service\n"); + exit(1); +#endif /* KERBEROS */ + } + port = sp->s_port; + } + #ifdef KERBEROS if (krb_realm != NULL) cmdsiz += strlen(krb_realm); |