scp.c (294328) | scp.c (294332) |
---|---|
1/* $OpenBSD: scp.c,v 1.180 2014/06/24 02:21:01 djm Exp $ */ | 1/* $OpenBSD: scp.c,v 1.181 2015/01/16 06:40:12 deraadt Exp $ */ |
2/* 3 * scp - secure remote copy. This is basically patched BSD rcp which 4 * uses ssh to do the data transfer (instead of using rcmd). 5 * 6 * NOTE: This version should NOT be suid root. (This uses ssh to 7 * do the transfer and ssh has the necessary privileges.) 8 * 9 * 1995 Timo Rinne <tri@iki.fi>, Tatu Ylonen <ylo@cs.hut.fi> --- 80 unchanged lines hidden (view full) --- 90#endif 91#include <sys/wait.h> 92#include <sys/uio.h> 93 94#include <ctype.h> 95#include <dirent.h> 96#include <errno.h> 97#include <fcntl.h> | 2/* 3 * scp - secure remote copy. This is basically patched BSD rcp which 4 * uses ssh to do the data transfer (instead of using rcmd). 5 * 6 * NOTE: This version should NOT be suid root. (This uses ssh to 7 * do the transfer and ssh has the necessary privileges.) 8 * 9 * 1995 Timo Rinne <tri@iki.fi>, Tatu Ylonen <ylo@cs.hut.fi> --- 80 unchanged lines hidden (view full) --- 90#endif 91#include <sys/wait.h> 92#include <sys/uio.h> 93 94#include <ctype.h> 95#include <dirent.h> 96#include <errno.h> 97#include <fcntl.h> |
98#include <limits.h> |
|
98#include <pwd.h> 99#include <signal.h> 100#include <stdarg.h> 101#include <stdio.h> 102#include <stdlib.h> 103#include <string.h> 104#include <time.h> 105#include <unistd.h> --- 638 unchanged lines hidden (view full) --- 744source(int argc, char **argv) 745{ 746 struct stat stb; 747 static BUF buffer; 748 BUF *bp; 749 off_t i, statbytes; 750 size_t amt, nr; 751 int fd = -1, haderr, indx; | 99#include <pwd.h> 100#include <signal.h> 101#include <stdarg.h> 102#include <stdio.h> 103#include <stdlib.h> 104#include <string.h> 105#include <time.h> 106#include <unistd.h> --- 638 unchanged lines hidden (view full) --- 745source(int argc, char **argv) 746{ 747 struct stat stb; 748 static BUF buffer; 749 BUF *bp; 750 off_t i, statbytes; 751 size_t amt, nr; 752 int fd = -1, haderr, indx; |
752 char *last, *name, buf[2048], encname[MAXPATHLEN]; | 753 char *last, *name, buf[2048], encname[PATH_MAX]; |
753 int len; 754 755 for (indx = 0; indx < argc; ++indx) { 756 name = argv[indx]; 757 statbytes = 0; 758 len = strlen(name); 759 while (len > 1 && name[len-1] == '/') 760 name[--len] = '\0'; --- 92 unchanged lines hidden (view full) --- 853 } 854} 855 856void 857rsource(char *name, struct stat *statp) 858{ 859 DIR *dirp; 860 struct dirent *dp; | 754 int len; 755 756 for (indx = 0; indx < argc; ++indx) { 757 name = argv[indx]; 758 statbytes = 0; 759 len = strlen(name); 760 while (len > 1 && name[len-1] == '/') 761 name[--len] = '\0'; --- 92 unchanged lines hidden (view full) --- 854 } 855} 856 857void 858rsource(char *name, struct stat *statp) 859{ 860 DIR *dirp; 861 struct dirent *dp; |
861 char *last, *vect[1], path[MAXPATHLEN]; | 862 char *last, *vect[1], path[PATH_MAX]; |
862 863 if (!(dirp = opendir(name))) { 864 run_err("%s: %s", name, strerror(errno)); 865 return; 866 } 867 last = strrchr(name, '/'); 868 if (last == 0) 869 last = name; --- 481 unchanged lines hidden --- | 863 864 if (!(dirp = opendir(name))) { 865 run_err("%s: %s", name, strerror(errno)); 866 return; 867 } 868 last = strrchr(name, '/'); 869 if (last == 0) 870 last = name; --- 481 unchanged lines hidden --- |