Deleted Added
full compact
compat.c (294328) compat.c (294332)
1/* $OpenBSD: compat.c,v 1.85 2014/04/20 02:49:32 djm Exp $ */
1/* $OpenBSD: compat.c,v 1.87 2015/01/19 20:20:20 markus Exp $ */
2/*
3 * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. 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.

--- 9 unchanged lines hidden (view full) ---

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#include "includes.h"
2/*
3 * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. 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.

--- 9 unchanged lines hidden (view full) ---

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#include "includes.h"
27__RCSID("$FreeBSD: head/crypto/openssh/compat.c 294328 2016-01-19 16:18:26Z des $");
27__RCSID("$FreeBSD: head/crypto/openssh/compat.c 294332 2016-01-19 18:28:23Z des $");
28
29#include <sys/types.h>
30
31#include <stdlib.h>
32#include <string.h>
33#include <stdarg.h>
34
35#include "xmalloc.h"

--- 17 unchanged lines hidden (view full) ---

53}
54void
55enable_compat13(void)
56{
57 debug("Enabling compatibility mode for protocol 1.3");
58 compat13 = 1;
59}
60/* datafellows bug compatibility */
28
29#include <sys/types.h>
30
31#include <stdlib.h>
32#include <string.h>
33#include <stdarg.h>
34
35#include "xmalloc.h"

--- 17 unchanged lines hidden (view full) ---

53}
54void
55enable_compat13(void)
56{
57 debug("Enabling compatibility mode for protocol 1.3");
58 compat13 = 1;
59}
60/* datafellows bug compatibility */
61void
61u_int
62compat_datafellows(const char *version)
63{
64 int i;
65 static struct {
66 char *pat;
67 int bugs;
68 } check[] = {
69 { "OpenSSH-2.0*,"

--- 100 unchanged lines hidden (view full) ---

170 SSH_BUG_PROBE },
171 { NULL, 0 }
172 };
173
174 /* process table, return first match */
175 for (i = 0; check[i].pat; i++) {
176 if (match_pattern_list(version, check[i].pat,
177 strlen(check[i].pat), 0) == 1) {
62compat_datafellows(const char *version)
63{
64 int i;
65 static struct {
66 char *pat;
67 int bugs;
68 } check[] = {
69 { "OpenSSH-2.0*,"

--- 100 unchanged lines hidden (view full) ---

170 SSH_BUG_PROBE },
171 { NULL, 0 }
172 };
173
174 /* process table, return first match */
175 for (i = 0; check[i].pat; i++) {
176 if (match_pattern_list(version, check[i].pat,
177 strlen(check[i].pat), 0) == 1) {
178 datafellows = check[i].bugs;
179 debug("match: %s pat %s compat 0x%08x",
178 debug("match: %s pat %s compat 0x%08x",
180 version, check[i].pat, datafellows);
181 return;
179 version, check[i].pat, check[i].bugs);
180 datafellows = check[i].bugs; /* XXX for now */
181 return check[i].bugs;
182 }
183 }
184 debug("no match: %s", version);
182 }
183 }
184 debug("no match: %s", version);
185 return 0;
185}
186
187#define SEP ","
188int
189proto_spec(const char *spec)
190{
191 char *s, *p, *q;
192 int ret = SSH_PROTO_UNKNOWN;
193
194 if (spec == NULL)
195 return ret;
186}
187
188#define SEP ","
189int
190proto_spec(const char *spec)
191{
192 char *s, *p, *q;
193 int ret = SSH_PROTO_UNKNOWN;
194
195 if (spec == NULL)
196 return ret;
196 q = s = xstrdup(spec);
197 q = s = strdup(spec);
198 if (s == NULL)
199 return ret;
197 for ((p = strsep(&q, SEP)); p && *p != '\0'; (p = strsep(&q, SEP))) {
198 switch (atoi(p)) {
199 case 1:
200 if (ret == SSH_PROTO_UNKNOWN)
201 ret |= SSH_PROTO_1_PREFERRED;
202 ret |= SSH_PROTO_1;
203 break;
204 case 2:

--- 25 unchanged lines hidden (view full) ---

230 if (match_pattern_list(cp, filter, strlen(cp), 0) != 1) {
231 if (buffer_len(&b) > 0)
232 buffer_append(&b, ",", 1);
233 buffer_append(&b, cp, strlen(cp));
234 } else
235 debug2("Compat: skipping algorithm \"%s\"", cp);
236 }
237 buffer_append(&b, "\0", 1);
200 for ((p = strsep(&q, SEP)); p && *p != '\0'; (p = strsep(&q, SEP))) {
201 switch (atoi(p)) {
202 case 1:
203 if (ret == SSH_PROTO_UNKNOWN)
204 ret |= SSH_PROTO_1_PREFERRED;
205 ret |= SSH_PROTO_1;
206 break;
207 case 2:

--- 25 unchanged lines hidden (view full) ---

233 if (match_pattern_list(cp, filter, strlen(cp), 0) != 1) {
234 if (buffer_len(&b) > 0)
235 buffer_append(&b, ",", 1);
236 buffer_append(&b, cp, strlen(cp));
237 } else
238 debug2("Compat: skipping algorithm \"%s\"", cp);
239 }
240 buffer_append(&b, "\0", 1);
238 fix_prop = xstrdup(buffer_ptr(&b));
241 fix_prop = xstrdup((char *)buffer_ptr(&b));
239 buffer_free(&b);
240 free(orig_prop);
241
242 return fix_prop;
243}
244
245char *
246compat_cipher_proposal(char *cipher_prop)

--- 37 unchanged lines hidden ---
242 buffer_free(&b);
243 free(orig_prop);
244
245 return fix_prop;
246}
247
248char *
249compat_cipher_proposal(char *cipher_prop)

--- 37 unchanged lines hidden ---