rugged 0.22.0b4 → 0.22.0b5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/rugged.c +8 -7
- data/ext/rugged/rugged_note.c +1 -1
- data/ext/rugged/rugged_remote.c +0 -5
- data/ext/rugged/rugged_tree.c +23 -25
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/include/git2/blame.h +0 -1
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +1 -1
- data/vendor/libgit2/include/git2/cherrypick.h +5 -2
- data/vendor/libgit2/include/git2/clone.h +0 -1
- data/vendor/libgit2/include/git2/common.h +6 -1
- data/vendor/libgit2/include/git2/config.h +13 -4
- data/vendor/libgit2/include/git2/filter.h +3 -0
- data/vendor/libgit2/include/git2/global.h +10 -4
- data/vendor/libgit2/include/git2/index.h +3 -0
- data/vendor/libgit2/include/git2/merge.h +20 -5
- data/vendor/libgit2/include/git2/net.h +3 -2
- data/vendor/libgit2/include/git2/notes.h +5 -7
- data/vendor/libgit2/include/git2/push.h +7 -14
- data/vendor/libgit2/include/git2/rebase.h +14 -1
- data/vendor/libgit2/include/git2/refs.h +7 -1
- data/vendor/libgit2/include/git2/remote.h +6 -1
- data/vendor/libgit2/include/git2/repository.h +6 -0
- data/vendor/libgit2/include/git2/revert.h +5 -2
- data/vendor/libgit2/include/git2/stash.h +15 -6
- data/vendor/libgit2/include/git2/submodule.h +1 -1
- data/vendor/libgit2/include/git2/sys/diff.h +5 -2
- data/vendor/libgit2/include/git2/sys/hashsig.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +1 -1
- data/vendor/libgit2/include/git2/sys/stream.h +40 -0
- data/vendor/libgit2/include/git2/sys/transport.h +17 -4
- data/vendor/libgit2/include/git2/tree.h +3 -3
- data/vendor/libgit2/src/checkout.c +27 -1
- data/vendor/libgit2/src/commit_list.c +1 -1
- data/vendor/libgit2/src/common.h +1 -1
- data/vendor/libgit2/src/config_cache.c +2 -0
- data/vendor/libgit2/src/config_file.c +1 -1
- data/vendor/libgit2/src/describe.c +2 -2
- data/vendor/libgit2/src/global.c +31 -14
- data/vendor/libgit2/src/ignore.c +86 -3
- data/vendor/libgit2/src/index.c +48 -25
- data/vendor/libgit2/src/indexer.c +1 -0
- data/vendor/libgit2/src/netops.c +18 -474
- data/vendor/libgit2/src/netops.h +3 -8
- data/vendor/libgit2/src/notes.c +3 -3
- data/vendor/libgit2/src/odb.c +1 -0
- data/vendor/libgit2/src/odb_loose.c +1 -1
- data/vendor/libgit2/src/openssl_stream.c +375 -0
- data/vendor/libgit2/src/openssl_stream.h +14 -0
- data/vendor/libgit2/src/path.c +256 -0
- data/vendor/libgit2/src/path.h +44 -1
- data/vendor/libgit2/src/pool.c +1 -1
- data/vendor/libgit2/src/push.c +5 -5
- data/vendor/libgit2/src/rebase.c +2 -2
- data/vendor/libgit2/src/refdb_fs.c +11 -1
- data/vendor/libgit2/src/remote.c +2 -7
- data/vendor/libgit2/src/repository.c +25 -0
- data/vendor/libgit2/src/repository.h +26 -2
- data/vendor/libgit2/src/socket_stream.c +212 -0
- data/vendor/libgit2/src/socket_stream.h +21 -0
- data/vendor/libgit2/src/stream.h +48 -0
- data/vendor/libgit2/src/tag.c +1 -1
- data/vendor/libgit2/src/transports/git.c +71 -57
- data/vendor/libgit2/src/transports/http.c +40 -62
- data/vendor/libgit2/src/transports/local.c +6 -11
- data/vendor/libgit2/src/transports/smart.c +3 -3
- data/vendor/libgit2/src/transports/ssh.c +12 -8
- data/vendor/libgit2/src/transports/winhttp.c +68 -47
- data/vendor/libgit2/src/tree.c +16 -14
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/util.c +91 -0
- data/vendor/libgit2/src/util.h +12 -0
- data/vendor/libgit2/src/win32/findfile.c +1 -0
- data/vendor/libgit2/src/win32/path_w32.c +305 -0
- data/vendor/libgit2/src/win32/path_w32.h +80 -0
- data/vendor/libgit2/src/win32/posix.h +1 -0
- data/vendor/libgit2/src/win32/posix_w32.c +25 -42
- data/vendor/libgit2/src/win32/utf-conv.c +36 -6
- data/vendor/libgit2/src/win32/utf-conv.h +0 -39
- data/vendor/libgit2/src/win32/w32_util.h +1 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- metadata +10 -2
data/vendor/libgit2/src/netops.h
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
|
10
10
|
#include "posix.h"
|
11
11
|
#include "common.h"
|
12
|
+
#include "stream.h"
|
12
13
|
|
13
14
|
#ifdef GIT_SSL
|
14
15
|
# include <openssl/ssl.h>
|
@@ -32,7 +33,6 @@ typedef struct gitno_buffer {
|
|
32
33
|
char *data;
|
33
34
|
size_t len;
|
34
35
|
size_t offset;
|
35
|
-
gitno_socket *socket;
|
36
36
|
int (*recv)(struct gitno_buffer *buffer);
|
37
37
|
void *cb_data;
|
38
38
|
} gitno_buffer;
|
@@ -56,18 +56,13 @@ enum {
|
|
56
56
|
*/
|
57
57
|
int gitno__match_host(const char *pattern, const char *host);
|
58
58
|
|
59
|
-
void
|
60
|
-
void gitno_buffer_setup_callback(
|
59
|
+
void gitno_buffer_setup_fromstream(git_stream *st, gitno_buffer *buf, char *data, size_t len);
|
60
|
+
void gitno_buffer_setup_callback(gitno_buffer *buf, char *data, size_t len, int (*recv)(gitno_buffer *buf), void *cb_data);
|
61
61
|
int gitno_recv(gitno_buffer *buf);
|
62
62
|
|
63
63
|
void gitno_consume(gitno_buffer *buf, const char *ptr);
|
64
64
|
void gitno_consume_n(gitno_buffer *buf, size_t cons);
|
65
65
|
|
66
|
-
int gitno_connect(gitno_socket *socket, const char *host, const char *port, int flags);
|
67
|
-
int gitno_send(gitno_socket *socket, const char *msg, size_t len, int flags);
|
68
|
-
int gitno_close(gitno_socket *s);
|
69
|
-
int gitno_select_in(gitno_buffer *buf, long int sec, long int usec);
|
70
|
-
|
71
66
|
typedef struct gitno_connection_data {
|
72
67
|
char *host;
|
73
68
|
char *port;
|
data/vendor/libgit2/src/notes.c
CHANGED
@@ -107,7 +107,7 @@ static int tree_write(
|
|
107
107
|
const git_tree_entry *entry;
|
108
108
|
git_oid tree_oid;
|
109
109
|
|
110
|
-
if ((error = git_treebuilder_create(&tb, source_tree)) < 0)
|
110
|
+
if ((error = git_treebuilder_create(&tb, repo, source_tree)) < 0)
|
111
111
|
goto cleanup;
|
112
112
|
|
113
113
|
if (object_oid) {
|
@@ -119,7 +119,7 @@ static int tree_write(
|
|
119
119
|
goto cleanup;
|
120
120
|
}
|
121
121
|
|
122
|
-
if ((error = git_treebuilder_write(&tree_oid,
|
122
|
+
if ((error = git_treebuilder_write(&tree_oid, tb)) < 0)
|
123
123
|
goto cleanup;
|
124
124
|
|
125
125
|
error = git_tree_lookup(out, repo, &tree_oid);
|
@@ -455,9 +455,9 @@ int git_note_read(git_note **out, git_repository *repo,
|
|
455
455
|
int git_note_create(
|
456
456
|
git_oid *out,
|
457
457
|
git_repository *repo,
|
458
|
+
const char *notes_ref,
|
458
459
|
const git_signature *author,
|
459
460
|
const git_signature *committer,
|
460
|
-
const char *notes_ref,
|
461
461
|
const git_oid *oid,
|
462
462
|
const char *note,
|
463
463
|
int allow_note_overwrite)
|
data/vendor/libgit2/src/odb.c
CHANGED
@@ -0,0 +1,375 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifdef GIT_SSL
|
9
|
+
|
10
|
+
#include <openssl/ssl.h>
|
11
|
+
#include <openssl/err.h>
|
12
|
+
#include <openssl/x509v3.h>
|
13
|
+
|
14
|
+
#include <ctype.h>
|
15
|
+
|
16
|
+
#include "global.h"
|
17
|
+
#include "posix.h"
|
18
|
+
#include "stream.h"
|
19
|
+
#include "socket_stream.h"
|
20
|
+
#include "netops.h"
|
21
|
+
#include "git2/transport.h"
|
22
|
+
|
23
|
+
static int ssl_set_error(SSL *ssl, int error)
|
24
|
+
{
|
25
|
+
int err;
|
26
|
+
unsigned long e;
|
27
|
+
|
28
|
+
err = SSL_get_error(ssl, error);
|
29
|
+
|
30
|
+
assert(err != SSL_ERROR_WANT_READ);
|
31
|
+
assert(err != SSL_ERROR_WANT_WRITE);
|
32
|
+
|
33
|
+
switch (err) {
|
34
|
+
case SSL_ERROR_WANT_CONNECT:
|
35
|
+
case SSL_ERROR_WANT_ACCEPT:
|
36
|
+
giterr_set(GITERR_NET, "SSL error: connection failure\n");
|
37
|
+
break;
|
38
|
+
case SSL_ERROR_WANT_X509_LOOKUP:
|
39
|
+
giterr_set(GITERR_NET, "SSL error: x509 error\n");
|
40
|
+
break;
|
41
|
+
case SSL_ERROR_SYSCALL:
|
42
|
+
e = ERR_get_error();
|
43
|
+
if (e > 0) {
|
44
|
+
giterr_set(GITERR_NET, "SSL error: %s",
|
45
|
+
ERR_error_string(e, NULL));
|
46
|
+
break;
|
47
|
+
} else if (error < 0) {
|
48
|
+
giterr_set(GITERR_OS, "SSL error: syscall failure");
|
49
|
+
break;
|
50
|
+
}
|
51
|
+
giterr_set(GITERR_NET, "SSL error: received early EOF");
|
52
|
+
break;
|
53
|
+
case SSL_ERROR_SSL:
|
54
|
+
e = ERR_get_error();
|
55
|
+
giterr_set(GITERR_NET, "SSL error: %s",
|
56
|
+
ERR_error_string(e, NULL));
|
57
|
+
break;
|
58
|
+
case SSL_ERROR_NONE:
|
59
|
+
case SSL_ERROR_ZERO_RETURN:
|
60
|
+
default:
|
61
|
+
giterr_set(GITERR_NET, "SSL error: unknown error");
|
62
|
+
break;
|
63
|
+
}
|
64
|
+
return -1;
|
65
|
+
}
|
66
|
+
|
67
|
+
static int ssl_teardown(SSL *ssl)
|
68
|
+
{
|
69
|
+
int ret;
|
70
|
+
|
71
|
+
ret = SSL_shutdown(ssl);
|
72
|
+
if (ret < 0)
|
73
|
+
ret = ssl_set_error(ssl, ret);
|
74
|
+
else
|
75
|
+
ret = 0;
|
76
|
+
|
77
|
+
SSL_free(ssl);
|
78
|
+
return ret;
|
79
|
+
}
|
80
|
+
|
81
|
+
static int check_host_name(const char *name, const char *host)
|
82
|
+
{
|
83
|
+
if (!strcasecmp(name, host))
|
84
|
+
return 0;
|
85
|
+
|
86
|
+
if (gitno__match_host(name, host) < 0)
|
87
|
+
return -1;
|
88
|
+
|
89
|
+
return 0;
|
90
|
+
}
|
91
|
+
|
92
|
+
static int verify_server_cert(SSL *ssl, const char *host)
|
93
|
+
{
|
94
|
+
X509 *cert;
|
95
|
+
X509_NAME *peer_name;
|
96
|
+
ASN1_STRING *str;
|
97
|
+
unsigned char *peer_cn = NULL;
|
98
|
+
int matched = -1, type = GEN_DNS;
|
99
|
+
GENERAL_NAMES *alts;
|
100
|
+
struct in6_addr addr6;
|
101
|
+
struct in_addr addr4;
|
102
|
+
void *addr;
|
103
|
+
int i = -1,j;
|
104
|
+
|
105
|
+
if (SSL_get_verify_result(ssl) != X509_V_OK) {
|
106
|
+
giterr_set(GITERR_SSL, "The SSL certificate is invalid");
|
107
|
+
return GIT_ECERTIFICATE;
|
108
|
+
}
|
109
|
+
|
110
|
+
/* Try to parse the host as an IP address to see if it is */
|
111
|
+
if (p_inet_pton(AF_INET, host, &addr4)) {
|
112
|
+
type = GEN_IPADD;
|
113
|
+
addr = &addr4;
|
114
|
+
} else {
|
115
|
+
if(p_inet_pton(AF_INET6, host, &addr6)) {
|
116
|
+
type = GEN_IPADD;
|
117
|
+
addr = &addr6;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
|
121
|
+
|
122
|
+
cert = SSL_get_peer_certificate(ssl);
|
123
|
+
if (!cert) {
|
124
|
+
giterr_set(GITERR_SSL, "the server did not provide a certificate");
|
125
|
+
return -1;
|
126
|
+
}
|
127
|
+
|
128
|
+
/* Check the alternative names */
|
129
|
+
alts = X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL);
|
130
|
+
if (alts) {
|
131
|
+
int num;
|
132
|
+
|
133
|
+
num = sk_GENERAL_NAME_num(alts);
|
134
|
+
for (i = 0; i < num && matched != 1; i++) {
|
135
|
+
const GENERAL_NAME *gn = sk_GENERAL_NAME_value(alts, i);
|
136
|
+
const char *name = (char *) ASN1_STRING_data(gn->d.ia5);
|
137
|
+
size_t namelen = (size_t) ASN1_STRING_length(gn->d.ia5);
|
138
|
+
|
139
|
+
/* Skip any names of a type we're not looking for */
|
140
|
+
if (gn->type != type)
|
141
|
+
continue;
|
142
|
+
|
143
|
+
if (type == GEN_DNS) {
|
144
|
+
/* If it contains embedded NULs, don't even try */
|
145
|
+
if (memchr(name, '\0', namelen))
|
146
|
+
continue;
|
147
|
+
|
148
|
+
if (check_host_name(name, host) < 0)
|
149
|
+
matched = 0;
|
150
|
+
else
|
151
|
+
matched = 1;
|
152
|
+
} else if (type == GEN_IPADD) {
|
153
|
+
/* Here name isn't so much a name but a binary representation of the IP */
|
154
|
+
matched = !!memcmp(name, addr, namelen);
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
GENERAL_NAMES_free(alts);
|
159
|
+
|
160
|
+
if (matched == 0)
|
161
|
+
goto cert_fail_name;
|
162
|
+
|
163
|
+
if (matched == 1)
|
164
|
+
return 0;
|
165
|
+
|
166
|
+
/* If no alternative names are available, check the common name */
|
167
|
+
peer_name = X509_get_subject_name(cert);
|
168
|
+
if (peer_name == NULL)
|
169
|
+
goto on_error;
|
170
|
+
|
171
|
+
if (peer_name) {
|
172
|
+
/* Get the index of the last CN entry */
|
173
|
+
while ((j = X509_NAME_get_index_by_NID(peer_name, NID_commonName, i)) >= 0)
|
174
|
+
i = j;
|
175
|
+
}
|
176
|
+
|
177
|
+
if (i < 0)
|
178
|
+
goto on_error;
|
179
|
+
|
180
|
+
str = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(peer_name, i));
|
181
|
+
if (str == NULL)
|
182
|
+
goto on_error;
|
183
|
+
|
184
|
+
/* Work around a bug in OpenSSL whereby ASN1_STRING_to_UTF8 fails if it's already in utf-8 */
|
185
|
+
if (ASN1_STRING_type(str) == V_ASN1_UTF8STRING) {
|
186
|
+
int size = ASN1_STRING_length(str);
|
187
|
+
|
188
|
+
if (size > 0) {
|
189
|
+
peer_cn = OPENSSL_malloc(size + 1);
|
190
|
+
GITERR_CHECK_ALLOC(peer_cn);
|
191
|
+
memcpy(peer_cn, ASN1_STRING_data(str), size);
|
192
|
+
peer_cn[size] = '\0';
|
193
|
+
}
|
194
|
+
} else {
|
195
|
+
int size = ASN1_STRING_to_UTF8(&peer_cn, str);
|
196
|
+
GITERR_CHECK_ALLOC(peer_cn);
|
197
|
+
if (memchr(peer_cn, '\0', size))
|
198
|
+
goto cert_fail_name;
|
199
|
+
}
|
200
|
+
|
201
|
+
if (check_host_name((char *)peer_cn, host) < 0)
|
202
|
+
goto cert_fail_name;
|
203
|
+
|
204
|
+
OPENSSL_free(peer_cn);
|
205
|
+
|
206
|
+
return 0;
|
207
|
+
|
208
|
+
on_error:
|
209
|
+
OPENSSL_free(peer_cn);
|
210
|
+
return ssl_set_error(ssl, 0);
|
211
|
+
|
212
|
+
cert_fail_name:
|
213
|
+
OPENSSL_free(peer_cn);
|
214
|
+
giterr_set(GITERR_SSL, "hostname does not match certificate");
|
215
|
+
return GIT_ECERTIFICATE;
|
216
|
+
}
|
217
|
+
|
218
|
+
typedef struct {
|
219
|
+
git_stream parent;
|
220
|
+
git_socket_stream *socket;
|
221
|
+
SSL *ssl;
|
222
|
+
git_cert_x509 cert_info;
|
223
|
+
} openssl_stream;
|
224
|
+
|
225
|
+
int openssl_close(git_stream *stream);
|
226
|
+
|
227
|
+
int openssl_connect(git_stream *stream)
|
228
|
+
{
|
229
|
+
int ret;
|
230
|
+
openssl_stream *st = (openssl_stream *) stream;
|
231
|
+
|
232
|
+
if ((ret = git_stream_connect((git_stream *)st->socket)) < 0)
|
233
|
+
return ret;
|
234
|
+
|
235
|
+
if ((ret = SSL_set_fd(st->ssl, st->socket->s)) <= 0) {
|
236
|
+
openssl_close((git_stream *) st);
|
237
|
+
return ssl_set_error(st->ssl, ret);
|
238
|
+
}
|
239
|
+
|
240
|
+
if ((ret = SSL_connect(st->ssl)) <= 0)
|
241
|
+
return ssl_set_error(st->ssl, ret);
|
242
|
+
|
243
|
+
return verify_server_cert(st->ssl, st->socket->host);
|
244
|
+
}
|
245
|
+
|
246
|
+
int openssl_certificate(git_cert **out, git_stream *stream)
|
247
|
+
{
|
248
|
+
openssl_stream *st = (openssl_stream *) stream;
|
249
|
+
int len;
|
250
|
+
X509 *cert = SSL_get_peer_certificate(st->ssl);
|
251
|
+
unsigned char *guard, *encoded_cert;
|
252
|
+
|
253
|
+
/* Retrieve the length of the certificate first */
|
254
|
+
len = i2d_X509(cert, NULL);
|
255
|
+
if (len < 0) {
|
256
|
+
giterr_set(GITERR_NET, "failed to retrieve certificate information");
|
257
|
+
return -1;
|
258
|
+
}
|
259
|
+
|
260
|
+
encoded_cert = git__malloc(len);
|
261
|
+
GITERR_CHECK_ALLOC(encoded_cert);
|
262
|
+
/* i2d_X509 makes 'guard' point to just after the data */
|
263
|
+
guard = encoded_cert;
|
264
|
+
|
265
|
+
len = i2d_X509(cert, &guard);
|
266
|
+
if (len < 0) {
|
267
|
+
git__free(encoded_cert);
|
268
|
+
giterr_set(GITERR_NET, "failed to retrieve certificate information");
|
269
|
+
return -1;
|
270
|
+
}
|
271
|
+
|
272
|
+
st->cert_info.cert_type = GIT_CERT_X509;
|
273
|
+
st->cert_info.data = encoded_cert;
|
274
|
+
st->cert_info.len = len;
|
275
|
+
|
276
|
+
*out = (git_cert *)&st->cert_info;
|
277
|
+
return 0;
|
278
|
+
}
|
279
|
+
|
280
|
+
ssize_t openssl_write(git_stream *stream, const char *data, size_t len, int flags)
|
281
|
+
{
|
282
|
+
openssl_stream *st = (openssl_stream *) stream;
|
283
|
+
int ret;
|
284
|
+
size_t off = 0;
|
285
|
+
|
286
|
+
GIT_UNUSED(flags);
|
287
|
+
|
288
|
+
while (off < len) {
|
289
|
+
ret = SSL_write(st->ssl, data + off, len - off);
|
290
|
+
if (ret <= 0 && ret != SSL_ERROR_WANT_WRITE)
|
291
|
+
return ssl_set_error(st->ssl, ret);
|
292
|
+
|
293
|
+
off += ret;
|
294
|
+
}
|
295
|
+
|
296
|
+
return off;
|
297
|
+
}
|
298
|
+
|
299
|
+
ssize_t openssl_read(git_stream *stream, void *data, size_t len)
|
300
|
+
{
|
301
|
+
openssl_stream *st = (openssl_stream *) stream;
|
302
|
+
int ret;
|
303
|
+
|
304
|
+
do {
|
305
|
+
ret = SSL_read(st->ssl, data, len);
|
306
|
+
} while (SSL_get_error(st->ssl, ret) == SSL_ERROR_WANT_READ);
|
307
|
+
|
308
|
+
if (ret < 0) {
|
309
|
+
ssl_set_error(st->ssl, ret);
|
310
|
+
return -1;
|
311
|
+
}
|
312
|
+
|
313
|
+
return ret;
|
314
|
+
}
|
315
|
+
|
316
|
+
int openssl_close(git_stream *stream)
|
317
|
+
{
|
318
|
+
openssl_stream *st = (openssl_stream *) stream;
|
319
|
+
int ret;
|
320
|
+
|
321
|
+
if ((ret = ssl_teardown(st->ssl)) < 0)
|
322
|
+
return -1;
|
323
|
+
|
324
|
+
return git_stream_close((git_stream *)st->socket);
|
325
|
+
}
|
326
|
+
|
327
|
+
void openssl_free(git_stream *stream)
|
328
|
+
{
|
329
|
+
openssl_stream *st = (openssl_stream *) stream;
|
330
|
+
|
331
|
+
git__free(st->cert_info.data);
|
332
|
+
git_stream_free((git_stream *) st->socket);
|
333
|
+
git__free(st);
|
334
|
+
}
|
335
|
+
|
336
|
+
int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
|
337
|
+
{
|
338
|
+
openssl_stream *st;
|
339
|
+
|
340
|
+
st = git__calloc(1, sizeof(openssl_stream));
|
341
|
+
GITERR_CHECK_ALLOC(st);
|
342
|
+
|
343
|
+
if (git_socket_stream_new((git_stream **) &st->socket, host, port))
|
344
|
+
return -1;
|
345
|
+
|
346
|
+
st->ssl = SSL_new(git__ssl_ctx);
|
347
|
+
if (st->ssl == NULL) {
|
348
|
+
giterr_set(GITERR_SSL, "failed to create ssl object");
|
349
|
+
return -1;
|
350
|
+
}
|
351
|
+
|
352
|
+
st->parent.version = GIT_STREAM_VERSION;
|
353
|
+
st->parent.encrypted = 1;
|
354
|
+
st->parent.connect = openssl_connect;
|
355
|
+
st->parent.certificate = openssl_certificate;
|
356
|
+
st->parent.read = openssl_read;
|
357
|
+
st->parent.write = openssl_write;
|
358
|
+
st->parent.close = openssl_close;
|
359
|
+
st->parent.free = openssl_free;
|
360
|
+
|
361
|
+
*out = (git_stream *) st;
|
362
|
+
return 0;
|
363
|
+
}
|
364
|
+
|
365
|
+
#else
|
366
|
+
|
367
|
+
#include "stream.h"
|
368
|
+
|
369
|
+
int git_openssl_stream_new(git_stream **out, const char *host, const char *port)
|
370
|
+
{
|
371
|
+
giterr_set(GITERR_SSL, "openssl is not supported in this version");
|
372
|
+
return -1;
|
373
|
+
}
|
374
|
+
|
375
|
+
#endif
|