rcp.c (46057) | rcp.c (48560) |
---|---|
1/* 2 * Copyright (c) 1983, 1990, 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)rcp.c 8.2 (Berkeley) 4/2/94"; 43#endif 44static const char rcsid[] = | 1/* 2 * Copyright (c) 1983, 1990, 1992, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)rcp.c 8.2 (Berkeley) 4/2/94"; 43#endif 44static const char rcsid[] = |
45 "$Id: rcp.c,v 1.21 1998/10/09 06:31:45 markm Exp $"; | 45 "$Id: rcp.c,v 1.22 1999/04/25 10:36:00 dt Exp $"; |
46#endif /* not lint */ 47 48#include <sys/param.h> 49#include <sys/stat.h> 50#include <sys/time.h> 51#include <sys/socket.h> 52#include <netinet/in.h> 53#include <netinet/in_systm.h> --- 62 unchanged lines hidden (view full) --- 116void usage __P((void)); 117 118int 119main(argc, argv) 120 int argc; 121 char *argv[]; 122{ 123 struct servent *sp; | 46#endif /* not lint */ 47 48#include <sys/param.h> 49#include <sys/stat.h> 50#include <sys/time.h> 51#include <sys/socket.h> 52#include <netinet/in.h> 53#include <netinet/in_systm.h> --- 62 unchanged lines hidden (view full) --- 116void usage __P((void)); 117 118int 119main(argc, argv) 120 int argc; 121 char *argv[]; 122{ 123 struct servent *sp; |
124 int ch, fflag, tflag; | 124 int ch, fflag, i, tflag; |
125 char *targ, *shell; | 125 char *targ, *shell; |
126 int i; | |
127#ifdef KERBEROS 128 char *k; 129#endif 130 131 /* 132 * Prepare for execing ourselves. 133 */ | 126#ifdef KERBEROS 127 char *k; 128#endif 129 130 /* 131 * Prepare for execing ourselves. 132 */ |
134 | |
135 argc_copy = argc + 1; 136 argv_copy = malloc((argc_copy + 1) * sizeof(*argv_copy)); 137 if (argv_copy == NULL) 138 err(1, "malloc"); 139 argv_copy[0] = argv[0]; 140 argv_copy[1] = "-K"; | 133 argc_copy = argc + 1; 134 argv_copy = malloc((argc_copy + 1) * sizeof(*argv_copy)); 135 if (argv_copy == NULL) 136 err(1, "malloc"); 137 argv_copy[0] = argv[0]; 138 argv_copy[1] = "-K"; |
141 for(i = 1; i < argc; ++i) { | 139 for (i = 1; i < argc; ++i) { |
142 argv_copy[i + 1] = strdup(argv[i]); 143 if (argv_copy[i + 1] == NULL) 144 errx(1, "strdup: out of memory"); 145 } 146 argv_copy[argc + 1] = NULL; 147 148 fflag = tflag = 0; 149 while ((ch = getopt(argc, argv, OPTIONS)) != -1) --- 669 unchanged lines hidden (view full) --- 819 krcmd(host, port, user, bp, 0, dest_realm); 820 821 if (rem < 0) { 822 if (errno == ECONNREFUSED) 823 oldw("remote host doesn't support Kerberos"); 824 else if (errno == ENOENT) 825 oldw("can't provide Kerberos authentication data"); 826 execv(_PATH_RCP, argv_copy); | 140 argv_copy[i + 1] = strdup(argv[i]); 141 if (argv_copy[i + 1] == NULL) 142 errx(1, "strdup: out of memory"); 143 } 144 argv_copy[argc + 1] = NULL; 145 146 fflag = tflag = 0; 147 while ((ch = getopt(argc, argv, OPTIONS)) != -1) --- 669 unchanged lines hidden (view full) --- 817 krcmd(host, port, user, bp, 0, dest_realm); 818 819 if (rem < 0) { 820 if (errno == ECONNREFUSED) 821 oldw("remote host doesn't support Kerberos"); 822 else if (errno == ENOENT) 823 oldw("can't provide Kerberos authentication data"); 824 execv(_PATH_RCP, argv_copy); |
825 err(1, "execv: %s", _PATH_RCP); |
|
827 } 828 } else { 829#ifdef CRYPT 830 if (doencrypt) 831 errx(1, 832 "the -x option requires Kerberos authentication"); 833#endif 834 rem = rcmd(host, port, locuser, user, bp, 0); --- 119 unchanged lines hidden --- | 826 } 827 } else { 828#ifdef CRYPT 829 if (doencrypt) 830 errx(1, 831 "the -x option requires Kerberos authentication"); 832#endif 833 rem = rcmd(host, port, locuser, user, bp, 0); --- 119 unchanged lines hidden --- |