summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-05-03 23:39:53 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-05-03 23:39:53 +0000
commit4529b70b4ca28e6f2120a834c88b3ee2bc2e43f5 (patch)
tree26c2d88d7d8ccf6961373455b68e1e087c211c7b
parent3524d697374a37d39e971d96c33080c307304820 (diff)
- mouring@cvs.openbsd.org 2001/05/03 23:09:53
[misc.c misc.h scp.c sftp.c] Move colon() and cleanhost() to misc.c where I should I have put it in the first place
-rw-r--r--ChangeLog6
-rw-r--r--Makefile.in10
-rw-r--r--misc.c37
-rw-r--r--misc.h6
-rw-r--r--scp-common.c98
-rw-r--r--scp-common.h64
-rw-r--r--scp.c3
-rw-r--r--sftp.c5
8 files changed, 53 insertions, 176 deletions
diff --git a/ChangeLog b/ChangeLog
index 46729c616..78c1713c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,10 @@
9 - stevesk@cvs.openbsd.org 2001/05/03 21:43:01 9 - stevesk@cvs.openbsd.org 2001/05/03 21:43:01
10 [servconf.c] 10 [servconf.c]
11 remove "\n" from fatal() 11 remove "\n" from fatal()
12 - mouring@cvs.openbsd.org 2001/05/03 23:09:53
13 [misc.c misc.h scp.c sftp.c]
14 Move colon() and cleanhost() to misc.c where I should I have put it in
15 the first place
12 - (bal) Updated Cygwin README by Corinna Vinschen <vinschen@redhat.com> 16 - (bal) Updated Cygwin README by Corinna Vinschen <vinschen@redhat.com>
13 - (bal) Avoid socket file security issues in ssh-agent for Cygwin. 17 - (bal) Avoid socket file security issues in ssh-agent for Cygwin.
14 Patch by Egor Duda <deo@logos-m.ru> 18 Patch by Egor Duda <deo@logos-m.ru>
@@ -5323,4 +5327,4 @@
5323 - Wrote replacements for strlcpy and mkdtemp 5327 - Wrote replacements for strlcpy and mkdtemp
5324 - Released 1.0pre1 5328 - Released 1.0pre1
5325 5329
5326$Id: ChangeLog,v 1.1195 2001/05/03 22:59:24 mouring Exp $ 5330$Id: ChangeLog,v 1.1196 2001/05/03 23:39:53 mouring Exp $
diff --git a/Makefile.in b/Makefile.in
index dda7b48fc..3bb432e18 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,4 +1,4 @@
1# $Id: Makefile.in,v 1.174 2001/04/27 00:31:08 mouring Exp $ 1# $Id: Makefile.in,v 1.175 2001/05/03 23:39:54 mouring Exp $
2 2
3prefix=@prefix@ 3prefix=@prefix@
4exec_prefix=@exec_prefix@ 4exec_prefix=@exec_prefix@
@@ -98,8 +98,8 @@ ssh$(EXEEXT): $(LIBCOMPAT) libssh.a $(SSHOBJS)
98sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS) 98sshd$(EXEEXT): libssh.a $(LIBCOMPAT) $(SSHDOBJS)
99 $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) 99 $(LD) -o $@ $(SSHDOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
100 100
101scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o scp-common.o 101scp$(EXEEXT): $(LIBCOMPAT) libssh.a scp.o
102 $(LD) -o $@ scp.o scp-common.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) 102 $(LD) -o $@ scp.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
103 103
104ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o 104ssh-add$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-add.o
105 $(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) 105 $(LD) -o $@ ssh-add.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
@@ -116,8 +116,8 @@ ssh-keyscan$(EXEEXT): $(LIBCOMPAT) libssh.a ssh-keyscan.o
116sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o 116sftp-server$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-common.o sftp-server.o
117 $(LD) -o $@ sftp-server.o sftp-common.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) 117 $(LD) -o $@ sftp-server.o sftp-common.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
118 118
119sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-int.o sftp-common.o sftp-glob.o scp-common.o 119sftp$(EXEEXT): $(LIBCOMPAT) libssh.a sftp.o sftp-client.o sftp-int.o sftp-common.o sftp-glob.o
120 $(LD) -o $@ sftp.o sftp-client.o sftp-common.o sftp-int.o sftp-glob.o scp-common.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS) 120 $(LD) -o $@ sftp.o sftp-client.o sftp-common.o sftp-int.o sftp-glob.o $(LDFLAGS) -lssh -lopenbsd-compat $(LIBS)
121 121
122# test driver for the loginrec code - not built by default 122# test driver for the loginrec code - not built by default
123logintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o 123logintest: logintest.o $(LIBCOMPAT) libssh.a loginrec.o
diff --git a/misc.c b/misc.c
index feeacb859..e949ded89 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.c,v 1.5 2001/04/12 20:09:37 stevesk Exp $ */ 1/* $OpenBSD: misc.c,v 1.6 2001/05/03 23:09:52 mouring Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000 Markus Friedl. All rights reserved.
@@ -25,7 +25,7 @@
25 */ 25 */
26 26
27#include "includes.h" 27#include "includes.h"
28RCSID("$OpenBSD: misc.c,v 1.5 2001/04/12 20:09:37 stevesk Exp $"); 28RCSID("$OpenBSD: misc.c,v 1.6 2001/05/03 23:09:52 mouring Exp $");
29 29
30#include "misc.h" 30#include "misc.h"
31#include "log.h" 31#include "log.h"
@@ -131,6 +131,39 @@ int a2port(const char *s)
131 return port; 131 return port;
132} 132}
133 133
134char *
135cleanhostname(char *host)
136{
137 if (*host == '[' && host[strlen(host) - 1] == ']') {
138 host[strlen(host) - 1] = '\0';
139 return (host + 1);
140 } else
141 return host;
142}
143
144char *
145colon(char *cp)
146{
147 int flag = 0;
148
149 if (*cp == ':') /* Leading colon is part of file name. */
150 return (0);
151 if (*cp == '[')
152 flag = 1;
153
154 for (; *cp; ++cp) {
155 if (*cp == '@' && *(cp+1) == '[')
156 flag = 1;
157 if (*cp == ']' && *(cp+1) == ':' && flag)
158 return (cp+1);
159 if (*cp == ':' && !flag)
160 return (cp);
161 if (*cp == '/')
162 return (0);
163 }
164 return (0);
165}
166
134mysig_t 167mysig_t
135mysignal(int sig, mysig_t act) 168mysignal(int sig, mysig_t act)
136{ 169{
diff --git a/misc.h b/misc.h
index 2346a5ea5..a307df3a0 100644
--- a/misc.h
+++ b/misc.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: misc.h,v 1.4 2001/04/12 20:09:36 stevesk Exp $ */ 1/* $OpenBSD: misc.h,v 1.5 2001/05/03 23:09:52 mouring Exp $ */
2 2
3/* 3/*
4 * Author: Tatu Ylonen <ylo@cs.hut.fi> 4 * Author: Tatu Ylonen <ylo@cs.hut.fi>
@@ -28,6 +28,10 @@ struct passwd * pwcopy(struct passwd *pw);
28 * Return 0 if invalid. 28 * Return 0 if invalid.
29 */ 29 */
30int a2port(const char *s); 30int a2port(const char *s);
31
32/* code from scp.c/rcp.c */
33char *cleanhostname(char *host);
34char *colon(char *cp);
31 35
32/* wrapper for signal interface */ 36/* wrapper for signal interface */
33typedef void (*mysig_t)(int); 37typedef void (*mysig_t)(int);
diff --git a/scp-common.c b/scp-common.c
deleted file mode 100644
index 7e5f09c74..000000000
--- a/scp-common.c
+++ /dev/null
@@ -1,98 +0,0 @@
1/*
2 * Copyright (c) 1999 Theo de Raadt. All rights reserved.
3 * Copyright (c) 1999 Aaron Campbell. 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
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26/*
27 * Parts from:
28 *
29 * Copyright (c) 1983, 1990, 1992, 1993, 1995
30 * The Regents of the University of California. All rights reserved.
31 *
32 * Redistribution and use in source and binary forms, with or without
33 * modification, are permitted provided that the following conditions
34 * are met:
35 * 1. Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * 2. Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in the
39 * documentation and/or other materials provided with the distribution.
40 * 3. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 */
61
62#include "includes.h"
63RCSID("$OpenBSD: scp-common.c,v 1.1 2001/04/16 02:31:43 mouring Exp $");
64
65char *
66cleanhostname(host)
67 char *host;
68{
69 if (*host == '[' && host[strlen(host) - 1] == ']') {
70 host[strlen(host) - 1] = '\0';
71 return (host + 1);
72 } else
73 return host;
74}
75
76char *
77colon(cp)
78 char *cp;
79{
80 int flag = 0;
81
82 if (*cp == ':') /* Leading colon is part of file name. */
83 return (0);
84 if (*cp == '[')
85 flag = 1;
86
87 for (; *cp; ++cp) {
88 if (*cp == '@' && *(cp+1) == '[')
89 flag = 1;
90 if (*cp == ']' && *(cp+1) == ':' && flag)
91 return (cp+1);
92 if (*cp == ':' && !flag)
93 return (cp);
94 if (*cp == '/')
95 return (0);
96 }
97 return (0);
98}
diff --git a/scp-common.h b/scp-common.h
deleted file mode 100644
index e0ab6ec32..000000000
--- a/scp-common.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/* $OpenBSD: scp-common.h,v 1.1 2001/04/16 02:31:43 mouring Exp $ */
2/*
3 * Copyright (c) 1999 Theo de Raadt. All rights reserved.
4 * Copyright (c) 1999 Aaron Campbell. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27/*
28 * Parts from:
29 *
30 * Copyright (c) 1983, 1990, 1992, 1993, 1995
31 * The Regents of the University of California. All rights reserved.
32 *
33 * Redistribution and use in source and binary forms, with or without
34 * modification, are permitted provided that the following conditions
35 * are met:
36 * 1. Redistributions of source code must retain the above copyright
37 * notice, this list of conditions and the following disclaimer.
38 * 2. Redistributions in binary form must reproduce the above copyright
39 * notice, this list of conditions and the following disclaimer in the
40 * documentation and/or other materials provided with the distribution.
41 * 3. All advertising materials mentioning features or use of this software
42 * must display the following acknowledgement:
43 * This product includes software developed by the University of
44 * California, Berkeley and its contributors.
45 * 4. Neither the name of the University nor the names of its contributors
46 * may be used to endorse or promote products derived from this software
47 * without specific prior written permission.
48 *
49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59 * SUCH DAMAGE.
60 *
61 */
62
63char *cleanhostname(char *host);
64char *colon(char *cp);
diff --git a/scp.c b/scp.c
index 1735693d6..10b77af6d 100644
--- a/scp.c
+++ b/scp.c
@@ -75,14 +75,13 @@
75 */ 75 */
76 76
77#include "includes.h" 77#include "includes.h"
78RCSID("$OpenBSD: scp.c,v 1.68 2001/04/22 12:34:05 markus Exp $"); 78RCSID("$OpenBSD: scp.c,v 1.69 2001/05/03 23:09:53 mouring Exp $");
79 79
80#include "xmalloc.h" 80#include "xmalloc.h"
81#include "atomicio.h" 81#include "atomicio.h"
82#include "pathnames.h" 82#include "pathnames.h"
83#include "log.h" 83#include "log.h"
84#include "misc.h" 84#include "misc.h"
85#include "scp-common.h"
86 85
87#ifdef HAVE___PROGNAME 86#ifdef HAVE___PROGNAME
88extern char *__progname; 87extern char *__progname;
diff --git a/sftp.c b/sftp.c
index 8c887fbcf..895e0e125 100644
--- a/sftp.c
+++ b/sftp.c
@@ -24,7 +24,7 @@
24 24
25#include "includes.h" 25#include "includes.h"
26 26
27RCSID("$OpenBSD: sftp.c,v 1.15 2001/04/16 02:31:44 mouring Exp $"); 27RCSID("$OpenBSD: sftp.c,v 1.16 2001/05/03 23:09:53 mouring Exp $");
28 28
29/* XXX: commandline mode */ 29/* XXX: commandline mode */
30/* XXX: short-form remote directory listings (like 'ls -C') */ 30/* XXX: short-form remote directory listings (like 'ls -C') */
@@ -33,6 +33,7 @@ RCSID("$OpenBSD: sftp.c,v 1.15 2001/04/16 02:31:44 mouring Exp $");
33#include "xmalloc.h" 33#include "xmalloc.h"
34#include "log.h" 34#include "log.h"
35#include "pathnames.h" 35#include "pathnames.h"
36#include "misc.h"
36 37
37#include "sftp.h" 38#include "sftp.h"
38#include "sftp-common.h" 39#include "sftp-common.h"
@@ -45,8 +46,6 @@ extern char *__progname;
45char *__progname; 46char *__progname;
46#endif 47#endif
47 48
48#include "scp-common.h"
49
50int use_ssh1 = 0; 49int use_ssh1 = 0;
51char *ssh_program = _PATH_SSH_PROGRAM; 50char *ssh_program = _PATH_SSH_PROGRAM;
52char *sftp_server = NULL; 51char *sftp_server = NULL;