Compare commits
913 Commits
libssh-0.8
...
libssh-0.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79900e5246 | ||
|
|
63b0399373 | ||
|
|
39665fd9c5 | ||
|
|
83f0be1f04 | ||
|
|
3bc5f88f77 | ||
|
|
466ca07626 | ||
|
|
b6e757d692 | ||
|
|
3f2375e948 | ||
|
|
4d06c2f283 | ||
|
|
0298bfbbf0 | ||
|
|
2399a9f8de | ||
|
|
79756c5c56 | ||
|
|
e8510043d2 | ||
|
|
1f7889f271 | ||
|
|
89efd56217 | ||
|
|
e3fca31c59 | ||
|
|
d71a7976dd | ||
|
|
8fe8d13e29 | ||
|
|
722f979790 | ||
|
|
2c60ef04d9 | ||
|
|
ec486d13db | ||
|
|
ebfe46f6ad | ||
|
|
3c0897b975 | ||
|
|
993e0df81e | ||
|
|
551188d99b | ||
|
|
cafafe8f5a | ||
|
|
c6c7856b51 | ||
|
|
ea71af9c22 | ||
|
|
bb98413fc1 | ||
|
|
2a8cd81e8f | ||
|
|
3cb0a1bf02 | ||
|
|
2d2a4f3784 | ||
|
|
70dd8b0348 | ||
|
|
c4463ba5e7 | ||
|
|
fba384ac58 | ||
|
|
ab25ca205d | ||
|
|
91960409c3 | ||
|
|
955d6f1b17 | ||
|
|
0280ff12a5 | ||
|
|
b775e316fa | ||
|
|
dc4d4cc8d4 | ||
|
|
4fc37bb6fe | ||
|
|
ed8284ab09 | ||
|
|
f46eff79e2 | ||
|
|
658a150991 | ||
|
|
32eec7b418 | ||
|
|
1f43b52117 | ||
|
|
c0c1454298 | ||
|
|
ddece69a07 | ||
|
|
5568e5e520 | ||
|
|
905b027f0f | ||
|
|
57cf0cf230 | ||
|
|
4416a0dae6 | ||
|
|
73b94abea4 | ||
|
|
bd32fb020b | ||
|
|
bb36cc30ee | ||
|
|
b6aef1fdd5 | ||
|
|
c7c3c16fc8 | ||
|
|
bfafdab035 | ||
|
|
426c6c1321 | ||
|
|
a006c3c451 | ||
|
|
20e58be7d8 | ||
|
|
8c59f7f236 | ||
|
|
9ef0b0b029 | ||
|
|
39c69893c7 | ||
|
|
ce888fd4c0 | ||
|
|
af031d8df6 | ||
|
|
92a0d23eac | ||
|
|
1a6ac291a7 | ||
|
|
bdb2ef4dcc | ||
|
|
41834f228b | ||
|
|
03ca994cc0 | ||
|
|
53ae2502f4 | ||
|
|
1b7146e28f | ||
|
|
a3ddc48cb0 | ||
|
|
132ed59d3f | ||
|
|
f91a5fce6e | ||
|
|
63f477181a | ||
|
|
2c385c0e13 | ||
|
|
66755c478c | ||
|
|
9f178be1fa | ||
|
|
1f66414805 | ||
|
|
6d5ac15a51 | ||
|
|
85241c19e9 | ||
|
|
53cee7c9a3 | ||
|
|
f64c3dec74 | ||
|
|
0cfe4c7ab8 | ||
|
|
01f4040218 | ||
|
|
7656911953 | ||
|
|
9f7f5dee18 | ||
|
|
5f01ed0278 | ||
|
|
196361c1f0 | ||
|
|
79cd2618ec | ||
|
|
54d76098ed | ||
|
|
56041dc784 | ||
|
|
167aa8bc6c | ||
|
|
0ce1e84d90 | ||
|
|
ee456104f1 | ||
|
|
0fb7d9831a | ||
|
|
55c637f2d3 | ||
|
|
d783aec96c | ||
|
|
dc35bbbeb1 | ||
|
|
2db2a4e170 | ||
|
|
a8064cb0ca | ||
|
|
e7ef40c8f0 | ||
|
|
79f0c38fbd | ||
|
|
07faf95a10 | ||
|
|
250a0be0f9 | ||
|
|
8f6e6f774e | ||
|
|
f4363f5655 | ||
|
|
bc95a51710 | ||
|
|
2c4850cbbd | ||
|
|
b0ff64bf1b | ||
|
|
d013a94f37 | ||
|
|
adfd3cd3f3 | ||
|
|
1a3436d7d3 | ||
|
|
77ada9e4dc | ||
|
|
328a631a0f | ||
|
|
a7e17a34ad | ||
|
|
d9f9bee13f | ||
|
|
7e344ca052 | ||
|
|
18a89c6ec2 | ||
|
|
cb502a4a6d | ||
|
|
123db84b2c | ||
|
|
30997a098c | ||
|
|
9b1772ecbd | ||
|
|
9fb7fb3fac | ||
|
|
59ba3f1896 | ||
|
|
38f9802eec | ||
|
|
eae971c002 | ||
|
|
962bdf806c | ||
|
|
1e22a089eb | ||
|
|
8152c6aba4 | ||
|
|
7cc159d720 | ||
|
|
248e5acd5c | ||
|
|
550a1a7667 | ||
|
|
db51fa1bc1 | ||
|
|
d923dc39c1 | ||
|
|
88a8b1f57c | ||
|
|
7bc53f3957 | ||
|
|
fd9446553b | ||
|
|
33af736555 | ||
|
|
132c7bee64 | ||
|
|
ba67555764 | ||
|
|
0ea9e39e81 | ||
|
|
e775182c2e | ||
|
|
76f9808eb2 | ||
|
|
58b3b2696c | ||
|
|
20c03c289e | ||
|
|
c27d41df75 | ||
|
|
99053a6c33 | ||
|
|
c3b8f9c0ec | ||
|
|
01e98a6df7 | ||
|
|
dbf3f962a4 | ||
|
|
3917a5c916 | ||
|
|
5f7a3c5c66 | ||
|
|
848f59c37e | ||
|
|
0849e44220 | ||
|
|
ee42e3badb | ||
|
|
ee82bab801 | ||
|
|
db8aca69a7 | ||
|
|
3fccb24464 | ||
|
|
19cb6f1b6c | ||
|
|
c0f3a96089 | ||
|
|
7ef2fe7f7b | ||
|
|
175375bc09 | ||
|
|
03a1f1dd0c | ||
|
|
410f100968 | ||
|
|
104c696bca | ||
|
|
e446507352 | ||
|
|
67beaf363f | ||
|
|
4012338862 | ||
|
|
bb7920efbc | ||
|
|
3e8bdb122f | ||
|
|
cc536377f9 | ||
|
|
643ca67f88 | ||
|
|
8a885f0bd3 | ||
|
|
c4348c7b3c | ||
|
|
5ffc595d0d | ||
|
|
815a53375e | ||
|
|
6cd506ea81 | ||
|
|
95ab5f0dce | ||
|
|
9340a0af5e | ||
|
|
08b3301e4f | ||
|
|
4a01496810 | ||
|
|
2f26b5d63c | ||
|
|
7c0719e53d | ||
|
|
04b284dae0 | ||
|
|
19cd909c8d | ||
|
|
b1f3cfec34 | ||
|
|
78f764b7c9 | ||
|
|
e036c426f8 | ||
|
|
77a6fe4a62 | ||
|
|
33ad6bc54e | ||
|
|
33399e52f0 | ||
|
|
7551857d08 | ||
|
|
30d97979a2 | ||
|
|
2f38af1559 | ||
|
|
997fe4d418 | ||
|
|
fd30cf0676 | ||
|
|
d9e6237a47 | ||
|
|
25af8641b3 | ||
|
|
d6d9b56bb9 | ||
|
|
68385a2e98 | ||
|
|
fd25beff68 | ||
|
|
bab4d2b77b | ||
|
|
55a713cb04 | ||
|
|
79049981a5 | ||
|
|
19e886d6b1 | ||
|
|
0bde6b142c | ||
|
|
45c7d07780 | ||
|
|
f05571841b | ||
|
|
55bcefbc56 | ||
|
|
b0bd05a724 | ||
|
|
cd8f5ddbc2 | ||
|
|
3ce9f78fb4 | ||
|
|
5104c86a2b | ||
|
|
144e551614 | ||
|
|
65bc24d8a4 | ||
|
|
d8fc65ad71 | ||
|
|
81d0f6b6b7 | ||
|
|
bed7dcb3ec | ||
|
|
104c9dca3f | ||
|
|
c180211c6b | ||
|
|
c235841436 | ||
|
|
449954d99a | ||
|
|
7c444c09d7 | ||
|
|
8234df5dec | ||
|
|
4a67c19118 | ||
|
|
e4c7912b35 | ||
|
|
c6608c9211 | ||
|
|
f055319efe | ||
|
|
369051a5b4 | ||
|
|
46d15b3161 | ||
|
|
1af10fcdb3 | ||
|
|
8a73e48184 | ||
|
|
7a8ed6d02b | ||
|
|
b73ffb3f91 | ||
|
|
702a6e7695 | ||
|
|
eb032e0dec | ||
|
|
17df34da96 | ||
|
|
7caf6d2ab6 | ||
|
|
5a590dfb5f | ||
|
|
881e1b4785 | ||
|
|
f890b09edb | ||
|
|
a1559505a5 | ||
|
|
5d279a7ad7 | ||
|
|
c2077ab775 | ||
|
|
128015bb17 | ||
|
|
5700477f3e | ||
|
|
fffa66698f | ||
|
|
a170580147 | ||
|
|
0833f07c53 | ||
|
|
805709dd36 | ||
|
|
fd95b68c0f | ||
|
|
82f4c6c607 | ||
|
|
c110122fb5 | ||
|
|
686cd6e83b | ||
|
|
9f9afab3e6 | ||
|
|
b84949b32c | ||
|
|
c0102e6a59 | ||
|
|
ccd73db90c | ||
|
|
3760e59c13 | ||
|
|
3334443089 | ||
|
|
b44987a164 | ||
|
|
886681a421 | ||
|
|
04c97c0eaf | ||
|
|
d27b817acc | ||
|
|
16a52a8362 | ||
|
|
5bc7432b10 | ||
|
|
8c7b6bffff | ||
|
|
42185fbf6e | ||
|
|
303bdc5a4f | ||
|
|
9b694f396c | ||
|
|
d41042f92d | ||
|
|
9b2eefe62c | ||
|
|
8ec80d1f5d | ||
|
|
8ddbe7bec6 | ||
|
|
61ad276a87 | ||
|
|
9c5a1967c3 | ||
|
|
27caaa000b | ||
|
|
bdf968c178 | ||
|
|
603b6d7222 | ||
|
|
89f58decb6 | ||
|
|
5ed5e97114 | ||
|
|
6dacc8b26c | ||
|
|
d41fd0c465 | ||
|
|
d598e4e52a | ||
|
|
932102bd13 | ||
|
|
e260a591f4 | ||
|
|
6c7eaa9e12 | ||
|
|
83d86ef6a5 | ||
|
|
db67fcbe88 | ||
|
|
be9943132e | ||
|
|
893510db35 | ||
|
|
e989c4afff | ||
|
|
3ce31532eb | ||
|
|
3b5f9ef8d6 | ||
|
|
53c88375fe | ||
|
|
40faa98c5e | ||
|
|
9407065879 | ||
|
|
b36219369d | ||
|
|
31da8025b2 | ||
|
|
574bfb5459 | ||
|
|
154eb91914 | ||
|
|
9c88769707 | ||
|
|
a6c47099b7 | ||
|
|
2f8239ade3 | ||
|
|
afe2673cfa | ||
|
|
43a4f86b6e | ||
|
|
e42a423a24 | ||
|
|
602a1defea | ||
|
|
fd5770973f | ||
|
|
416d03b19e | ||
|
|
db1a999852 | ||
|
|
29445e4ff1 | ||
|
|
13aa791e7b | ||
|
|
7f18a27504 | ||
|
|
2113dc9d23 | ||
|
|
1f7a15ffb1 | ||
|
|
37262b98ef | ||
|
|
e91e221d02 | ||
|
|
79fe88bfb8 | ||
|
|
98a8bf771d | ||
|
|
0ceda043ce | ||
|
|
86849c0883 | ||
|
|
0e9add9a89 | ||
|
|
2eb0dc6446 | ||
|
|
4b4fb638f8 | ||
|
|
f118ea010b | ||
|
|
481d749559 | ||
|
|
c7aba3a716 | ||
|
|
0170ed8883 | ||
|
|
de54a88ee1 | ||
|
|
51f035aa3f | ||
|
|
edc7b96b2f | ||
|
|
ab269f036e | ||
|
|
4512a3fead | ||
|
|
fc840d8d69 | ||
|
|
0e7a962417 | ||
|
|
531b80a60b | ||
|
|
27fe60954c | ||
|
|
ca62632170 | ||
|
|
fae1ed7ded | ||
|
|
851c580cf5 | ||
|
|
40b63f7c39 | ||
|
|
8012afd5e4 | ||
|
|
7e41d08f26 | ||
|
|
347af845ab | ||
|
|
bfff7db5ff | ||
|
|
58cae2366a | ||
|
|
c86a00d06b | ||
|
|
8e0c047031 | ||
|
|
8d90266661 | ||
|
|
836982358a | ||
|
|
a61368a06a | ||
|
|
92e978f2f3 | ||
|
|
1a92c4bc64 | ||
|
|
e973f95b37 | ||
|
|
78427a9264 | ||
|
|
b3ae5e06ee | ||
|
|
d4e5644e21 | ||
|
|
42c92074b9 | ||
|
|
81fdb574e7 | ||
|
|
fff2e85ab2 | ||
|
|
1be9618f4e | ||
|
|
b26ca652f5 | ||
|
|
9f1718e159 | ||
|
|
d011b780c3 | ||
|
|
c6460cc955 | ||
|
|
b5f1949480 | ||
|
|
dea6fe3d89 | ||
|
|
6cd8d4a24a | ||
|
|
0bd404bcbd | ||
|
|
c9bdb9a01e | ||
|
|
973da84a47 | ||
|
|
990794c580 | ||
|
|
9b1852f728 | ||
|
|
055bf830db | ||
|
|
8c812dbfa3 | ||
|
|
9128ecf397 | ||
|
|
48aede2a31 | ||
|
|
fe309ba43f | ||
|
|
c3067f8e73 | ||
|
|
1d5b222cc4 | ||
|
|
13b9d268d4 | ||
|
|
0ba10870d1 | ||
|
|
e4e51ccc13 | ||
|
|
8ece2abfab | ||
|
|
f05717d23e | ||
|
|
eaa97d2062 | ||
|
|
bda2cc69af | ||
|
|
83d827d7dd | ||
|
|
0f95295966 | ||
|
|
8e69d435ef | ||
|
|
d78a29eb79 | ||
|
|
58113d489e | ||
|
|
c306a693f3 | ||
|
|
21e2522360 | ||
|
|
8f887e82c7 | ||
|
|
993e24a361 | ||
|
|
cf6f1e7a64 | ||
|
|
31bc83f366 | ||
|
|
42ce989488 | ||
|
|
4282f3c664 | ||
|
|
3784226fd8 | ||
|
|
cf24048f02 | ||
|
|
f427a975b8 | ||
|
|
c413834764 | ||
|
|
41b0d263d6 | ||
|
|
a08a97f9c7 | ||
|
|
c0ae59e102 | ||
|
|
109a203453 | ||
|
|
ac8b954019 | ||
|
|
c6ca62d7e1 | ||
|
|
6d3672911b | ||
|
|
95f83c2391 | ||
|
|
130256c348 | ||
|
|
b72c9eead6 | ||
|
|
c7628fbfea | ||
|
|
783e5fd206 | ||
|
|
c79c33e224 | ||
|
|
968fdf4e18 | ||
|
|
bc91fa98ea | ||
|
|
d2434c69c0 | ||
|
|
7f83a1efae | ||
|
|
7b725e6bc7 | ||
|
|
46d8840f7e | ||
|
|
c1fdb56d23 | ||
|
|
57bdc9cb20 | ||
|
|
312084731e | ||
|
|
500bf54a34 | ||
|
|
a56fa14fda | ||
|
|
ac1377148f | ||
|
|
f38c6fcc6e | ||
|
|
0dd2b375c7 | ||
|
|
77be4ce905 | ||
|
|
78b1f0ead3 | ||
|
|
31527d4105 | ||
|
|
65e16b8d9e | ||
|
|
1f6b929735 | ||
|
|
74285d3aca | ||
|
|
7960fbaabb | ||
|
|
a2baf6e97b | ||
|
|
f9ff53b494 | ||
|
|
98487f464b | ||
|
|
b214f84538 | ||
|
|
05417665b9 | ||
|
|
e639c9d0d8 | ||
|
|
bf2c7128ab | ||
|
|
83f2ac4abb | ||
|
|
0b4c2a8e62 | ||
|
|
8418a1131e | ||
|
|
c18ed4eafa | ||
|
|
daabb084fe | ||
|
|
6709f2edf9 | ||
|
|
5bdb7a5079 | ||
|
|
824c56067b | ||
|
|
db5721d041 | ||
|
|
3da5fcbb56 | ||
|
|
9d8c943c68 | ||
|
|
21881cde34 | ||
|
|
55252e4d70 | ||
|
|
8e002b9415 | ||
|
|
f4339df577 | ||
|
|
0197e5e1e5 | ||
|
|
9546b20dec | ||
|
|
b227c12ad2 | ||
|
|
f369d02932 | ||
|
|
0b9e07fbdc | ||
|
|
c47cdc0f97 | ||
|
|
4b6eb05023 | ||
|
|
59ada799d7 | ||
|
|
bb5d46c190 | ||
|
|
aa56b8ca53 | ||
|
|
67f418218b | ||
|
|
03c30e9c8a | ||
|
|
61cac32288 | ||
|
|
aa899f8ec0 | ||
|
|
c88fb4c55b | ||
|
|
a8ed5e31dc | ||
|
|
86dabfe7e4 | ||
|
|
1650d8178e | ||
|
|
6eb43fcbf3 | ||
|
|
9aa47fef99 | ||
|
|
de7405f1c7 | ||
|
|
4a95a35bc6 | ||
|
|
f6b390084e | ||
|
|
b7fefb0500 | ||
|
|
89a8a6fcf0 | ||
|
|
7e44ce1556 | ||
|
|
5fc4d5b22a | ||
|
|
5159cd96e8 | ||
|
|
35c417312c | ||
|
|
e1a8b359c1 | ||
|
|
c8519c435e | ||
|
|
d85bc347d3 | ||
|
|
9c4baa7fd5 | ||
|
|
a4342b97d6 | ||
|
|
963c3077a4 | ||
|
|
a280747462 | ||
|
|
bce8d56705 | ||
|
|
ced05eb6db | ||
|
|
b796924fea | ||
|
|
2af4e3970e | ||
|
|
cf3c2ee5b3 | ||
|
|
57eb6a400a | ||
|
|
8c77a49729 | ||
|
|
8c8026b892 | ||
|
|
80be1d0ee9 | ||
|
|
9c3ba94960 | ||
|
|
194c34ebe3 | ||
|
|
00cd5b1c83 | ||
|
|
9fbbdcc154 | ||
|
|
b9ac61d5a3 | ||
|
|
ca425ebe67 | ||
|
|
7e6b540277 | ||
|
|
12ec1fed2f | ||
|
|
fb70d0fb41 | ||
|
|
f8b70d6a73 | ||
|
|
74888a6fa4 | ||
|
|
729384f346 | ||
|
|
7e5291668c | ||
|
|
bb081f6681 | ||
|
|
8a3ea3bdd5 | ||
|
|
a190ff9302 | ||
|
|
2e7e0ad6c9 | ||
|
|
39b08af2e8 | ||
|
|
60a3796041 | ||
|
|
cc4f220fd3 | ||
|
|
bc72ec5821 | ||
|
|
54ec81db2d | ||
|
|
1ec2ca4202 | ||
|
|
2fad391456 | ||
|
|
cde13b0f00 | ||
|
|
8f31623947 | ||
|
|
253bda4bac | ||
|
|
480915c07d | ||
|
|
e27c6b21b5 | ||
|
|
f65c00f39d | ||
|
|
1d33a4424d | ||
|
|
0386e088eb | ||
|
|
e91bb29e9d | ||
|
|
f622c4309b | ||
|
|
ae6b0e0f49 | ||
|
|
bdb3bb9ccd | ||
|
|
32e502a79d | ||
|
|
6ec5a08639 | ||
|
|
35a6455489 | ||
|
|
c1a8c41c5d | ||
|
|
893b69d82b | ||
|
|
9285e8516b | ||
|
|
91f35eca4d | ||
|
|
49e287006f | ||
|
|
85fc0d5b83 | ||
|
|
0ff566b6dd | ||
|
|
9c200d3ef4 | ||
|
|
4ea46eecce | ||
|
|
009ca5c9dd | ||
|
|
fe618a35dc | ||
|
|
795389ae1b | ||
|
|
60037f3275 | ||
|
|
e1548a71bd | ||
|
|
75be012b4a | ||
|
|
68b0c7a934 | ||
|
|
459868c4a5 | ||
|
|
5d7414467d | ||
|
|
20981bf229 | ||
|
|
825f4ba964 | ||
|
|
2bddafeb70 | ||
|
|
16b876d07f | ||
|
|
a80caec19b | ||
|
|
d6b6fff7f7 | ||
|
|
259d7de153 | ||
|
|
d13517e922 | ||
|
|
45058285fc | ||
|
|
42bd7cdf6c | ||
|
|
72bd2fe197 | ||
|
|
a2120e168b | ||
|
|
5790036a23 | ||
|
|
032f486f27 | ||
|
|
46090facba | ||
|
|
777786d76c | ||
|
|
101df98e54 | ||
|
|
f747e46f33 | ||
|
|
275f73125d | ||
|
|
422376efd4 | ||
|
|
3245b50795 | ||
|
|
508dfc5251 | ||
|
|
43a40999da | ||
|
|
e701913fc8 | ||
|
|
aec9fa4442 | ||
|
|
85a274ff3c | ||
|
|
e210b61148 | ||
|
|
f09ca85ebf | ||
|
|
096d966e43 | ||
|
|
cc513c4c9a | ||
|
|
31202822a7 | ||
|
|
6118628424 | ||
|
|
00e5ef1b3c | ||
|
|
6eef4b4a3c | ||
|
|
79e907402e | ||
|
|
ca7da823c3 | ||
|
|
2eaa23a20e | ||
|
|
143b5e2e50 | ||
|
|
11d480134c | ||
|
|
3786db4cdf | ||
|
|
9cf341bad3 | ||
|
|
e57f0273a6 | ||
|
|
3d74c3802e | ||
|
|
667fb5f9a9 | ||
|
|
14f5624ff5 | ||
|
|
9adc2d36eb | ||
|
|
1e5e09563a | ||
|
|
35bf5334b8 | ||
|
|
a7604c7d6e | ||
|
|
c5cadaa982 | ||
|
|
caf50270c6 | ||
|
|
b7a29c7ffd | ||
|
|
491a42d046 | ||
|
|
642a1b1aa4 | ||
|
|
f709c3ac58 | ||
|
|
ae2b9a3bde | ||
|
|
1d7520b68a | ||
|
|
9c37c8c5a5 | ||
|
|
6c56c1e0d7 | ||
|
|
e4711c469f | ||
|
|
8410f43d8b | ||
|
|
d0ce2d1ecd | ||
|
|
5a198732a5 | ||
|
|
92aa2cf496 | ||
|
|
bbed139eca | ||
|
|
0eab270754 | ||
|
|
71594f9d6c | ||
|
|
2ae2baf9ca | ||
|
|
4c47719d98 | ||
|
|
a30d542207 | ||
|
|
d9d3b65df2 | ||
|
|
97cb302c0e | ||
|
|
90373d8394 | ||
|
|
07f7fa7806 | ||
|
|
5123f7955b | ||
|
|
c15ad753a7 | ||
|
|
63aa274f4b | ||
|
|
8170e30073 | ||
|
|
77f58a225f | ||
|
|
48459c37f6 | ||
|
|
31f24ed23e | ||
|
|
82c3faa44d | ||
|
|
7c75e76d10 | ||
|
|
f246e31ca0 | ||
|
|
7390db6bbb | ||
|
|
cc83b463ce | ||
|
|
39975fdd6d | ||
|
|
1226de875b | ||
|
|
2307be32cf | ||
|
|
eaaa4131de | ||
|
|
39102224b2 | ||
|
|
e365aed6d2 | ||
|
|
d23bda8181 | ||
|
|
86d521cbe7 | ||
|
|
856dc698a9 | ||
|
|
4d09c6dc31 | ||
|
|
03a66b8599 | ||
|
|
c04eac40f3 | ||
|
|
8cc0672c0c | ||
|
|
8f7214a584 | ||
|
|
9d2de880ec | ||
|
|
039c066da5 | ||
|
|
6efbf7a30e | ||
|
|
e5170107c9 | ||
|
|
30df04a8a5 | ||
|
|
aaca395bd3 | ||
|
|
0762057eb9 | ||
|
|
57153f6481 | ||
|
|
4c32befd93 | ||
|
|
be8302e2f3 | ||
|
|
97d2e1f4cb | ||
|
|
12fc0ea1bf | ||
|
|
573eab0d51 | ||
|
|
0e317e612f | ||
|
|
01135703a3 | ||
|
|
c070414309 | ||
|
|
d2cc4eccc7 | ||
|
|
38781f69b0 | ||
|
|
dc4faf9952 | ||
|
|
cbbc6ddcb6 | ||
|
|
a7456bf4d5 | ||
|
|
afc14fe003 | ||
|
|
79a3fcac72 | ||
|
|
945afaa6b4 | ||
|
|
d840a05be3 | ||
|
|
662c30eb72 | ||
|
|
29b5477849 | ||
|
|
2e8f2f03e7 | ||
|
|
983d1189d0 | ||
|
|
7b2e1c7fb7 | ||
|
|
ceecd3fd6f | ||
|
|
bfd33ecf29 | ||
|
|
56317caafc | ||
|
|
ca4fb9c6f8 | ||
|
|
91800eb243 | ||
|
|
2923ad59f9 | ||
|
|
556ad59a5a | ||
|
|
fcb203cb2d | ||
|
|
6dbcc21921 | ||
|
|
2eccd04ff6 | ||
|
|
e9b44d26b1 | ||
|
|
9f5f10552b | ||
|
|
458bda8877 | ||
|
|
3d35250c07 | ||
|
|
ef06ef2c1b | ||
|
|
ba1ff992ce | ||
|
|
e558827c4e | ||
|
|
1e195a232a | ||
|
|
d1cd914012 | ||
|
|
c3980d433a | ||
|
|
78498ee289 | ||
|
|
76f5a60a82 | ||
|
|
07986731c6 | ||
|
|
f1608778be | ||
|
|
72e91d5131 | ||
|
|
4af4b59e21 | ||
|
|
ca464ca2ba | ||
|
|
9ac6ac6c26 | ||
|
|
b6b5a61c97 | ||
|
|
1acb82e38a | ||
|
|
a6d59811bb | ||
|
|
d4a443d56c | ||
|
|
62bff4aff1 | ||
|
|
f8e68b92b8 | ||
|
|
9c5d2d4543 | ||
|
|
7867126aa6 | ||
|
|
4774d2b9f7 | ||
|
|
f48dcb26e3 | ||
|
|
d1f23cd6d8 | ||
|
|
e601dbd8e3 | ||
|
|
f3ffd8aa41 | ||
|
|
4d98b1cd7e | ||
|
|
b00a0578f9 | ||
|
|
336c097ae7 | ||
|
|
1dd8466f66 | ||
|
|
8b19ef05f3 | ||
|
|
7e11e41a9f | ||
|
|
5914ea7c75 | ||
|
|
f1e84d5e67 | ||
|
|
8e3dd09e11 | ||
|
|
ae0afec98d | ||
|
|
0be43c333e | ||
|
|
83a5d3b258 | ||
|
|
bb4bdec184 | ||
|
|
e0449ba21f | ||
|
|
8a56b90c3e | ||
|
|
218c67a51d | ||
|
|
89c525bbf1 | ||
|
|
2c0baef7d4 | ||
|
|
bfb6718b50 | ||
|
|
d99c066a0b | ||
|
|
2844942c1b | ||
|
|
3a729829fd | ||
|
|
576fdbe1e8 | ||
|
|
87df9cfc5d | ||
|
|
ea375d1605 | ||
|
|
c15bd2831f | ||
|
|
efef877356 | ||
|
|
254a0f7132 | ||
|
|
d2131b286f | ||
|
|
c1c32bda14 | ||
|
|
a1b57d3b94 | ||
|
|
be703974e9 | ||
|
|
29f36791c9 | ||
|
|
492e3d5c77 | ||
|
|
9a3f43f4ee | ||
|
|
baa434ebed | ||
|
|
f99e6766d6 | ||
|
|
3efc64112a | ||
|
|
bc19f892eb | ||
|
|
f8fc0b9dfb | ||
|
|
1b12a2415d | ||
|
|
1c0ac0b12e | ||
|
|
ea2b403ab2 | ||
|
|
8323cd791f | ||
|
|
461ebd1e2f | ||
|
|
be147e897d | ||
|
|
1d329236b3 | ||
|
|
0c6544adcb | ||
|
|
09a1d95b69 | ||
|
|
6b10bbea2f | ||
|
|
b4c8bd9fe4 | ||
|
|
5d13006650 | ||
|
|
6fa5e8adb0 | ||
|
|
60ad7ee15d | ||
|
|
5fe81e89fb | ||
|
|
09cf301eee | ||
|
|
594c62d718 | ||
|
|
4169be45eb | ||
|
|
5d53f519bc | ||
|
|
37864b6575 | ||
|
|
4521ab73b6 | ||
|
|
9ca6127b91 | ||
|
|
ebb01549d0 | ||
|
|
945469c9e0 | ||
|
|
82da0c3361 | ||
|
|
1f08aabe43 | ||
|
|
3ca7e1eea9 | ||
|
|
fa60827840 | ||
|
|
761225712a | ||
|
|
df13d8c61f | ||
|
|
cbccae795d | ||
|
|
100c9c98ce | ||
|
|
d7a64b9519 | ||
|
|
fc212d73ed | ||
|
|
2b05e46b62 | ||
|
|
8d8b64cc3f | ||
|
|
11d87238b8 | ||
|
|
8243030c55 | ||
|
|
111d06eac5 | ||
|
|
20ca6e09dd | ||
|
|
66a0f14a0c | ||
|
|
aba6e34b63 | ||
|
|
4fcc0bd407 | ||
|
|
7960b8ed1b | ||
|
|
2aeee5194c | ||
|
|
ca925588b0 | ||
|
|
5b07c1aa2c | ||
|
|
9510a538c2 | ||
|
|
f32cb70675 | ||
|
|
1499b38aef | ||
|
|
509331ec81 | ||
|
|
247983e982 | ||
|
|
f0e99961b6 | ||
|
|
2291c75ab0 | ||
|
|
77b4801e11 | ||
|
|
a3c8dac6b6 | ||
|
|
5334cb9d55 | ||
|
|
9a73fa885a | ||
|
|
23f60a56f3 | ||
|
|
648f5cf400 | ||
|
|
f49bb1b6a3 | ||
|
|
f0a4c1e888 | ||
|
|
a0fec81221 | ||
|
|
0aad4de5f4 | ||
|
|
280519af29 | ||
|
|
0ae376f133 | ||
|
|
73c9d60e5a | ||
|
|
ae3825dfb2 | ||
|
|
8f1e995cec | ||
|
|
4de8ed684b | ||
|
|
d0f3cdfa10 | ||
|
|
a97e227a9d | ||
|
|
119a457357 | ||
|
|
4ae7e35d9c | ||
|
|
47bf099c36 | ||
|
|
9a43298b3a | ||
|
|
3f17154367 | ||
|
|
f8435e261c | ||
|
|
6162b63d5e | ||
|
|
19e081aedb | ||
|
|
a154bd9f22 | ||
|
|
e618298bda | ||
|
|
7e1b67754c | ||
|
|
868623f9a8 | ||
|
|
49f92cf5cd | ||
|
|
c2fc9ac956 | ||
|
|
15473426c8 | ||
|
|
9820a35a9e | ||
|
|
5e9435924c | ||
|
|
64a354159f | ||
|
|
0a46690eca | ||
|
|
26263aabd4 | ||
|
|
6867a35004 | ||
|
|
7946104566 | ||
|
|
140ddf5109 | ||
|
|
887908107a | ||
|
|
8855a140cf | ||
|
|
a9a99fb31f | ||
|
|
26a4097742 | ||
|
|
99a9cf0fcb | ||
|
|
fd157befae | ||
|
|
6f6840a88a | ||
|
|
562e579675 | ||
|
|
1e89896d05 | ||
|
|
3b896750b8 | ||
|
|
f433949dcd | ||
|
|
8e418ea020 | ||
|
|
6766b0a860 | ||
|
|
ce45de9ea2 | ||
|
|
85d2c0371a | ||
|
|
1d9f548204 | ||
|
|
dad456a1ee | ||
|
|
a0214dfc9a | ||
|
|
c004b43fde | ||
|
|
6848c23d84 | ||
|
|
4104d2fb91 | ||
|
|
86d00f438c | ||
|
|
f65882cca6 | ||
|
|
a3475c2e4b | ||
|
|
4d87256ca7 | ||
|
|
6aa9392699 | ||
|
|
0656f8a43d | ||
|
|
66a3bc0332 | ||
|
|
dbce0e5228 | ||
|
|
8ef35a005c | ||
|
|
8425dce7b2 | ||
|
|
0be1ae0e3b | ||
|
|
83898f3f6c | ||
|
|
a33e71ae88 | ||
|
|
f2b6899298 | ||
|
|
4c058aefd9 | ||
|
|
8c2ad7bdd3 | ||
|
|
e04a8b3abd | ||
|
|
15ab612592 | ||
|
|
4f0f1a9160 |
486
.gitlab-ci.yml
@@ -6,13 +6,16 @@ variables:
|
|||||||
MINGW_BUILD: buildenv-mingw
|
MINGW_BUILD: buildenv-mingw
|
||||||
DEBIAN_CROSS_BUILD: buildenv-debian-cross
|
DEBIAN_CROSS_BUILD: buildenv-debian-cross
|
||||||
|
|
||||||
# torture_auth fails on centos7 docker images, so we don't use -DCLIENT_TESTING=ON
|
# pkd tests fail on CentOS7 docker images, so we don't use -DSERVER_TESTING=ON
|
||||||
centos7/openssl_1.0.x/x86-64:
|
centos7/openssl_1.0.x/x86_64:
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$CENTOS7_BUILD
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$CENTOS7_BUILD
|
||||||
script:
|
script:
|
||||||
- mkdir -p obj && cd obj && cmake3 -DUNIT_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
|
- mkdir -p obj && cd obj && cmake3
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
-DWITH_PCAP=ON .. && make -j$(nproc) && ctest --output-on-failure
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON .. &&
|
||||||
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
tags:
|
tags:
|
||||||
- shared
|
- shared
|
||||||
except:
|
except:
|
||||||
@@ -23,11 +26,15 @@ centos7/openssl_1.0.x/x86-64:
|
|||||||
paths:
|
paths:
|
||||||
- obj/
|
- obj/
|
||||||
|
|
||||||
fedora/openssl_1.1.x/x86-64:
|
fedora/openssl_1.1.x/x86_64:
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
script:
|
script:
|
||||||
- mkdir -p obj && cd obj && cmake -DCMAKE_BUILD_TYPE=Debug
|
- mkdir -p obj && cd obj && cmake
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_BLOWFISH_CIPHER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DWITH_DEBUG_PACKET=ON -DWITH_DEBUG_CALLTRACE=ON
|
||||||
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
|
||||||
make -j$(nproc) && ctest --output-on-failure
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
tags:
|
tags:
|
||||||
@@ -40,15 +47,59 @@ fedora/openssl_1.1.x/x86-64:
|
|||||||
paths:
|
paths:
|
||||||
- obj/
|
- obj/
|
||||||
|
|
||||||
|
fedora/openssl_1.1.x/x86_64/fips:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
|
script:
|
||||||
|
- echo 1 > /etc/system-fips
|
||||||
|
- update-crypto-policies --set FIPS
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_BLOWFISH_CIPHER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DWITH_DEBUG_CRYPTO=ON -DWITH_DEBUG_PACKET=ON -DWITH_DEBUG_CALLTRACE=ON
|
||||||
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
|
||||||
|
make -j$(nproc) && OPENSSL_FORCE_FIPS_MODE=1 ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
fedora/openssl_1.1.x/x86_64/minimal:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=OFF -DWITH_SERVER=OFF -DWITH_ZLIB=OFF -DWITH_PCAP=OFF
|
||||||
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DWITH_GEX=OFF .. &&
|
||||||
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
# Address sanitizer doesn't mix well with LD_PRELOAD used in the testsuite
|
# Address sanitizer doesn't mix well with LD_PRELOAD used in the testsuite
|
||||||
.fedora/address-sanitizer:
|
# so, this is only enabled for unit tests right now.
|
||||||
|
# TODO: add -DCLIENT_TESTING=ON -DSERVER_TESTING=ON
|
||||||
|
fedora/address-sanitizer:
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
script:
|
script:
|
||||||
- mkdir -p obj && cd obj && cmake
|
- mkdir -p obj && cd obj && cmake
|
||||||
-DCMAKE_C_FLAGS="-O2 -g -fsanitize=address"
|
-DCMAKE_BUILD_TYPE=AddressSanitizer
|
||||||
-DCMAKE_LINK_FLAGS="-fsanitize=address -static-libasan"
|
-DPICKY_DEVELOPER=ON
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
|
-DUNIT_TESTING=ON .. &&
|
||||||
make -j$(nproc) && ctest --output-on-failure
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
tags:
|
tags:
|
||||||
- shared
|
- shared
|
||||||
@@ -60,12 +111,35 @@ fedora/openssl_1.1.x/x86-64:
|
|||||||
paths:
|
paths:
|
||||||
- obj/
|
- obj/
|
||||||
|
|
||||||
|
# This is disabled as it report OpenSSL issues
|
||||||
|
# It also has ethe same issues with cwrap as AddressSanitizer
|
||||||
|
.fedora/memory-sanitizer:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_BUILD_TYPE=MemorySanitizer
|
||||||
|
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DUNIT_TESTING=ON ..
|
||||||
|
&& make -j$(nproc) && ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
fedora/undefined-sanitizer:
|
fedora/undefined-sanitizer:
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
script:
|
script:
|
||||||
- mkdir -p obj && cd obj && cmake
|
- mkdir -p obj && cd obj && cmake
|
||||||
-DCMAKE_C_FLAGS="-fsanitize=undefined -fsanitize=null -fsanitize=alignment -fno-sanitize-recover"
|
-DCMAKE_BUILD_TYPE=UndefinedSanitizer
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON ..
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON ..
|
||||||
&& make -j$(nproc) && ctest --output-on-failure
|
&& make -j$(nproc) && ctest --output-on-failure
|
||||||
tags:
|
tags:
|
||||||
@@ -78,16 +152,27 @@ fedora/undefined-sanitizer:
|
|||||||
paths:
|
paths:
|
||||||
- obj/
|
- obj/
|
||||||
|
|
||||||
fedora/static-analysis:
|
fedora/csbuild:
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
script:
|
script:
|
||||||
- export CCC_CC=clang
|
- |
|
||||||
- export CCC_CXX=clang++
|
if [[ -z "$CI_COMMIT_BEFORE_SHA" ]]; then
|
||||||
- mkdir -p obj && cd obj && scan-build cmake -DCMAKE_BUILD_TYPE=Debug
|
export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~20")
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
fi
|
||||||
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON
|
|
||||||
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang .. &&
|
# Check if the commit exists in this branch
|
||||||
scan-build --status-bugs -o scan make -j$(nproc)
|
# This is not the case for a force push
|
||||||
|
git branch --contains $CI_COMMIT_BEFORE_SHA 2>/dev/null || export CI_COMMIT_BEFORE_SHA=$(git rev-parse "${CI_COMMIT_SHA}~20")
|
||||||
|
|
||||||
|
export CI_COMMIT_RANGE="$CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA"
|
||||||
|
|
||||||
|
- csbuild
|
||||||
|
--build-dir=obj-csbuild
|
||||||
|
--prep-cmd="rm -rf CMakeFiles CMakeCache.txt && cmake -DCMAKE_BUILD_TYPE=Debug -DPICKY_DEVELOPER=ON -DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON -DFUZZ_TESTING=ON @SRCDIR@"
|
||||||
|
--build-cmd "make clean && make -j$(nproc)"
|
||||||
|
--git-commit-range $CI_COMMIT_RANGE
|
||||||
|
--color
|
||||||
|
--print-current --print-fixed
|
||||||
tags:
|
tags:
|
||||||
- shared
|
- shared
|
||||||
except:
|
except:
|
||||||
@@ -96,15 +181,17 @@ fedora/static-analysis:
|
|||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
when: on_failure
|
when: on_failure
|
||||||
paths:
|
paths:
|
||||||
- obj/scan
|
- obj-csbuild/
|
||||||
|
|
||||||
# That is a specific runner that we cannot enable universally.
|
# That is a specific runner that we cannot enable universally.
|
||||||
# We restrict it to builds under the $BUILD_IMAGES_PROJECT project.
|
# We restrict it to builds under the $BUILD_IMAGES_PROJECT project.
|
||||||
freebsd/x86-64:
|
freebsd/x86_64:
|
||||||
image:
|
image:
|
||||||
script:
|
script:
|
||||||
- mkdir -p obj && cd obj && cmake -DCMAKE_BUILD_TYPE=Debug
|
- mkdir -p obj && cd obj && cmake
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
-DUNIT_TESTING=ON .. &&
|
-DUNIT_TESTING=ON .. &&
|
||||||
make && ctest --output-on-failure
|
make && ctest --output-on-failure
|
||||||
tags:
|
tags:
|
||||||
@@ -120,11 +207,13 @@ freebsd/x86-64:
|
|||||||
paths:
|
paths:
|
||||||
- obj/
|
- obj/
|
||||||
|
|
||||||
fedora/libgcrypt/x86-64:
|
fedora/libgcrypt/x86_64:
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
script:
|
script:
|
||||||
- mkdir -p obj && cd obj && cmake -DCMAKE_BUILD_TYPE=Debug
|
- mkdir -p obj && cd obj && cmake
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON
|
||||||
-DWITH_GCRYPT=ON .. &&
|
-DWITH_GCRYPT=ON .. &&
|
||||||
make -j$(nproc) && ctest --output-on-failure
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
@@ -138,11 +227,13 @@ fedora/libgcrypt/x86-64:
|
|||||||
paths:
|
paths:
|
||||||
- obj/
|
- obj/
|
||||||
|
|
||||||
fedora/mbedtls/x86-64:
|
fedora/mbedtls/x86_64:
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
script:
|
script:
|
||||||
- mkdir -p obj && cd obj && cmake -DCMAKE_BUILD_TYPE=Debug
|
- mkdir -p obj && cd obj && cmake
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON
|
||||||
-DWITH_MBEDTLS=ON .. &&
|
-DWITH_MBEDTLS=ON .. &&
|
||||||
make -j$(nproc) && ctest --output-on-failure
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
@@ -156,92 +247,20 @@ fedora/mbedtls/x86-64:
|
|||||||
paths:
|
paths:
|
||||||
- obj/
|
- obj/
|
||||||
|
|
||||||
tumbleweed/openssl_1.1.x/x86-64:
|
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
|
||||||
script:
|
|
||||||
- mkdir -p obj && cd obj && cmake -DCMAKE_BUILD_TYPE=Debug
|
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
|
||||||
-DKRB5_CONFIG=/usr/lib/mit/bin/krb5-config
|
|
||||||
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
|
|
||||||
make -j$(nproc) && ctest --output-on-failure
|
|
||||||
tags:
|
|
||||||
- shared
|
|
||||||
except:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
when: on_failure
|
|
||||||
paths:
|
|
||||||
- obj/
|
|
||||||
|
|
||||||
tumbleweed/openssl_1.1.x/x86:
|
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
|
||||||
script:
|
|
||||||
- mkdir -p obj && cd obj && cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-m32.cmake
|
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
|
||||||
-DUNIT_TESTING=ON .. &&
|
|
||||||
make -j$(nproc) && ctest --output-on-failure
|
|
||||||
tags:
|
|
||||||
- shared
|
|
||||||
except:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
when: on_failure
|
|
||||||
paths:
|
|
||||||
- obj/
|
|
||||||
|
|
||||||
tumbleweed/undefined-sanitizer:
|
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
|
||||||
script:
|
|
||||||
- mkdir -p obj && cd obj && cmake
|
|
||||||
-DCMAKE_C_FLAGS="-fsanitize=undefined -fsanitize=null -fsanitize=alignment -fno-sanitize-recover"
|
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
|
||||||
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON ..
|
|
||||||
&& make -j$(nproc) && ctest --output-on-failure
|
|
||||||
tags:
|
|
||||||
- shared
|
|
||||||
except:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
when: on_failure
|
|
||||||
paths:
|
|
||||||
- obj/
|
|
||||||
|
|
||||||
tumbleweed/static-analysis:
|
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
|
||||||
script:
|
|
||||||
- export CCC_CC=clang
|
|
||||||
- export CCC_CXX=clang++
|
|
||||||
- mkdir -p obj && cd obj && scan-build cmake -DCMAKE_BUILD_TYPE=Debug
|
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
|
||||||
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON
|
|
||||||
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang .. &&
|
|
||||||
scan-build --status-bugs -o scan make -j$(nproc)
|
|
||||||
tags:
|
|
||||||
- shared
|
|
||||||
except:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
when: on_failure
|
|
||||||
paths:
|
|
||||||
- obj/scan
|
|
||||||
|
|
||||||
# Unit testing only, no client and pkd testing, because cwrap is not available
|
# Unit testing only, no client and pkd testing, because cwrap is not available
|
||||||
# for MinGW
|
# for MinGW
|
||||||
mingw64:
|
fedora/mingw64:
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$MINGW_BUILD
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$MINGW_BUILD
|
||||||
script:
|
script:
|
||||||
- Xvfb :1 -screen 0 1024x768x16 -ac +extension GLX +render -noreset -nolisten tcp &
|
|
||||||
- export DISPLAY=:1
|
|
||||||
- mkdir -p obj && cd obj && mingw64-cmake -DCMAKE_BUILD_TYPE=Debug
|
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
|
||||||
-DUNIT_TESTING=ON .. &&
|
|
||||||
make -j$(nproc)
|
|
||||||
- export WINEPATH=/usr/x86_64-w64-mingw32/sys-root/mingw/bin
|
- export WINEPATH=/usr/x86_64-w64-mingw32/sys-root/mingw/bin
|
||||||
- ctest --output-on-failure
|
- export WINEDEBUG=-all
|
||||||
|
- mkdir -p obj && cd obj && mingw64-cmake
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DUNIT_TESTING=ON .. &&
|
||||||
|
make -j$(nproc) &&
|
||||||
|
ctest --output-on-failure
|
||||||
tags:
|
tags:
|
||||||
- shared
|
- shared
|
||||||
except:
|
except:
|
||||||
@@ -254,17 +273,18 @@ mingw64:
|
|||||||
|
|
||||||
# Unit testing only, no client and pkd testing, because cwrap is not available
|
# Unit testing only, no client and pkd testing, because cwrap is not available
|
||||||
# for MinGW
|
# for MinGW
|
||||||
mingw32:
|
fedora/mingw32:
|
||||||
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$MINGW_BUILD
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$MINGW_BUILD
|
||||||
script:
|
script:
|
||||||
- Xvfb :1 -screen 0 1024x768x16 -ac +extension GLX +render -noreset -nolisten tcp &
|
|
||||||
- export DISPLAY=:1
|
|
||||||
- mkdir -p obj && cd obj && mingw32-cmake -DCMAKE_BUILD_TYPE=Debug
|
|
||||||
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
|
||||||
-DUNIT_TESTING=ON .. &&
|
|
||||||
make -j$(nproc)
|
|
||||||
- export WINEPATH=/usr/i686-w64-mingw32/sys-root/mingw/bin
|
- export WINEPATH=/usr/i686-w64-mingw32/sys-root/mingw/bin
|
||||||
- ctest --output-on-failure
|
- export WINEDEBUG=-all
|
||||||
|
- mkdir -p obj && cd obj && mingw32-cmake
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DUNIT_TESTING=ON .. &&
|
||||||
|
make -j$(nproc) &&
|
||||||
|
ctest --output-on-failure
|
||||||
tags:
|
tags:
|
||||||
- shared
|
- shared
|
||||||
except:
|
except:
|
||||||
@@ -284,10 +304,11 @@ mingw32:
|
|||||||
- mkdir -p obj && cd obj && cmake
|
- mkdir -p obj && cd obj && cmake
|
||||||
-DCMAKE_C_COMPILER="$(which $host-gcc)"
|
-DCMAKE_C_COMPILER="$(which $host-gcc)"
|
||||||
-DCMAKE_CXX_COMPILER="$(which $host-g++)"
|
-DCMAKE_CXX_COMPILER="$(which $host-g++)"
|
||||||
-DCMAKE_BUILD_TYPE=Debug
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
-DUNIT_TESTING=ON -DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON
|
-DUNIT_TESTING=ON -DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON
|
||||||
-DWITH_PCAP=ON .. && make -j$(nproc)
|
-DWITH_PCAP=ON .. &&
|
||||||
- ctest --output-on-failure -j$(nproc)
|
make -j$(nproc) &&
|
||||||
|
ctest --output-on-failure
|
||||||
tags:
|
tags:
|
||||||
- shared
|
- shared
|
||||||
except:
|
except:
|
||||||
@@ -298,5 +319,218 @@ mingw32:
|
|||||||
paths:
|
paths:
|
||||||
- obj/
|
- obj/
|
||||||
|
|
||||||
Debian.cross.mips-linux-gnu:
|
.Debian.cross.mips-linux-gnu:
|
||||||
<<: *Debian_cross_template
|
<<: *Debian_cross_template
|
||||||
|
|
||||||
|
tumbleweed/openssl_1.1.x/x86_64/gcc:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DKRB5_CONFIG=/usr/lib/mit/bin/krb5-config
|
||||||
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
|
||||||
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
tumbleweed/openssl_1.1.x/x86/gcc:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-m32.cmake
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DUNIT_TESTING=ON .. &&
|
||||||
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
tumbleweed/openssl_1.1.x/x86_64/gcc7:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DKRB5_CONFIG=/usr/lib/mit/bin/krb5-config
|
||||||
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
|
||||||
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
tumbleweed/openssl_1.1.x/x86/gcc7:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cross-m32.cmake
|
||||||
|
-DCMAKE_C_COMPILER=gcc-7 -DCMAKE_CXX_COMPILER=g++-7
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DUNIT_TESTING=ON .. &&
|
||||||
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
tumbleweed/openssl_1.1.x/x86_64/clang:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
|
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DKRB5_CONFIG=/usr/lib/mit/bin/krb5-config
|
||||||
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
|
||||||
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
tumbleweed/docs:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake .. && make docs
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
tumbleweed/undefined-sanitizer:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_BUILD_TYPE=UndefinedSanitizer
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
|
||||||
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
tumbleweed/static-analysis:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
||||||
|
script:
|
||||||
|
- export CCC_CC=clang
|
||||||
|
- export CCC_CXX=clang++
|
||||||
|
- mkdir -p obj && cd obj && scan-build cmake
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug
|
||||||
|
-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DUNIT_TESTING=ON -DCLIENT_TESTING=ON -DSERVER_TESTING=ON .. &&
|
||||||
|
scan-build --status-bugs -o scan make -j$(nproc)
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/scan
|
||||||
|
|
||||||
|
visualstudio/x86_64:
|
||||||
|
script:
|
||||||
|
- $env:VCPKG_DEFAULT_TRIPLET="x64-windows"
|
||||||
|
- cd obj
|
||||||
|
- cmake
|
||||||
|
-A x64
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_TOOLCHAIN_FILE"
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DUNIT_TESTING=ON ..
|
||||||
|
- cmake --build .
|
||||||
|
- ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- vs2017
|
||||||
|
- windows
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
only:
|
||||||
|
- branches@libssh/libssh-mirror
|
||||||
|
- branches@ansasaki/libssh-mirror
|
||||||
|
- branches@cryptomilk/libssh-mirror
|
||||||
|
- branches@jjelen/libssh-mirror
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
visualstudio/x86:
|
||||||
|
script:
|
||||||
|
- $env:VCPKG_DEFAULT_TRIPLET="x86-windows"
|
||||||
|
- cd obj
|
||||||
|
- cmake
|
||||||
|
-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_TOOLCHAIN_FILE"
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON -DWITH_PCAP=ON
|
||||||
|
-DUNIT_TESTING=ON ..
|
||||||
|
- cmake --build .
|
||||||
|
- ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- vs2017
|
||||||
|
- windows
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
only:
|
||||||
|
- branches@libssh/libssh-mirror
|
||||||
|
- branches@ansasaki/libssh-mirror
|
||||||
|
- branches@cryptomilk/libssh-mirror
|
||||||
|
- branches@jjelen/libssh-mirror
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|||||||
@@ -1,7 +1,16 @@
|
|||||||
cmake_minimum_required(VERSION 3.2.0)
|
cmake_minimum_required(VERSION 3.3.0)
|
||||||
cmake_policy(SET CMP0048 NEW)
|
cmake_policy(SET CMP0048 NEW)
|
||||||
|
|
||||||
project(libssh VERSION 0.8.0 LANGUAGES C)
|
# Specify search path for CMake modules to be loaded by include()
|
||||||
|
# and find_package()
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
|
||||||
|
|
||||||
|
# Add defaults for cmake
|
||||||
|
# Those need to be set before the project() call.
|
||||||
|
include(DefineCMakeDefaults)
|
||||||
|
include(DefineCompilerFlags)
|
||||||
|
|
||||||
|
project(libssh VERSION 0.9.0 LANGUAGES C)
|
||||||
|
|
||||||
# global needed variable
|
# global needed variable
|
||||||
set(APPLICATION_NAME ${PROJECT_NAME})
|
set(APPLICATION_NAME ${PROJECT_NAME})
|
||||||
@@ -13,26 +22,26 @@ set(APPLICATION_NAME ${PROJECT_NAME})
|
|||||||
# Increment AGE. Set REVISION to 0
|
# Increment AGE. Set REVISION to 0
|
||||||
# If the source code was changed, but there were no interface changes:
|
# If the source code was changed, but there were no interface changes:
|
||||||
# Increment REVISION.
|
# Increment REVISION.
|
||||||
set(LIBRARY_VERSION "4.5.0")
|
set(LIBRARY_VERSION "4.8.1")
|
||||||
set(LIBRARY_SOVERSION "4")
|
set(LIBRARY_SOVERSION "4")
|
||||||
|
|
||||||
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
|
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
|
||||||
set(CMAKE_MODULE_PATH
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules
|
|
||||||
)
|
|
||||||
|
|
||||||
# add definitions
|
# add definitions
|
||||||
include(DefineCMakeDefaults)
|
|
||||||
include(DefinePlatformDefaults)
|
include(DefinePlatformDefaults)
|
||||||
include(DefineCompilerFlags)
|
|
||||||
include(DefineInstallationPaths)
|
include(DefineInstallationPaths)
|
||||||
include(DefineOptions.cmake)
|
include(DefineOptions.cmake)
|
||||||
include(CPackConfig.cmake)
|
include(CPackConfig.cmake)
|
||||||
|
|
||||||
|
include(CompilerChecks.cmake)
|
||||||
|
|
||||||
# disallow in-source build
|
# disallow in-source build
|
||||||
include(MacroEnsureOutOfSourceBuild)
|
include(MacroEnsureOutOfSourceBuild)
|
||||||
macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.")
|
macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.")
|
||||||
|
|
||||||
|
# Copy library files to a lib sub-directory
|
||||||
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
|
||||||
|
|
||||||
# search for libraries
|
# search for libraries
|
||||||
if (WITH_ZLIB)
|
if (WITH_ZLIB)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
@@ -61,6 +70,10 @@ else (WITH_GCRYPT)
|
|||||||
endif (NOT OPENSSL_FOUND)
|
endif (NOT OPENSSL_FOUND)
|
||||||
endif(WITH_GCRYPT)
|
endif(WITH_GCRYPT)
|
||||||
|
|
||||||
|
if (UNIT_TESTING)
|
||||||
|
find_package(CMocka REQUIRED)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# Find out if we have threading available
|
# Find out if we have threading available
|
||||||
set(CMAKE_THREAD_PREFER_PTHREADS ON)
|
set(CMAKE_THREAD_PREFER_PTHREADS ON)
|
||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
@@ -83,7 +96,7 @@ endif (BSD OR SOLARIS OR OSX)
|
|||||||
|
|
||||||
# Disable symbol versioning in non UNIX platforms
|
# Disable symbol versioning in non UNIX platforms
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
find_package(ABIMap)
|
find_package(ABIMap 0.3.1)
|
||||||
else (UNIX)
|
else (UNIX)
|
||||||
set(WITH_SYMBOL_VERSIONING OFF)
|
set(WITH_SYMBOL_VERSIONING OFF)
|
||||||
endif (UNIX)
|
endif (UNIX)
|
||||||
@@ -110,11 +123,22 @@ install(
|
|||||||
)
|
)
|
||||||
endif (UNIX)
|
endif (UNIX)
|
||||||
|
|
||||||
# cmake config files
|
# CMake config files
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
set(LIBSSH_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX})
|
set(LIBSSH_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
|
|
||||||
configure_file(${PROJECT_NAME}-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake @ONLY)
|
# libssh-config-version.cmake
|
||||||
configure_file(${PROJECT_NAME}-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake @ONLY)
|
write_basic_package_version_file(libssh-config-version.cmake
|
||||||
|
VERSION ${PROJECT_VERSION}
|
||||||
|
COMPATIBILITY SameMajorVersion)
|
||||||
|
|
||||||
|
# libssh-config.cmake
|
||||||
|
configure_package_config_file(${PROJECT_NAME}-config.cmake.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
|
||||||
|
INSTALL_DESTINATION ${CMAKE_INSTALL_DIR}/${PROJECT_NAME}
|
||||||
|
PATH_VARS INCLUDE_INSTALL_DIR LIB_INSTALL_DIR)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
|
||||||
@@ -125,18 +149,13 @@ install(
|
|||||||
devel
|
devel
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# in tree build settings
|
|
||||||
configure_file(libssh-build-tree-settings.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libssh-build-tree-settings.cmake @ONLY)
|
|
||||||
|
|
||||||
if (WITH_EXAMPLES)
|
if (WITH_EXAMPLES)
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif (WITH_EXAMPLES)
|
endif (WITH_EXAMPLES)
|
||||||
|
|
||||||
if (UNIT_TESTING)
|
if (UNIT_TESTING)
|
||||||
find_package(CMocka REQUIRED)
|
include(AddCMockaTest)
|
||||||
include(AddCMockaTest)
|
add_subdirectory(tests)
|
||||||
add_subdirectory(tests)
|
|
||||||
endif (UNIT_TESTING)
|
endif (UNIT_TESTING)
|
||||||
|
|
||||||
### SOURCE PACKAGE
|
### SOURCE PACKAGE
|
||||||
@@ -158,13 +177,13 @@ if (WITH_SYMBOL_VERSIONING AND ABIMAP_FOUND)
|
|||||||
message(STATUS "Library version bumped to ${LIBRARY_VERSION}: Updating ABI")
|
message(STATUS "Library version bumped to ${LIBRARY_VERSION}: Updating ABI")
|
||||||
|
|
||||||
# Get the list of header files
|
# Get the list of header files
|
||||||
get_file_list("${PROJECT_NAME}_header_list"
|
get_file_list(${PROJECT_NAME}_header_list
|
||||||
DIRECTORIES "${CMAKE_SOURCE_DIR}/include/libssh"
|
DIRECTORIES "${CMAKE_SOURCE_DIR}/include/libssh"
|
||||||
FILES_PATTERNS "*.h")
|
FILES_PATTERNS "*.h")
|
||||||
|
|
||||||
# Extract the symbols marked as "LIBSSH_API" from the header files
|
# Extract the symbols marked as "LIBSSH_API" from the header files
|
||||||
extract_symbols(${PROJECT_NAME}.symbols
|
extract_symbols(${PROJECT_NAME}.symbols
|
||||||
HEADERS_LIST_FILE "${PROJECT_NAME}_header_list"
|
HEADERS_LIST ${PROJECT_NAME}_header_list
|
||||||
FILTER_PATTERN "LIBSSH_API"
|
FILTER_PATTERN "LIBSSH_API"
|
||||||
COPY_TO "${CMAKE_SOURCE_DIR}/src/ABI/${PROJECT_NAME}-${LIBRARY_VERSION}.symbols")
|
COPY_TO "${CMAKE_SOURCE_DIR}/src/ABI/${PROJECT_NAME}-${LIBRARY_VERSION}.symbols")
|
||||||
|
|
||||||
@@ -180,7 +199,7 @@ if (WITH_SYMBOL_VERSIONING AND ABIMAP_FOUND)
|
|||||||
|
|
||||||
# Generate the symbol version map file
|
# Generate the symbol version map file
|
||||||
generate_map_file(${_SYMBOL_TARGET}
|
generate_map_file(${_SYMBOL_TARGET}
|
||||||
SYMBOLS "${PROJECT_NAME}.symbols"
|
SYMBOLS ${PROJECT_NAME}.symbols
|
||||||
RELEASE_NAME_VERSION ${PROJECT_NAME}_${LIBRARY_VERSION}
|
RELEASE_NAME_VERSION ${PROJECT_NAME}_${LIBRARY_VERSION}
|
||||||
CURRENT_MAP ${MAP_PATH}
|
CURRENT_MAP ${MAP_PATH}
|
||||||
COPY_TO ${MAP_PATH}
|
COPY_TO ${MAP_PATH}
|
||||||
@@ -204,10 +223,12 @@ message(STATUS "libnacl support: ${WITH_NACL}")
|
|||||||
message(STATUS "SFTP support: ${WITH_SFTP}")
|
message(STATUS "SFTP support: ${WITH_SFTP}")
|
||||||
message(STATUS "Server support : ${WITH_SERVER}")
|
message(STATUS "Server support : ${WITH_SERVER}")
|
||||||
message(STATUS "GSSAPI support : ${WITH_GSSAPI}")
|
message(STATUS "GSSAPI support : ${WITH_GSSAPI}")
|
||||||
|
message(STATUS "GEX support : ${WITH_GEX}")
|
||||||
message(STATUS "Pcap debugging support : ${WITH_PCAP}")
|
message(STATUS "Pcap debugging support : ${WITH_PCAP}")
|
||||||
message(STATUS "With static library: ${WITH_STATIC_LIB}")
|
message(STATUS "With static library: ${WITH_STATIC_LIB}")
|
||||||
message(STATUS "Unit testing: ${UNIT_TESTING}")
|
message(STATUS "Unit testing: ${UNIT_TESTING}")
|
||||||
message(STATUS "Client code testing: ${CLIENT_TESTING}")
|
message(STATUS "Client code testing: ${CLIENT_TESTING}")
|
||||||
|
message(STATUS "Blowfish cipher support: ${WITH_BLOWFISH_CIPHER}")
|
||||||
set(_SERVER_TESTING OFF)
|
set(_SERVER_TESTING OFF)
|
||||||
if (WITH_SERVER)
|
if (WITH_SERVER)
|
||||||
set(_SERVER_TESTING ${SERVER_TESTING})
|
set(_SERVER_TESTING ${SERVER_TESTING})
|
||||||
@@ -222,5 +243,9 @@ message(STATUS "Benchmarks: ${WITH_BENCHMARKS}")
|
|||||||
message(STATUS "Symbol versioning: ${WITH_SYMBOL_VERSIONING}")
|
message(STATUS "Symbol versioning: ${WITH_SYMBOL_VERSIONING}")
|
||||||
message(STATUS "Allow ABI break: ${WITH_ABI_BREAK}")
|
message(STATUS "Allow ABI break: ${WITH_ABI_BREAK}")
|
||||||
message(STATUS "Release is final: ${WITH_FINAL}")
|
message(STATUS "Release is final: ${WITH_FINAL}")
|
||||||
|
message(STATUS "Global client config: ${GLOBAL_CLIENT_CONFIG}")
|
||||||
|
if (WITH_SERVER)
|
||||||
|
message(STATUS "Global bind config: ${GLOBAL_BIND_CONFIG}")
|
||||||
|
endif()
|
||||||
message(STATUS "********************************************")
|
message(STATUS "********************************************")
|
||||||
|
|
||||||
|
|||||||
13
COPYING
@@ -455,6 +455,15 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
|||||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
DAMAGES.
|
DAMAGES.
|
||||||
|
|
||||||
Linking with OpenSSL
|
Linking with OpenSSL
|
||||||
17. In addition, as a special exception, we give permission to link the code of its release of libssh with the OpenSSL project's "OpenSSL" library (or with modified versions of it that use the same license as the "OpenSSL" library), and distribute the linked executables. You must obey the GNU Lesser General Public License in all respects for all of the code used other than "OpenSSL". If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.
|
|
||||||
|
17. In addition, as a special exception, we give permission to link the code
|
||||||
|
of its release of libssh with the OpenSSL project's "OpenSSL" library (or with
|
||||||
|
modified versions of it that use the same license as the "OpenSSL" library),
|
||||||
|
and distribute the linked executables. You must obey the GNU Lesser General
|
||||||
|
Public License in all respects for all of the code used other than "OpenSSL".
|
||||||
|
If you modify this file, you may extend this exception to your version of the
|
||||||
|
file, but you are not obligated to do so. If you do not wish to do so, delete
|
||||||
|
this exception statement from your version.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
|||||||
|
|
||||||
# SOURCE GENERATOR
|
# SOURCE GENERATOR
|
||||||
set(CPACK_SOURCE_GENERATOR "TXZ")
|
set(CPACK_SOURCE_GENERATOR "TXZ")
|
||||||
set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]git/;.gitignore;build;obj*;tags;cscope.*")
|
set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]git/;.gitignore;/build*;/obj*;tags;cscope.*")
|
||||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||||
|
|
||||||
### NSIS INSTALLER
|
### NSIS INSTALLER
|
||||||
|
|||||||
80
ChangeLog
@@ -1,6 +1,86 @@
|
|||||||
ChangeLog
|
ChangeLog
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
version 0.9.0 (released 2019-06-28)
|
||||||
|
* Added support for AES-GCM
|
||||||
|
* Added improved rekeying support
|
||||||
|
* Added performance improvements
|
||||||
|
* Disabled blowfish support by default
|
||||||
|
* Fixed several ssh config parsing issues
|
||||||
|
* Added support for DH Group Exchange KEX
|
||||||
|
* Added support for Encrypt-then-MAC mode
|
||||||
|
* Added support for parsing server side configuration file
|
||||||
|
* Added support for ECDSA/Ed25519 certificates
|
||||||
|
* Added FIPS 140-2 compatibility
|
||||||
|
* Improved known_hosts parsing
|
||||||
|
* Improved documentation
|
||||||
|
* Improved OpenSSL API usage for KEX, DH, and signatures
|
||||||
|
|
||||||
|
version 0.8.7 (released 2019-02-25)
|
||||||
|
* Fixed handling extension flags in the server implementation
|
||||||
|
* Fixed exporting ed25519 private keys
|
||||||
|
* Fixed corner cases for rsa-sha2 signatures
|
||||||
|
* Fixed some issues with connector
|
||||||
|
|
||||||
|
version 0.8.6 (released 2018-12-24)
|
||||||
|
* Fixed compilation issues with different OpenSSL versions
|
||||||
|
* Fixed StrictHostKeyChecking in new knownhosts API
|
||||||
|
* Fixed ssh_send_keepalive() with packet filter
|
||||||
|
* Fixed possible crash with knownhosts options
|
||||||
|
* Fixed issus with rekeying
|
||||||
|
* Fixed strong ECDSA keys
|
||||||
|
* Fixed some issues with rsa-sha2 extentions
|
||||||
|
* Fixed access violation in ssh_init() (static linking)
|
||||||
|
* Fixed ssh_channel_close() handling
|
||||||
|
|
||||||
|
version 0.8.5 (released 2018-10-29)
|
||||||
|
* Added support to get known_hosts locations with ssh_options_get()
|
||||||
|
* Fixed preferred algorithm for known hosts negotiations
|
||||||
|
* Fixed KEX with some server implementations (e.g. Cisco)
|
||||||
|
* Fixed issues with MSVC
|
||||||
|
* Fixed keyboard-interactive auth in server mode
|
||||||
|
(regression from CVE-2018-10933)
|
||||||
|
* Fixed gssapi auth in server mode (regression from CVE-2018-10933)
|
||||||
|
* Fixed socket fd handling with proxy command
|
||||||
|
* Fixed a memory leak with OpenSSL
|
||||||
|
|
||||||
|
version 0.8.4 (released 2018-10-16)
|
||||||
|
* Fixed CVE-2018-10933
|
||||||
|
* Fixed building without globbing support
|
||||||
|
* Fixed possible memory leaks
|
||||||
|
* Avoid SIGPIPE on sockets
|
||||||
|
|
||||||
|
version 0.8.3 (released 2018-09-21)
|
||||||
|
* Added support for rsa-sha2
|
||||||
|
* Added support to parse private keys in openssh container format
|
||||||
|
(other than ed25519)
|
||||||
|
* Added support for diffie-hellman-group18-sha512 and
|
||||||
|
diffie-hellman-group16-sha512
|
||||||
|
* Added ssh_get_fingerprint_hash()
|
||||||
|
* Added ssh_pki_export_privkey_base64()
|
||||||
|
* Added support for Match keyword in config file
|
||||||
|
* Improved performance and reduced memory footprint for sftp
|
||||||
|
* Fixed ecdsa publickey auth
|
||||||
|
* Fixed reading a closed channel
|
||||||
|
* Added support to announce posix-rename@openssh.com and
|
||||||
|
hardlink@openssh.com in the sftp server
|
||||||
|
|
||||||
|
version 0.8.2 (released 2018-08-30)
|
||||||
|
* Added sha256 fingerprints for pubkeys
|
||||||
|
* Improved compiler flag detection
|
||||||
|
* Fixed race condition in reading sftp messages
|
||||||
|
* Fixed doxygen generation and added modern style
|
||||||
|
* Fixed library initialization on Windows
|
||||||
|
* Fixed __bounded__ attribute detection
|
||||||
|
* Fixed a bug in the options parser
|
||||||
|
* Fixed documentation for new knwon_hosts API
|
||||||
|
|
||||||
|
version 0.8.1 (released 2018-08-13)
|
||||||
|
* Fixed version number in the header
|
||||||
|
* Fixed version number in pkg-config and cmake config
|
||||||
|
* Fixed library initialization
|
||||||
|
* Fixed attribute detection
|
||||||
|
|
||||||
version 0.8.0 (released 2018-08-10)
|
version 0.8.0 (released 2018-08-10)
|
||||||
* Removed support for deprecated SSHv1 protocol
|
* Removed support for deprecated SSHv1 protocol
|
||||||
* Added new connector API for clients
|
* Added new connector API for clients
|
||||||
|
|||||||
121
CompilerChecks.cmake
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
include(AddCCompilerFlag)
|
||||||
|
include(CheckCCompilerFlagSSP)
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
#
|
||||||
|
# Check for -Werror turned on if possible
|
||||||
|
#
|
||||||
|
# This will prevent that compiler flags are detected incorrectly.
|
||||||
|
#
|
||||||
|
check_c_compiler_flag("-Werror" REQUIRED_FLAGS_WERROR)
|
||||||
|
if (REQUIRED_FLAGS_WERROR)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-Werror")
|
||||||
|
|
||||||
|
if (PICKY_DEVELOPER)
|
||||||
|
list(APPEND SUPPORTED_COMPILER_FLAGS "-Werror")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_c_compiler_flag("-std=gnu99" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wpedantic" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wall" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wshadow" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wmissing-prototypes" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wcast-align" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
#add_c_compiler_flag("-Wcast-qual" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Werror=address" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wstrict-prototypes" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Werror=strict-prototypes" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wwrite-strings" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Werror=write-strings" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Werror-implicit-function-declaration" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wpointer-arith" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Werror=pointer-arith" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wdeclaration-after-statement" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Werror=declaration-after-statement" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wreturn-type" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Werror=return-type" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wuninitialized" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Werror=uninitialized" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wimplicit-fallthrough" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Werror=strict-overflow" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wstrict-overflow=2" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wno-format-zero-length" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wmissing-field-initializers" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
|
||||||
|
check_c_compiler_flag("-Wformat" REQUIRED_FLAGS_WFORMAT)
|
||||||
|
if (REQUIRED_FLAGS_WFORMAT)
|
||||||
|
list(APPEND SUPPORTED_COMPILER_FLAGS "-Wformat")
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wformat")
|
||||||
|
endif()
|
||||||
|
add_c_compiler_flag("-Wformat-security" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Werror=format-security" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
|
||||||
|
# Allow zero for a variadic macro argument
|
||||||
|
string(TOLOWER "${CMAKE_C_COMPILER_ID}" _C_COMPILER_ID)
|
||||||
|
if ("${_C_COMPILER_ID}" STREQUAL "clang")
|
||||||
|
add_c_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_c_compiler_flag("-fno-common" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
|
||||||
|
if (CMAKE_BUILD_TYPE)
|
||||||
|
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
|
||||||
|
if (CMAKE_BUILD_TYPE_LOWER MATCHES (release|relwithdebinfo|minsizerel))
|
||||||
|
add_c_compiler_flag("-Wp,-D_FORTIFY_SOURCE=2" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
check_c_compiler_flag_ssp("-fstack-protector-strong" WITH_STACK_PROTECTOR_STRONG)
|
||||||
|
if (WITH_STACK_PROTECTOR_STRONG)
|
||||||
|
list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector-strong")
|
||||||
|
# This is needed as Solaris has a seperate libssp
|
||||||
|
if (SOLARIS)
|
||||||
|
list(APPEND SUPPORTED_LINKER_FLAGS "-fstack-protector-strong")
|
||||||
|
endif()
|
||||||
|
else (WITH_STACK_PROTECTOR_STRONG)
|
||||||
|
check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR)
|
||||||
|
if (WITH_STACK_PROTECTOR)
|
||||||
|
list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector")
|
||||||
|
# This is needed as Solaris has a seperate libssp
|
||||||
|
if (SOLARIS)
|
||||||
|
list(APPEND SUPPORTED_LINKER_FLAGS "-fstack-protector")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif (WITH_STACK_PROTECTOR_STRONG)
|
||||||
|
|
||||||
|
check_c_compiler_flag_ssp("-fstack-clash-protection" WITH_STACK_CLASH_PROTECTION)
|
||||||
|
if (WITH_STACK_CLASH_PROTECTION)
|
||||||
|
list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-clash-protection")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (PICKY_DEVELOPER)
|
||||||
|
add_c_compiler_flag("-Wno-error=deprecated-declarations" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-Wno-error=tautological-compare" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_c_compiler_flag("-Wno-deprecated-declarations" DEPRECATION_COMPILER_FLAGS)
|
||||||
|
|
||||||
|
# Unset CMAKE_REQUIRED_FLAGS
|
||||||
|
unset(CMAKE_REQUIRED_FLAGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
add_c_compiler_flag("/D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("/D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("/D _CRT_NONSTDC_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("/D _CRT_SECURE_NO_WARNINGS=1" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# This removes this annoying warning
|
||||||
|
# "warning: 'BN_CTX_free' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]"
|
||||||
|
if (OSX)
|
||||||
|
add_c_compiler_flag("-Wno-deprecated-declarations" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(DEFAULT_C_COMPILE_FLAGS ${SUPPORTED_COMPILER_FLAGS} CACHE INTERNAL "Default C Compiler Flags" FORCE)
|
||||||
|
set(DEFAULT_LINK_FLAGS ${SUPPORTED_LINKER_FLAGS} CACHE INTERNAL "Default C Linker Flags" FORCE)
|
||||||
|
|
||||||
|
if (DEPRECATION_COMPILER_FLAGS)
|
||||||
|
set(DEFAULT_C_NO_DEPRECATION_FLAGS ${DEPRECATION_COMPILER_FLAGS} CACHE INTERNAL "Default no deprecation flags" FORCE)
|
||||||
|
endif()
|
||||||
@@ -4,11 +4,11 @@ include(CheckSymbolExists)
|
|||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
include(CheckTypeSize)
|
include(CheckTypeSize)
|
||||||
include(CheckCXXSourceCompiles)
|
include(CheckStructHasMember)
|
||||||
include(TestBigEndian)
|
include(TestBigEndian)
|
||||||
|
|
||||||
set(PACKAGE ${APPLICATION_NAME})
|
set(PACKAGE ${PROJECT_NAME})
|
||||||
set(VERSION ${APPLICATION_VERSION})
|
set(VERSION ${PROJECT_VERSION})
|
||||||
set(DATADIR ${DATA_INSTALL_DIR})
|
set(DATADIR ${DATA_INSTALL_DIR})
|
||||||
set(LIBDIR ${LIB_INSTALL_DIR})
|
set(LIBDIR ${LIB_INSTALL_DIR})
|
||||||
set(PLUGINDIR "${PLUGIN_INSTALL_DIR}-${LIBRARY_SOVERSION}")
|
set(PLUGINDIR "${PLUGIN_INSTALL_DIR}-${LIBRARY_SOVERSION}")
|
||||||
@@ -64,6 +64,7 @@ check_include_file(sys/param.h HAVE_SYS_PARAM_H)
|
|||||||
check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
|
check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
|
||||||
check_include_file(byteswap.h HAVE_BYTESWAP_H)
|
check_include_file(byteswap.h HAVE_BYTESWAP_H)
|
||||||
check_include_file(glob.h HAVE_GLOB_H)
|
check_include_file(glob.h HAVE_GLOB_H)
|
||||||
|
check_include_file(valgrind/valgrind.h HAVE_VALGRIND_VALGRIND_H)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
check_include_file(io.h HAVE_IO_H)
|
check_include_file(io.h HAVE_IO_H)
|
||||||
@@ -88,8 +89,10 @@ if (OPENSSL_FOUND)
|
|||||||
message(FATAL_ERROR "Could not detect openssl/aes.h")
|
message(FATAL_ERROR "Could not detect openssl/aes.h")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
if (WITH_BLOWFISH_CIPHER)
|
||||||
check_include_file(openssl/blowfish.h HAVE_OPENSSL_BLOWFISH_H)
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
|
check_include_file(openssl/blowfish.h HAVE_OPENSSL_BLOWFISH_H)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
check_include_file(openssl/ecdh.h HAVE_OPENSSL_ECDH_H)
|
check_include_file(openssl/ecdh.h HAVE_OPENSSL_ECDH_H)
|
||||||
@@ -108,6 +111,10 @@ if (OPENSSL_FOUND)
|
|||||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
check_function_exists(EVP_aes_128_cbc HAVE_OPENSSL_EVP_AES_CBC)
|
check_function_exists(EVP_aes_128_cbc HAVE_OPENSSL_EVP_AES_CBC)
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
check_function_exists(EVP_aes_128_gcm HAVE_OPENSSL_EVP_AES_GCM)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
check_function_exists(CRYPTO_THREADID_set_callback HAVE_OPENSSL_CRYPTO_THREADID_SET_CALLBACK)
|
check_function_exists(CRYPTO_THREADID_set_callback HAVE_OPENSSL_CRYPTO_THREADID_SET_CALLBACK)
|
||||||
@@ -120,10 +127,16 @@ if (OPENSSL_FOUND)
|
|||||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
check_function_exists(EVP_CIPHER_CTX_new HAVE_OPENSSL_EVP_CIPHER_CTX_NEW)
|
check_function_exists(EVP_CIPHER_CTX_new HAVE_OPENSSL_EVP_CIPHER_CTX_NEW)
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
check_function_exists(EVP_KDF_CTX_new_id HAVE_OPENSSL_EVP_KDF_CTX_NEW_ID)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
check_function_exists(RAND_priv_bytes HAVE_OPENSSL_RAND_PRIV_BYTES)
|
check_function_exists(RAND_priv_bytes HAVE_OPENSSL_RAND_PRIV_BYTES)
|
||||||
|
|
||||||
|
check_function_exists(OPENSSL_ia32cap_loc HAVE_OPENSSL_IA32CAP_LOC)
|
||||||
|
|
||||||
unset(CMAKE_REQUIRED_INCLUDES)
|
unset(CMAKE_REQUIRED_INCLUDES)
|
||||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||||
endif()
|
endif()
|
||||||
@@ -150,12 +163,14 @@ endif (NOT WITH_MBEDTLS)
|
|||||||
|
|
||||||
check_function_exists(isblank HAVE_ISBLANK)
|
check_function_exists(isblank HAVE_ISBLANK)
|
||||||
check_function_exists(strncpy HAVE_STRNCPY)
|
check_function_exists(strncpy HAVE_STRNCPY)
|
||||||
|
check_function_exists(strndup HAVE_STRNDUP)
|
||||||
check_function_exists(strtoull HAVE_STRTOULL)
|
check_function_exists(strtoull HAVE_STRTOULL)
|
||||||
check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
|
check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
|
||||||
check_function_exists(memset_s HAVE_MEMSET_S)
|
check_function_exists(memset_s HAVE_MEMSET_S)
|
||||||
|
|
||||||
if (HAVE_GLOB_H)
|
if (HAVE_GLOB_H)
|
||||||
check_function_exists(glob HAVE_GLOB)
|
check_struct_has_member(glob_t gl_flags glob.h HAVE_GLOB_GL_FLAGS_MEMBER)
|
||||||
|
check_function_exists(glob HAVE_GLOB)
|
||||||
endif (HAVE_GLOB_H)
|
endif (HAVE_GLOB_H)
|
||||||
|
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
@@ -252,6 +267,14 @@ if (CMAKE_USE_PTHREADS_INIT)
|
|||||||
set(HAVE_PTHREAD 1)
|
set(HAVE_PTHREAD 1)
|
||||||
endif (CMAKE_USE_PTHREADS_INIT)
|
endif (CMAKE_USE_PTHREADS_INIT)
|
||||||
|
|
||||||
|
if (UNIT_TESTING)
|
||||||
|
if (CMOCKA_FOUND)
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${CMOCKA_LIBRARIES})
|
||||||
|
check_function_exists(cmocka_set_test_filter HAVE_CMOCKA_SET_TEST_FILTER)
|
||||||
|
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
__thread int tls;
|
__thread int tls;
|
||||||
@@ -267,25 +290,57 @@ int main(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}" HAVE_MSC_THREAD_LOCAL_STORAGE)
|
}" HAVE_MSC_THREAD_LOCAL_STORAGE)
|
||||||
|
|
||||||
|
###########################################################
|
||||||
|
# For detecting attributes we need to treat warnings as
|
||||||
|
# errors
|
||||||
|
if (UNIX OR MINGW)
|
||||||
|
# Get warnings for attributs
|
||||||
|
check_c_compiler_flag("-Wattributes" REQUIRED_FLAGS_WERROR)
|
||||||
|
if (REQUIRED_FLAGS_WERROR)
|
||||||
|
string(APPEND CMAKE_REQUIRED_FLAGS "-Wattributes ")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Turn warnings into errors
|
||||||
|
check_c_compiler_flag("-Werror" REQUIRED_FLAGS_WERROR)
|
||||||
|
if (REQUIRED_FLAGS_WERROR)
|
||||||
|
string(APPEND CMAKE_REQUIRED_FLAGS "-Werror ")
|
||||||
|
endif()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
check_c_source_compiles("
|
||||||
|
void test_constructor_attribute(void) __attribute__ ((constructor));
|
||||||
|
|
||||||
|
void test_constructor_attribute(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
return 0;
|
||||||
|
}" HAVE_CONSTRUCTOR_ATTRIBUTE)
|
||||||
|
|
||||||
|
check_c_source_compiles("
|
||||||
|
void test_destructor_attribute(void) __attribute__ ((destructor));
|
||||||
|
|
||||||
|
void test_destructor_attribute(void)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
return 0;
|
||||||
|
}" HAVE_DESTRUCTOR_ATTRIBUTE)
|
||||||
|
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#define FALL_THROUGH __attribute__((fallthrough))
|
#define FALL_THROUGH __attribute__((fallthrough))
|
||||||
|
|
||||||
enum direction_e {
|
|
||||||
UP = 0,
|
|
||||||
DOWN,
|
|
||||||
};
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
enum direction_e key = UP;
|
int i = 2;
|
||||||
int i = 10;
|
|
||||||
int j = 0;
|
|
||||||
|
|
||||||
switch (key) {
|
switch (i) {
|
||||||
case UP:
|
case 0:
|
||||||
i = 5;
|
|
||||||
FALL_THROUGH;
|
FALL_THROUGH;
|
||||||
case DOWN:
|
case 1:
|
||||||
j = i * 2;
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -294,6 +349,28 @@ int main(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}" HAVE_FALLTHROUGH_ATTRIBUTE)
|
}" HAVE_FALLTHROUGH_ATTRIBUTE)
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
check_c_source_compiles("
|
||||||
|
#define __unused __attribute__((unused))
|
||||||
|
|
||||||
|
static int do_nothing(int i __unused)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
i = do_nothing(5);
|
||||||
|
if (i > 5) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}" HAVE_UNUSED_ATTRIBUTE)
|
||||||
|
endif()
|
||||||
|
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -306,18 +383,6 @@ int main(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}" HAVE_GCC_VOLATILE_MEMORY_PROTECTION)
|
}" HAVE_GCC_VOLATILE_MEMORY_PROTECTION)
|
||||||
|
|
||||||
check_c_source_compiles("
|
|
||||||
#include <stdio.h>
|
|
||||||
#define __VA_NARG__(...) (__VA_NARG_(_0, ## __VA_ARGS__, __RSEQ_N()) - 1)
|
|
||||||
#define __VA_NARG_(...) __VA_ARG_N(__VA_ARGS__)
|
|
||||||
#define __VA_ARG_N( _1, _2, _3, _4, _5, _6, _7, _8, _9,_10,N,...) N
|
|
||||||
#define __RSEQ_N() 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
|
|
||||||
#define myprintf(format, ...) printf((format), __VA_NARG__(__VA_ARGS__), __VA_ARGS__)
|
|
||||||
int main(void) {
|
|
||||||
myprintf(\"%d %d %d %d\",1,2,3);
|
|
||||||
return 0;
|
|
||||||
}" HAVE_GCC_NARG_MACRO)
|
|
||||||
|
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int main(void) {
|
int main(void) {
|
||||||
@@ -332,11 +397,34 @@ int main(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}" HAVE_COMPILER__FUNCTION__)
|
}" HAVE_COMPILER__FUNCTION__)
|
||||||
|
|
||||||
|
# This is only available with OpenBSD's gcc implementation */
|
||||||
|
if (OPENBSD)
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
void chacha_keysetup(struct chacha_ctx *x, const u_char *k, u_int kbits)
|
#define ARRAY_LEN 16
|
||||||
__attribute__((__bounded__(__minbytes__, 2, CHACHA_MINKEYLEN)));
|
void test_attr(const unsigned char *k)
|
||||||
int main(void) { return 0; }" HAVE_GCC_BOUNDED_ATTRIBUTE)
|
__attribute__((__bounded__(__minbytes__, 2, 16)));
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
return 0;
|
||||||
|
}" HAVE_GCC_BOUNDED_ATTRIBUTE)
|
||||||
|
endif(OPENBSD)
|
||||||
|
|
||||||
|
# Stop treating warnings as errors
|
||||||
|
unset(CMAKE_REQUIRED_FLAGS)
|
||||||
|
|
||||||
|
# Check for version script support
|
||||||
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
|
||||||
|
global: sym;
|
||||||
|
};
|
||||||
|
VERS_2 {
|
||||||
|
global: sym;
|
||||||
|
} VERS_1;
|
||||||
|
")
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-Wl,--version-script=\"${CMAKE_CURRENT_BINARY_DIR}/conftest.map\"")
|
||||||
|
check_c_source_compiles("int main(void) { return 0; }" HAVE_LD_VERSION_SCRIPT)
|
||||||
|
unset(CMAKE_REQUIRED_FLAGS)
|
||||||
|
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
|
||||||
|
|
||||||
if (WITH_DEBUG_CRYPTO)
|
if (WITH_DEBUG_CRYPTO)
|
||||||
set(DEBUG_CRYPTO 1)
|
set(DEBUG_CRYPTO 1)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ option(WITH_DEBUG_PACKET "Build with packet debug output" OFF)
|
|||||||
option(WITH_DEBUG_CALLTRACE "Build with calltrace debug output" ON)
|
option(WITH_DEBUG_CALLTRACE "Build with calltrace debug output" ON)
|
||||||
option(WITH_GCRYPT "Compile against libgcrypt" OFF)
|
option(WITH_GCRYPT "Compile against libgcrypt" OFF)
|
||||||
option(WITH_MBEDTLS "Compile against libmbedtls" OFF)
|
option(WITH_MBEDTLS "Compile against libmbedtls" OFF)
|
||||||
|
option(WITH_BLOWFISH_CIPHER "Compile with blowfish support" OFF)
|
||||||
option(WITH_PCAP "Compile with Pcap generation support" ON)
|
option(WITH_PCAP "Compile with Pcap generation support" ON)
|
||||||
option(WITH_INTERNAL_DOC "Compile doxygen internal documentation" OFF)
|
option(WITH_INTERNAL_DOC "Compile doxygen internal documentation" OFF)
|
||||||
option(UNIT_TESTING "Build with unit tests" OFF)
|
option(UNIT_TESTING "Build with unit tests" OFF)
|
||||||
@@ -18,19 +19,27 @@ option(WITH_EXAMPLES "Build examples" ON)
|
|||||||
option(WITH_NACL "Build with libnacl (curve25519)" ON)
|
option(WITH_NACL "Build with libnacl (curve25519)" ON)
|
||||||
option(WITH_SYMBOL_VERSIONING "Build with symbol versioning" ON)
|
option(WITH_SYMBOL_VERSIONING "Build with symbol versioning" ON)
|
||||||
option(WITH_ABI_BREAK "Allow ABI break" OFF)
|
option(WITH_ABI_BREAK "Allow ABI break" OFF)
|
||||||
|
option(WITH_GEX "Enable DH Group exchange mechanisms" ON)
|
||||||
option(FUZZ_TESTING "Build with fuzzer for the server" OFF)
|
option(FUZZ_TESTING "Build with fuzzer for the server" OFF)
|
||||||
|
option(PICKY_DEVELOPER "Build with picky developer flags" OFF)
|
||||||
|
|
||||||
if (WITH_ZLIB)
|
if (WITH_ZLIB)
|
||||||
set(WITH_LIBZ ON)
|
set(WITH_LIBZ ON)
|
||||||
else (WITH_ZLIB)
|
else (WITH_ZLIB)
|
||||||
set(WITH_LIBZ OFF)
|
set(WITH_LIBZ OFF)
|
||||||
endif (WITH_ZLIB)
|
endif (WITH_ZLIB)
|
||||||
|
|
||||||
if(WITH_BENCHMARKS)
|
if (WITH_BENCHMARKS)
|
||||||
set(UNIT_TESTING ON)
|
set(UNIT_TESTING ON)
|
||||||
endif(WITH_BENCHMARKS)
|
set(CLIENT_TESTING ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (WITH_STATIC_LIB)
|
||||||
|
set(BUILD_STATIC_LIB ON)
|
||||||
|
endif (WITH_STATIC_LIB)
|
||||||
|
|
||||||
if (UNIT_TESTING)
|
if (UNIT_TESTING)
|
||||||
set(WITH_STATIC_LIB ON)
|
set(BUILD_STATIC_LIB ON)
|
||||||
endif (UNIT_TESTING)
|
endif (UNIT_TESTING)
|
||||||
|
|
||||||
if (WITH_NACL)
|
if (WITH_NACL)
|
||||||
@@ -40,3 +49,11 @@ endif (WITH_NACL)
|
|||||||
if (WITH_ABI_BREAK)
|
if (WITH_ABI_BREAK)
|
||||||
set(WITH_SYMBOL_VERSIONING ON)
|
set(WITH_SYMBOL_VERSIONING ON)
|
||||||
endif (WITH_ABI_BREAK)
|
endif (WITH_ABI_BREAK)
|
||||||
|
|
||||||
|
if (NOT GLOBAL_BIND_CONFIG)
|
||||||
|
set(GLOBAL_BIND_CONFIG "/etc/ssh/libssh_server_config")
|
||||||
|
endif (NOT GLOBAL_BIND_CONFIG)
|
||||||
|
|
||||||
|
if (NOT GLOBAL_CLIENT_CONFIG)
|
||||||
|
set(GLOBAL_CLIENT_CONFIG "/etc/ssh/ssh_config")
|
||||||
|
endif (NOT GLOBAL_CLIENT_CONFIG)
|
||||||
|
|||||||
11
INSTALL
@@ -11,9 +11,10 @@ In order to build libssh, you need to install several components:
|
|||||||
- [openssl](http://www.openssl.org) >= 0.9.8
|
- [openssl](http://www.openssl.org) >= 0.9.8
|
||||||
or
|
or
|
||||||
- [gcrypt](http://www.gnu.org/directory/Security/libgcrypt.html) >= 1.4
|
- [gcrypt](http://www.gnu.org/directory/Security/libgcrypt.html) >= 1.4
|
||||||
|
- [libz](http://www.zlib.net) >= 1.2
|
||||||
|
|
||||||
optional:
|
optional:
|
||||||
- [libz](http://www.zlib.net) >= 1.2
|
- [cmocka](https://cmocka.org/) >= 1.1.0
|
||||||
- [socket_wrapper](https://cwrap.org/) >= 1.1.5
|
- [socket_wrapper](https://cwrap.org/) >= 1.1.5
|
||||||
- [nss_wrapper](https://cwrap.org/) >= 1.1.2
|
- [nss_wrapper](https://cwrap.org/) >= 1.1.2
|
||||||
- [uid_wrapper](https://cwrap.org/) >= 1.2.0
|
- [uid_wrapper](https://cwrap.org/) >= 1.2.0
|
||||||
@@ -22,12 +23,12 @@ optional:
|
|||||||
Note that these version numbers are version we know works correctly. If you
|
Note that these version numbers are version we know works correctly. If you
|
||||||
build and run libssh successfully with an older version, please let us know.
|
build and run libssh successfully with an older version, please let us know.
|
||||||
|
|
||||||
Windows binaries known to be working:
|
For Windows use vcpkg:
|
||||||
|
|
||||||
- http://www.slproweb.com/products/Win32OpenSSL.html
|
https://github.com/Microsoft/vcpkg
|
||||||
- http://zlib.net/ -> zlib compiled DLL
|
|
||||||
|
|
||||||
We installed them in C:\Program Files
|
which you can use to install openssl and zlib. libssh itself is also part of
|
||||||
|
vcpkg!
|
||||||
|
|
||||||
## Building
|
## Building
|
||||||
First, you need to configure the compilation, using CMake. Go inside the
|
First, you need to configure the compilation, using CMake. Go inside the
|
||||||
|
|||||||
21
cmake/Modules/AddCCompilerFlag.cmake
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
#
|
||||||
|
# add_c_compiler_flag("-Werror" SUPPORTED_CFLAGS)
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
include(CheckCCompilerFlag)
|
||||||
|
|
||||||
|
macro(add_c_compiler_flag _COMPILER_FLAG _OUTPUT_VARIABLE)
|
||||||
|
string(TOUPPER ${_COMPILER_FLAG} _COMPILER_FLAG_NAME)
|
||||||
|
string(REGEX REPLACE "^-" "" _COMPILER_FLAG_NAME "${_COMPILER_FLAG_NAME}")
|
||||||
|
string(REGEX REPLACE "(-|=|\ )" "_" _COMPILER_FLAG_NAME "${_COMPILER_FLAG_NAME}")
|
||||||
|
|
||||||
|
check_c_compiler_flag("${_COMPILER_FLAG}" WITH_${_COMPILER_FLAG_NAME}_FLAG)
|
||||||
|
if (WITH_${_COMPILER_FLAG_NAME}_FLAG)
|
||||||
|
#string(APPEND ${_OUTPUT_VARIABLE} "${_COMPILER_FLAG} ")
|
||||||
|
list(APPEND ${_OUTPUT_VARIABLE} ${_COMPILER_FLAG})
|
||||||
|
endif()
|
||||||
|
endmacro()
|
||||||
@@ -1,28 +1,66 @@
|
|||||||
# - ADD_CHECK_TEST(test_name test_source linklib1 ... linklibN)
|
#
|
||||||
|
|
||||||
# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
|
# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
|
||||||
# Copyright (c) 2007-2010 Andreas Schneider <asn@cryptomilk.org>
|
# Copyright (c) 2007-2018 Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
# Copyright (c) 2018 Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
|
||||||
#
|
#
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
#.rst:
|
||||||
|
# AddCMockaTest
|
||||||
|
# -------------
|
||||||
|
#
|
||||||
|
# This file provides a function to add a test
|
||||||
|
#
|
||||||
|
# Functions provided
|
||||||
|
# ------------------
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# add_cmocka_test(target_name
|
||||||
|
# SOURCES src1 src2 ... srcN
|
||||||
|
# [COMPILE_OPTIONS opt1 opt2 ... optN]
|
||||||
|
# [LINK_LIBRARIES lib1 lib2 ... libN]
|
||||||
|
# [LINK_OPTIONS lopt1 lop2 .. loptN]
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# ``target_name``:
|
||||||
|
# Required, expects the name of the test which will be used to define a target
|
||||||
|
#
|
||||||
|
# ``SOURCES``:
|
||||||
|
# Required, expects one or more source files names
|
||||||
|
#
|
||||||
|
# ``COMPILE_OPTIONS``:
|
||||||
|
# Optional, expects one or more options to be passed to the compiler
|
||||||
|
#
|
||||||
|
# ``LINK_LIBRARIES``:
|
||||||
|
# Optional, expects one or more libraries to be linked with the test
|
||||||
|
# executable.
|
||||||
|
#
|
||||||
|
# ``LINK_OPTIONS``:
|
||||||
|
# Optional, expects one or more options to be passed to the linker
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# .. code-block:: cmake
|
||||||
|
#
|
||||||
|
# add_cmocka_test(my_test
|
||||||
|
# SOURCES my_test.c other_source.c
|
||||||
|
# COMPILE_OPTIONS -g -Wall
|
||||||
|
# LINK_LIBRARIES mylib
|
||||||
|
# LINK_OPTIONS -Wl,--enable-syscall-fixup
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# Where ``my_test`` is the name of the test, ``my_test.c`` and
|
||||||
|
# ``other_source.c`` are sources for the binary, ``-g -Wall`` are compiler
|
||||||
|
# options to be used, ``mylib`` is a target of a library to be linked, and
|
||||||
|
# ``-Wl,--enable-syscall-fixup`` is an option passed to the linker.
|
||||||
|
#
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
|
|
||||||
# Profiling
|
|
||||||
set(CMAKE_C_FLAGS_PROFILING "-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wwrite-strings -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Compiler Flags")
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
|
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
|
|
||||||
set(CMAKE_EXEC_LINKER_FLAGS_PROFILING " -fprofile-arcs -ftest-coverage" CACHE STRING "Profiling Linker Flags")
|
|
||||||
|
|
||||||
# Address Sanitizer
|
|
||||||
set(CMAKE_C_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer" CACHE STRING "Address sanitizer compiler flags")
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" CACHE STRING "Address sanitizer shared linker flags")
|
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" CACHE STRING "Address sanitizer module linker flags")
|
|
||||||
set(CMAKE_EXEC_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address" CACHE STRING "Address sanitizer executable linker flags")
|
|
||||||
endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
|
|
||||||
|
|
||||||
if (CMAKE_CROSSCOMPILING)
|
if (CMAKE_CROSSCOMPILING)
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
find_program(WINE_EXECUTABLE
|
find_program(WINE_EXECUTABLE
|
||||||
@@ -31,8 +69,52 @@ if (CMAKE_CROSSCOMPILING)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
function (ADD_CMOCKA_TEST _testName _testSource)
|
function(ADD_CMOCKA_TEST _TARGET_NAME)
|
||||||
add_executable(${_testName} ${_testSource})
|
|
||||||
target_link_libraries(${_testName} ${ARGN})
|
set(one_value_arguments
|
||||||
add_test(${_testName} ${TARGET_SYSTEM_EMULATOR} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}${CMAKE_EXECUTABLE_SUFFIX})
|
)
|
||||||
|
|
||||||
|
set(multi_value_arguments
|
||||||
|
SOURCES
|
||||||
|
COMPILE_OPTIONS
|
||||||
|
LINK_LIBRARIES
|
||||||
|
LINK_OPTIONS
|
||||||
|
)
|
||||||
|
|
||||||
|
cmake_parse_arguments(_add_cmocka_test
|
||||||
|
""
|
||||||
|
"${one_value_arguments}"
|
||||||
|
"${multi_value_arguments}"
|
||||||
|
${ARGN}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (NOT DEFINED _add_cmocka_test_SOURCES)
|
||||||
|
message(FATAL_ERROR "No sources provided for target ${_TARGET_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_executable(${_TARGET_NAME} ${_add_cmocka_test_SOURCES})
|
||||||
|
|
||||||
|
if (DEFINED _add_cmocka_test_COMPILE_OPTIONS)
|
||||||
|
target_compile_options(${_TARGET_NAME}
|
||||||
|
PRIVATE ${_add_cmocka_test_COMPILE_OPTIONS}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (DEFINED _add_cmocka_test_LINK_LIBRARIES)
|
||||||
|
target_link_libraries(${_TARGET_NAME}
|
||||||
|
PRIVATE ${_add_cmocka_test_LINK_LIBRARIES}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (DEFINED _add_cmocka_test_LINK_OPTIONS)
|
||||||
|
set_target_properties(${_TARGET_NAME}
|
||||||
|
PROPERTIES LINK_FLAGS
|
||||||
|
${_add_cmocka_test_LINK_OPTIONS}
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_test(${_TARGET_NAME}
|
||||||
|
${TARGET_SYSTEM_EMULATOR} ${_TARGET_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
endfunction (ADD_CMOCKA_TEST)
|
endfunction (ADD_CMOCKA_TEST)
|
||||||
|
|||||||
@@ -15,12 +15,15 @@
|
|||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
|
||||||
|
# Requires cmake 3.10
|
||||||
|
#include_guard(GLOBAL)
|
||||||
include(CheckCSourceCompiles)
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
function(CHECK_C_COMPILER_FLAG_SSP _FLAG _RESULT)
|
macro(CHECK_C_COMPILER_FLAG_SSP _FLAG _RESULT)
|
||||||
set(SAFE_CMAKE_REQUIRED_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS}")
|
set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS "${_FLAG}")
|
set(CMAKE_REQUIRED_FLAGS "${_FLAG}")
|
||||||
|
|
||||||
check_c_source_compiles("int main(int argc, char **argv) { char buffer[256]; return buffer[argc]=0;}" ${_RESULT})
|
check_c_source_compiles("int main(int argc, char **argv) { char buffer[256]; return buffer[argc]=0;}" ${_RESULT})
|
||||||
set(CMAKE_REQUIRED_DEFINITIONS "${SAFE_CMAKE_REQUIRED_DEFINITIONS}")
|
|
||||||
endfunction(CHECK_C_COMPILER_FLAG_SSP)
|
set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
|
||||||
|
endmacro(CHECK_C_COMPILER_FLAG_SSP)
|
||||||
|
|||||||
@@ -14,17 +14,8 @@ set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
|
|||||||
# since cmake 2.4.0
|
# since cmake 2.4.0
|
||||||
set(CMAKE_COLOR_MAKEFILE ON)
|
set(CMAKE_COLOR_MAKEFILE ON)
|
||||||
|
|
||||||
# Define the generic version of the libraries here
|
|
||||||
set(GENERIC_LIB_VERSION "0.1.0")
|
|
||||||
set(GENERIC_LIB_SOVERSION "0")
|
|
||||||
|
|
||||||
# Set the default build type to release with debug info
|
|
||||||
if (NOT CMAKE_BUILD_TYPE)
|
|
||||||
set(CMAKE_BUILD_TYPE RelWithDebInfo
|
|
||||||
CACHE STRING
|
|
||||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
|
||||||
)
|
|
||||||
endif (NOT CMAKE_BUILD_TYPE)
|
|
||||||
|
|
||||||
# Create the compile command database for clang by default
|
# Create the compile command database for clang by default
|
||||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|
||||||
|
# Always build with -fPIC
|
||||||
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||||
|
|||||||
@@ -1,84 +1,49 @@
|
|||||||
# define system dependent compiler flags
|
|
||||||
|
|
||||||
include(CheckCCompilerFlag)
|
|
||||||
include(CheckCCompilerFlagSSP)
|
|
||||||
|
|
||||||
if (UNIX AND NOT WIN32)
|
if (UNIX AND NOT WIN32)
|
||||||
#
|
# Activate with: -DCMAKE_BUILD_TYPE=Profiling
|
||||||
# Define GNUCC compiler flags
|
set(CMAKE_C_FLAGS_PROFILING "-O0 -g -fprofile-arcs -ftest-coverage"
|
||||||
#
|
CACHE STRING "Flags used by the C compiler during PROFILING builds.")
|
||||||
if (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
|
set(CMAKE_CXX_FLAGS_PROFILING "-O0 -g -fprofile-arcs -ftest-coverage"
|
||||||
|
CACHE STRING "Flags used by the CXX compiler during PROFILING builds.")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
|
||||||
|
CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.")
|
||||||
|
set(CMAKE_MODULE_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
|
||||||
|
CACHE STRING "Flags used by the linker during the creation of shared libraries during PROFILING builds.")
|
||||||
|
set(CMAKE_EXEC_LINKER_FLAGS_PROFILING "-fprofile-arcs -ftest-coverage"
|
||||||
|
CACHE STRING "Flags used by the linker during PROFILING builds.")
|
||||||
|
|
||||||
# add -Wconversion ?
|
# Activate with: -DCMAKE_BUILD_TYPE=AddressSanitizer
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -pedantic-errors")
|
set(CMAKE_C_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer"
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow -Wmissing-prototypes -Wdeclaration-after-statement")
|
CACHE STRING "Flags used by the C compiler during ADDRESSSANITIZER builds.")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wfloat-equal -Wpointer-arith -Wwrite-strings -Wformat-security")
|
set(CMAKE_CXX_FLAGS_ADDRESSSANITIZER "-g -O1 -fsanitize=address -fno-omit-frame-pointer"
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute")
|
CACHE STRING "Flags used by the CXX compiler during ADDRESSSANITIZER builds.")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
|
||||||
|
CACHE STRING "Flags used by the linker during the creation of shared libraries during ADDRESSSANITIZER builds.")
|
||||||
|
set(CMAKE_MODULE_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
|
||||||
|
CACHE STRING "Flags used by the linker during the creation of shared libraries during ADDRESSSANITIZER builds.")
|
||||||
|
set(CMAKE_EXEC_LINKER_FLAGS_ADDRESSSANITIZER "-fsanitize=address"
|
||||||
|
CACHE STRING "Flags used by the linker during ADDRESSSANITIZER builds.")
|
||||||
|
|
||||||
# with -fPIC
|
# Activate with: -DCMAKE_BUILD_TYPE=MemorySanitizer
|
||||||
check_c_compiler_flag("-fPIC" WITH_FPIC)
|
set(CMAKE_C_FLAGS_MEMORYSANITIZER "-g -O2 -fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer"
|
||||||
if (WITH_FPIC)
|
CACHE STRING "Flags used by the C compiler during MEMORYSANITIZER builds.")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
set(CMAKE_CXX_FLAGS_MEMORYSANITIZER "-g -O2 -fsanitize=memory -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer"
|
||||||
endif (WITH_FPIC)
|
CACHE STRING "Flags used by the CXX compiler during MEMORYSANITIZER builds.")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS_MEMORYSANITIZER "-fsanitize=memory"
|
||||||
check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR)
|
CACHE STRING "Flags used by the linker during the creation of shared libraries during MEMORYSANITIZER builds.")
|
||||||
if (WITH_STACK_PROTECTOR)
|
set(CMAKE_MODULE_LINKER_FLAGS_MEMORYSANITIZER "-fsanitize=memory"
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
|
CACHE STRING "Flags used by the linker during the creation of shared libraries during MEMORYSANITIZER builds.")
|
||||||
endif (WITH_STACK_PROTECTOR)
|
set(CMAKE_EXEC_LINKER_FLAGS_MEMORYSANITIZER "-fsanitize=memory"
|
||||||
|
CACHE STRING "Flags used by the linker during MEMORYSANITIZER builds.")
|
||||||
if (CMAKE_BUILD_TYPE)
|
|
||||||
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
|
|
||||||
if (CMAKE_BUILD_TYPE_LOWER MATCHES (release|relwithdebinfo|minsizerel))
|
|
||||||
check_c_compiler_flag("-Wp,-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
|
|
||||||
if (WITH_FORTIFY_SOURCE)
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wp,-D_FORTIFY_SOURCE=2")
|
|
||||||
endif (WITH_FORTIFY_SOURCE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endif (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
|
|
||||||
|
|
||||||
#
|
|
||||||
# Check for large filesystem support
|
|
||||||
#
|
|
||||||
if (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
|
||||||
# with large file support
|
|
||||||
execute_process(
|
|
||||||
COMMAND
|
|
||||||
getconf LFS64_CFLAGS
|
|
||||||
OUTPUT_VARIABLE
|
|
||||||
_lfs_CFLAGS
|
|
||||||
ERROR_QUIET
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
)
|
|
||||||
else (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
|
||||||
# with large file support
|
|
||||||
execute_process(
|
|
||||||
COMMAND
|
|
||||||
getconf LFS_CFLAGS
|
|
||||||
OUTPUT_VARIABLE
|
|
||||||
_lfs_CFLAGS
|
|
||||||
ERROR_QUIET
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
||||||
)
|
|
||||||
endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
|
|
||||||
if (_lfs_CFLAGS)
|
|
||||||
string(REGEX REPLACE "[\r\n]" " " "${_lfs_CFLAGS}" "${${_lfs_CFLAGS}}")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_lfs_CFLAGS}")
|
|
||||||
endif (_lfs_CFLAGS)
|
|
||||||
|
|
||||||
endif (UNIX AND NOT WIN32)
|
|
||||||
|
|
||||||
if (MSVC)
|
|
||||||
# Use secure functions by defaualt and suppress warnings about
|
|
||||||
#"deprecated" functions
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D _CRT_NONSTDC_NO_WARNINGS=1 /D _CRT_SECURE_NO_WARNINGS=1")
|
|
||||||
endif (MSVC)
|
|
||||||
|
|
||||||
# This removes this annoying warning
|
|
||||||
# "warning: 'BN_CTX_free' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]"
|
|
||||||
if (OSX)
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
|
|
||||||
endif (OSX)
|
|
||||||
|
|
||||||
|
# Activate with: -DCMAKE_BUILD_TYPE=UndefinedSanitizer
|
||||||
|
set(CMAKE_C_FLAGS_UNDEFINEDSANITIZER "-g -O1 -fsanitize=undefined -fsanitize=null -fsanitize=alignment -fno-sanitize-recover"
|
||||||
|
CACHE STRING "Flags used by the C compiler during UNDEFINEDSANITIZER builds.")
|
||||||
|
set(CMAKE_CXX_FLAGS_UNDEFINEDSANITIZER "-g -O1 -fsanitize=undefined -fsanitize=null -fsanitize=alignment -fno-sanitize-recover"
|
||||||
|
CACHE STRING "Flags used by the CXX compiler during UNDEFINEDSANITIZER builds.")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS_UNDEFINEDSANITIZER "-fsanitize=undefined"
|
||||||
|
CACHE STRING "Flags used by the linker during the creation of shared libraries during UNDEFINEDSANITIZER builds.")
|
||||||
|
set(CMAKE_MODULE_LINKER_FLAGS_UNDEFINEDSANITIZER "-fsanitize=undefined"
|
||||||
|
CACHE STRING "Flags used by the linker during the creation of shared libraries during UNDEFINEDSANITIZER builds.")
|
||||||
|
set(CMAKE_EXEC_LINKER_FLAGS_UNDEFINEDSANITIZER "-fsanitize=undefined"
|
||||||
|
CACHE STRING "Flags used by the linker during UNDEFINEDSANITIZER builds.")
|
||||||
|
endif()
|
||||||
|
|||||||
@@ -85,4 +85,8 @@ endforeach()
|
|||||||
|
|
||||||
list(REMOVE_DUPLICATES symbols)
|
list(REMOVE_DUPLICATES symbols)
|
||||||
|
|
||||||
file(WRITE ${OUTPUT_PATH} "${symbols}")
|
list(SORT symbols)
|
||||||
|
|
||||||
|
string(REPLACE ";" "\n" symbols_list "${symbols}")
|
||||||
|
|
||||||
|
file(WRITE ${OUTPUT_PATH} "${symbols_list}")
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#
|
#
|
||||||
# generate_map_file(target_name
|
# generate_map_file(target_name
|
||||||
# RELEASE_NAME_VERSION release_name
|
# RELEASE_NAME_VERSION release_name
|
||||||
# SYMBOLS symbols_file
|
# SYMBOLS symbols_target
|
||||||
# [CURRENT_MAP cur_map]
|
# [CURRENT_MAP cur_map]
|
||||||
# [FINAL]
|
# [FINAL]
|
||||||
# [BREAK_ABI]
|
# [BREAK_ABI]
|
||||||
@@ -55,8 +55,9 @@
|
|||||||
# added to the symbols in the format ``lib_name_1_2_3``.
|
# added to the symbols in the format ``lib_name_1_2_3``.
|
||||||
#
|
#
|
||||||
# ``SYMBOLS``:
|
# ``SYMBOLS``:
|
||||||
# Required, expects a file containing the list of symbols to be added to the
|
# Required, expects a target with the property ``LIST_FILE`` containing a path
|
||||||
# symbol version script.
|
# to a file containing the list of symbols to be added to the symbol version
|
||||||
|
# script.
|
||||||
#
|
#
|
||||||
# ``CURRENT_MAP``:
|
# ``CURRENT_MAP``:
|
||||||
# Optional. If given, the new set of symbols will be checked against the
|
# Optional. If given, the new set of symbols will be checked against the
|
||||||
@@ -87,9 +88,15 @@
|
|||||||
# find_package(ABIMap)
|
# find_package(ABIMap)
|
||||||
# generate_map_file("lib.map"
|
# generate_map_file("lib.map"
|
||||||
# RELEASE_NAME_VERSION "lib_1_0_0"
|
# RELEASE_NAME_VERSION "lib_1_0_0"
|
||||||
# SYMBOLS "symbol1;symbol2"
|
# SYMBOLS symbols
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
|
# Where the target ``symbols`` has its property ``LIST_FILE`` set to the path to
|
||||||
|
# a file containing::
|
||||||
|
#
|
||||||
|
# ``symbol1``
|
||||||
|
# ``symbol2``
|
||||||
|
#
|
||||||
# This example would result in the symbol version script to be created in
|
# This example would result in the symbol version script to be created in
|
||||||
# ``${CMAKE_CURRENT_BINARY_DIR}/lib.map`` containing the provided symbols.
|
# ``${CMAKE_CURRENT_BINARY_DIR}/lib.map`` containing the provided symbols.
|
||||||
#
|
#
|
||||||
@@ -102,8 +109,8 @@
|
|||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
# ``target_name``:
|
# ``target_name``:
|
||||||
# Required, expects the name of the target to be created. A file named after
|
# Required, expects the name of the target to be created. A file named as
|
||||||
# the string given in ``target_name`` will be created in
|
# ``${target_name}.list`` will be created in
|
||||||
# ``${CMAKE_CURRENT_BINARY_DIR}`` to receive the list of files found.
|
# ``${CMAKE_CURRENT_BINARY_DIR}`` to receive the list of files found.
|
||||||
#
|
#
|
||||||
# ``DIRECTORIES``:
|
# ``DIRECTORIES``:
|
||||||
@@ -112,7 +119,7 @@
|
|||||||
#
|
#
|
||||||
# ``FILES_PATTERN``:
|
# ``FILES_PATTERN``:
|
||||||
# Required, expects a list of matching expressions to find the files to be
|
# Required, expects a list of matching expressions to find the files to be
|
||||||
# considered.
|
# considered in the directories.
|
||||||
#
|
#
|
||||||
# ``COPY_TO``:
|
# ``COPY_TO``:
|
||||||
# Optional, expects a string containing the path to where the file containing
|
# Optional, expects a string containing the path to where the file containing
|
||||||
@@ -120,7 +127,9 @@
|
|||||||
#
|
#
|
||||||
# This command searches the directories provided in ``DIRECTORIES`` for files
|
# This command searches the directories provided in ``DIRECTORIES`` for files
|
||||||
# matching any of the patterns provided in ``FILES_PATTERNS``. The obtained list
|
# matching any of the patterns provided in ``FILES_PATTERNS``. The obtained list
|
||||||
# is written to the path specified by ``output``.
|
# is written to the path specified by ``output``. A target named ``target_name``
|
||||||
|
# will be created and its property ``LIST_FILE`` will be set to contain
|
||||||
|
# ``${CMAKE_CURRENT_BINARY_DIR}/${target_name}.list``
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
#
|
#
|
||||||
@@ -140,10 +149,13 @@
|
|||||||
#
|
#
|
||||||
# ``h1.h;h2.h``
|
# ``h1.h;h2.h``
|
||||||
#
|
#
|
||||||
|
# And the target ``target`` will have its property ``LIST_FILE`` set to contain
|
||||||
|
# ``${CMAKE_CURRENT_BINARY_DIR}/target.list``
|
||||||
|
#
|
||||||
# ::
|
# ::
|
||||||
#
|
#
|
||||||
# extract_symbols(target_name
|
# extract_symbols(target_name
|
||||||
# HEADERS_LIST_FILE headers_list
|
# HEADERS_LIST headers_list_target
|
||||||
# [FILTER_PATTERN pattern]
|
# [FILTER_PATTERN pattern]
|
||||||
# [COPY_TO output]
|
# [COPY_TO output]
|
||||||
# )
|
# )
|
||||||
@@ -153,9 +165,9 @@
|
|||||||
# the string given in ``target_name`` will be created in
|
# the string given in ``target_name`` will be created in
|
||||||
# ``${CMAKE_CURRENT_BINARY_DIR}`` to receive the list of symbols.
|
# ``${CMAKE_CURRENT_BINARY_DIR}`` to receive the list of symbols.
|
||||||
#
|
#
|
||||||
# ``HEADERS_LIST_FILE``:
|
# ``HEADERS_LIST``:
|
||||||
# Required, expects a path to a file containing the list of header files to be
|
# Required, expects a target with the property ``LIST_FILE`` set, containing a
|
||||||
# parsed.
|
# file path. Such file must contain a list of files paths.
|
||||||
#
|
#
|
||||||
# ``FILTER_PATTERN``:
|
# ``FILTER_PATTERN``:
|
||||||
# Optional, expects a string. Only the lines containing the filter pattern
|
# Optional, expects a string. Only the lines containing the filter pattern
|
||||||
@@ -170,7 +182,9 @@
|
|||||||
# is provided, then only the lines containing the string given in ``pattern``
|
# is provided, then only the lines containing the string given in ``pattern``
|
||||||
# will be considered. It is recommended to provide a ``FILTER_PATTERN`` to mark
|
# will be considered. It is recommended to provide a ``FILTER_PATTERN`` to mark
|
||||||
# the lines containing exported function declaration, since this function is
|
# the lines containing exported function declaration, since this function is
|
||||||
# experimental and can return wrong symbols when parsing the header files.
|
# experimental and can return wrong symbols when parsing the header files. A
|
||||||
|
# target named ``target_name`` will be created with the property ``LIST_FILE``
|
||||||
|
# set to contain ``${CMAKE_CURRENT_BINARY_DIR}/${target_name}.list``.
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
#
|
#
|
||||||
@@ -178,11 +192,12 @@
|
|||||||
#
|
#
|
||||||
# find_package(ABIMap)
|
# find_package(ABIMap)
|
||||||
# extract_symbols("lib.symbols"
|
# extract_symbols("lib.symbols"
|
||||||
# HEADERS_LIST_FILE "headers_list"
|
# HEADERS_LIST "headers_target"
|
||||||
# FILTER_PATTERN "API_FUNCTION"
|
# FILTER_PATTERN "API_FUNCTION"
|
||||||
# )
|
# )
|
||||||
#
|
#
|
||||||
# Where headers_list contains::
|
# Where ``LIST_FILE`` property in ``headers_target`` points to a file
|
||||||
|
# containing::
|
||||||
#
|
#
|
||||||
# header1.h;header2.h
|
# header1.h;header2.h
|
||||||
#
|
#
|
||||||
@@ -196,25 +211,52 @@
|
|||||||
#
|
#
|
||||||
# int private_func2(int b);
|
# int private_func2(int b);
|
||||||
#
|
#
|
||||||
# Will result in a file ``lib.symbols`` in ``${CMAKE_CURRENT_BINARY_DIR}`` containing::
|
# Will result in a file ``lib.symbols.list`` in ``${CMAKE_CURRENT_BINARY_DIR}``
|
||||||
|
# containing::
|
||||||
#
|
#
|
||||||
# ``exported_func1;exported_func2``
|
# ``exported_func1``
|
||||||
|
# ``exported_func2``
|
||||||
#
|
#
|
||||||
|
|
||||||
# Search for python which is required
|
# Search for python which is required
|
||||||
find_package(PythonInterp REQUIRED)
|
if (ABIMap_FIND_REQURIED)
|
||||||
|
find_package(PythonInterp REQUIRED)
|
||||||
|
else()
|
||||||
|
find_package(PythonInterp)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Search for abimap tool used to generate the map files
|
|
||||||
find_program(ABIMAP_EXECUTABLE NAMES abimap DOC "path to the abimap executable")
|
|
||||||
mark_as_advanced(ABIMAP_EXECUTABLE)
|
|
||||||
|
|
||||||
if (NOT ABIMAP_EXECUTABLE AND UNIX)
|
if (PYTHONINTERP_FOUND)
|
||||||
message(STATUS "Could not find `abimap` in PATH."
|
# Search for abimap tool used to generate the map files
|
||||||
" It can be found in PyPI as `abimap`"
|
find_program(ABIMAP_EXECUTABLE NAMES abimap DOC "path to the abimap executable")
|
||||||
" (try `pip install abimap`)")
|
mark_as_advanced(ABIMAP_EXECUTABLE)
|
||||||
else ()
|
|
||||||
set(ABIMAP_FOUND TRUE)
|
if (NOT ABIMAP_EXECUTABLE AND UNIX)
|
||||||
endif ()
|
message(STATUS "Could not find `abimap` in PATH."
|
||||||
|
" It can be found in PyPI as `abimap`"
|
||||||
|
" (try `pip install abimap`)")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (ABIMAP_EXECUTABLE)
|
||||||
|
# Get the abimap version
|
||||||
|
execute_process(COMMAND ${ABIMAP_EXECUTABLE} version
|
||||||
|
OUTPUT_VARIABLE ABIMAP_VERSION_STRING
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
# If the version string starts with abimap-, strip it
|
||||||
|
if ("abimap" STRLESS_EQUAL ${ABIMAP_VERSION_STRING})
|
||||||
|
string(REGEX REPLACE "abimap-" "" ABIMAP_VERSION_STRING "${ABIMAP_VERSION_STRING}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(ABIMap
|
||||||
|
REQUIRED_VARS ABIMAP_EXECUTABLE
|
||||||
|
VERSION_VAR ABIMAP_VERSION_STRING)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if (ABIMAP_FOUND)
|
||||||
|
|
||||||
# Define helper scripts
|
# Define helper scripts
|
||||||
set(_EXTRACT_SYMBOLS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/ExtractSymbols.cmake)
|
set(_EXTRACT_SYMBOLS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/ExtractSymbols.cmake)
|
||||||
@@ -224,42 +266,41 @@ set(_GET_FILES_LIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/GetFilesList.cmake)
|
|||||||
function(get_file_list _TARGET_NAME)
|
function(get_file_list _TARGET_NAME)
|
||||||
|
|
||||||
set(one_value_arguments
|
set(one_value_arguments
|
||||||
COPY_TO
|
COPY_TO
|
||||||
)
|
)
|
||||||
|
|
||||||
set(multi_value_arguments
|
set(multi_value_arguments
|
||||||
DIRECTORIES
|
DIRECTORIES
|
||||||
FILES_PATTERNS
|
FILES_PATTERNS
|
||||||
)
|
)
|
||||||
|
|
||||||
cmake_parse_arguments(_get_files_list
|
cmake_parse_arguments(_get_files_list
|
||||||
""
|
""
|
||||||
"${one_value_arguments}"
|
"${one_value_arguments}"
|
||||||
"${multi_value_arguments}"
|
"${multi_value_arguments}"
|
||||||
${ARGN}
|
${ARGN}
|
||||||
)
|
)
|
||||||
|
|
||||||
# The DIRS argument is required
|
# The DIRS argument is required
|
||||||
if (NOT DEFINED _get_files_list_DIRECTORIES)
|
if (NOT DEFINED _get_files_list_DIRECTORIES)
|
||||||
message(FATAL_ERROR "No directories paths provided. Provide a list of"
|
message(FATAL_ERROR "No directories paths provided. Provide a list of"
|
||||||
" directories paths containing header files."
|
" directories paths containing header files.")
|
||||||
)
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
# The FILES_PATTERNS argument is required
|
# The FILES_PATTERNS argument is required
|
||||||
if (NOT DEFINED _get_files_list_FILES_PATTERNS)
|
if (NOT DEFINED _get_files_list_FILES_PATTERNS)
|
||||||
message(FATAL_ERROR "No matching expressions provided. Provide a list"
|
message(FATAL_ERROR "No matching expressions provided. Provide a list"
|
||||||
" of matching patterns for the header files."
|
" of matching patterns for the header files.")
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_filename_component(_get_files_list_OUTPUT_PATH
|
set(_FILES_LIST_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${_TARGET_NAME}.list)
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${_TARGET_NAME}"
|
|
||||||
ABSOLUTE
|
|
||||||
)
|
|
||||||
|
|
||||||
add_custom_command(
|
get_filename_component(_get_files_list_OUTPUT_PATH
|
||||||
OUTPUT ${_TARGET_NAME}
|
"${_FILES_LIST_OUTPUT_PATH}"
|
||||||
|
ABSOLUTE)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
${_TARGET_NAME}_int ALL
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DOUTPUT_PATH="${_get_files_list_OUTPUT_PATH}"
|
-DOUTPUT_PATH="${_get_files_list_OUTPUT_PATH}"
|
||||||
-DDIRECTORIES="${_get_files_list_DIRECTORIES}"
|
-DDIRECTORIES="${_get_files_list_DIRECTORIES}"
|
||||||
@@ -271,59 +312,90 @@ function(get_file_list _TARGET_NAME)
|
|||||||
|
|
||||||
if (DEFINED _get_files_list_COPY_TO)
|
if (DEFINED _get_files_list_COPY_TO)
|
||||||
# Copy the generated file back to the COPY_TO
|
# Copy the generated file back to the COPY_TO
|
||||||
add_custom_target(copy_headers_list_${TARGET_NAME} ALL
|
add_custom_target(${_TARGET_NAME} ALL
|
||||||
COMMAND
|
COMMAND
|
||||||
${CMAKE_COMMAND} -E copy_if_different ${_TARGET_NAME} ${_get_files_list_COPY_TO}
|
${CMAKE_COMMAND} -E copy_if_different
|
||||||
DEPENDS "${_TARGET_NAME}"
|
${_FILES_LIST_OUTPUT_PATH} ${_get_files_list_COPY_TO}
|
||||||
|
DEPENDS ${_TARGET_NAME}_int
|
||||||
COMMENT "Copying ${_TARGET_NAME} to ${_get_files_list_COPY_TO}"
|
COMMENT "Copying ${_TARGET_NAME} to ${_get_files_list_COPY_TO}"
|
||||||
)
|
)
|
||||||
|
else()
|
||||||
|
add_custom_target(${_TARGET_NAME} ALL
|
||||||
|
DEPENDS ${_TARGET_NAME}_int
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(${_TARGET_NAME}
|
||||||
|
PROPERTIES LIST_FILE ${_FILES_LIST_OUTPUT_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(extract_symbols _TARGET_NAME)
|
function(extract_symbols _TARGET_NAME)
|
||||||
|
|
||||||
set(one_value_arguments
|
set(one_value_arguments
|
||||||
FILTER_PATTERN
|
FILTER_PATTERN
|
||||||
HEADERS_LIST_FILE
|
HEADERS_LIST
|
||||||
COPY_TO
|
COPY_TO
|
||||||
)
|
)
|
||||||
|
|
||||||
set(multi_value_arguments
|
set(multi_value_arguments
|
||||||
)
|
)
|
||||||
|
|
||||||
cmake_parse_arguments(_extract_symbols
|
cmake_parse_arguments(_extract_symbols
|
||||||
""
|
""
|
||||||
"${one_value_arguments}"
|
"${one_value_arguments}"
|
||||||
"${multi_value_arguments}"
|
"${multi_value_arguments}"
|
||||||
${ARGN}
|
${ARGN}
|
||||||
)
|
)
|
||||||
|
|
||||||
# The HEADERS_LIST_FILE argument is required
|
# The HEADERS_LIST_FILE argument is required
|
||||||
if (NOT DEFINED _extract_symbols_HEADERS_LIST_FILE)
|
if (NOT DEFINED _extract_symbols_HEADERS_LIST)
|
||||||
message(FATAL_ERROR "No header files given. Provide a list of header"
|
message(FATAL_ERROR "No target provided in HEADERS_LIST. Provide a"
|
||||||
" files containing exported symbols."
|
" target with the property LIST_FILE set as the"
|
||||||
|
" path to the file containing the list of headers.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
get_filename_component(_SYMBOLS_OUTPUT_PATH
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${_TARGET_NAME}.list"
|
||||||
|
ABSOLUTE
|
||||||
|
)
|
||||||
|
|
||||||
|
get_target_property(_HEADERS_LIST_FILE
|
||||||
|
${_extract_symbols_HEADERS_LIST}
|
||||||
|
LIST_FILE
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
${_TARGET_NAME}_int ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DOUTPUT_PATH="${_SYMBOLS_OUTPUT_PATH}"
|
||||||
|
-DHEADERS_LIST_FILE="${_HEADERS_LIST_FILE}"
|
||||||
|
-DFILTER_PATTERN=${_extract_symbols_FILTER_PATTERN}
|
||||||
|
-P ${_EXTRACT_SYMBOLS_SCRIPT}
|
||||||
|
DEPENDS ${_extract_symbols_HEADERS_LIST}
|
||||||
|
COMMENT "Extracting symbols from headers"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (DEFINED _extract_symbols_COPY_TO)
|
||||||
|
# Copy the generated file back to the COPY_TO
|
||||||
|
add_custom_target(${_TARGET_NAME} ALL
|
||||||
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${_SYMBOLS_OUTPUT_PATH} ${_extract_symbols_COPY_TO}
|
||||||
|
DEPENDS ${_TARGET_NAME}_int
|
||||||
|
COMMENT "Copying ${_TARGET_NAME} to ${_extract_symbols_COPY_TO}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_custom_target(${_TARGET_NAME} ALL
|
||||||
|
DEPENDS ${_TARGET_NAME}_int
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
get_filename_component(_extract_symbols_OUTPUT_PATH
|
set_target_properties(${_TARGET_NAME}
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${_TARGET_NAME}"
|
PROPERTIES LIST_FILE ${_SYMBOLS_OUTPUT_PATH}
|
||||||
ABSOLUTE
|
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(${_TARGET_NAME}
|
|
||||||
COMMAND ${CMAKE_COMMAND}
|
|
||||||
-DOUTPUT_PATH="${_extract_symbols_OUTPUT_PATH}"
|
|
||||||
-DHEADERS_LIST_FILE="${_extract_symbols_HEADERS_LIST_FILE}"
|
|
||||||
-DFILTER_PATTERN=${_extract_symbols_FILTER_PATTERN}
|
|
||||||
-P ${_EXTRACT_SYMBOLS_SCRIPT}
|
|
||||||
DEPENDS ${_extract_symbols_HEADERS_LIST_FILE}
|
|
||||||
COMMENT "Extracting symbols from headers")
|
|
||||||
|
|
||||||
if (DEFINED _extract_symbols_COPY_TO)
|
|
||||||
file(READ "${CMAKE_CURRENT_BINARY_DIR}/${_TARGET_NAME}" SYMBOL_CONTENT)
|
|
||||||
string(REPLACE ";" "\n" SYMBOL_CONTENT_NEW "${SYMBOL_CONTENT}")
|
|
||||||
file(WRITE "${_extract_symbols_COPY_TO}" "${SYMBOL_CONTENT_NEW}")
|
|
||||||
endif()
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(generate_map_file _TARGET_NAME)
|
function(generate_map_file _TARGET_NAME)
|
||||||
@@ -344,36 +416,42 @@ function(generate_map_file _TARGET_NAME)
|
|||||||
)
|
)
|
||||||
|
|
||||||
cmake_parse_arguments(_generate_map_file
|
cmake_parse_arguments(_generate_map_file
|
||||||
"${options}"
|
"${options}"
|
||||||
"${one_value_arguments}"
|
"${one_value_arguments}"
|
||||||
"${multi_value_arguments}"
|
"${multi_value_arguments}"
|
||||||
${ARGN}
|
${ARGN}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT DEFINED _generate_map_file_SYMBOLS)
|
if (NOT DEFINED _generate_map_file_SYMBOLS)
|
||||||
message(FATAL_ERROR "No symbols file provided."
|
message(FATAL_ERROR "No target provided in SYMBOLS. Provide a target"
|
||||||
)
|
" with the property LIST_FILE set as the path to"
|
||||||
|
" the file containing the list of symbols.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT DEFINED _generate_map_file_RELEASE_NAME_VERSION)
|
if (NOT DEFINED _generate_map_file_RELEASE_NAME_VERSION)
|
||||||
message(FATAL_ERROR "Release name and version not provided."
|
message(FATAL_ERROR "Release name and version not provided."
|
||||||
" (e.g. libname_1_0_0"
|
" (e.g. libname_1_0_0)")
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set generated map file path
|
|
||||||
get_filename_component(_generate_map_file_OUTPUT_PATH
|
get_target_property(_SYMBOLS_FILE
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/${_TARGET_NAME}"
|
${_generate_map_file_SYMBOLS}
|
||||||
ABSOLUTE
|
LIST_FILE
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(
|
# Set generated map file path
|
||||||
OUTPUT ${_TARGET_NAME}
|
get_filename_component(_MAP_OUTPUT_PATH
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${_TARGET_NAME}"
|
||||||
|
ABSOLUTE
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
${_TARGET_NAME}_int ALL
|
||||||
COMMAND ${CMAKE_COMMAND}
|
COMMAND ${CMAKE_COMMAND}
|
||||||
-DABIMAP_EXECUTABLE=${ABIMAP_EXECUTABLE}
|
-DABIMAP_EXECUTABLE=${ABIMAP_EXECUTABLE}
|
||||||
-DSYMBOLS="${_generate_map_file_SYMBOLS}"
|
-DSYMBOLS="${_SYMBOLS_FILE}"
|
||||||
-DCURRENT_MAP=${_generate_map_file_CURRENT_MAP}
|
-DCURRENT_MAP=${_generate_map_file_CURRENT_MAP}
|
||||||
-DOUTPUT_PATH="${_generate_map_file_OUTPUT_PATH}"
|
-DOUTPUT_PATH="${_MAP_OUTPUT_PATH}"
|
||||||
-DFINAL=${_generate_map_file_FINAL}
|
-DFINAL=${_generate_map_file_FINAL}
|
||||||
-DBREAK_ABI=${_generate_map_file_BREAK_ABI}
|
-DBREAK_ABI=${_generate_map_file_BREAK_ABI}
|
||||||
-DRELEASE_NAME_VERSION=${_generate_map_file_RELEASE_NAME_VERSION}
|
-DRELEASE_NAME_VERSION=${_generate_map_file_RELEASE_NAME_VERSION}
|
||||||
@@ -382,13 +460,27 @@ function(generate_map_file _TARGET_NAME)
|
|||||||
COMMENT "Generating the map ${_TARGET_NAME}"
|
COMMENT "Generating the map ${_TARGET_NAME}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Add a custom command setting the map as OUTPUT to allow it to be added as
|
||||||
|
# a generated source
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${_MAP_OUTPUT_PATH}
|
||||||
|
DEPENDS ${_TARGET_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
if (DEFINED _generate_map_file_COPY_TO)
|
if (DEFINED _generate_map_file_COPY_TO)
|
||||||
# Copy the generated map back to the COPY_TO
|
# Copy the generated map back to the COPY_TO
|
||||||
add_custom_target(copy_map_${_TARGET_NAME} ALL
|
add_custom_target(${_TARGET_NAME} ALL
|
||||||
COMMAND
|
COMMAND
|
||||||
${CMAKE_COMMAND} -E copy_if_different ${_TARGET_NAME} ${_generate_map_file_COPY_TO}
|
${CMAKE_COMMAND} -E copy_if_different ${_MAP_OUTPUT_PATH}
|
||||||
DEPENDS "${_TARGET_NAME}"
|
${_generate_map_file_COPY_TO}
|
||||||
COMMENT "Copying ${_TARGET_NAME} to ${_generate_map_file_COPY_TO}"
|
DEPENDS ${_TARGET_NAME}_int
|
||||||
|
COMMENT "Copying ${_MAP_OUTPUT_PATH} to ${_generate_map_file_COPY_TO}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_custom_target(${_TARGET_NAME} ALL
|
||||||
|
DEPENDS ${_TARGET_NAME}_int
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
endif (ABIMAP_FOUND)
|
||||||
|
|||||||
@@ -49,7 +49,15 @@ find_library(GCRYPT_LIBRARY
|
|||||||
PATH_SUFFIXES
|
PATH_SUFFIXES
|
||||||
lib
|
lib
|
||||||
)
|
)
|
||||||
set(GCRYPT_LIBRARIES ${GCRYPT_LIBRARY})
|
find_library(GCRYPT_ERROR_LIBRARY
|
||||||
|
NAMES
|
||||||
|
gpg-error
|
||||||
|
libgpg-error-0
|
||||||
|
libgpg-error6-0
|
||||||
|
HINTS
|
||||||
|
${_GCRYPT_ROOT_HINTS_AND_PATHS}
|
||||||
|
)
|
||||||
|
set(GCRYPT_LIBRARIES ${GCRYPT_LIBRARY} ${GCRYPT_ERROR_LIBRARY})
|
||||||
|
|
||||||
if (GCRYPT_INCLUDE_DIR)
|
if (GCRYPT_INCLUDE_DIR)
|
||||||
file(STRINGS "${GCRYPT_INCLUDE_DIR}/gcrypt.h" _gcrypt_version_str REGEX "^#define GCRYPT_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]")
|
file(STRINGS "${GCRYPT_INCLUDE_DIR}/gcrypt.h" _gcrypt_version_str REGEX "^#define GCRYPT_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]")
|
||||||
|
|||||||
@@ -21,17 +21,16 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set(_NSIS_ROOT_HINTS
|
set(_x86 "(x86)")
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS;Default]")
|
|
||||||
|
|
||||||
set(_NSIS_ROOT_PATHS
|
set(_NSIS_ROOT_PATHS
|
||||||
$ENV{PROGRAMFILES}/NSIS)
|
"$ENV{ProgramFiles}/NSIS"
|
||||||
|
"$ENV{ProgramFiles${_x86}}/NSIS"
|
||||||
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\NSIS;Default]")
|
||||||
|
|
||||||
find_path(NSIS_ROOT_PATH
|
find_path(NSIS_ROOT_PATH
|
||||||
NAMES
|
NAMES
|
||||||
Include/Library.nsh
|
Include/Library.nsh
|
||||||
HINTS
|
|
||||||
${_NSIS_ROOT_HINTS}
|
|
||||||
PATHS
|
PATHS
|
||||||
${_NSIS_ROOT_PATHS}
|
${_NSIS_ROOT_PATHS}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,140 +0,0 @@
|
|||||||
# - Run Doxygen
|
|
||||||
#
|
|
||||||
# Adds a doxygen target that runs doxygen to generate the html
|
|
||||||
# and optionally the LaTeX API documentation.
|
|
||||||
# The doxygen target is added to the doc target as a dependency.
|
|
||||||
# i.e.: the API documentation is built with:
|
|
||||||
# make doc
|
|
||||||
#
|
|
||||||
# USAGE: GLOBAL INSTALL
|
|
||||||
#
|
|
||||||
# Install it with:
|
|
||||||
# cmake ./ && sudo make install
|
|
||||||
# Add the following to the CMakeLists.txt of your project:
|
|
||||||
# include(UseDoxygen OPTIONAL)
|
|
||||||
# Optionally copy Doxyfile.in in the directory of CMakeLists.txt and edit it.
|
|
||||||
#
|
|
||||||
# USAGE: INCLUDE IN PROJECT
|
|
||||||
#
|
|
||||||
# set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
# include(UseDoxygen)
|
|
||||||
# Add the Doxyfile.in and UseDoxygen.cmake files to the projects source directory.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# CONFIGURATION
|
|
||||||
#
|
|
||||||
# To configure Doxygen you can edit Doxyfile.in and set some variables in cmake.
|
|
||||||
# Variables you may define are:
|
|
||||||
# DOXYFILE_SOURCE_DIR - Path where the Doxygen input files are.
|
|
||||||
# Defaults to the current source directory.
|
|
||||||
# DOXYFILE_EXTRA_SOURCES - Additional source diretories/files for Doxygen to scan.
|
|
||||||
# The Paths should be in double quotes and separated by space. e.g.:
|
|
||||||
# "${CMAKE_CURRENT_BINARY_DIR}/foo.c" "${CMAKE_CURRENT_BINARY_DIR}/bar/"
|
|
||||||
#
|
|
||||||
# DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored.
|
|
||||||
# Defaults to "${CMAKE_CURRENT_BINARY_DIR}/doc".
|
|
||||||
#
|
|
||||||
# DOXYFILE_LATEX - ON/OFF; Set to "ON" if you want the LaTeX documentation
|
|
||||||
# to be built.
|
|
||||||
# DOXYFILE_LATEX_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where
|
|
||||||
# the Doxygen LaTeX output is stored. Defaults to "latex".
|
|
||||||
#
|
|
||||||
# DOXYFILE_HTML_DIR - Directory relative to DOXYFILE_OUTPUT_DIR where
|
|
||||||
# the Doxygen html output is stored. Defaults to "html".
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright (c) 2009, 2010, 2011 Tobias Rautenkranz <tobias@rautenkranz.ch>
|
|
||||||
#
|
|
||||||
# Redistribution and use is allowed according to the terms of the New
|
|
||||||
# BSD license.
|
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
||||||
#
|
|
||||||
|
|
||||||
macro(usedoxygen_set_default name value type docstring)
|
|
||||||
if(NOT DEFINED "${name}")
|
|
||||||
set("${name}" "${value}" CACHE "${type}" "${docstring}")
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
find_package(Doxygen)
|
|
||||||
|
|
||||||
if(DOXYGEN_FOUND)
|
|
||||||
find_file(DOXYFILE_IN "Doxyfile.in"
|
|
||||||
PATHS "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_ROOT}/Modules/"
|
|
||||||
NO_DEFAULT_PATH
|
|
||||||
DOC "Path to the doxygen configuration template file")
|
|
||||||
set(DOXYFILE "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile")
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND)
|
|
||||||
usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/doc"
|
|
||||||
PATH "Doxygen output directory")
|
|
||||||
usedoxygen_set_default(DOXYFILE_HTML_DIR "html"
|
|
||||||
STRING "Doxygen HTML output directory")
|
|
||||||
usedoxygen_set_default(DOXYFILE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
||||||
PATH "Input files source directory")
|
|
||||||
usedoxygen_set_default(DOXYFILE_EXTRA_SOURCE_DIRS ""
|
|
||||||
STRING "Additional source files/directories separated by space")
|
|
||||||
set(DOXYFILE_SOURCE_DIRS "\"${DOXYFILE_SOURCE_DIR}\" ${DOXYFILE_EXTRA_SOURCES}")
|
|
||||||
|
|
||||||
usedoxygen_set_default(DOXYFILE_LATEX YES BOOL "Generate LaTeX API documentation" OFF)
|
|
||||||
usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex" STRING "LaTex output directory")
|
|
||||||
|
|
||||||
mark_as_advanced(DOXYFILE_OUTPUT_DIR DOXYFILE_HTML_DIR DOXYFILE_LATEX_DIR
|
|
||||||
DOXYFILE_SOURCE_DIR DOXYFILE_EXTRA_SOURCE_DIRS DOXYFILE_IN)
|
|
||||||
|
|
||||||
|
|
||||||
set_property(DIRECTORY
|
|
||||||
APPEND PROPERTY
|
|
||||||
ADDITIONAL_MAKE_CLEAN_FILES
|
|
||||||
"${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}")
|
|
||||||
|
|
||||||
add_custom_target(doxygen
|
|
||||||
COMMAND "${DOXYGEN_EXECUTABLE}"
|
|
||||||
"${DOXYFILE}"
|
|
||||||
COMMENT "Writing documentation to ${DOXYFILE_OUTPUT_DIR}..."
|
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
|
||||||
|
|
||||||
set(DOXYFILE_DOT "NO")
|
|
||||||
if(DOXYGEN_DOT_EXECUTABLE)
|
|
||||||
set(DOXYFILE_DOT "YES")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
## LaTeX
|
|
||||||
set(DOXYFILE_PDFLATEX "NO")
|
|
||||||
|
|
||||||
set_property(DIRECTORY APPEND PROPERTY
|
|
||||||
ADDITIONAL_MAKE_CLEAN_FILES
|
|
||||||
"${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
|
|
||||||
|
|
||||||
if(DOXYFILE_LATEX STREQUAL "ON")
|
|
||||||
set(DOXYFILE_GENERATE_LATEX "YES")
|
|
||||||
find_package(LATEX)
|
|
||||||
find_program(DOXYFILE_MAKE make)
|
|
||||||
mark_as_advanced(DOXYFILE_MAKE)
|
|
||||||
if(LATEX_COMPILER AND MAKEINDEX_COMPILER AND DOXYFILE_MAKE)
|
|
||||||
if(PDFLATEX_COMPILER)
|
|
||||||
set(DOXYFILE_PDFLATEX "YES")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_custom_command(TARGET doxygen
|
|
||||||
POST_BUILD
|
|
||||||
COMMAND "${DOXYFILE_MAKE}"
|
|
||||||
COMMENT "Running LaTeX for Doxygen documentation in ${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}..."
|
|
||||||
WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
|
|
||||||
else()
|
|
||||||
set(DOXYGEN_LATEX "NO")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(DOXYFILE_GENERATE_LATEX "NO")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
configure_file("${DOXYFILE_IN}" "${DOXYFILE}" @ONLY)
|
|
||||||
|
|
||||||
add_custom_target(doc)
|
|
||||||
add_dependencies(doc doxygen)
|
|
||||||
endif()
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* Name of package */
|
/* Name of package */
|
||||||
#cmakedefine PACKAGE "${APPLICATION_NAME}"
|
#cmakedefine PACKAGE "${PROJECT_NAME}"
|
||||||
|
|
||||||
/* Version number of package */
|
/* Version number of package */
|
||||||
#cmakedefine VERSION "${APPLICATION_VERSION}"
|
#cmakedefine VERSION "${PROJECT_VERSION}"
|
||||||
|
|
||||||
#cmakedefine LOCALEDIR "${LOCALE_INSTALL_DIR}"
|
#cmakedefine LOCALEDIR "${LOCALE_INSTALL_DIR}"
|
||||||
#cmakedefine DATADIR "${DATADIR}"
|
#cmakedefine DATADIR "${DATADIR}"
|
||||||
@@ -12,6 +12,12 @@
|
|||||||
#cmakedefine BINARYDIR "${BINARYDIR}"
|
#cmakedefine BINARYDIR "${BINARYDIR}"
|
||||||
#cmakedefine SOURCEDIR "${SOURCEDIR}"
|
#cmakedefine SOURCEDIR "${SOURCEDIR}"
|
||||||
|
|
||||||
|
/* Global bind configuration file path */
|
||||||
|
#cmakedefine GLOBAL_BIND_CONFIG "${GLOBAL_BIND_CONFIG}"
|
||||||
|
|
||||||
|
/* Global client configuration file path */
|
||||||
|
#cmakedefine GLOBAL_CLIENT_CONFIG "${GLOBAL_CLIENT_CONFIG}"
|
||||||
|
|
||||||
/************************** HEADER FILES *************************/
|
/************************** HEADER FILES *************************/
|
||||||
|
|
||||||
/* Define to 1 if you have the <argp.h> header file. */
|
/* Define to 1 if you have the <argp.h> header file. */
|
||||||
@@ -23,6 +29,9 @@
|
|||||||
/* Define to 1 if you have the <glob.h> header file. */
|
/* Define to 1 if you have the <glob.h> header file. */
|
||||||
#cmakedefine HAVE_GLOB_H 1
|
#cmakedefine HAVE_GLOB_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <valgrind/valgrind.h> header file. */
|
||||||
|
#cmakedefine HAVE_VALGRIND_VALGRIND_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <pty.h> header file. */
|
/* Define to 1 if you have the <pty.h> header file. */
|
||||||
#cmakedefine HAVE_PTY_H 1
|
#cmakedefine HAVE_PTY_H 1
|
||||||
|
|
||||||
@@ -89,6 +98,9 @@
|
|||||||
/* Define to 1 if you have DSA */
|
/* Define to 1 if you have DSA */
|
||||||
#cmakedefine HAVE_DSA 1
|
#cmakedefine HAVE_DSA 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have gl_flags as a glob_t sturct member */
|
||||||
|
#cmakedefine HAVE_GLOB_GL_FLAGS_MEMBER 1
|
||||||
|
|
||||||
/*************************** FUNCTIONS ***************************/
|
/*************************** FUNCTIONS ***************************/
|
||||||
|
|
||||||
/* Define to 1 if you have the `EVP_aes128_ctr' function. */
|
/* Define to 1 if you have the `EVP_aes128_ctr' function. */
|
||||||
@@ -97,6 +109,9 @@
|
|||||||
/* Define to 1 if you have the `EVP_aes128_cbc' function. */
|
/* Define to 1 if you have the `EVP_aes128_cbc' function. */
|
||||||
#cmakedefine HAVE_OPENSSL_EVP_AES_CBC 1
|
#cmakedefine HAVE_OPENSSL_EVP_AES_CBC 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `EVP_aes128_gcm' function. */
|
||||||
|
#cmakedefine HAVE_OPENSSL_EVP_AES_GCM 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `CRYPTO_THREADID_set_callback' function. */
|
/* Define to 1 if you have the `CRYPTO_THREADID_set_callback' function. */
|
||||||
#cmakedefine HAVE_OPENSSL_CRYPTO_THREADID_SET_CALLBACK 1
|
#cmakedefine HAVE_OPENSSL_CRYPTO_THREADID_SET_CALLBACK 1
|
||||||
|
|
||||||
@@ -106,6 +121,12 @@
|
|||||||
/* Define to 1 if you have the `EVP_CIPHER_CTX_new' function. */
|
/* Define to 1 if you have the `EVP_CIPHER_CTX_new' function. */
|
||||||
#cmakedefine HAVE_OPENSSL_EVP_CIPHER_CTX_NEW 1
|
#cmakedefine HAVE_OPENSSL_EVP_CIPHER_CTX_NEW 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `EVP_KDF_CTX_new_id' function. */
|
||||||
|
#cmakedefine HAVE_OPENSSL_EVP_KDF_CTX_NEW_ID 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `OPENSSL_ia32cap_loc' function. */
|
||||||
|
#cmakedefine HAVE_OPENSSL_IA32CAP_LOC 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `snprintf' function. */
|
/* Define to 1 if you have the `snprintf' function. */
|
||||||
#cmakedefine HAVE_SNPRINTF 1
|
#cmakedefine HAVE_SNPRINTF 1
|
||||||
|
|
||||||
@@ -130,6 +151,9 @@
|
|||||||
/* Define to 1 if you have the `strncpy' function. */
|
/* Define to 1 if you have the `strncpy' function. */
|
||||||
#cmakedefine HAVE_STRNCPY 1
|
#cmakedefine HAVE_STRNCPY 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strndup' function. */
|
||||||
|
#cmakedefine HAVE_STRNDUP 1
|
||||||
|
|
||||||
/* Define to 1 if you have the `cfmakeraw' function. */
|
/* Define to 1 if you have the `cfmakeraw' function. */
|
||||||
#cmakedefine HAVE_CFMAKERAW 1
|
#cmakedefine HAVE_CFMAKERAW 1
|
||||||
|
|
||||||
@@ -172,6 +196,9 @@
|
|||||||
/* Define to 1 if you have the `SecureZeroMemory' function. */
|
/* Define to 1 if you have the `SecureZeroMemory' function. */
|
||||||
#cmakedefine HAVE_SECURE_ZERO_MEMORY 1
|
#cmakedefine HAVE_SECURE_ZERO_MEMORY 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `cmocka_set_test_filter' function. */
|
||||||
|
#cmakedefine HAVE_CMOCKA_SET_TEST_FILTER 1
|
||||||
|
|
||||||
/*************************** LIBRARIES ***************************/
|
/*************************** LIBRARIES ***************************/
|
||||||
|
|
||||||
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
||||||
@@ -186,15 +213,21 @@
|
|||||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||||
#cmakedefine HAVE_PTHREAD 1
|
#cmakedefine HAVE_PTHREAD 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `cmocka' library (-lcmocka). */
|
||||||
|
#cmakedefine HAVE_CMOCKA 1
|
||||||
|
|
||||||
/**************************** OPTIONS ****************************/
|
/**************************** OPTIONS ****************************/
|
||||||
|
|
||||||
#cmakedefine HAVE_GCC_THREAD_LOCAL_STORAGE 1
|
#cmakedefine HAVE_GCC_THREAD_LOCAL_STORAGE 1
|
||||||
#cmakedefine HAVE_MSC_THREAD_LOCAL_STORAGE 1
|
#cmakedefine HAVE_MSC_THREAD_LOCAL_STORAGE 1
|
||||||
|
|
||||||
#cmakedefine HAVE_FALLTHROUGH_ATTRIBUTE 1
|
#cmakedefine HAVE_FALLTHROUGH_ATTRIBUTE 1
|
||||||
|
#cmakedefine HAVE_UNUSED_ATTRIBUTE 1
|
||||||
|
|
||||||
|
#cmakedefine HAVE_CONSTRUCTOR_ATTRIBUTE 1
|
||||||
|
#cmakedefine HAVE_DESTRUCTOR_ATTRIBUTE 1
|
||||||
|
|
||||||
#cmakedefine HAVE_GCC_VOLATILE_MEMORY_PROTECTION 1
|
#cmakedefine HAVE_GCC_VOLATILE_MEMORY_PROTECTION 1
|
||||||
#cmakedefine HAVE_GCC_NARG_MACRO 1
|
|
||||||
|
|
||||||
#cmakedefine HAVE_COMPILER__FUNC__ 1
|
#cmakedefine HAVE_COMPILER__FUNC__ 1
|
||||||
#cmakedefine HAVE_COMPILER__FUNCTION__ 1
|
#cmakedefine HAVE_COMPILER__FUNCTION__ 1
|
||||||
@@ -213,6 +246,12 @@
|
|||||||
/* Define to 1 if you want to enable server support */
|
/* Define to 1 if you want to enable server support */
|
||||||
#cmakedefine WITH_SERVER 1
|
#cmakedefine WITH_SERVER 1
|
||||||
|
|
||||||
|
/* Define to 1 if you want to enable DH group exchange algorithms */
|
||||||
|
#cmakedefine WITH_GEX 1
|
||||||
|
|
||||||
|
/* Define to 1 if you want to enable blowfish cipher support */
|
||||||
|
#cmakedefine WITH_BLOWFISH_CIPHER 1
|
||||||
|
|
||||||
/* Define to 1 if you want to enable debug output for crypto functions */
|
/* Define to 1 if you want to enable debug output for crypto functions */
|
||||||
#cmakedefine DEBUG_CRYPTO 1
|
#cmakedefine DEBUG_CRYPTO 1
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,46 @@
|
|||||||
#
|
#
|
||||||
# Build the documentation
|
# Build the documentation
|
||||||
#
|
#
|
||||||
include(UseDoxygen OPTIONAL)
|
if (${CMAKE_VERSION} VERSION_GREATER "3.8.99")
|
||||||
|
|
||||||
|
find_package(Doxygen)
|
||||||
|
|
||||||
|
if (DOXYGEN_FOUND)
|
||||||
|
set(DOXYGEN_PROJECT_NAME ${PROJECT_NAME})
|
||||||
|
set(DOXYGEN_PROJECT_NUMBER ${PROJECT_VERSION})
|
||||||
|
set(DOXYGEN_PROJECT_BRIEF "The SSH library")
|
||||||
|
|
||||||
|
set(DOXYGEN_TAB_SIZE 4)
|
||||||
|
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
|
||||||
|
set(DOXYGEN_MARKDOWN_SUPPORT YES)
|
||||||
|
|
||||||
|
set(DOXYGEN_PREDEFINED DOXYGEN
|
||||||
|
PRINTF_ATTRIBUTE(x,y))
|
||||||
|
|
||||||
|
set(DOXYGEN_EXCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/that_style)
|
||||||
|
set(DOXYGEN_HTML_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/that_style/header.html)
|
||||||
|
set(DOXYGEN_HTML_EXTRA_STYLESHEET ${CMAKE_CURRENT_SOURCE_DIR}/that_style/that_style.css)
|
||||||
|
set(DOXYGEN_HTML_EXTRA_FILES ${CMAKE_CURRENT_SOURCE_DIR}/that_style/img/nav_edge_left.svg
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/that_style/img/nav_edge_right.svg
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/that_style/img/nav_edge_inter.svg
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/that_style/img/sync_off.png
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/that_style/img/sync_on.png
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/that_style/img/splitbar_handle.svg
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/that_style/img/doc.svg
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/that_style/img/mag_glass.svg
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/that_style/img/folderclosed.svg
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/that_style/img/folderopen.svg
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/that_style/js/striped_bg.js)
|
||||||
|
|
||||||
|
# This updates the Doxyfile if we do changes here
|
||||||
|
set(_doxyfile_template "${CMAKE_BINARY_DIR}/CMakeDoxyfile.in")
|
||||||
|
set(_target_doxyfile "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.docs")
|
||||||
|
configure_file("${_doxyfile_template}" "${_target_doxyfile}")
|
||||||
|
|
||||||
|
doxygen_add_docs(docs
|
||||||
|
${CMAKE_SOURCE_DIR}/include/libssh
|
||||||
|
${CMAKE_SOURCE_DIR}/src
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
endif() # DOXYGEN_FOUND
|
||||||
|
|
||||||
|
endif() # CMAKE_VERSION
|
||||||
|
|||||||
1917
doc/Doxyfile.in
@@ -63,7 +63,7 @@ int authenticate_pubkey(ssh_session session)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = ssh_userauth_publickey_auto(session, NULL);
|
rc = ssh_userauth_publickey_auto(session, NULL, NULL);
|
||||||
|
|
||||||
if (rc == SSH_AUTH_ERROR)
|
if (rc == SSH_AUTH_ERROR)
|
||||||
{
|
{
|
||||||
@@ -127,7 +127,7 @@ The keyboard-interactive method is, as its name tells, interactive. The
|
|||||||
server will issue one or more challenges that the user has to answer,
|
server will issue one or more challenges that the user has to answer,
|
||||||
until the server takes an authentication decision.
|
until the server takes an authentication decision.
|
||||||
|
|
||||||
ssh_userauth_kbdint() is the the main keyboard-interactive function.
|
ssh_userauth_kbdint() is the the main keyboard-interactive function.
|
||||||
It will return SSH_AUTH_SUCCESS,SSH_AUTH_DENIED, SSH_AUTH_PARTIAL,
|
It will return SSH_AUTH_SUCCESS,SSH_AUTH_DENIED, SSH_AUTH_PARTIAL,
|
||||||
SSH_AUTH_ERROR, or SSH_AUTH_INFO, depending on the result of the request.
|
SSH_AUTH_ERROR, or SSH_AUTH_INFO, depending on the result of the request.
|
||||||
|
|
||||||
@@ -154,9 +154,9 @@ Here are a few remarks:
|
|||||||
- Even the first call can return SSH_AUTH_DENIED or SSH_AUTH_SUCCESS.
|
- Even the first call can return SSH_AUTH_DENIED or SSH_AUTH_SUCCESS.
|
||||||
- The server can send an empty question set (this is the default behavior
|
- The server can send an empty question set (this is the default behavior
|
||||||
on my system) after you have sent the answers to the first questions.
|
on my system) after you have sent the answers to the first questions.
|
||||||
You must still parse the answer, it might contain some
|
You must still parse the answer, it might contain some
|
||||||
message from the server saying hello or such things. Just call
|
message from the server saying hello or such things. Just call
|
||||||
ssh_userauth_kbdint() until needed.
|
ssh_userauth_kbdint() until needed.
|
||||||
- The meaning of "name", "prompt", "instruction" may be a little
|
- The meaning of "name", "prompt", "instruction" may be a little
|
||||||
confusing. An explanation is given in the RFC section that follows.
|
confusing. An explanation is given in the RFC section that follows.
|
||||||
|
|
||||||
@@ -187,7 +187,7 @@ keyboard-interactive authentication, coming from the RFC itself (rfc4256):
|
|||||||
the name and prompts. If the server presents names or prompts longer than 30
|
the name and prompts. If the server presents names or prompts longer than 30
|
||||||
characters, the client MAY truncate these fields to the length it can
|
characters, the client MAY truncate these fields to the length it can
|
||||||
display. If the client does truncate any fields, there MUST be an obvious
|
display. If the client does truncate any fields, there MUST be an obvious
|
||||||
indication that such truncation has occured.
|
indication that such truncation has occurred.
|
||||||
|
|
||||||
The instruction field SHOULD NOT be truncated. Clients SHOULD use control
|
The instruction field SHOULD NOT be truncated. Clients SHOULD use control
|
||||||
character filtering as discussed in [SSH-ARCH] to avoid attacks by
|
character filtering as discussed in [SSH-ARCH] to avoid attacks by
|
||||||
@@ -281,7 +281,7 @@ pass, ssh_userauth_none() might answer SSH_AUTH_SUCCESS.
|
|||||||
The following example shows how to perform "none" authentication:
|
The following example shows how to perform "none" authentication:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
int authenticate_kbdint(ssh_session session)
|
int authenticate_none(ssh_session session)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
Port forwarding comes in SSH protocol in two different flavours:
|
Port forwarding comes in SSH protocol in two different flavours:
|
||||||
direct or reverse port forwarding. Direct port forwarding is also
|
direct or reverse port forwarding. Direct port forwarding is also
|
||||||
named local port forwardind, and reverse port forwarding is also called
|
named local port forwarding, and reverse port forwarding is also called
|
||||||
remote port forwarding. SSH also allows X11 tunnels.
|
remote port forwarding. SSH also allows X11 tunnels.
|
||||||
|
|
||||||
|
|
||||||
@@ -23,15 +23,15 @@ Mail client application Google Mail
|
|||||||
5555 (arbitrary) |
|
5555 (arbitrary) |
|
||||||
| 143 (IMAP2)
|
| 143 (IMAP2)
|
||||||
V |
|
V |
|
||||||
SSH client =====> SSH server
|
SSH client =====> SSH server
|
||||||
|
|
||||||
Legend:
|
Legend:
|
||||||
--P-->: port connexion through port P
|
--P-->: port connections through port P
|
||||||
=====>: SSH tunnel
|
=====>: SSH tunnel
|
||||||
@endverbatim
|
@endverbatim
|
||||||
A mail client connects to port 5555 of a client. An encrypted tunnel is
|
A mail client connects to port 5555 of a client. An encrypted tunnel is
|
||||||
established to the server. The server connects to port 143 of Google Mail (the
|
established to the server. The server connects to port 143 of Google Mail (the
|
||||||
end point). Now the local mail client can retreive mail.
|
end point). Now the local mail client can retrieve mail.
|
||||||
|
|
||||||
|
|
||||||
@subsection forwarding_reverse Reverse port forwarding
|
@subsection forwarding_reverse Reverse port forwarding
|
||||||
@@ -51,7 +51,7 @@ Example of use of reverse port forwarding:
|
|||||||
SSH client <===== SSH server
|
SSH client <===== SSH server
|
||||||
|
|
||||||
Legend:
|
Legend:
|
||||||
--P-->: port connexion through port P
|
--P-->: port connections through port P
|
||||||
=====>: SSH tunnel
|
=====>: SSH tunnel
|
||||||
@endverbatim
|
@endverbatim
|
||||||
In this example, the SSH client establishes the tunnel,
|
In this example, the SSH client establishes the tunnel,
|
||||||
@@ -148,9 +148,9 @@ To do reverse port forwarding, call ssh_channel_listen_forward(),
|
|||||||
then ssh_channel_accept_forward().
|
then ssh_channel_accept_forward().
|
||||||
|
|
||||||
When you call ssh_channel_listen_forward(), you can let the remote server
|
When you call ssh_channel_listen_forward(), you can let the remote server
|
||||||
chose the non-priviledged port it should listen to. Otherwise, you can chose
|
chose the non-privileged port it should listen to. Otherwise, you can chose
|
||||||
your own priviledged or non-priviledged port. Beware that you should have
|
your own privileged or non-privileged port. Beware that you should have
|
||||||
administrative priviledges on the remote server to open a priviledged port
|
administrative privileges on the remote server to open a privileged port
|
||||||
(port number < 1024).
|
(port number < 1024).
|
||||||
|
|
||||||
Below is an example of a very rough web server waiting for connections on port
|
Below is an example of a very rough web server waiting for connections on port
|
||||||
|
|||||||
@@ -31,20 +31,20 @@ A SSH session goes through the following steps:
|
|||||||
- Invoke your own subsystem. This is outside the scope of this document,
|
- Invoke your own subsystem. This is outside the scope of this document,
|
||||||
but can be done.
|
but can be done.
|
||||||
|
|
||||||
- When everything is finished, just close the channels, and then the connection.
|
- When everything is finished, just close the channels, and then the connection.
|
||||||
|
|
||||||
The sftp and scp subsystems use channels, but libssh hides them to
|
The sftp and scp subsystems use channels, but libssh hides them to
|
||||||
the programmer. If you want to use those subsystems, instead of a channel,
|
the programmer. If you want to use those subsystems, instead of a channel,
|
||||||
you'll usually open a "sftp session" or a "scp session".
|
you'll usually open a "sftp session" or a "scp session".
|
||||||
|
|
||||||
|
|
||||||
@subsection setup Creating the session and setting options
|
@subsection setup Creating the session and setting options
|
||||||
|
|
||||||
The most important object in a SSH connection is the SSH session. In order
|
The most important object in a SSH connection is the SSH session. In order
|
||||||
to allocate a new SSH session, you use ssh_new(). Don't forget to
|
to allocate a new SSH session, you use ssh_new(). Don't forget to
|
||||||
always verify that the allocation successed.
|
always verify that the allocation succeeded.
|
||||||
@code
|
@code
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@@ -69,12 +69,12 @@ The ssh_options_set() function sets the options of the session. The most importa
|
|||||||
|
|
||||||
The complete list of options can be found in the documentation of ssh_options_set().
|
The complete list of options can be found in the documentation of ssh_options_set().
|
||||||
The only mandatory option is SSH_OPTIONS_HOST. If you don't use SSH_OPTIONS_USER,
|
The only mandatory option is SSH_OPTIONS_HOST. If you don't use SSH_OPTIONS_USER,
|
||||||
the local username of your account will be used.
|
the local username of your account will be used.
|
||||||
|
|
||||||
Here is a small example of how to use it:
|
Here is a small example of how to use it:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@@ -122,7 +122,7 @@ Here's an example:
|
|||||||
@code
|
@code
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -285,9 +285,9 @@ int verify_knownhost(ssh_session session)
|
|||||||
|
|
||||||
The authentication process is the way a service provider can identify a
|
The authentication process is the way a service provider can identify a
|
||||||
user and verify his/her identity. The authorization process is about enabling
|
user and verify his/her identity. The authorization process is about enabling
|
||||||
the authenticated user the access to ressources. In SSH, the two concepts
|
the authenticated user the access to resources. In SSH, the two concepts
|
||||||
are linked. After authentication, the server can grant the user access to
|
are linked. After authentication, the server can grant the user access to
|
||||||
several ressources such as port forwarding, shell, sftp subsystem, and so on.
|
several resources such as port forwarding, shell, sftp subsystem, and so on.
|
||||||
|
|
||||||
libssh supports several methods of authentication:
|
libssh supports several methods of authentication:
|
||||||
- "none" method. This method allows to get the available authentications
|
- "none" method. This method allows to get the available authentications
|
||||||
@@ -313,7 +313,7 @@ The example below shows an authentication with password:
|
|||||||
@code
|
@code
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
@@ -338,7 +338,7 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the server's identity
|
// Verify the server's identity
|
||||||
// For the source code of verify_knowhost(), check previous example
|
// For the source code of verify_knownhost(), check previous example
|
||||||
if (verify_knownhost(my_ssh_session) < 0)
|
if (verify_knownhost(my_ssh_session) < 0)
|
||||||
{
|
{
|
||||||
ssh_disconnect(my_ssh_session);
|
ssh_disconnect(my_ssh_session);
|
||||||
@@ -415,7 +415,7 @@ int show_remote_processes(ssh_session session)
|
|||||||
}
|
}
|
||||||
nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0);
|
nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbytes < 0)
|
if (nbytes < 0)
|
||||||
{
|
{
|
||||||
ssh_channel_close(channel);
|
ssh_channel_close(channel);
|
||||||
@@ -431,6 +431,9 @@ int show_remote_processes(ssh_session session)
|
|||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
Each ssh_channel_request_exec() needs to be run on freshly created
|
||||||
|
and connected (with ssh_channel_open_session()) channel.
|
||||||
|
|
||||||
@see @ref opening_shell
|
@see @ref opening_shell
|
||||||
@see @ref remote_command
|
@see @ref remote_command
|
||||||
@see @ref sftp_subsystem
|
@see @ref sftp_subsystem
|
||||||
@@ -456,7 +459,7 @@ might be recoverable. SSH_FATAL means the connection has an important
|
|||||||
problem and isn't probably recoverable.
|
problem and isn't probably recoverable.
|
||||||
|
|
||||||
Most of time, the error returned are SSH_FATAL, but some functions
|
Most of time, the error returned are SSH_FATAL, but some functions
|
||||||
(generaly the ssh_request_xxx ones) may fail because of server denying request.
|
(generally the ssh_request_xxx ones) may fail because of server denying request.
|
||||||
In these cases, SSH_REQUEST_DENIED is returned.
|
In these cases, SSH_REQUEST_DENIED is returned.
|
||||||
|
|
||||||
For thread safety, errors are bound to ssh_session objects.
|
For thread safety, errors are bound to ssh_session objects.
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ mean that you should not try to know about and understand these details.
|
|||||||
|
|
||||||
libssh is a Free Software / Open Source project. The libssh library
|
libssh is a Free Software / Open Source project. The libssh library
|
||||||
is distributed under LGPL license. The libssh project has nothing to do with
|
is distributed under LGPL license. The libssh project has nothing to do with
|
||||||
"libssh2", which is a completly different and independant project.
|
"libssh2", which is a completely different and independent project.
|
||||||
|
|
||||||
libssh can run on top of either libgcrypt or libcrypto,
|
libssh can run on top of either libgcrypt or libcrypto,
|
||||||
two general-purpose cryptographic libraries.
|
two general-purpose cryptographic libraries.
|
||||||
|
|
||||||
This tutorial concentrates for its main part on the "client" side of libssh.
|
This tutorial concentrates for its main part on the "client" side of libssh.
|
||||||
To learn how to accept incoming SSH connexions (how to write a SSH server),
|
To learn how to accept incoming SSH connections (how to write a SSH server),
|
||||||
you'll have to jump to the end of this document.
|
you'll have to jump to the end of this document.
|
||||||
|
|
||||||
This tutorial describes libssh version 0.5.0. This version is a little different
|
This tutorial describes libssh version 0.5.0. This version is a little different
|
||||||
|
|||||||
@@ -27,4 +27,7 @@ the dllimport attribute.
|
|||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
|
If you're are statically linking with OpenSSL, read the "Linking your
|
||||||
|
application" section in the NOTES.<OS> in the OpenSSL source tree!
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ the interesting functions as you go.
|
|||||||
The libssh library provides:
|
The libssh library provides:
|
||||||
|
|
||||||
- <strong>Key Exchange Methods</strong>: <i>curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521</i>, diffie-hellman-group1-sha1, diffie-hellman-group14-sha1
|
- <strong>Key Exchange Methods</strong>: <i>curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521</i>, diffie-hellman-group1-sha1, diffie-hellman-group14-sha1
|
||||||
- <strong>Hostkey Types</strong>: <i>ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521</i>, ssh-dss, ssh-rsa
|
- <strong>Public Key Algorithms</strong>: ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, ssh-rsa, rsa-sha2-512, rsa-sha2-256,ssh-dss
|
||||||
- <strong>Ciphers</strong>: <i>aes256-ctr, aes192-ctr, aes128-ctr</i>, aes256-cbc (rijndael-cbc@lysator.liu.se), aes192-cbc, aes128-cbc, 3des-cbc, blowfish-cbc, none
|
- <strong>Ciphers</strong>: <i>aes256-ctr, aes192-ctr, aes128-ctr</i>, aes256-cbc (rijndael-cbc@lysator.liu.se), aes192-cbc, aes128-cbc, 3des-cbc, blowfish-cbc, none
|
||||||
- <strong>Compression Schemes</strong>: zlib, <i>zlib@openssh.com</i>, none
|
- <strong>Compression Schemes</strong>: zlib, <i>zlib@openssh.com</i>, none
|
||||||
- <strong>MAC hashes</strong>: hmac-sha1, hmac-sha2-256, hmac-sha2-384, hmac-sha2-512, hmac-md5, none
|
- <strong>MAC hashes</strong>: hmac-sha1, hmac-sha2-256, hmac-sha2-512, hmac-md5, none
|
||||||
- <strong>Authentication</strong>: none, password, public-key, hostbased, keyboard-interactive, <i>gssapi-with-mic</i>
|
- <strong>Authentication</strong>: none, password, public-key, keyboard-interactive, <i>gssapi-with-mic</i>
|
||||||
- <strong>Channels</strong>: shell, exec (incl. SCP wrapper), direct-tcpip, subsystem, <i>auth-agent-req@openssh.com</i>
|
- <strong>Channels</strong>: shell, exec (incl. SCP wrapper), direct-tcpip, subsystem, <i>auth-agent-req@openssh.com</i>
|
||||||
- <strong>Global Requests</strong>: tcpip-forward, forwarded-tcpip
|
- <strong>Global Requests</strong>: tcpip-forward, forwarded-tcpip
|
||||||
- <strong>Channel Requests</strong>: x11, pty, <i>exit-status, signal, exit-signal, keepalive@openssh.com, auth-agent-req@openssh.com</i>
|
- <strong>Channel Requests</strong>: x11, pty, <i>exit-status, signal, exit-signal, keepalive@openssh.com, auth-agent-req@openssh.com</i>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
@page libssh_tutor_scp Chapter 6: The SCP subsystem
|
@page libssh_tutor_scp Chapter 6: The SCP subsystem
|
||||||
@section scp_subsystem The SCP subsystem
|
@section scp_subsystem The SCP subsystem
|
||||||
|
|
||||||
The SCP subsystem has far less functionnality than the SFTP subsystem.
|
The SCP subsystem has far less functionality than the SFTP subsystem.
|
||||||
However, if you only need to copy files from and to the remote system,
|
However, if you only need to copy files from and to the remote system,
|
||||||
it does its job.
|
it does its job.
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ Let's say you want to copy the following tree of files to the remote site:
|
|||||||
+-- file1
|
+-- file1
|
||||||
+-- B --+
|
+-- B --+
|
||||||
| +-- file2
|
| +-- file2
|
||||||
-- A --+
|
-- A --+
|
||||||
| +-- file3
|
| +-- file3
|
||||||
+-- C --+
|
+-- C --+
|
||||||
+-- file4
|
+-- file4
|
||||||
@@ -210,7 +210,7 @@ int scp_receive(ssh_session session, ssh_scp scp)
|
|||||||
size = ssh_scp_request_get_size(scp);
|
size = ssh_scp_request_get_size(scp);
|
||||||
filename = strdup(ssh_scp_request_get_filename(scp));
|
filename = strdup(ssh_scp_request_get_filename(scp));
|
||||||
mode = ssh_scp_request_get_permissions(scp);
|
mode = ssh_scp_request_get_permissions(scp);
|
||||||
printf("Receiving file %s, size %d, permisssions 0%o\n",
|
printf("Receiving file %s, size %d, permissions 0%o\n",
|
||||||
filename, size, mode);
|
filename, size, mode);
|
||||||
free(filename);
|
free(filename);
|
||||||
|
|
||||||
|
|||||||
10
doc/sftp.dox
@@ -61,7 +61,7 @@ int sftp_helloworld(ssh_session session)
|
|||||||
rc = sftp_init(sftp);
|
rc = sftp_init(sftp);
|
||||||
if (rc != SSH_OK)
|
if (rc != SSH_OK)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error initializing SFTP session: %s.\n",
|
fprintf(stderr, "Error initializing SFTP session: code %d.\n",
|
||||||
sftp_get_error(sftp));
|
sftp_get_error(sftp));
|
||||||
sftp_free(sftp);
|
sftp_free(sftp);
|
||||||
return rc;
|
return rc;
|
||||||
@@ -100,7 +100,7 @@ Possible errors are:
|
|||||||
|
|
||||||
@subsection sftp_mkdir Creating a directory
|
@subsection sftp_mkdir Creating a directory
|
||||||
|
|
||||||
The function sftp_mkdir() tahes the "SFTP session" we juste created as
|
The function sftp_mkdir() takes the "SFTP session" we just created as
|
||||||
its first argument. It also needs the name of the file to create, and the
|
its first argument. It also needs the name of the file to create, and the
|
||||||
desired permissions. The permissions are the same as for the usual mkdir()
|
desired permissions. The permissions are the same as for the usual mkdir()
|
||||||
function. To get a comprehensive list of the available permissions, use the
|
function. To get a comprehensive list of the available permissions, use the
|
||||||
@@ -358,19 +358,19 @@ int sftp_read_async(ssh_session session, sftp_session sftp)
|
|||||||
@subsection sftp_ls Listing the contents of a directory
|
@subsection sftp_ls Listing the contents of a directory
|
||||||
|
|
||||||
The functions sftp_opendir(), sftp_readdir(), sftp_dir_eof(),
|
The functions sftp_opendir(), sftp_readdir(), sftp_dir_eof(),
|
||||||
and sftp_closedir() enable to list the contents of a directory.
|
and sftp_closedir() enable to list the contents of a directory.
|
||||||
They use a new handle_type, "sftp_dir", which gives access to the
|
They use a new handle_type, "sftp_dir", which gives access to the
|
||||||
directory being read.
|
directory being read.
|
||||||
|
|
||||||
In addition, sftp_readdir() returns a "sftp_attributes" which is a pointer
|
In addition, sftp_readdir() returns a "sftp_attributes" which is a pointer
|
||||||
to a structure with informations about a directory entry:
|
to a structure with information about a directory entry:
|
||||||
- name: the name of the file or directory
|
- name: the name of the file or directory
|
||||||
- size: its size in bytes
|
- size: its size in bytes
|
||||||
- etc.
|
- etc.
|
||||||
|
|
||||||
sftp_readdir() might return NULL under two conditions:
|
sftp_readdir() might return NULL under two conditions:
|
||||||
- when the end of the directory has been met
|
- when the end of the directory has been met
|
||||||
- when an error occured
|
- when an error occurred
|
||||||
|
|
||||||
To tell the difference, call sftp_dir_eof().
|
To tell the difference, call sftp_dir_eof().
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ int interactive_shell_session(ssh_channel channel)
|
|||||||
|
|
||||||
Of course, this is a poor terminal emulator, since the echo from the keys
|
Of course, this is a poor terminal emulator, since the echo from the keys
|
||||||
pressed should not be done locally, but should be done by the remote side.
|
pressed should not be done locally, but should be done by the remote side.
|
||||||
Also, user's input should not be sent once "Enter" key is pressed, but
|
Also, user's input should not be sent once "Enter" key is pressed, but
|
||||||
immediately after each key is pressed. This can be accomplished
|
immediately after each key is pressed. This can be accomplished
|
||||||
by setting the local terminal to "raw" mode with the cfmakeraw(3) function.
|
by setting the local terminal to "raw" mode with the cfmakeraw(3) function.
|
||||||
cfmakeraw() is a standard function under Linux, on other systems you can
|
cfmakeraw() is a standard function under Linux, on other systems you can
|
||||||
@@ -245,13 +245,13 @@ provide a more elegant way to wait for data coming from many sources.
|
|||||||
|
|
||||||
The functions ssh_select() and ssh_channel_select() remind of the standard
|
The functions ssh_select() and ssh_channel_select() remind of the standard
|
||||||
UNIX select(2) function. The idea is to wait for "something" to happen:
|
UNIX select(2) function. The idea is to wait for "something" to happen:
|
||||||
incoming data to be read, outcoming data to block, or an exception to
|
incoming data to be read, outgoing data to block, or an exception to
|
||||||
occur. Both these functions do a "passive wait", i.e. you can safely use
|
occur. Both these functions do a "passive wait", i.e. you can safely use
|
||||||
them repeatedly in a loop, it will not consume exaggerate processor time
|
them repeatedly in a loop, it will not consume exaggerate processor time
|
||||||
and make your computer unresponsive. It is quite common to use these
|
and make your computer unresponsive. It is quite common to use these
|
||||||
functions in your application's main loop.
|
functions in your application's main loop.
|
||||||
|
|
||||||
The difference between ssh_select() and ssh_channel_select() is that
|
The difference between ssh_select() and ssh_channel_select() is that
|
||||||
ssh_channel_select() is simpler, but allows you only to watch SSH channels.
|
ssh_channel_select() is simpler, but allows you only to watch SSH channels.
|
||||||
ssh_select() is more complete and enables watching regular file descriptors
|
ssh_select() is more complete and enables watching regular file descriptors
|
||||||
as well, in the same function call.
|
as well, in the same function call.
|
||||||
|
|||||||
21
doc/that_style/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2017 Jan-Lukas Wynen
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
22
doc/that_style/README.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# that style
|
||||||
|
A plain, more modern HTML style for Doxygen
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
- Doxygen (tested with version 1.8.13)
|
||||||
|
- *optional*: a sass/scss compiler if you want to modify the style
|
||||||
|
|
||||||
|
## Simple usage
|
||||||
|
Tell Doxygen about the files for that style as shown in [doxyfile.conf](doxyfile.conf). You might need to adjust the
|
||||||
|
paths depending on where you installed that style.
|
||||||
|
When you run Doxygen, all files are copied into to generated HTML folder. So you don't need to keep the originals around
|
||||||
|
unless you want to re-generate the documentation.
|
||||||
|
|
||||||
|
## Advanced
|
||||||
|
that style uses a custom javascript to hack some nice stripes into some tables. It has to be loaded from HTML. Hence you need
|
||||||
|
to use the provided custom header. Since its default content may change when Doxygen is updated, there might be syntax error in
|
||||||
|
the generated HTML. If this is the case, you can remove the custom header (adjust your doxyfile.conf). This has no
|
||||||
|
disadvantages other than removing the stripes.
|
||||||
|
|
||||||
|
[that_style.css](that_style.css) was generated from the scss files in the folder [sass](sass). If you want to change the style,
|
||||||
|
use those files in order to have better control. For instance, you can easily change most colors by modifying the variables
|
||||||
|
in the beginning of [that_style.scss](sass/that_style.scss).
|
||||||
56
doc/that_style/header.html
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
<!-- HTML header for doxygen 1.8.13-->
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||||
|
<meta name="generator" content="Doxygen $doxygenversion"/>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
|
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
|
||||||
|
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
|
||||||
|
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
|
||||||
|
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||||
|
$treeview
|
||||||
|
$search
|
||||||
|
$mathjax
|
||||||
|
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
|
||||||
|
<script src="$relpath^striped_bg.js"></script>
|
||||||
|
$extrastylesheet
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||||
|
|
||||||
|
<!--BEGIN TITLEAREA-->
|
||||||
|
<div id="titlearea">
|
||||||
|
<table cellspacing="0" cellpadding="0">
|
||||||
|
<tbody>
|
||||||
|
<tr style="height: 56px;">
|
||||||
|
<!--BEGIN PROJECT_LOGO-->
|
||||||
|
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
|
||||||
|
<!--END PROJECT_LOGO-->
|
||||||
|
<!--BEGIN PROJECT_NAME-->
|
||||||
|
<td id="projectalign" style="padding-left: 0.5em;">
|
||||||
|
<div id="projectname">$projectname
|
||||||
|
<!--BEGIN PROJECT_NUMBER--> <span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
|
||||||
|
</div>
|
||||||
|
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
|
||||||
|
</td>
|
||||||
|
<!--END PROJECT_NAME-->
|
||||||
|
<!--BEGIN !PROJECT_NAME-->
|
||||||
|
<!--BEGIN PROJECT_BRIEF-->
|
||||||
|
<td style="padding-left: 0.5em;">
|
||||||
|
<div id="projectbrief">$projectbrief</div>
|
||||||
|
</td>
|
||||||
|
<!--END PROJECT_BRIEF-->
|
||||||
|
<!--END !PROJECT_NAME-->
|
||||||
|
<!--BEGIN DISABLE_INDEX-->
|
||||||
|
<!--BEGIN SEARCHENGINE-->
|
||||||
|
<td>$searchbox</td>
|
||||||
|
<!--END SEARCHENGINE-->
|
||||||
|
<!--END DISABLE_INDEX-->
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<!--END TITLEAREA-->
|
||||||
|
<!-- end header part -->
|
||||||
97
doc/that_style/img/doc.svg
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="24"
|
||||||
|
height="22"
|
||||||
|
viewBox="0 0 6.3499999 5.8208335"
|
||||||
|
version="1.1"
|
||||||
|
id="svg8"
|
||||||
|
sodipodi:docname="doc.svg"
|
||||||
|
inkscape:version="0.92.1 r">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="32"
|
||||||
|
inkscape:cx="11.139212"
|
||||||
|
inkscape:cy="14.811193"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
units="px"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1357"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-291.17915)">
|
||||||
|
<path
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#4d4d4d;stroke-width:0.26458329;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="M 3.315043,291.8406 H 1.4552083 v 4.49792 h 3.1749999 v -3.10055 z"
|
||||||
|
id="path5095"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#4d4d4d;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="m 3.1837239,291.84114 v 1.71186 h 1.4472656 v -0.31418 H 3.4473958 v -1.39768 z"
|
||||||
|
id="path5128"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<rect
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
id="rect5132"
|
||||||
|
width="2.1166668"
|
||||||
|
height="0.26458332"
|
||||||
|
x="1.8520833"
|
||||||
|
y="293.82498" />
|
||||||
|
<rect
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
id="rect5136"
|
||||||
|
width="1.0583334"
|
||||||
|
height="0.26458332"
|
||||||
|
x="1.8520832"
|
||||||
|
y="294.35416" />
|
||||||
|
<rect
|
||||||
|
y="294.88333"
|
||||||
|
x="1.8520832"
|
||||||
|
height="0.26458332"
|
||||||
|
width="1.8520833"
|
||||||
|
id="rect5138"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||||
|
<rect
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:normal;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
id="rect4543"
|
||||||
|
width="1.5875"
|
||||||
|
height="0.26458332"
|
||||||
|
x="1.8520832"
|
||||||
|
y="295.41248" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 6.5 KiB |
77
doc/that_style/img/folderclosed.svg
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="24"
|
||||||
|
height="22"
|
||||||
|
viewBox="0 0 6.3499998 5.8208335"
|
||||||
|
version="1.1"
|
||||||
|
id="svg8"
|
||||||
|
inkscape:version="0.92.1 r"
|
||||||
|
sodipodi:docname="folderclosed.svg"
|
||||||
|
inkscape:export-filename="/home/jl/Prog/doxygen_style/folderclosed.png"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="51.113139"
|
||||||
|
inkscape:cx="7.7057751"
|
||||||
|
inkscape:cy="12.584171"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:snap-global="false"
|
||||||
|
units="px"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1357"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:measure-start="0,0"
|
||||||
|
inkscape:measure-end="0,0" />
|
||||||
|
<metadata
|
||||||
|
id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-291.17915)">
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26458332;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke fill markers;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="m 0.52916667,292.2374 -0.26458334,0.52925 v 3.43958 H 4.7625001 v -3.43958 H 2.38125 L 2.1166667,292.2374 Z"
|
||||||
|
id="rect4498"
|
||||||
|
sodipodi:nodetypes="cccccccc" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#cccccc;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.66145831;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="M 2.9104167,292.76665 2.38125,293.56034 H 0.26458333 v 0.26464 H 2.38125 l 0.5291667,-0.79375 h 1.8520834 v -0.26458 z"
|
||||||
|
id="rect4500"
|
||||||
|
sodipodi:nodetypes="ccccccccc" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.4 KiB |
83
doc/that_style/img/folderopen.svg
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="24"
|
||||||
|
height="22"
|
||||||
|
viewBox="0 0 6.3499998 5.8208335"
|
||||||
|
version="1.1"
|
||||||
|
id="svg8"
|
||||||
|
inkscape:version="0.92.1 r"
|
||||||
|
sodipodi:docname="folderopen.svg"
|
||||||
|
inkscape:export-filename="/home/jl/Prog/doxygen_style/folderopen.png"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="43.725861"
|
||||||
|
inkscape:cx="8.2043861"
|
||||||
|
inkscape:cy="13.464183"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:snap-global="false"
|
||||||
|
units="px"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1357"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:measure-start="0,0"
|
||||||
|
inkscape:measure-end="0,0" />
|
||||||
|
<metadata
|
||||||
|
id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-291.17915)">
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.66145831;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="m 0.52916667,292.23748 -0.26458334,0.52917 v 3.43958 H 4.762461 l 7.8e-5,-3.43958 H 2.38125 l -0.2645833,-0.52917 z"
|
||||||
|
id="path5228"
|
||||||
|
sodipodi:nodetypes="cccccccc" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path5279"
|
||||||
|
d="M 1.0583333,293.5604 H 5.55625 L 4.7625,296.20603 H 0.26458333 Z"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ececec;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.66145831;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
sodipodi:nodetypes="ccccc" />
|
||||||
|
<path
|
||||||
|
sodipodi:nodetypes="ccccccc"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path5234"
|
||||||
|
d="M 1.0583333,294.35415 H 3.175 l 0.5291667,-0.52917 H 5.55625 L 4.7625,296.20603 H 0.26458333 Z"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#4d4d4d;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.66145831;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 4.1 KiB |
73
doc/that_style/img/mag_glass.svg
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="22"
|
||||||
|
height="22"
|
||||||
|
viewBox="0 0 5.8208332 5.8208335"
|
||||||
|
version="1.1"
|
||||||
|
id="svg8"
|
||||||
|
inkscape:version="0.92.1 r"
|
||||||
|
sodipodi:docname="mag_glass.svg">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="32"
|
||||||
|
inkscape:cx="8.961936"
|
||||||
|
inkscape:cy="10.205344"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
units="px"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
inkscape:snap-bbox="false"
|
||||||
|
inkscape:bbox-nodes="true"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1357"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:snap-global="false" />
|
||||||
|
<metadata
|
||||||
|
id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-291.17915)">
|
||||||
|
<path
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#333333;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1.99999988;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="M 6.9101562 2.4082031 C 3.1105656 2.4082031 -5.9211895e-16 5.5081643 0 9.3027344 C 0 13.097342 3.1105656 16.197266 6.9101562 16.197266 C 8.2869348 16.197266 9.5698699 15.787508 10.650391 15.087891 L 15.162109 19.587891 L 16.636719 18.115234 L 12.214844 13.707031 C 13.214837 12.510659 13.818359 10.974238 13.818359 9.3027344 C 13.818359 5.5081643 10.709747 2.4082031 6.9101562 2.4082031 z M 6.9101562 4.9101562 C 9.3624717 4.9101562 11.324219 6.8631249 11.324219 9.3027344 C 11.324219 11.742382 9.3624717 13.695312 6.9101562 13.695312 C 4.4578408 13.695312 2.5019531 11.742382 2.5019531 9.3027344 C 2.5019531 6.8631249 4.4578408 4.9101562 6.9101562 4.9101562 z "
|
||||||
|
transform="matrix(0.26458333,0,0,0.26458333,0,291.17915)"
|
||||||
|
id="rect4524" />
|
||||||
|
<path
|
||||||
|
transform="matrix(0.99422295,0,0,0.68955299,-0.83134947,91.755588)"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#333333;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.63466448;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
inkscape:transform-center-y="0.25905895"
|
||||||
|
d="m 5.6074138,294.49889 -1.0836583,-1.87695 2.1673165,0 z"
|
||||||
|
id="path4491" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.8 KiB |
73
doc/that_style/img/nav_edge_inter.svg
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="10.53333"
|
||||||
|
height="32"
|
||||||
|
viewBox="0 0 9.8749964 30"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.92.1 r"
|
||||||
|
sodipodi:docname="nav_edge_inter.svg">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="32"
|
||||||
|
inkscape:cx="8.6823304"
|
||||||
|
inkscape:cy="16.225639"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
units="px"
|
||||||
|
inkscape:snap-bbox="true"
|
||||||
|
inkscape:bbox-paths="false"
|
||||||
|
inkscape:bbox-nodes="true"
|
||||||
|
inkscape:snap-bbox-edge-midpoints="true"
|
||||||
|
inkscape:object-nodes="true"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1357"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-1022.3622)">
|
||||||
|
<path
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="m 0,1022.3622 v 15 15 l 8,-15 z"
|
||||||
|
id="path4143"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#333333;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.9375px;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="m 1.2910156,1022.3496 -0.82421872,0.4473 7.87890622,14.5527 -7.87890622,14.5527 0.82421872,0.4473 8.1210938,-15 z"
|
||||||
|
id="path5240"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.8 KiB |
73
doc/that_style/img/nav_edge_left.svg
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="8.5333338"
|
||||||
|
height="32"
|
||||||
|
viewBox="0 0 8.0000001 30"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.92.1 r"
|
||||||
|
sodipodi:docname="nav_edge_left.svg">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="32"
|
||||||
|
inkscape:cx="5.3721385"
|
||||||
|
inkscape:cy="14.16429"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
units="px"
|
||||||
|
inkscape:snap-bbox="true"
|
||||||
|
inkscape:bbox-paths="false"
|
||||||
|
inkscape:bbox-nodes="false"
|
||||||
|
inkscape:snap-bbox-edge-midpoints="false"
|
||||||
|
inkscape:object-nodes="true"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1357"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-1022.3622)">
|
||||||
|
<path
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="M 0 0 L 0 32 L 8.5332031 16 L 0 0 z "
|
||||||
|
transform="matrix(0.93749998,0,0,0.93749998,0,1022.3622)"
|
||||||
|
id="rect4586" />
|
||||||
|
<path
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="m 0,1022.3622 v 15 15 l 8,-15 z"
|
||||||
|
id="path4143"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.1 KiB |
73
doc/that_style/img/nav_edge_right.svg
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="8"
|
||||||
|
height="30"
|
||||||
|
viewBox="0 0 8.0000001 30"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="nav_edge.svg">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="32"
|
||||||
|
inkscape:cx="5.3721385"
|
||||||
|
inkscape:cy="14.16429"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
units="px"
|
||||||
|
inkscape:snap-bbox="true"
|
||||||
|
inkscape:bbox-paths="false"
|
||||||
|
inkscape:bbox-nodes="false"
|
||||||
|
inkscape:snap-bbox-edge-midpoints="false"
|
||||||
|
inkscape:object-nodes="true"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1357"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-1022.3622)">
|
||||||
|
<path
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="m 0,1022.3622 0,15 0,15 8,-15 -8,-15 z"
|
||||||
|
id="path4143"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
<path
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
d="m 1e-8,1022.3622 7.99999999,15 0,-15 -8,0 z m 7.99999999,15 -8,15 8,0 0,-15 z"
|
||||||
|
id="rect4136"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.1 KiB |
120
doc/that_style/img/splitbar_handle.svg
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="6"
|
||||||
|
height="9"
|
||||||
|
viewBox="0 0 1.5875 2.3812501"
|
||||||
|
version="1.1"
|
||||||
|
id="svg8"
|
||||||
|
inkscape:version="0.92.1 r"
|
||||||
|
sodipodi:docname="splitbar_handle.svg">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="32"
|
||||||
|
inkscape:cx="8.7681488"
|
||||||
|
inkscape:cy="-2.7929517"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
units="px"
|
||||||
|
inkscape:showpageshadow="false"
|
||||||
|
showguides="false"
|
||||||
|
inkscape:window-width="2560"
|
||||||
|
inkscape:window-height="1357"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1">
|
||||||
|
<inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid4487" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-294.61873)">
|
||||||
|
<rect
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
id="rect4485"
|
||||||
|
width="0.26458335"
|
||||||
|
height="0.26458332"
|
||||||
|
x="0.26458332"
|
||||||
|
y="294.8833" />
|
||||||
|
<rect
|
||||||
|
y="294.8833"
|
||||||
|
x="1.0583333"
|
||||||
|
height="0.26458332"
|
||||||
|
width="0.26458335"
|
||||||
|
id="rect4489"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||||
|
<rect
|
||||||
|
y="295.41248"
|
||||||
|
x="0.26458329"
|
||||||
|
height="0.26458332"
|
||||||
|
width="0.26458335"
|
||||||
|
id="rect4491"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||||
|
<rect
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
id="rect4493"
|
||||||
|
width="0.26458335"
|
||||||
|
height="0.26458332"
|
||||||
|
x="1.0583333"
|
||||||
|
y="295.41248" />
|
||||||
|
<rect
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
id="rect4495"
|
||||||
|
width="0.26458335"
|
||||||
|
height="0.26458332"
|
||||||
|
x="0.26458332"
|
||||||
|
y="295.94165" />
|
||||||
|
<rect
|
||||||
|
y="295.94165"
|
||||||
|
x="1.0583333"
|
||||||
|
height="0.26458332"
|
||||||
|
width="0.26458335"
|
||||||
|
id="rect4497"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||||
|
<rect
|
||||||
|
y="296.47079"
|
||||||
|
x="0.26458329"
|
||||||
|
height="0.26458332"
|
||||||
|
width="0.26458335"
|
||||||
|
id="rect4499"
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||||
|
<rect
|
||||||
|
style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52916664;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||||
|
id="rect4501"
|
||||||
|
width="0.26458335"
|
||||||
|
height="0.26458332"
|
||||||
|
x="1.0583333"
|
||||||
|
y="296.47079" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 7.1 KiB |
BIN
doc/that_style/img/sync_off.png
Normal file
|
After Width: | Height: | Size: 483 B |
BIN
doc/that_style/img/sync_on.png
Normal file
|
After Width: | Height: | Size: 488 B |
32
doc/that_style/js/striped_bg.js
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
// Adds extra CSS classes "even" and "odd" to .memberdecls to allow
|
||||||
|
// striped backgrounds.
|
||||||
|
function MemberDeclsStriper () {
|
||||||
|
var counter = 0;
|
||||||
|
|
||||||
|
this.stripe = function() {
|
||||||
|
$(".memberdecls tbody").children().each(function(i) {
|
||||||
|
|
||||||
|
// reset counter at every heading -> always start with even
|
||||||
|
if ($(this).is(".heading")) {
|
||||||
|
counter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add extra classes
|
||||||
|
if (counter % 2 == 1) {
|
||||||
|
$(this).addClass("odd");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$(this).addClass("even");
|
||||||
|
}
|
||||||
|
|
||||||
|
// advance counter at every separator
|
||||||
|
// this is the only way to reliably detect which table rows belong together
|
||||||
|
if ($(this).is('[class^="separator"]')) {
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// execute the function
|
||||||
|
$(document).ready(new MemberDeclsStriper().stripe);
|
||||||
1431
doc/that_style/that_style.css
Normal file
@@ -3,64 +3,50 @@
|
|||||||
@section threads_with_libssh How to use libssh with threads
|
@section threads_with_libssh How to use libssh with threads
|
||||||
|
|
||||||
libssh may be used in multithreaded applications, but under several conditions :
|
libssh may be used in multithreaded applications, but under several conditions :
|
||||||
- Threading must be initialized during the initialization of libssh. This
|
- Your system must support libpthread or, in Windows environment,
|
||||||
initialization must be done outside of any threading context.
|
CriticalSection based mutex control.
|
||||||
- If pthreads is being used by your application (or your framework's backend),
|
- Since version 0.8.0, threads initialization is called automatically in the
|
||||||
you must link with libssh_threads dynamic library and initialize
|
library constructor if libssh is dynamically linked. This means it is no
|
||||||
threading with the ssh_threads_pthreads threading object.
|
longer necessary to call ssh_init()/ssh_finalize().
|
||||||
- If an other threading library is being used by your application, you must
|
- If libssh is statically linked, threading must be initialized by calling
|
||||||
implement all the methods of the ssh_threads_callbacks_struct structure
|
ssh_init() before using any of libssh provided functions. This initialization
|
||||||
and initialize libssh with it.
|
must be done outside of any threading context. Don't forget to call
|
||||||
|
ssh_finalize() to avoid memory leak
|
||||||
- At all times, you may use different sessions inside threads, make parallel
|
- At all times, you may use different sessions inside threads, make parallel
|
||||||
connections, read/write on different sessions and so on. You *cannot* use a
|
connections, read/write on different sessions and so on. You *cannot* use a
|
||||||
single session (or channels for a single session) in several threads at the same
|
single session (or channels for a single session) in several threads at the same
|
||||||
time. This will most likely lead to internal state corruption. This limitation is
|
time. This will most likely lead to internal state corruption. This limitation is
|
||||||
being worked out and will maybe disappear later.
|
being worked out and will maybe disappear later.
|
||||||
|
|
||||||
@subsection threads_init Initialization of threads
|
@subsection threads_init Initialization of threads
|
||||||
|
|
||||||
To initialize threading, you must first select the threading model you want to
|
Since version 0.8.0, it is no longer necessary to call ssh_init()/ssh_finalize()
|
||||||
use, using ssh_threads_set_callbacks(), then call ssh_init().
|
if libssh is dynamically linked.
|
||||||
|
|
||||||
@code
|
If libssh is statically linked, call ssh_init() before using any of libssh
|
||||||
#include <libssh/callbacks.h>
|
provided functions.
|
||||||
...
|
|
||||||
ssh_threads_set_callbacks(ssh_threads_get_noop());
|
|
||||||
ssh_init();
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
ssh_threads_noop is the threading structure that does nothing. It's the
|
|
||||||
threading callbacks being used by default when you're not using threading.
|
|
||||||
|
|
||||||
@subsection threads_pthread Using libpthread with libssh
|
@subsection threads_pthread Using libpthread with libssh
|
||||||
|
|
||||||
If your application is using libpthread, you may simply use the libpthread
|
Since version 0.8.0, libpthread is the default threads library used by libssh.
|
||||||
threading backend:
|
|
||||||
|
|
||||||
@code
|
To use libpthread, simply link it to you application.
|
||||||
#include <libssh/callbacks.h>
|
|
||||||
...
|
|
||||||
ssh_threads_set_callbacks(ssh_threads_get_pthread());
|
|
||||||
ssh_init();
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
However, you must be sure to link with the library ssh_threads. If
|
|
||||||
you're using gcc, you must use the commandline
|
|
||||||
@code
|
|
||||||
gcc -o output input.c -lssh -lssh_threads
|
|
||||||
@endcode
|
|
||||||
|
|
||||||
|
If you are using libssh statically linked, don't forget to call ssh_init()
|
||||||
|
before using any of libssh provided functions (and ssh_finalize() in the end).
|
||||||
|
|
||||||
@subsection threads_other Using another threading library
|
@subsection threads_other Using another threading library
|
||||||
|
|
||||||
You must find your way in the ssh_threads_callbacks_struct structure. You must
|
Since version 0.8.0, libssh does not support custom threading libraries.
|
||||||
implement the following methods :
|
The change makes sense since the newer versions for libcrypto (OpenSSL) and
|
||||||
- mutex_lock
|
libgcrypt don't support custom threading libraries.
|
||||||
- mutex_unlock
|
|
||||||
- mutex_init
|
The default used threading library is libpthread.
|
||||||
- mutex_destroy
|
Alternatively, in Windows environment, CriticalSection based mutex control can
|
||||||
- thread_id
|
be used.
|
||||||
|
|
||||||
|
If your system does not support libpthread nor CriticalSection based mutex
|
||||||
|
control, unfortunately, you cannot use libssh in multithreaded scenarios.
|
||||||
|
|
||||||
libgcrypt 1.6 and bigger backend does not support custom callback. Using anything else than pthreads (ssh_threads_get_pthread()) here will fail.
|
|
||||||
Good luck !
|
Good luck !
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,48 +17,67 @@ endif()
|
|||||||
|
|
||||||
if (UNIX AND NOT WIN32)
|
if (UNIX AND NOT WIN32)
|
||||||
add_executable(libssh_scp libssh_scp.c ${examples_SRCS})
|
add_executable(libssh_scp libssh_scp.c ${examples_SRCS})
|
||||||
|
target_compile_options(libssh_scp PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(libssh_scp ${LIBSSH_SHARED_LIBRARY})
|
target_link_libraries(libssh_scp ${LIBSSH_SHARED_LIBRARY})
|
||||||
|
|
||||||
add_executable(scp_download scp_download.c ${examples_SRCS})
|
add_executable(scp_download scp_download.c ${examples_SRCS})
|
||||||
|
target_compile_options(scp_download PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(scp_download ${LIBSSH_SHARED_LIBRARY})
|
target_link_libraries(scp_download ${LIBSSH_SHARED_LIBRARY})
|
||||||
|
|
||||||
add_executable(sshnetcat sshnetcat.c ${examples_SRCS})
|
add_executable(sshnetcat sshnetcat.c ${examples_SRCS})
|
||||||
|
target_compile_options(sshnetcat PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(sshnetcat ${LIBSSH_SHARED_LIBRARY})
|
target_link_libraries(sshnetcat ${LIBSSH_SHARED_LIBRARY})
|
||||||
|
|
||||||
if (WITH_SFTP)
|
if (WITH_SFTP)
|
||||||
add_executable(samplesftp samplesftp.c ${examples_SRCS})
|
add_executable(samplesftp samplesftp.c ${examples_SRCS})
|
||||||
|
target_compile_options(samplesftp PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(samplesftp ${LIBSSH_SHARED_LIBRARY})
|
target_link_libraries(samplesftp ${LIBSSH_SHARED_LIBRARY})
|
||||||
endif (WITH_SFTP)
|
endif (WITH_SFTP)
|
||||||
|
|
||||||
add_executable(ssh-client ssh_client.c ${examples_SRCS})
|
add_executable(ssh-client ssh_client.c ${examples_SRCS})
|
||||||
|
target_compile_options(ssh-client PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(ssh-client ${LIBSSH_SHARED_LIBRARY})
|
target_link_libraries(ssh-client ${LIBSSH_SHARED_LIBRARY})
|
||||||
|
|
||||||
if (WITH_SERVER AND (ARGP_LIBRARY OR HAVE_ARGP_H))
|
if (WITH_SERVER AND (ARGP_LIBRARY OR HAVE_ARGP_H))
|
||||||
if (HAVE_LIBUTIL)
|
if (HAVE_LIBUTIL)
|
||||||
add_executable(ssh_server_fork ssh_server_fork.c)
|
add_executable(ssh_server_fork ssh_server_fork.c)
|
||||||
|
target_compile_options(ssh_server_fork PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(ssh_server_fork ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY} util)
|
target_link_libraries(ssh_server_fork ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY} util)
|
||||||
endif (HAVE_LIBUTIL)
|
endif (HAVE_LIBUTIL)
|
||||||
|
|
||||||
if (WITH_GSSAPI AND GSSAPI_FOUND)
|
if (WITH_GSSAPI AND GSSAPI_FOUND)
|
||||||
add_executable(samplesshd-cb samplesshd-cb.c)
|
add_executable(samplesshd-cb samplesshd-cb.c)
|
||||||
|
target_compile_options(samplesshd-cb PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(samplesshd-cb ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
|
target_link_libraries(samplesshd-cb ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
|
||||||
|
|
||||||
add_executable(proxy proxy.c)
|
add_executable(proxy proxy.c)
|
||||||
|
target_compile_options(proxy PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(proxy ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
|
target_link_libraries(proxy ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
|
||||||
|
|
||||||
|
add_executable(sshd_direct-tcpip sshd_direct-tcpip.c)
|
||||||
|
target_compile_options(sshd_direct-tcpip PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
|
target_link_libraries(sshd_direct-tcpip ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
|
||||||
endif (WITH_GSSAPI AND GSSAPI_FOUND)
|
endif (WITH_GSSAPI AND GSSAPI_FOUND)
|
||||||
|
|
||||||
add_executable(samplesshd-kbdint samplesshd-kbdint.c)
|
add_executable(samplesshd-kbdint samplesshd-kbdint.c)
|
||||||
|
target_compile_options(samplesshd-kbdint PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(samplesshd-kbdint ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
|
target_link_libraries(samplesshd-kbdint ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
endif (UNIX AND NOT WIN32)
|
endif (UNIX AND NOT WIN32)
|
||||||
|
|
||||||
add_executable(exec exec.c ${examples_SRCS})
|
add_executable(exec exec.c ${examples_SRCS})
|
||||||
|
target_compile_options(exec PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(exec ${LIBSSH_SHARED_LIBRARY})
|
target_link_libraries(exec ${LIBSSH_SHARED_LIBRARY})
|
||||||
|
|
||||||
add_executable(senddata senddata.c ${examples_SRCS})
|
add_executable(senddata senddata.c ${examples_SRCS})
|
||||||
|
target_compile_options(senddata PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
target_link_libraries(senddata ${LIBSSH_SHARED_LIBRARY})
|
target_link_libraries(senddata ${LIBSSH_SHARED_LIBRARY})
|
||||||
|
|
||||||
|
add_executable(keygen keygen.c)
|
||||||
|
target_compile_options(keygen PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
|
target_link_libraries(keygen ${LIBSSH_SHARED_LIBRARY})
|
||||||
|
|
||||||
add_executable(libsshpp libsshpp.cpp)
|
add_executable(libsshpp libsshpp.cpp)
|
||||||
target_link_libraries(libsshpp ${LIBSSH_SHARED_LIBRARY})
|
target_link_libraries(libsshpp ${LIBSSH_SHARED_LIBRARY})
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ clients must be made or how a client should react.
|
|||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include "examples_common.h"
|
#include "examples_common.h"
|
||||||
|
|
||||||
int authenticate_kbdint(ssh_session session, const char *password) {
|
int authenticate_kbdint(ssh_session session, const char *password)
|
||||||
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = ssh_userauth_kbdint(session, NULL, NULL);
|
err = ssh_userauth_kbdint(session, NULL, NULL);
|
||||||
@@ -99,78 +100,142 @@ int authenticate_kbdint(ssh_session session, const char *password) {
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void error(ssh_session session){
|
static int auth_keyfile(ssh_session session, char* keyfile)
|
||||||
fprintf(stderr,"Authentication failed: %s\n",ssh_get_error(session));
|
{
|
||||||
}
|
ssh_key key = NULL;
|
||||||
|
char pubkey[132] = {0}; // +".pub"
|
||||||
|
int rc;
|
||||||
|
|
||||||
int authenticate_console(ssh_session session){
|
snprintf(pubkey, sizeof(pubkey), "%s.pub", keyfile);
|
||||||
int rc;
|
|
||||||
int method;
|
rc = ssh_pki_import_pubkey_file( pubkey, &key);
|
||||||
char password[128] = {0};
|
|
||||||
char *banner;
|
if (rc != SSH_OK)
|
||||||
|
return SSH_AUTH_DENIED;
|
||||||
|
|
||||||
|
rc = ssh_userauth_try_publickey(session, NULL, key);
|
||||||
|
|
||||||
|
ssh_key_free(key);
|
||||||
|
|
||||||
|
if (rc!=SSH_AUTH_SUCCESS)
|
||||||
|
return SSH_AUTH_DENIED;
|
||||||
|
|
||||||
|
rc = ssh_pki_import_privkey_file(keyfile, NULL, NULL, NULL, &key);
|
||||||
|
|
||||||
|
if (rc != SSH_OK)
|
||||||
|
return SSH_AUTH_DENIED;
|
||||||
|
|
||||||
|
rc = ssh_userauth_publickey(session, NULL, key);
|
||||||
|
|
||||||
|
ssh_key_free(key);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void error(ssh_session session)
|
||||||
|
{
|
||||||
|
fprintf(stderr,"Authentication failed: %s\n",ssh_get_error(session));
|
||||||
|
}
|
||||||
|
|
||||||
|
int authenticate_console(ssh_session session)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
int method;
|
||||||
|
char password[128] = {0};
|
||||||
|
char *banner;
|
||||||
|
|
||||||
|
// Try to authenticate
|
||||||
|
rc = ssh_userauth_none(session, NULL);
|
||||||
|
if (rc == SSH_AUTH_ERROR) {
|
||||||
|
error(session);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
method = ssh_userauth_list(session, NULL);
|
||||||
|
while (rc != SSH_AUTH_SUCCESS) {
|
||||||
|
if (method & SSH_AUTH_METHOD_GSSAPI_MIC){
|
||||||
|
rc = ssh_userauth_gssapi(session);
|
||||||
|
if(rc == SSH_AUTH_ERROR) {
|
||||||
|
error(session);
|
||||||
|
return rc;
|
||||||
|
} else if (rc == SSH_AUTH_SUCCESS) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Try to authenticate with public key first
|
||||||
|
if (method & SSH_AUTH_METHOD_PUBLICKEY) {
|
||||||
|
rc = ssh_userauth_publickey_auto(session, NULL, NULL);
|
||||||
|
if (rc == SSH_AUTH_ERROR) {
|
||||||
|
error(session);
|
||||||
|
return rc;
|
||||||
|
} else if (rc == SSH_AUTH_SUCCESS) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
char buffer[128] = {0};
|
||||||
|
char *p = NULL;
|
||||||
|
|
||||||
|
printf("Automatic pubkey failed. "
|
||||||
|
"Do you want to try a specific key? (y/n)\n");
|
||||||
|
if (fgets(buffer, sizeof(buffer), stdin) == NULL) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ((buffer[0]=='Y') || (buffer[0]=='y')) {
|
||||||
|
printf("private key filename: ");
|
||||||
|
|
||||||
|
if (fgets(buffer, sizeof(buffer), stdin) == NULL) {
|
||||||
|
return SSH_AUTH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer[sizeof(buffer) - 1] = '\0';
|
||||||
|
if ((p = strchr(buffer, '\n'))) {
|
||||||
|
*p = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = auth_keyfile(session, buffer);
|
||||||
|
|
||||||
|
if(rc == SSH_AUTH_SUCCESS) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
fprintf(stderr, "failed with key\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to authenticate with keyboard interactive";
|
||||||
|
if (method & SSH_AUTH_METHOD_INTERACTIVE) {
|
||||||
|
rc = authenticate_kbdint(session, NULL);
|
||||||
|
if (rc == SSH_AUTH_ERROR) {
|
||||||
|
error(session);
|
||||||
|
return rc;
|
||||||
|
} else if (rc == SSH_AUTH_SUCCESS) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ssh_getpass("Password: ", password, sizeof(password), 0, 0) < 0) {
|
||||||
|
return SSH_AUTH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to authenticate with password
|
||||||
|
if (method & SSH_AUTH_METHOD_PASSWORD) {
|
||||||
|
rc = ssh_userauth_password(session, NULL, password);
|
||||||
|
if (rc == SSH_AUTH_ERROR) {
|
||||||
|
error(session);
|
||||||
|
return rc;
|
||||||
|
} else if (rc == SSH_AUTH_SUCCESS) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
memset(password, 0, sizeof(password));
|
||||||
|
}
|
||||||
|
|
||||||
|
banner = ssh_get_issue_banner(session);
|
||||||
|
if (banner) {
|
||||||
|
printf("%s\n",banner);
|
||||||
|
ssh_string_free_char(banner);
|
||||||
|
}
|
||||||
|
|
||||||
// Try to authenticate
|
|
||||||
rc = ssh_userauth_none(session, NULL);
|
|
||||||
if (rc == SSH_AUTH_ERROR) {
|
|
||||||
error(session);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
|
||||||
|
|
||||||
method = ssh_userauth_list(session, NULL);
|
|
||||||
while (rc != SSH_AUTH_SUCCESS) {
|
|
||||||
if (method & SSH_AUTH_METHOD_GSSAPI_MIC){
|
|
||||||
rc = ssh_userauth_gssapi(session);
|
|
||||||
if(rc == SSH_AUTH_ERROR) {
|
|
||||||
error(session);
|
|
||||||
return rc;
|
|
||||||
} else if (rc == SSH_AUTH_SUCCESS) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Try to authenticate with public key first
|
|
||||||
if (method & SSH_AUTH_METHOD_PUBLICKEY) {
|
|
||||||
rc = ssh_userauth_publickey_auto(session, NULL, NULL);
|
|
||||||
if (rc == SSH_AUTH_ERROR) {
|
|
||||||
error(session);
|
|
||||||
return rc;
|
|
||||||
} else if (rc == SSH_AUTH_SUCCESS) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to authenticate with keyboard interactive";
|
|
||||||
if (method & SSH_AUTH_METHOD_INTERACTIVE) {
|
|
||||||
rc = authenticate_kbdint(session, NULL);
|
|
||||||
if (rc == SSH_AUTH_ERROR) {
|
|
||||||
error(session);
|
|
||||||
return rc;
|
|
||||||
} else if (rc == SSH_AUTH_SUCCESS) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ssh_getpass("Password: ", password, sizeof(password), 0, 0) < 0) {
|
|
||||||
return SSH_AUTH_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to authenticate with password
|
|
||||||
if (method & SSH_AUTH_METHOD_PASSWORD) {
|
|
||||||
rc = ssh_userauth_password(session, NULL, password);
|
|
||||||
if (rc == SSH_AUTH_ERROR) {
|
|
||||||
error(session);
|
|
||||||
return rc;
|
|
||||||
} else if (rc == SSH_AUTH_SUCCESS) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
memset(password, 0, sizeof(password));
|
|
||||||
}
|
|
||||||
|
|
||||||
banner = ssh_get_issue_banner(session);
|
|
||||||
if (banner) {
|
|
||||||
printf("%s\n",banner);
|
|
||||||
ssh_string_free_char(banner);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,10 @@ clients must be made or how a client should react.
|
|||||||
#define EXAMPLES_COMMON_H_
|
#define EXAMPLES_COMMON_H_
|
||||||
|
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
|
|
||||||
|
/** Zero a structure */
|
||||||
|
#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
|
||||||
|
|
||||||
int authenticate_console(ssh_session session);
|
int authenticate_console(ssh_session session);
|
||||||
int authenticate_kbdint(ssh_session session, const char *password);
|
int authenticate_kbdint(ssh_session session, const char *password);
|
||||||
int verify_knownhost(ssh_session session);
|
int verify_knownhost(ssh_session session);
|
||||||
|
|||||||
41
examples/keygen.c
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/* keygen.c
|
||||||
|
* Sample implementation of ssh-keygen using libssh
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Copyright 2019 Red Hat, Inc.
|
||||||
|
|
||||||
|
Author: Jakub Jelen <jjelen@redhat.com>
|
||||||
|
|
||||||
|
This file is part of the SSH Library
|
||||||
|
|
||||||
|
You are free to copy this file, modify it in any way, consider it being public
|
||||||
|
domain. This does not apply to the rest of the library though, but it is
|
||||||
|
allowed to cut-and-paste working code from this file to any license of
|
||||||
|
program.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <libssh/libssh.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
ssh_key key = NULL;
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
/* Generate a new ED25519 private key file */
|
||||||
|
rv = ssh_pki_generate(SSH_KEYTYPE_ED25519, 0, &key);
|
||||||
|
if (rv != SSH_OK) {
|
||||||
|
fprintf(stderr, "Failed to generate private key");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write it to a file testkey in the current dirrectory */
|
||||||
|
rv = ssh_pki_export_privkey_file(key, NULL, NULL, NULL, "testkey");
|
||||||
|
if (rv != SSH_OK) {
|
||||||
|
fprintf(stderr, "Failed to write private key file");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -32,83 +32,86 @@ clients must be made or how a client should react.
|
|||||||
#define strncasecmp _strnicmp
|
#define strncasecmp _strnicmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int verify_knownhost(ssh_session session){
|
int verify_knownhost(ssh_session session)
|
||||||
char *hexa;
|
{
|
||||||
enum ssh_known_hosts_e state;
|
enum ssh_known_hosts_e state;
|
||||||
char buf[10];
|
char buf[10];
|
||||||
unsigned char *hash = NULL;
|
unsigned char *hash = NULL;
|
||||||
size_t hlen;
|
size_t hlen;
|
||||||
ssh_key srv_pubkey;
|
ssh_key srv_pubkey;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = ssh_get_server_publickey(session, &srv_pubkey);
|
rc = ssh_get_server_publickey(session, &srv_pubkey);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = ssh_get_publickey_hash(srv_pubkey,
|
rc = ssh_get_publickey_hash(srv_pubkey,
|
||||||
SSH_PUBLICKEY_HASH_SHA1,
|
SSH_PUBLICKEY_HASH_SHA256,
|
||||||
&hash,
|
&hash,
|
||||||
&hlen);
|
&hlen);
|
||||||
ssh_key_free(srv_pubkey);
|
ssh_key_free(srv_pubkey);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
state = ssh_session_is_known_server(session);
|
state = ssh_session_is_known_server(session);
|
||||||
|
|
||||||
switch(state){
|
switch(state) {
|
||||||
case SSH_KNOWN_HOSTS_OK:
|
|
||||||
break; /* ok */
|
|
||||||
case SSH_KNOWN_HOSTS_CHANGED:
|
case SSH_KNOWN_HOSTS_CHANGED:
|
||||||
fprintf(stderr,"Host key for server changed : server's one is now :\n");
|
fprintf(stderr,"Host key for server changed : server's one is now :\n");
|
||||||
ssh_print_hexa("Public key hash",hash, hlen);
|
ssh_print_hash(SSH_PUBLICKEY_HASH_SHA256, hash, hlen);
|
||||||
ssh_clean_pubkey_hash(&hash);
|
ssh_clean_pubkey_hash(&hash);
|
||||||
fprintf(stderr,"For security reason, connection will be stopped\n");
|
fprintf(stderr,"For security reason, connection will be stopped\n");
|
||||||
return -1;
|
return -1;
|
||||||
case SSH_KNOWN_HOSTS_OTHER:
|
case SSH_KNOWN_HOSTS_OTHER:
|
||||||
fprintf(stderr,"The host key for this server was not found but an other type of key exists.\n");
|
fprintf(stderr,"The host key for this server was not found but an other type of key exists.\n");
|
||||||
fprintf(stderr,"An attacker might change the default server key to confuse your client"
|
fprintf(stderr,"An attacker might change the default server key to confuse your client"
|
||||||
"into thinking the key does not exist\n"
|
"into thinking the key does not exist\n"
|
||||||
"We advise you to rerun the client with -d or -r for more safety.\n");
|
"We advise you to rerun the client with -d or -r for more safety.\n");
|
||||||
return -1;
|
return -1;
|
||||||
case SSH_KNOWN_HOSTS_NOT_FOUND:
|
case SSH_KNOWN_HOSTS_NOT_FOUND:
|
||||||
fprintf(stderr,"Could not find known host file. If you accept the host key here,\n");
|
fprintf(stderr,"Could not find known host file. If you accept the host key here,\n");
|
||||||
fprintf(stderr,"the file will be automatically created.\n");
|
fprintf(stderr,"the file will be automatically created.\n");
|
||||||
/* fallback to SSH_SERVER_NOT_KNOWN behavior */
|
/* fallback to SSH_SERVER_NOT_KNOWN behavior */
|
||||||
FALL_THROUGH;
|
FALL_THROUGH;
|
||||||
case SSH_SERVER_NOT_KNOWN:
|
case SSH_SERVER_NOT_KNOWN:
|
||||||
hexa = ssh_get_hexa(hash, hlen);
|
fprintf(stderr,
|
||||||
fprintf(stderr,"The server is unknown. Do you trust the host key ?\n");
|
"The server is unknown. Do you trust the host key (yes/no)?\n");
|
||||||
fprintf(stderr, "Public key hash: %s\n", hexa);
|
ssh_print_hash(SSH_PUBLICKEY_HASH_SHA256, hash, hlen);
|
||||||
ssh_string_free_char(hexa);
|
|
||||||
if (fgets(buf, sizeof(buf), stdin) == NULL) {
|
|
||||||
ssh_clean_pubkey_hash(&hash);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if(strncasecmp(buf,"yes",3)!=0){
|
|
||||||
ssh_clean_pubkey_hash(&hash);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
fprintf(stderr,"This new key will be written on disk for further usage. do you agree ?\n");
|
|
||||||
if (fgets(buf, sizeof(buf), stdin) == NULL) {
|
|
||||||
ssh_clean_pubkey_hash(&hash);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if(strncasecmp(buf,"yes",3)==0){
|
|
||||||
if (ssh_write_knownhost(session) < 0) {
|
|
||||||
ssh_clean_pubkey_hash(&hash);
|
|
||||||
fprintf(stderr, "error %s\n", strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
if (fgets(buf, sizeof(buf), stdin) == NULL) {
|
||||||
|
ssh_clean_pubkey_hash(&hash);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(strncasecmp(buf,"yes",3)!=0){
|
||||||
|
ssh_clean_pubkey_hash(&hash);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
fprintf(stderr,"This new key will be written on disk for further usage. do you agree ?\n");
|
||||||
|
if (fgets(buf, sizeof(buf), stdin) == NULL) {
|
||||||
|
ssh_clean_pubkey_hash(&hash);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if(strncasecmp(buf,"yes",3)==0){
|
||||||
|
rc = ssh_session_update_known_hosts(session);
|
||||||
|
if (rc != SSH_OK) {
|
||||||
|
ssh_clean_pubkey_hash(&hash);
|
||||||
|
fprintf(stderr, "error %s\n", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
case SSH_KNOWN_HOSTS_ERROR:
|
case SSH_KNOWN_HOSTS_ERROR:
|
||||||
ssh_clean_pubkey_hash(&hash);
|
ssh_clean_pubkey_hash(&hash);
|
||||||
fprintf(stderr,"%s",ssh_get_error(session));
|
fprintf(stderr,"%s",ssh_get_error(session));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
case SSH_KNOWN_HOSTS_OK:
|
||||||
ssh_clean_pubkey_hash(&hash);
|
break; /* ok */
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
ssh_clean_pubkey_hash(&hash);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,148 +25,230 @@ program.
|
|||||||
static char **sources;
|
static char **sources;
|
||||||
static int nsources;
|
static int nsources;
|
||||||
static char *destination;
|
static char *destination;
|
||||||
static int verbosity=0;
|
static int verbosity = 0;
|
||||||
|
|
||||||
struct location {
|
struct location {
|
||||||
int is_ssh;
|
int is_ssh;
|
||||||
char *user;
|
char *user;
|
||||||
char *host;
|
char *host;
|
||||||
char *path;
|
char *path;
|
||||||
ssh_session session;
|
ssh_session session;
|
||||||
ssh_scp scp;
|
ssh_scp scp;
|
||||||
FILE *file;
|
FILE *file;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
READ,
|
READ,
|
||||||
WRITE
|
WRITE
|
||||||
};
|
};
|
||||||
|
|
||||||
static void usage(const char *argv0){
|
static void usage(const char *argv0) {
|
||||||
fprintf(stderr,"Usage : %s [options] [[user@]host1:]file1 ... \n"
|
fprintf(stderr, "Usage : %s [options] [[user@]host1:]file1 ... \n"
|
||||||
" [[user@]host2:]destination\n"
|
" [[user@]host2:]destination\n"
|
||||||
"sample scp client - libssh-%s\n",
|
"sample scp client - libssh-%s\n",
|
||||||
// "Options :\n",
|
// "Options :\n",
|
||||||
// " -r : use RSA to verify host public key\n",
|
// " -r : use RSA to verify host public key\n",
|
||||||
argv0,
|
argv0,
|
||||||
ssh_version(0));
|
ssh_version(0));
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opts(int argc, char **argv){
|
static int opts(int argc, char **argv) {
|
||||||
int i;
|
int i;
|
||||||
while((i=getopt(argc,argv,"v"))!=-1){
|
|
||||||
switch(i){
|
while((i = getopt(argc, argv, "v")) != -1) {
|
||||||
case 'v':
|
switch(i) {
|
||||||
verbosity++;
|
case 'v':
|
||||||
break;
|
verbosity++;
|
||||||
default:
|
break;
|
||||||
fprintf(stderr,"unknown option %c\n",optopt);
|
default:
|
||||||
|
fprintf(stderr, "unknown option %c\n", optopt);
|
||||||
|
usage(argv[0]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nsources = argc - optind - 1;
|
||||||
|
if (nsources < 1) {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
nsources=argc-optind-1;
|
sources = malloc((nsources + 1) * sizeof(char *));
|
||||||
if(nsources < 1){
|
if (sources == NULL) {
|
||||||
usage(argv[0]);
|
return -1;
|
||||||
return -1;
|
}
|
||||||
}
|
|
||||||
sources=malloc((nsources + 1) * sizeof(char *));
|
for(i = 0; i < nsources; ++i) {
|
||||||
if(sources == NULL)
|
sources[i] = argv[optind];
|
||||||
return -1;
|
optind++;
|
||||||
for(i=0;i<nsources;++i){
|
}
|
||||||
sources[i] = argv[optind];
|
|
||||||
optind++;
|
sources[i] = NULL;
|
||||||
}
|
destination = argv[optind];
|
||||||
sources[i]=NULL;
|
return 0;
|
||||||
destination=argv[optind];
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct location *parse_location(char *loc){
|
static void location_free(struct location *loc)
|
||||||
struct location *location;
|
{
|
||||||
char *ptr;
|
if (loc) {
|
||||||
|
if (loc->path) {
|
||||||
|
free(loc->path);
|
||||||
|
}
|
||||||
|
loc->path = NULL;
|
||||||
|
if (loc->is_ssh) {
|
||||||
|
if (loc->host) {
|
||||||
|
free(loc->host);
|
||||||
|
}
|
||||||
|
loc->host = NULL;
|
||||||
|
if (loc->user) {
|
||||||
|
free(loc->user);
|
||||||
|
}
|
||||||
|
loc->user = NULL;
|
||||||
|
if (loc->host) {
|
||||||
|
free(loc->host);
|
||||||
|
}
|
||||||
|
loc->host = NULL;
|
||||||
|
}
|
||||||
|
free(loc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
location = malloc(sizeof(struct location));
|
static struct location *parse_location(char *loc) {
|
||||||
if (location == NULL) {
|
struct location *location;
|
||||||
return NULL;
|
char *ptr;
|
||||||
}
|
|
||||||
memset(location, 0, sizeof(struct location));
|
|
||||||
|
|
||||||
location->host=location->user=NULL;
|
location = malloc(sizeof(struct location));
|
||||||
ptr=strchr(loc,':');
|
if (location == NULL) {
|
||||||
if(ptr != NULL){
|
return NULL;
|
||||||
location->is_ssh=1;
|
}
|
||||||
location->path=strdup(ptr+1);
|
memset(location, 0, sizeof(struct location));
|
||||||
*ptr='\0';
|
|
||||||
ptr=strchr(loc,'@');
|
location->host = location->user = NULL;
|
||||||
if(ptr != NULL){
|
ptr = strchr(loc, ':');
|
||||||
location->host=strdup(ptr+1);
|
|
||||||
*ptr='\0';
|
if (ptr != NULL) {
|
||||||
location->user=strdup(loc);
|
location->is_ssh = 1;
|
||||||
|
location->path = strdup(ptr+1);
|
||||||
|
*ptr = '\0';
|
||||||
|
ptr = strchr(loc, '@');
|
||||||
|
|
||||||
|
if (ptr != NULL) {
|
||||||
|
location->host = strdup(ptr+1);
|
||||||
|
*ptr = '\0';
|
||||||
|
location->user = strdup(loc);
|
||||||
|
} else {
|
||||||
|
location->host = strdup(loc);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
location->host=strdup(loc);
|
location->is_ssh = 0;
|
||||||
|
location->path = strdup(loc);
|
||||||
}
|
}
|
||||||
} else {
|
return location;
|
||||||
location->is_ssh=0;
|
|
||||||
location->path=strdup(loc);
|
|
||||||
}
|
|
||||||
return location;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int open_location(struct location *loc, int flag){
|
static void close_location(struct location *loc) {
|
||||||
if(loc->is_ssh && flag==WRITE){
|
int rc;
|
||||||
loc->session=connect_ssh(loc->host,loc->user,verbosity);
|
|
||||||
if(!loc->session){
|
if (loc) {
|
||||||
fprintf(stderr,"Couldn't connect to %s\n",loc->host);
|
if (loc->is_ssh) {
|
||||||
return -1;
|
if (loc->scp) {
|
||||||
|
rc = ssh_scp_close(loc->scp);
|
||||||
|
if (rc == SSH_ERROR) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Error closing scp: %s\n",
|
||||||
|
ssh_get_error(loc->session));
|
||||||
|
}
|
||||||
|
ssh_scp_free(loc->scp);
|
||||||
|
loc->scp = NULL;
|
||||||
|
}
|
||||||
|
if (loc->session) {
|
||||||
|
ssh_disconnect(loc->session);
|
||||||
|
ssh_free(loc->session);
|
||||||
|
loc->session = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (loc->file) {
|
||||||
|
fclose(loc->file);
|
||||||
|
loc->file = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
loc->scp=ssh_scp_new(loc->session,SSH_SCP_WRITE,loc->path);
|
}
|
||||||
if(!loc->scp){
|
|
||||||
fprintf(stderr,"error : %s\n",ssh_get_error(loc->session));
|
static int open_location(struct location *loc, int flag) {
|
||||||
return -1;
|
if (loc->is_ssh && flag == WRITE) {
|
||||||
|
loc->session = connect_ssh(loc->host, loc->user, verbosity);
|
||||||
|
if (!loc->session) {
|
||||||
|
fprintf(stderr, "Couldn't connect to %s\n", loc->host);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
loc->scp = ssh_scp_new(loc->session, SSH_SCP_WRITE, loc->path);
|
||||||
|
if (!loc->scp) {
|
||||||
|
fprintf(stderr, "error : %s\n", ssh_get_error(loc->session));
|
||||||
|
ssh_disconnect(loc->session);
|
||||||
|
ssh_free(loc->session);
|
||||||
|
loc->session = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ssh_scp_init(loc->scp) == SSH_ERROR) {
|
||||||
|
fprintf(stderr, "error : %s\n", ssh_get_error(loc->session));
|
||||||
|
ssh_scp_free(loc->scp);
|
||||||
|
loc->scp = NULL;
|
||||||
|
ssh_disconnect(loc->session);
|
||||||
|
ssh_free(loc->session);
|
||||||
|
loc->session = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
} else if (loc->is_ssh && flag == READ) {
|
||||||
|
loc->session = connect_ssh(loc->host, loc->user, verbosity);
|
||||||
|
if (!loc->session) {
|
||||||
|
fprintf(stderr, "Couldn't connect to %s\n", loc->host);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
loc->scp = ssh_scp_new(loc->session, SSH_SCP_READ, loc->path);
|
||||||
|
if (!loc->scp) {
|
||||||
|
fprintf(stderr, "error : %s\n", ssh_get_error(loc->session));
|
||||||
|
ssh_disconnect(loc->session);
|
||||||
|
ssh_free(loc->session);
|
||||||
|
loc->session = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ssh_scp_init(loc->scp) == SSH_ERROR) {
|
||||||
|
fprintf(stderr, "error : %s\n", ssh_get_error(loc->session));
|
||||||
|
ssh_scp_free(loc->scp);
|
||||||
|
loc->scp = NULL;
|
||||||
|
ssh_disconnect(loc->session);
|
||||||
|
ssh_free(loc->session);
|
||||||
|
loc->session = NULL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
loc->file = fopen(loc->path, flag == READ ? "r":"w");
|
||||||
|
if (!loc->file) {
|
||||||
|
if (errno == EISDIR) {
|
||||||
|
if (chdir(loc->path)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Error changing directory to %s: %s\n",
|
||||||
|
loc->path, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
fprintf(stderr,
|
||||||
|
"Error opening %s: %s\n",
|
||||||
|
loc->path, strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
if(ssh_scp_init(loc->scp)==SSH_ERROR){
|
return -1;
|
||||||
fprintf(stderr,"error : %s\n",ssh_get_error(loc->session));
|
|
||||||
ssh_scp_free(loc->scp);
|
|
||||||
loc->scp = NULL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
} else if(loc->is_ssh && flag==READ){
|
|
||||||
loc->session=connect_ssh(loc->host, loc->user,verbosity);
|
|
||||||
if(!loc->session){
|
|
||||||
fprintf(stderr,"Couldn't connect to %s\n",loc->host);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
loc->scp=ssh_scp_new(loc->session,SSH_SCP_READ,loc->path);
|
|
||||||
if(!loc->scp){
|
|
||||||
fprintf(stderr,"error : %s\n",ssh_get_error(loc->session));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if(ssh_scp_init(loc->scp)==SSH_ERROR){
|
|
||||||
fprintf(stderr,"error : %s\n",ssh_get_error(loc->session));
|
|
||||||
ssh_scp_free(loc->scp);
|
|
||||||
loc->scp = NULL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
loc->file=fopen(loc->path,flag==READ ? "r":"w");
|
|
||||||
if(!loc->file){
|
|
||||||
if(errno==EISDIR){
|
|
||||||
if(chdir(loc->path)){
|
|
||||||
fprintf(stderr,"Error changing directory to %s: %s\n",loc->path,strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
fprintf(stderr,"Error opening %s: %s\n",loc->path,strerror(errno));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief copies files from source location to destination
|
/** @brief copies files from source location to destination
|
||||||
@@ -174,155 +256,197 @@ static int open_location(struct location *loc, int flag){
|
|||||||
* @param dest destination location
|
* @param dest destination location
|
||||||
* @param recursive Copy also directories
|
* @param recursive Copy also directories
|
||||||
*/
|
*/
|
||||||
static int do_copy(struct location *src, struct location *dest, int recursive){
|
static int do_copy(struct location *src, struct location *dest, int recursive) {
|
||||||
int size;
|
int size;
|
||||||
socket_t fd;
|
socket_t fd;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
int w,r;
|
int w, r;
|
||||||
char buffer[16384];
|
char buffer[16384];
|
||||||
int total=0;
|
int total = 0;
|
||||||
int mode;
|
int mode;
|
||||||
char *filename = NULL;
|
char *filename = NULL;
|
||||||
/* recursive mode doesn't work yet */
|
/* recursive mode doesn't work yet */
|
||||||
(void)recursive;
|
(void)recursive;
|
||||||
/* Get the file name and size*/
|
/* Get the file name and size*/
|
||||||
if(!src->is_ssh){
|
if (!src->is_ssh) {
|
||||||
fd = fileno(src->file);
|
fd = fileno(src->file);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
fprintf(stderr, "Invalid file pointer, error: %s\n", strerror(errno));
|
fprintf(stderr,
|
||||||
return -1;
|
"Invalid file pointer, error: %s\n",
|
||||||
}
|
strerror(errno));
|
||||||
r = fstat(fd, &s);
|
return -1;
|
||||||
if (r < 0) {
|
}
|
||||||
return -1;
|
r = fstat(fd, &s);
|
||||||
}
|
if (r < 0) {
|
||||||
size=s.st_size;
|
return -1;
|
||||||
mode = s.st_mode & ~S_IFMT;
|
}
|
||||||
filename=ssh_basename(src->path);
|
size = s.st_size;
|
||||||
} else {
|
mode = s.st_mode & ~S_IFMT;
|
||||||
size=0;
|
filename = ssh_basename(src->path);
|
||||||
do {
|
} else {
|
||||||
r=ssh_scp_pull_request(src->scp);
|
size = 0;
|
||||||
if(r==SSH_SCP_REQUEST_NEWDIR){
|
do {
|
||||||
ssh_scp_deny_request(src->scp,"Not in recursive mode");
|
r = ssh_scp_pull_request(src->scp);
|
||||||
continue;
|
if (r == SSH_SCP_REQUEST_NEWDIR) {
|
||||||
}
|
ssh_scp_deny_request(src->scp, "Not in recursive mode");
|
||||||
if(r==SSH_SCP_REQUEST_NEWFILE){
|
continue;
|
||||||
size=ssh_scp_request_get_size(src->scp);
|
}
|
||||||
filename=strdup(ssh_scp_request_get_filename(src->scp));
|
if (r == SSH_SCP_REQUEST_NEWFILE) {
|
||||||
mode=ssh_scp_request_get_permissions(src->scp);
|
size = ssh_scp_request_get_size(src->scp);
|
||||||
//ssh_scp_accept_request(src->scp);
|
filename = strdup(ssh_scp_request_get_filename(src->scp));
|
||||||
break;
|
mode = ssh_scp_request_get_permissions(src->scp);
|
||||||
}
|
//ssh_scp_accept_request(src->scp);
|
||||||
if(r==SSH_ERROR){
|
break;
|
||||||
fprintf(stderr,"Error: %s\n",ssh_get_error(src->session));
|
}
|
||||||
|
if (r == SSH_ERROR) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Error: %s\n",
|
||||||
|
ssh_get_error(src->session));
|
||||||
ssh_string_free_char(filename);
|
ssh_string_free_char(filename);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} while(r != SSH_SCP_REQUEST_NEWFILE);
|
} while(r != SSH_SCP_REQUEST_NEWFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dest->is_ssh){
|
if (dest->is_ssh) {
|
||||||
r=ssh_scp_push_file(dest->scp,src->path, size, mode);
|
r = ssh_scp_push_file(dest->scp, src->path, size, mode);
|
||||||
// snprintf(buffer,sizeof(buffer),"C0644 %d %s\n",size,src->path);
|
// snprintf(buffer, sizeof(buffer), "C0644 %d %s\n", size, src->path);
|
||||||
if(r==SSH_ERROR){
|
if (r == SSH_ERROR) {
|
||||||
fprintf(stderr,"error: %s\n",ssh_get_error(dest->session));
|
fprintf(stderr,
|
||||||
ssh_string_free_char(filename);
|
"error: %s\n",
|
||||||
ssh_scp_free(dest->scp);
|
ssh_get_error(dest->session));
|
||||||
dest->scp = NULL;
|
ssh_string_free_char(filename);
|
||||||
return -1;
|
ssh_scp_free(dest->scp);
|
||||||
}
|
dest->scp = NULL;
|
||||||
} else {
|
return -1;
|
||||||
if(!dest->file){
|
}
|
||||||
dest->file=fopen(filename,"w");
|
} else {
|
||||||
if(!dest->file){
|
if (!dest->file) {
|
||||||
fprintf(stderr,"Cannot open %s for writing: %s\n",filename,strerror(errno));
|
dest->file = fopen(filename, "w");
|
||||||
if(src->is_ssh)
|
if (!dest->file) {
|
||||||
ssh_scp_deny_request(src->scp,"Cannot open local file");
|
fprintf(stderr,
|
||||||
ssh_string_free_char(filename);
|
"Cannot open %s for writing: %s\n",
|
||||||
return -1;
|
filename, strerror(errno));
|
||||||
}
|
if (src->is_ssh) {
|
||||||
}
|
ssh_scp_deny_request(src->scp, "Cannot open local file");
|
||||||
if(src->is_ssh){
|
}
|
||||||
ssh_scp_accept_request(src->scp);
|
ssh_string_free_char(filename);
|
||||||
}
|
return -1;
|
||||||
}
|
}
|
||||||
do {
|
}
|
||||||
if(src->is_ssh){
|
if (src->is_ssh) {
|
||||||
r=ssh_scp_read(src->scp,buffer,sizeof(buffer));
|
ssh_scp_accept_request(src->scp);
|
||||||
if(r==SSH_ERROR){
|
}
|
||||||
fprintf(stderr,"Error reading scp: %s\n",ssh_get_error(src->session));
|
}
|
||||||
ssh_string_free_char(filename);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if(r==0)
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
r=fread(buffer,1,sizeof(buffer),src->file);
|
|
||||||
if(r==0)
|
|
||||||
break;
|
|
||||||
if(r<0){
|
|
||||||
fprintf(stderr,"Error reading file: %s\n",strerror(errno));
|
|
||||||
ssh_string_free_char(filename);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(dest->is_ssh){
|
|
||||||
w=ssh_scp_write(dest->scp,buffer,r);
|
|
||||||
if(w == SSH_ERROR){
|
|
||||||
fprintf(stderr,"Error writing in scp: %s\n",ssh_get_error(dest->session));
|
|
||||||
ssh_scp_free(dest->scp);
|
|
||||||
dest->scp=NULL;
|
|
||||||
ssh_string_free_char(filename);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
w=fwrite(buffer,r,1,dest->file);
|
|
||||||
if(w<=0){
|
|
||||||
fprintf(stderr,"Error writing in local file: %s\n",strerror(errno));
|
|
||||||
ssh_string_free_char(filename);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
total+=r;
|
|
||||||
|
|
||||||
} while(total < size);
|
do {
|
||||||
ssh_string_free_char(filename);
|
if (src->is_ssh) {
|
||||||
printf("wrote %d bytes\n",total);
|
r = ssh_scp_read(src->scp, buffer, sizeof(buffer));
|
||||||
return 0;
|
if (r == SSH_ERROR) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Error reading scp: %s\n",
|
||||||
|
ssh_get_error(src->session));
|
||||||
|
ssh_string_free_char(filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
r = fread(buffer, 1, sizeof(buffer), src->file);
|
||||||
|
if (r == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r < 0) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Error reading file: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
ssh_string_free_char(filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dest->is_ssh) {
|
||||||
|
w = ssh_scp_write(dest->scp, buffer, r);
|
||||||
|
if (w == SSH_ERROR) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Error writing in scp: %s\n",
|
||||||
|
ssh_get_error(dest->session));
|
||||||
|
ssh_scp_free(dest->scp);
|
||||||
|
dest->scp = NULL;
|
||||||
|
ssh_string_free_char(filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
w = fwrite(buffer, r, 1, dest->file);
|
||||||
|
if (w <= 0) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Error writing in local file: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
ssh_string_free_char(filename);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
total += r;
|
||||||
|
|
||||||
|
} while(total < size);
|
||||||
|
|
||||||
|
ssh_string_free_char(filename);
|
||||||
|
printf("wrote %d bytes\n", total);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv) {
|
||||||
struct location *dest, *src;
|
struct location *dest, *src;
|
||||||
int i;
|
int i;
|
||||||
int r;
|
int r;
|
||||||
if(opts(argc,argv)<0)
|
if (opts(argc, argv) < 0) {
|
||||||
return EXIT_FAILURE;
|
r = EXIT_FAILURE;
|
||||||
dest=parse_location(destination);
|
goto end;
|
||||||
if(open_location(dest,WRITE)<0)
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
for(i=0;i<nsources;++i){
|
|
||||||
src=parse_location(sources[i]);
|
|
||||||
if(open_location(src,READ)<0){
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
}
|
}
|
||||||
if(do_copy(src,dest,0) < 0){
|
|
||||||
break;
|
dest = parse_location(destination);
|
||||||
|
if (dest == NULL) {
|
||||||
|
r = EXIT_FAILURE;
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (dest->is_ssh && dest->scp != NULL) {
|
if (open_location(dest, WRITE) < 0) {
|
||||||
r=ssh_scp_close(dest->scp);
|
location_free(dest);
|
||||||
if(r == SSH_ERROR){
|
r = EXIT_FAILURE;
|
||||||
fprintf(stderr,"Error closing scp: %s\n",ssh_get_error(dest->session));
|
goto end;
|
||||||
ssh_scp_free(dest->scp);
|
}
|
||||||
dest->scp=NULL;
|
|
||||||
return -1;
|
for (i = 0; i < nsources; ++i) {
|
||||||
}
|
src = parse_location(sources[i]);
|
||||||
} else {
|
if (src == NULL) {
|
||||||
fclose(dest->file);
|
r = EXIT_FAILURE;
|
||||||
dest->file=NULL;
|
goto close_dest;
|
||||||
}
|
}
|
||||||
ssh_disconnect(dest->session);
|
|
||||||
ssh_finalize();
|
if (open_location(src, READ) < 0) {
|
||||||
return 0;
|
location_free(src);
|
||||||
|
r = EXIT_FAILURE;
|
||||||
|
goto close_dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (do_copy(src, dest, 0) < 0) {
|
||||||
|
close_location(src);
|
||||||
|
location_free(src);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
close_location(src);
|
||||||
|
location_free(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
r = 0;
|
||||||
|
|
||||||
|
close_dest:
|
||||||
|
close_location(dest);
|
||||||
|
location_free(dest);
|
||||||
|
end:
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,236 +33,259 @@ static int verbosity;
|
|||||||
static char *destination;
|
static char *destination;
|
||||||
|
|
||||||
#define DATALEN 65536
|
#define DATALEN 65536
|
||||||
static void do_sftp(ssh_session session){
|
|
||||||
sftp_session sftp=sftp_new(session);
|
static void do_sftp(ssh_session session) {
|
||||||
|
sftp_session sftp = sftp_new(session);
|
||||||
sftp_dir dir;
|
sftp_dir dir;
|
||||||
sftp_attributes file;
|
sftp_attributes file;
|
||||||
sftp_statvfs_t sftpstatvfs;
|
sftp_statvfs_t sftpstatvfs;
|
||||||
struct statvfs sysstatvfs;
|
struct statvfs sysstatvfs;
|
||||||
sftp_file fichier;
|
sftp_file fichier;
|
||||||
sftp_file to;
|
sftp_file to;
|
||||||
int len=1;
|
int len = 1;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
char data[DATALEN]={0};
|
char data[DATALEN] = {0};
|
||||||
char *lnk;
|
char *lnk;
|
||||||
|
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
|
||||||
if(!sftp){
|
if (!sftp) {
|
||||||
fprintf(stderr, "sftp error initialising channel: %s\n",
|
fprintf(stderr, "sftp error initialising channel: %s\n",
|
||||||
ssh_get_error(session));
|
ssh_get_error(session));
|
||||||
return;
|
goto end;
|
||||||
}
|
}
|
||||||
if(sftp_init(sftp)){
|
|
||||||
|
if (sftp_init(sftp)) {
|
||||||
fprintf(stderr, "error initialising sftp: %s\n",
|
fprintf(stderr, "error initialising sftp: %s\n",
|
||||||
ssh_get_error(session));
|
ssh_get_error(session));
|
||||||
return;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Additional SFTP extensions provided by the server:\n");
|
printf("Additional SFTP extensions provided by the server:\n");
|
||||||
count = sftp_extensions_get_count(sftp);
|
count = sftp_extensions_get_count(sftp);
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
printf("\t%s, version: %s\n",
|
printf("\t%s, version: %s\n",
|
||||||
sftp_extensions_get_name(sftp, i),
|
sftp_extensions_get_name(sftp, i),
|
||||||
sftp_extensions_get_data(sftp, i));
|
sftp_extensions_get_data(sftp, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test symlink and readlink */
|
/* test symlink and readlink */
|
||||||
if (sftp_symlink(sftp, "/tmp/this_is_the_link",
|
if (sftp_symlink(sftp, "/tmp/this_is_the_link",
|
||||||
"/tmp/sftp_symlink_test") < 0) {
|
"/tmp/sftp_symlink_test") < 0)
|
||||||
fprintf(stderr, "Could not create link (%s)\n", ssh_get_error(session));
|
{
|
||||||
return;
|
fprintf(stderr, "Could not create link (%s)\n",
|
||||||
|
ssh_get_error(session));
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
lnk = sftp_readlink(sftp, "/tmp/sftp_symlink_test");
|
lnk = sftp_readlink(sftp, "/tmp/sftp_symlink_test");
|
||||||
if (lnk == NULL) {
|
if (lnk == NULL) {
|
||||||
fprintf(stderr, "Could not read link (%s)\n", ssh_get_error(session));
|
fprintf(stderr, "Could not read link (%s)\n", ssh_get_error(session));
|
||||||
return;
|
goto end;
|
||||||
}
|
}
|
||||||
printf("readlink /tmp/sftp_symlink_test: %s\n", lnk);
|
printf("readlink /tmp/sftp_symlink_test: %s\n", lnk);
|
||||||
|
|
||||||
sftp_unlink(sftp, "/tmp/sftp_symlink_test");
|
sftp_unlink(sftp, "/tmp/sftp_symlink_test");
|
||||||
|
|
||||||
if (sftp_extension_supported(sftp, "statvfs@openssh.com", "2")) {
|
if (sftp_extension_supported(sftp, "statvfs@openssh.com", "2")) {
|
||||||
sftpstatvfs = sftp_statvfs(sftp, "/tmp");
|
sftpstatvfs = sftp_statvfs(sftp, "/tmp");
|
||||||
if (sftpstatvfs == NULL) {
|
if (sftpstatvfs == NULL) {
|
||||||
fprintf(stderr, "statvfs failed (%s)\n", ssh_get_error(session));
|
fprintf(stderr, "statvfs failed (%s)\n", ssh_get_error(session));
|
||||||
return;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("sftp statvfs:\n"
|
printf("sftp statvfs:\n"
|
||||||
"\tfile system block size: %llu\n"
|
"\tfile system block size: %llu\n"
|
||||||
"\tfundamental fs block size: %llu\n"
|
"\tfundamental fs block size: %llu\n"
|
||||||
"\tnumber of blocks (unit f_frsize): %llu\n"
|
"\tnumber of blocks (unit f_frsize): %llu\n"
|
||||||
"\tfree blocks in file system: %llu\n"
|
"\tfree blocks in file system: %llu\n"
|
||||||
"\tfree blocks for non-root: %llu\n"
|
"\tfree blocks for non-root: %llu\n"
|
||||||
"\ttotal file inodes: %llu\n"
|
"\ttotal file inodes: %llu\n"
|
||||||
"\tfree file inodes: %llu\n"
|
"\tfree file inodes: %llu\n"
|
||||||
"\tfree file inodes for to non-root: %llu\n"
|
"\tfree file inodes for to non-root: %llu\n"
|
||||||
"\tfile system id: %llu\n"
|
"\tfile system id: %llu\n"
|
||||||
"\tbit mask of f_flag values: %llu\n"
|
"\tbit mask of f_flag values: %llu\n"
|
||||||
"\tmaximum filename length: %llu\n",
|
"\tmaximum filename length: %llu\n",
|
||||||
(unsigned long long) sftpstatvfs->f_bsize,
|
(unsigned long long) sftpstatvfs->f_bsize,
|
||||||
(unsigned long long) sftpstatvfs->f_frsize,
|
(unsigned long long) sftpstatvfs->f_frsize,
|
||||||
(unsigned long long) sftpstatvfs->f_blocks,
|
(unsigned long long) sftpstatvfs->f_blocks,
|
||||||
(unsigned long long) sftpstatvfs->f_bfree,
|
(unsigned long long) sftpstatvfs->f_bfree,
|
||||||
(unsigned long long) sftpstatvfs->f_bavail,
|
(unsigned long long) sftpstatvfs->f_bavail,
|
||||||
(unsigned long long) sftpstatvfs->f_files,
|
(unsigned long long) sftpstatvfs->f_files,
|
||||||
(unsigned long long) sftpstatvfs->f_ffree,
|
(unsigned long long) sftpstatvfs->f_ffree,
|
||||||
(unsigned long long) sftpstatvfs->f_favail,
|
(unsigned long long) sftpstatvfs->f_favail,
|
||||||
(unsigned long long) sftpstatvfs->f_fsid,
|
(unsigned long long) sftpstatvfs->f_fsid,
|
||||||
(unsigned long long) sftpstatvfs->f_flag,
|
(unsigned long long) sftpstatvfs->f_flag,
|
||||||
(unsigned long long) sftpstatvfs->f_namemax);
|
(unsigned long long) sftpstatvfs->f_namemax);
|
||||||
|
|
||||||
sftp_statvfs_free(sftpstatvfs);
|
sftp_statvfs_free(sftpstatvfs);
|
||||||
|
|
||||||
if (statvfs("/tmp", &sysstatvfs) < 0) {
|
if (statvfs("/tmp", &sysstatvfs) < 0) {
|
||||||
fprintf(stderr, "statvfs failed (%s)\n", strerror(errno));
|
fprintf(stderr, "statvfs failed (%s)\n", strerror(errno));
|
||||||
return;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("sys statvfs:\n"
|
printf("sys statvfs:\n"
|
||||||
"\tfile system block size: %llu\n"
|
"\tfile system block size: %llu\n"
|
||||||
"\tfundamental fs block size: %llu\n"
|
"\tfundamental fs block size: %llu\n"
|
||||||
"\tnumber of blocks (unit f_frsize): %llu\n"
|
"\tnumber of blocks (unit f_frsize): %llu\n"
|
||||||
"\tfree blocks in file system: %llu\n"
|
"\tfree blocks in file system: %llu\n"
|
||||||
"\tfree blocks for non-root: %llu\n"
|
"\tfree blocks for non-root: %llu\n"
|
||||||
"\ttotal file inodes: %llu\n"
|
"\ttotal file inodes: %llu\n"
|
||||||
"\tfree file inodes: %llu\n"
|
"\tfree file inodes: %llu\n"
|
||||||
"\tfree file inodes for to non-root: %llu\n"
|
"\tfree file inodes for to non-root: %llu\n"
|
||||||
"\tfile system id: %llu\n"
|
"\tfile system id: %llu\n"
|
||||||
"\tbit mask of f_flag values: %llu\n"
|
"\tbit mask of f_flag values: %llu\n"
|
||||||
"\tmaximum filename length: %llu\n",
|
"\tmaximum filename length: %llu\n",
|
||||||
(unsigned long long) sysstatvfs.f_bsize,
|
(unsigned long long) sysstatvfs.f_bsize,
|
||||||
(unsigned long long) sysstatvfs.f_frsize,
|
(unsigned long long) sysstatvfs.f_frsize,
|
||||||
(unsigned long long) sysstatvfs.f_blocks,
|
(unsigned long long) sysstatvfs.f_blocks,
|
||||||
(unsigned long long) sysstatvfs.f_bfree,
|
(unsigned long long) sysstatvfs.f_bfree,
|
||||||
(unsigned long long) sysstatvfs.f_bavail,
|
(unsigned long long) sysstatvfs.f_bavail,
|
||||||
(unsigned long long) sysstatvfs.f_files,
|
(unsigned long long) sysstatvfs.f_files,
|
||||||
(unsigned long long) sysstatvfs.f_ffree,
|
(unsigned long long) sysstatvfs.f_ffree,
|
||||||
(unsigned long long) sysstatvfs.f_favail,
|
(unsigned long long) sysstatvfs.f_favail,
|
||||||
(unsigned long long) sysstatvfs.f_fsid,
|
(unsigned long long) sysstatvfs.f_fsid,
|
||||||
(unsigned long long) sysstatvfs.f_flag,
|
(unsigned long long) sysstatvfs.f_flag,
|
||||||
(unsigned long long) sysstatvfs.f_namemax);
|
(unsigned long long) sysstatvfs.f_namemax);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* the connection is made */
|
/* the connection is made */
|
||||||
/* opening a directory */
|
/* opening a directory */
|
||||||
dir=sftp_opendir(sftp,"./");
|
dir = sftp_opendir(sftp, "./");
|
||||||
if(!dir) {
|
if (!dir) {
|
||||||
fprintf(stderr, "Directory not opened(%s)\n", ssh_get_error(session));
|
fprintf(stderr, "Directory not opened(%s)\n", ssh_get_error(session));
|
||||||
return ;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* reading the whole directory, file by file */
|
/* reading the whole directory, file by file */
|
||||||
while((file=sftp_readdir(sftp,dir))){
|
while ((file = sftp_readdir(sftp, dir))) {
|
||||||
fprintf(stderr, "%30s(%.8o) : %s(%.5d) %s(%.5d) : %.10llu bytes\n",
|
fprintf(stderr, "%30s(%.8o) : %s(%.5d) %s(%.5d) : %.10llu bytes\n",
|
||||||
file->name,
|
file->name,
|
||||||
file->permissions,
|
file->permissions,
|
||||||
file->owner,
|
file->owner,
|
||||||
file->uid,
|
file->uid,
|
||||||
file->group,
|
file->group,
|
||||||
file->gid,
|
file->gid,
|
||||||
(long long unsigned int) file->size);
|
(long long unsigned int) file->size);
|
||||||
sftp_attributes_free(file);
|
sftp_attributes_free(file);
|
||||||
}
|
}
|
||||||
/* when file=NULL, an error has occured OR the directory listing is end of file */
|
|
||||||
if(!sftp_dir_eof(dir)){
|
/* when file = NULL, an error has occured OR the directory listing is end of
|
||||||
|
* file */
|
||||||
|
if (!sftp_dir_eof(dir)) {
|
||||||
fprintf(stderr, "Error: %s\n", ssh_get_error(session));
|
fprintf(stderr, "Error: %s\n", ssh_get_error(session));
|
||||||
return;
|
goto end;
|
||||||
}
|
}
|
||||||
if(sftp_closedir(dir)){
|
|
||||||
|
if (sftp_closedir(dir)) {
|
||||||
fprintf(stderr, "Error: %s\n", ssh_get_error(session));
|
fprintf(stderr, "Error: %s\n", ssh_get_error(session));
|
||||||
return;
|
goto end;
|
||||||
}
|
}
|
||||||
/* this will open a file and copy it into your /home directory */
|
/* this will open a file and copy it into your /home directory */
|
||||||
/* the small buffer size was intended to stress the library. of course, you can use a buffer till 20kbytes without problem */
|
/* the small buffer size was intended to stress the library. of course, you
|
||||||
|
* can use a buffer till 20kbytes without problem */
|
||||||
|
|
||||||
fichier=sftp_open(sftp,"/usr/bin/ssh",O_RDONLY, 0);
|
fichier = sftp_open(sftp, "/usr/bin/ssh", O_RDONLY, 0);
|
||||||
if(!fichier){
|
if (!fichier) {
|
||||||
fprintf(stderr, "Error opening /usr/bin/ssh: %s\n",
|
fprintf(stderr, "Error opening /usr/bin/ssh: %s\n",
|
||||||
ssh_get_error(session));
|
ssh_get_error(session));
|
||||||
return;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* open a file for writing... */
|
/* open a file for writing... */
|
||||||
to=sftp_open(sftp,"ssh-copy",O_WRONLY | O_CREAT, 0700);
|
to = sftp_open(sftp, "ssh-copy", O_WRONLY | O_CREAT, 0700);
|
||||||
if(!to){
|
if (!to) {
|
||||||
fprintf(stderr, "Error opening ssh-copy for writing: %s\n",
|
fprintf(stderr, "Error opening ssh-copy for writing: %s\n",
|
||||||
ssh_get_error(session));
|
ssh_get_error(session));
|
||||||
return;
|
sftp_close(fichier);
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
while((len=sftp_read(fichier,data,4096)) > 0){
|
|
||||||
if(sftp_write(to,data,len)!=len){
|
while ((len = sftp_read(fichier, data, 4096)) > 0) {
|
||||||
|
if (sftp_write(to, data, len) != len) {
|
||||||
fprintf(stderr, "Error writing %d bytes: %s\n",
|
fprintf(stderr, "Error writing %d bytes: %s\n",
|
||||||
len, ssh_get_error(session));
|
len, ssh_get_error(session));
|
||||||
return;
|
sftp_close(to);
|
||||||
|
sftp_close(fichier);
|
||||||
|
goto end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("finished\n");
|
printf("finished\n");
|
||||||
if(len<0)
|
if (len < 0) {
|
||||||
fprintf(stderr, "Error reading file: %s\n", ssh_get_error(session));
|
fprintf(stderr, "Error reading file: %s\n", ssh_get_error(session));
|
||||||
|
}
|
||||||
|
|
||||||
sftp_close(fichier);
|
sftp_close(fichier);
|
||||||
sftp_close(to);
|
sftp_close(to);
|
||||||
printf("fichiers ferm\n");
|
printf("fichiers ferm\n");
|
||||||
to=sftp_open(sftp,"/tmp/grosfichier",O_WRONLY|O_CREAT, 0644);
|
to = sftp_open(sftp, "/tmp/grosfichier", O_WRONLY|O_CREAT, 0644);
|
||||||
for(i=0;i<1000;++i){
|
|
||||||
len=sftp_write(to,data,DATALEN);
|
for (i = 0; i < 1000; ++i) {
|
||||||
printf("wrote %d bytes\n",len);
|
len = sftp_write(to, data, DATALEN);
|
||||||
if(len != DATALEN){
|
printf("wrote %d bytes\n", len);
|
||||||
printf("chunk %d : %d (%s)\n",i,len,ssh_get_error(session));
|
if (len != DATALEN) {
|
||||||
|
printf("chunk %d : %d (%s)\n", i, len, ssh_get_error(session));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sftp_close(to);
|
|
||||||
|
|
||||||
|
sftp_close(to);
|
||||||
|
end:
|
||||||
/* close the sftp session */
|
/* close the sftp session */
|
||||||
sftp_free(sftp);
|
sftp_free(sftp);
|
||||||
printf("sftp session terminated\n");
|
printf("sftp session terminated\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(const char *argv0){
|
static void usage(const char *argv0) {
|
||||||
fprintf(stderr,"Usage : %s [-v] remotehost\n"
|
fprintf(stderr, "Usage : %s [-v] remotehost\n"
|
||||||
"sample sftp test client - libssh-%s\n"
|
"sample sftp test client - libssh-%s\n"
|
||||||
"Options :\n"
|
"Options :\n"
|
||||||
" -v : increase log verbosity\n",
|
" -v : increase log verbosity\n",
|
||||||
argv0,
|
argv0,
|
||||||
ssh_version(0));
|
ssh_version(0));
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opts(int argc, char **argv){
|
static int opts(int argc, char **argv) {
|
||||||
int i;
|
int i;
|
||||||
while((i=getopt(argc,argv,"v"))!=-1){
|
|
||||||
switch(i){
|
while ((i = getopt(argc, argv, "v")) != -1) {
|
||||||
case 'v':
|
switch(i) {
|
||||||
verbosity++;
|
case 'v':
|
||||||
break;
|
verbosity++;
|
||||||
default:
|
break;
|
||||||
fprintf(stderr,"unknown option %c\n",optopt);
|
default:
|
||||||
|
fprintf(stderr, "unknown option %c\n", optopt);
|
||||||
|
usage(argv[0]);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
destination = argv[optind];
|
||||||
|
if (destination == NULL) {
|
||||||
usage(argv[0]);
|
usage(argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
return 0;
|
||||||
|
|
||||||
destination=argv[optind];
|
|
||||||
if(destination == NULL){
|
|
||||||
usage(argv[0]);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv) {
|
||||||
ssh_session session;
|
ssh_session session;
|
||||||
if(opts(argc,argv)<0)
|
|
||||||
return EXIT_FAILURE;
|
if (opts(argc, argv) < 0) {
|
||||||
session=connect_ssh(destination,NULL,verbosity);
|
return EXIT_FAILURE;
|
||||||
if(session == NULL)
|
}
|
||||||
return EXIT_FAILURE;
|
|
||||||
do_sftp(session);
|
session = connect_ssh(destination, NULL, verbosity);
|
||||||
ssh_disconnect(session);
|
if (session == NULL) {
|
||||||
ssh_free(session);
|
return EXIT_FAILURE;
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
do_sftp(session);
|
||||||
|
ssh_disconnect(session);
|
||||||
|
ssh_free(session);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ clients must be made or how a client should react.
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define SSHD_USER "libssh"
|
#define SSHD_USER "libssh"
|
||||||
#define SSHD_PASSWORD "libssh"
|
#define SSHD_PASSWORD "libssh"
|
||||||
@@ -36,6 +37,7 @@ clients must be made or how a client should react.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int port = 22;
|
static int port = 22;
|
||||||
|
static bool authenticated = false;
|
||||||
|
|
||||||
#ifdef WITH_PCAP
|
#ifdef WITH_PCAP
|
||||||
static const char *pcap_file = "debug.server.pcap";
|
static const char *pcap_file = "debug.server.pcap";
|
||||||
@@ -61,11 +63,20 @@ static void cleanup_pcap(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static int auth_password(const char *user, const char *password){
|
static int auth_password(const char *user, const char *password)
|
||||||
if(strcmp(user, SSHD_USER))
|
{
|
||||||
|
int cmp;
|
||||||
|
|
||||||
|
cmp = strcmp(user, SSHD_USER);
|
||||||
|
if (cmp != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
if(strcmp(password, SSHD_PASSWORD))
|
}
|
||||||
|
cmp = strcmp(password, SSHD_PASSWORD);
|
||||||
|
if (cmp != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
authenticated = true;
|
||||||
return 1; // authenticated
|
return 1; // authenticated
|
||||||
}
|
}
|
||||||
#ifdef HAVE_ARGP_H
|
#ifdef HAVE_ARGP_H
|
||||||
@@ -200,6 +211,7 @@ static int kbdint_check_response(ssh_session session) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
authenticated = true;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,7 +340,7 @@ int main(int argc, char **argv){
|
|||||||
|
|
||||||
/* proceed to authentication */
|
/* proceed to authentication */
|
||||||
auth = authenticate(session);
|
auth = authenticate(session);
|
||||||
if(!auth){
|
if (!auth || !authenticated) {
|
||||||
printf("Authentication error: %s\n", ssh_get_error(session));
|
printf("Authentication error: %s\n", ssh_get_error(session));
|
||||||
ssh_disconnect(session);
|
ssh_disconnect(session);
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
@@ -48,12 +48,17 @@ static char *user;
|
|||||||
static char *cmds[MAXCMD];
|
static char *cmds[MAXCMD];
|
||||||
static struct termios terminal;
|
static struct termios terminal;
|
||||||
|
|
||||||
static char *pcap_file=NULL;
|
static char *pcap_file = NULL;
|
||||||
|
|
||||||
static char *proxycommand;
|
static char *proxycommand;
|
||||||
|
|
||||||
static int auth_callback(const char *prompt, char *buf, size_t len,
|
static int auth_callback(const char *prompt,
|
||||||
int echo, int verify, void *userdata) {
|
char *buf,
|
||||||
|
size_t len,
|
||||||
|
int echo,
|
||||||
|
int verify,
|
||||||
|
void *userdata)
|
||||||
|
{
|
||||||
(void) verify;
|
(void) verify;
|
||||||
(void) userdata;
|
(void) userdata;
|
||||||
|
|
||||||
@@ -61,11 +66,12 @@ static int auth_callback(const char *prompt, char *buf, size_t len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct ssh_callbacks_struct cb = {
|
struct ssh_callbacks_struct cb = {
|
||||||
.auth_function=auth_callback,
|
.auth_function = auth_callback,
|
||||||
.userdata=NULL
|
.userdata = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void add_cmd(char *cmd){
|
static void add_cmd(char *cmd)
|
||||||
|
{
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (n = 0; (n < MAXCMD) && cmds[n] != NULL; n++);
|
for (n = 0; (n < MAXCMD) && cmds[n] != NULL; n++);
|
||||||
@@ -73,7 +79,8 @@ static void add_cmd(char *cmd){
|
|||||||
if (n == MAXCMD) {
|
if (n == MAXCMD) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cmds[n]=strdup(cmd);
|
|
||||||
|
cmds[n] = strdup(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
@@ -98,37 +105,43 @@ static void usage(void)
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int opts(int argc, char **argv){
|
static int opts(int argc, char **argv)
|
||||||
|
{
|
||||||
int i;
|
int i;
|
||||||
// for(i=0;i<argc;i++)
|
|
||||||
// printf("%d : %s\n",i,argv[i]);
|
while((i = getopt(argc,argv,"T:P:")) != -1) {
|
||||||
/* insert your own arguments here */
|
|
||||||
while((i=getopt(argc,argv,"T:P:"))!=-1){
|
|
||||||
switch(i){
|
switch(i){
|
||||||
case 'P':
|
case 'P':
|
||||||
pcap_file=optarg;
|
pcap_file = optarg;
|
||||||
break;
|
break;
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
case 'T':
|
case 'T':
|
||||||
proxycommand=optarg;
|
proxycommand = optarg;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
fprintf(stderr,"unknown option %c\n",optopt);
|
fprintf(stderr, "Unknown option %c\n", optopt);
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(optind < argc)
|
if (optind < argc) {
|
||||||
host=argv[optind++];
|
host = argv[optind++];
|
||||||
while(optind < argc)
|
}
|
||||||
|
|
||||||
|
while(optind < argc) {
|
||||||
add_cmd(argv[optind++]);
|
add_cmd(argv[optind++]);
|
||||||
if(host==NULL)
|
}
|
||||||
|
|
||||||
|
if (host == NULL) {
|
||||||
usage();
|
usage();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef HAVE_CFMAKERAW
|
#ifndef HAVE_CFMAKERAW
|
||||||
static void cfmakeraw(struct termios *termios_p){
|
static void cfmakeraw(struct termios *termios_p)
|
||||||
|
{
|
||||||
termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
|
termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
|
||||||
termios_p->c_oflag &= ~OPOST;
|
termios_p->c_oflag &= ~OPOST;
|
||||||
termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
|
termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
|
||||||
@@ -138,44 +151,54 @@ static void cfmakeraw(struct termios *termios_p){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void do_cleanup(int i) {
|
static void do_cleanup(int i)
|
||||||
|
{
|
||||||
/* unused variable */
|
/* unused variable */
|
||||||
(void) i;
|
(void) i;
|
||||||
|
|
||||||
tcsetattr(0,TCSANOW,&terminal);
|
tcsetattr(0, TCSANOW, &terminal);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_exit(int i) {
|
static void do_exit(int i)
|
||||||
/* unused variable */
|
{
|
||||||
(void) i;
|
/* unused variable */
|
||||||
|
(void) i;
|
||||||
|
|
||||||
do_cleanup(0);
|
do_cleanup(0);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_channel chan;
|
static ssh_channel chan;
|
||||||
int signal_delayed=0;
|
static int signal_delayed = 0;
|
||||||
|
|
||||||
static void sigwindowchanged(int i){
|
static void sigwindowchanged(int i)
|
||||||
(void) i;
|
{
|
||||||
signal_delayed=1;
|
(void) i;
|
||||||
|
signal_delayed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setsignal(void){
|
static void setsignal(void)
|
||||||
|
{
|
||||||
signal(SIGWINCH, sigwindowchanged);
|
signal(SIGWINCH, sigwindowchanged);
|
||||||
signal_delayed=0;
|
signal_delayed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sizechanged(void){
|
static void sizechanged(void)
|
||||||
struct winsize win = { 0, 0, 0, 0 };
|
{
|
||||||
|
struct winsize win = {
|
||||||
|
.ws_row = 0,
|
||||||
|
};
|
||||||
|
|
||||||
ioctl(1, TIOCGWINSZ, &win);
|
ioctl(1, TIOCGWINSZ, &win);
|
||||||
ssh_channel_change_pty_size(chan,win.ws_col, win.ws_row);
|
ssh_channel_change_pty_size(chan,win.ws_col, win.ws_row);
|
||||||
// printf("Changed pty size\n");
|
|
||||||
setsignal();
|
setsignal();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void select_loop(ssh_session session,ssh_channel channel){
|
static void select_loop(ssh_session session,ssh_channel channel)
|
||||||
|
{
|
||||||
ssh_connector connector_in, connector_out, connector_err;
|
ssh_connector connector_in, connector_out, connector_err;
|
||||||
|
int rc;
|
||||||
|
|
||||||
ssh_event event = ssh_event_new();
|
ssh_event event = ssh_event_new();
|
||||||
|
|
||||||
/* stdin */
|
/* stdin */
|
||||||
@@ -196,10 +219,15 @@ static void select_loop(ssh_session session,ssh_channel channel){
|
|||||||
ssh_connector_set_in_channel(connector_err, channel, SSH_CONNECTOR_STDERR);
|
ssh_connector_set_in_channel(connector_err, channel, SSH_CONNECTOR_STDERR);
|
||||||
ssh_event_add_connector(event, connector_err);
|
ssh_event_add_connector(event, connector_err);
|
||||||
|
|
||||||
while(ssh_channel_is_open(channel)){
|
while (ssh_channel_is_open(channel)) {
|
||||||
if(signal_delayed)
|
if (signal_delayed) {
|
||||||
sizechanged();
|
sizechanged();
|
||||||
ssh_event_dopoll(event, 60000);
|
}
|
||||||
|
rc = ssh_event_dopoll(event, 60000);
|
||||||
|
if (rc == SSH_ERROR) {
|
||||||
|
fprintf(stderr, "Error in ssh_event_dopoll()\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ssh_event_remove_connector(event, connector_in);
|
ssh_event_remove_connector(event, connector_in);
|
||||||
ssh_event_remove_connector(event, connector_out);
|
ssh_event_remove_connector(event, connector_out);
|
||||||
@@ -213,121 +241,148 @@ static void select_loop(ssh_session session,ssh_channel channel){
|
|||||||
ssh_channel_free(channel);
|
ssh_channel_free(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void shell(ssh_session session){
|
static void shell(ssh_session session)
|
||||||
|
{
|
||||||
ssh_channel channel;
|
ssh_channel channel;
|
||||||
struct termios terminal_local;
|
struct termios terminal_local;
|
||||||
int interactive=isatty(0);
|
int interactive=isatty(0);
|
||||||
channel = ssh_channel_new(session);
|
channel = ssh_channel_new(session);
|
||||||
if(interactive){
|
|
||||||
tcgetattr(0,&terminal_local);
|
if (interactive) {
|
||||||
memcpy(&terminal,&terminal_local,sizeof(struct termios));
|
tcgetattr(0, &terminal_local);
|
||||||
|
memcpy(&terminal, &terminal_local, sizeof(struct termios));
|
||||||
}
|
}
|
||||||
if(ssh_channel_open_session(channel)){
|
|
||||||
printf("error opening channel : %s\n",ssh_get_error(session));
|
if (ssh_channel_open_session(channel)) {
|
||||||
|
printf("Error opening channel : %s\n", ssh_get_error(session));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
chan=channel;
|
chan = channel;
|
||||||
if(interactive){
|
if (interactive) {
|
||||||
ssh_channel_request_pty(channel);
|
ssh_channel_request_pty(channel);
|
||||||
sizechanged();
|
sizechanged();
|
||||||
}
|
}
|
||||||
if(ssh_channel_request_shell(channel)){
|
|
||||||
printf("Requesting shell : %s\n",ssh_get_error(session));
|
if (ssh_channel_request_shell(channel)) {
|
||||||
|
printf("Requesting shell : %s\n", ssh_get_error(session));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(interactive){
|
|
||||||
|
if (interactive) {
|
||||||
cfmakeraw(&terminal_local);
|
cfmakeraw(&terminal_local);
|
||||||
tcsetattr(0,TCSANOW,&terminal_local);
|
tcsetattr(0, TCSANOW, &terminal_local);
|
||||||
setsignal();
|
setsignal();
|
||||||
}
|
}
|
||||||
signal(SIGTERM,do_cleanup);
|
signal(SIGTERM, do_cleanup);
|
||||||
select_loop(session,channel);
|
select_loop(session, channel);
|
||||||
if(interactive)
|
if (interactive) {
|
||||||
do_cleanup(0);
|
do_cleanup(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void batch_shell(ssh_session session){
|
static void batch_shell(ssh_session session)
|
||||||
|
{
|
||||||
ssh_channel channel;
|
ssh_channel channel;
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
int i,s=0;
|
size_t i;
|
||||||
for(i=0;i<MAXCMD && cmds[i];++i) {
|
int s = 0;
|
||||||
s+=snprintf(buffer+s,sizeof(buffer)-s,"%s ",cmds[i]);
|
|
||||||
free(cmds[i]);
|
for (i = 0; i < MAXCMD && cmds[i]; ++i) {
|
||||||
cmds[i] = NULL;
|
s += snprintf(buffer + s, sizeof(buffer) - s, "%s ", cmds[i]);
|
||||||
}
|
free(cmds[i]);
|
||||||
channel=ssh_channel_new(session);
|
cmds[i] = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
channel = ssh_channel_new(session);
|
||||||
ssh_channel_open_session(channel);
|
ssh_channel_open_session(channel);
|
||||||
if(ssh_channel_request_exec(channel,buffer)){
|
if (ssh_channel_request_exec(channel, buffer)) {
|
||||||
printf("error executing \"%s\" : %s\n",buffer,ssh_get_error(session));
|
printf("Error executing '%s' : %s\n", buffer, ssh_get_error(session));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
select_loop(session,channel);
|
select_loop(session, channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int client(ssh_session session){
|
static int client(ssh_session session)
|
||||||
int auth=0;
|
{
|
||||||
char *banner;
|
int auth = 0;
|
||||||
int state;
|
char *banner;
|
||||||
if (user)
|
int state;
|
||||||
if (ssh_options_set(session, SSH_OPTIONS_USER, user) < 0)
|
|
||||||
return -1;
|
|
||||||
if (ssh_options_set(session, SSH_OPTIONS_HOST ,host) < 0)
|
|
||||||
return -1;
|
|
||||||
if (proxycommand != NULL){
|
|
||||||
if(ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, proxycommand))
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
ssh_options_parse_config(session, NULL);
|
|
||||||
|
|
||||||
if(ssh_connect(session)){
|
if (user) {
|
||||||
fprintf(stderr,"Connection failed : %s\n",ssh_get_error(session));
|
if (ssh_options_set(session, SSH_OPTIONS_USER, user) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
state=verify_knownhost(session);
|
}
|
||||||
if (state != 0)
|
if (ssh_options_set(session, SSH_OPTIONS_HOST ,host) < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
ssh_userauth_none(session, NULL);
|
}
|
||||||
banner=ssh_get_issue_banner(session);
|
if (proxycommand != NULL) {
|
||||||
if(banner){
|
if (ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, proxycommand)) {
|
||||||
printf("%s\n",banner);
|
return -1;
|
||||||
free(banner);
|
}
|
||||||
}
|
}
|
||||||
auth=authenticate_console(session);
|
ssh_options_parse_config(session, NULL);
|
||||||
if(auth != SSH_AUTH_SUCCESS){
|
|
||||||
return -1;
|
if (ssh_connect(session)) {
|
||||||
}
|
fprintf(stderr, "Connection failed : %s\n", ssh_get_error(session));
|
||||||
if(!cmds[0])
|
return -1;
|
||||||
shell(session);
|
}
|
||||||
else
|
|
||||||
batch_shell(session);
|
state = verify_knownhost(session);
|
||||||
return 0;
|
if (state != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_userauth_none(session, NULL);
|
||||||
|
banner = ssh_get_issue_banner(session);
|
||||||
|
if (banner) {
|
||||||
|
printf("%s\n", banner);
|
||||||
|
free(banner);
|
||||||
|
}
|
||||||
|
auth = authenticate_console(session);
|
||||||
|
if (auth != SSH_AUTH_SUCCESS) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (cmds[0] == NULL) {
|
||||||
|
shell(session);
|
||||||
|
} else {
|
||||||
|
batch_shell(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_pcap_file pcap;
|
static ssh_pcap_file pcap;
|
||||||
void set_pcap(ssh_session session);
|
static void set_pcap(ssh_session session)
|
||||||
void set_pcap(ssh_session session){
|
{
|
||||||
if(!pcap_file)
|
if (pcap_file == NULL) {
|
||||||
return;
|
return;
|
||||||
pcap=ssh_pcap_file_new();
|
}
|
||||||
if(!pcap)
|
|
||||||
return;
|
pcap = ssh_pcap_file_new();
|
||||||
if(ssh_pcap_file_open(pcap,pcap_file) == SSH_ERROR){
|
if (pcap == NULL) {
|
||||||
printf("Error opening pcap file\n");
|
return;
|
||||||
ssh_pcap_file_free(pcap);
|
}
|
||||||
pcap=NULL;
|
|
||||||
return;
|
if (ssh_pcap_file_open(pcap, pcap_file) == SSH_ERROR) {
|
||||||
}
|
printf("Error opening pcap file\n");
|
||||||
ssh_set_pcap_file(session,pcap);
|
ssh_pcap_file_free(pcap);
|
||||||
|
pcap = NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ssh_set_pcap_file(session, pcap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup_pcap(void);
|
static void cleanup_pcap(void)
|
||||||
void cleanup_pcap(){
|
{
|
||||||
if(pcap)
|
if (pcap != NULL) {
|
||||||
ssh_pcap_file_free(pcap);
|
ssh_pcap_file_free(pcap);
|
||||||
pcap=NULL;
|
}
|
||||||
|
pcap = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
ssh_session session;
|
ssh_session session;
|
||||||
|
|
||||||
session = ssh_new();
|
session = ssh_new();
|
||||||
@@ -335,12 +390,13 @@ int main(int argc, char **argv){
|
|||||||
ssh_callbacks_init(&cb);
|
ssh_callbacks_init(&cb);
|
||||||
ssh_set_callbacks(session,&cb);
|
ssh_set_callbacks(session,&cb);
|
||||||
|
|
||||||
if(ssh_options_getopt(session, &argc, argv)) {
|
if (ssh_options_getopt(session, &argc, argv)) {
|
||||||
fprintf(stderr, "error parsing command line :%s\n",
|
fprintf(stderr,
|
||||||
ssh_get_error(session));
|
"Error parsing command line: %s\n",
|
||||||
usage();
|
ssh_get_error(session));
|
||||||
|
usage();
|
||||||
}
|
}
|
||||||
opts(argc,argv);
|
opts(argc, argv);
|
||||||
signal(SIGTERM, do_exit);
|
signal(SIGTERM, do_exit);
|
||||||
|
|
||||||
set_pcap(session);
|
set_pcap(session);
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ The goal is to show the API in action.
|
|||||||
#endif
|
#endif
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifndef KEYS_FOLDER
|
#ifndef KEYS_FOLDER
|
||||||
@@ -70,7 +71,8 @@ static void set_default_keys(ssh_bind sshbind,
|
|||||||
KEYS_FOLDER "ssh_host_ecdsa_key");
|
KEYS_FOLDER "ssh_host_ecdsa_key");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#define DEF_STR_SIZE 1024
|
||||||
|
char authorizedkeys[DEF_STR_SIZE] = {0};
|
||||||
#ifdef HAVE_ARGP_H
|
#ifdef HAVE_ARGP_H
|
||||||
const char *argp_program_version = "libssh server example "
|
const char *argp_program_version = "libssh server example "
|
||||||
SSH_STRINGIFY(LIBSSH_VERSION);
|
SSH_STRINGIFY(LIBSSH_VERSION);
|
||||||
@@ -125,6 +127,14 @@ static struct argp_option options[] = {
|
|||||||
.doc = "Set the ecdsa key.",
|
.doc = "Set the ecdsa key.",
|
||||||
.group = 0
|
.group = 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = "authorizedkeys",
|
||||||
|
.key = 'a',
|
||||||
|
.arg = "FILE",
|
||||||
|
.flags = 0,
|
||||||
|
.doc = "Set the authorized keys file.",
|
||||||
|
.group = 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = "no-default-keys",
|
.name = "no-default-keys",
|
||||||
.key = 'n',
|
.key = 'n',
|
||||||
@@ -178,6 +188,9 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state) {
|
|||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_ECDSAKEY, arg);
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_ECDSAKEY, arg);
|
||||||
ecdsa_already_set = 1;
|
ecdsa_already_set = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'a':
|
||||||
|
strncpy(authorizedkeys, arg, DEF_STR_SIZE-1);
|
||||||
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_LOG_VERBOSITY_STR,
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_LOG_VERBOSITY_STR,
|
||||||
"3");
|
"3");
|
||||||
@@ -434,6 +447,53 @@ static int auth_password(ssh_session session, const char *user,
|
|||||||
return SSH_AUTH_DENIED;
|
return SSH_AUTH_DENIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int auth_publickey(ssh_session session,
|
||||||
|
const char *user,
|
||||||
|
struct ssh_key_struct *pubkey,
|
||||||
|
char signature_state,
|
||||||
|
void *userdata)
|
||||||
|
{
|
||||||
|
struct session_data_struct *sdata = (struct session_data_struct *) userdata;
|
||||||
|
|
||||||
|
(void) user;
|
||||||
|
(void) session;
|
||||||
|
|
||||||
|
if (signature_state == SSH_PUBLICKEY_STATE_NONE) {
|
||||||
|
return SSH_AUTH_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (signature_state != SSH_PUBLICKEY_STATE_VALID) {
|
||||||
|
return SSH_AUTH_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// valid so far. Now look through authorized keys for a match
|
||||||
|
if (authorizedkeys[0]) {
|
||||||
|
ssh_key key = NULL;
|
||||||
|
int result;
|
||||||
|
struct stat buf;
|
||||||
|
|
||||||
|
if (stat(authorizedkeys, &buf) == 0) {
|
||||||
|
result = ssh_pki_import_pubkey_file( authorizedkeys, &key );
|
||||||
|
if ((result != SSH_OK) || (key==NULL)) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"Unable to import public key file %s\n",
|
||||||
|
authorizedkeys);
|
||||||
|
} else {
|
||||||
|
result = ssh_key_cmp( key, pubkey, SSH_KEY_CMP_PUBLIC );
|
||||||
|
ssh_key_free(key);
|
||||||
|
if (result == 0) {
|
||||||
|
sdata->authenticated = 1;
|
||||||
|
return SSH_AUTH_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// no matches
|
||||||
|
sdata->authenticated = 0;
|
||||||
|
return SSH_AUTH_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
static ssh_channel channel_open(ssh_session session, void *userdata) {
|
static ssh_channel channel_open(ssh_session session, void *userdata) {
|
||||||
struct session_data_struct *sdata = (struct session_data_struct *) userdata;
|
struct session_data_struct *sdata = (struct session_data_struct *) userdata;
|
||||||
|
|
||||||
@@ -472,7 +532,8 @@ static int process_stderr(socket_t fd, int revents, void *userdata) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void handle_session(ssh_event event, ssh_session session) {
|
static void handle_session(ssh_event event, ssh_session session) {
|
||||||
int n, rc;
|
int n;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
/* Structure for storing the pty size. */
|
/* Structure for storing the pty size. */
|
||||||
struct winsize wsize = {
|
struct winsize wsize = {
|
||||||
@@ -517,6 +578,12 @@ static void handle_session(ssh_event event, ssh_session session) {
|
|||||||
.channel_open_request_session_function = channel_open,
|
.channel_open_request_session_function = channel_open,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (authorizedkeys[0]) {
|
||||||
|
server_cb.auth_pubkey_function = auth_publickey;
|
||||||
|
ssh_set_auth_methods(session, SSH_AUTH_METHOD_PASSWORD | SSH_AUTH_METHOD_PUBLICKEY);
|
||||||
|
} else
|
||||||
|
ssh_set_auth_methods(session, SSH_AUTH_METHOD_PASSWORD);
|
||||||
|
|
||||||
ssh_callbacks_init(&server_cb);
|
ssh_callbacks_init(&server_cb);
|
||||||
ssh_callbacks_init(&channel_cb);
|
ssh_callbacks_init(&channel_cb);
|
||||||
|
|
||||||
@@ -527,7 +594,6 @@ static void handle_session(ssh_event event, ssh_session session) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ssh_set_auth_methods(session, SSH_AUTH_METHOD_PASSWORD);
|
|
||||||
ssh_event_add_session(event, session);
|
ssh_event_add_session(event, session);
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|||||||
654
examples/sshd_direct-tcpip.c
Normal file
@@ -0,0 +1,654 @@
|
|||||||
|
/* This is a sample implementation of a libssh based SSH server */
|
||||||
|
/*
|
||||||
|
Copyright 2003-2009 Aris Adamantiadis
|
||||||
|
Copyright 2018 T. Wimmer
|
||||||
|
|
||||||
|
This file is part of the SSH Library
|
||||||
|
|
||||||
|
You are free to copy this file, modify it in any way, consider it being public
|
||||||
|
domain. This does not apply to the rest of the library though, but it is
|
||||||
|
allowed to cut-and-paste working code from this file to any license of
|
||||||
|
program.
|
||||||
|
The goal is to show the API in action. It's not a reference on how terminal
|
||||||
|
clients must be made or how a client should react.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Example:
|
||||||
|
./sshd_direct-tcpip -v -p 2022 -d serverkey.dsa -r serverkey.rsa 127.0.0.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <libssh/libssh.h>
|
||||||
|
#include <libssh/server.h>
|
||||||
|
#include <libssh/callbacks.h>
|
||||||
|
#include <libssh/channels.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_ARGP_H
|
||||||
|
#include <argp.h>
|
||||||
|
#endif
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <poll.h>
|
||||||
|
|
||||||
|
#ifndef KEYS_FOLDER
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define KEYS_FOLDER
|
||||||
|
#else
|
||||||
|
#define KEYS_FOLDER "/etc/ssh/"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USER "user"
|
||||||
|
#define PASSWORD "pwd"
|
||||||
|
|
||||||
|
struct event_fd_data_struct {
|
||||||
|
int *p_fd;
|
||||||
|
ssh_channel channel;
|
||||||
|
struct ssh_channel_callbacks_struct *cb_chan;
|
||||||
|
int stacked;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct cleanup_node_struct {
|
||||||
|
struct event_fd_data_struct *data;
|
||||||
|
struct cleanup_node_struct *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
static bool authenticated = false;
|
||||||
|
static int tries = 0;
|
||||||
|
static bool error_set = false;
|
||||||
|
static int sockets_cnt = 0;
|
||||||
|
static ssh_event mainloop = NULL;
|
||||||
|
static struct cleanup_node_struct *cleanup_stack = NULL;
|
||||||
|
|
||||||
|
static void _close_socket(struct event_fd_data_struct event_fd_data);
|
||||||
|
|
||||||
|
static void cleanup_push(struct cleanup_node_struct** head_ref, struct event_fd_data_struct *new_data) {
|
||||||
|
// Allocate memory for node
|
||||||
|
struct cleanup_node_struct *new_node = malloc(sizeof *new_node);
|
||||||
|
|
||||||
|
new_node->next = (*head_ref);
|
||||||
|
|
||||||
|
// Copy new_data
|
||||||
|
new_node->data = new_data;
|
||||||
|
|
||||||
|
// Change head pointer as new node is added at the beginning
|
||||||
|
(*head_ref) = new_node;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void do_cleanup(struct cleanup_node_struct **head_ref) {
|
||||||
|
struct cleanup_node_struct *current = (*head_ref);
|
||||||
|
struct cleanup_node_struct *previous = NULL, *gone = NULL;
|
||||||
|
|
||||||
|
while (current != NULL) {
|
||||||
|
if (ssh_channel_is_closed(current->data->channel)) {
|
||||||
|
if (current == (*head_ref)) {
|
||||||
|
(*head_ref) = current->next;
|
||||||
|
}
|
||||||
|
if (previous != NULL) {
|
||||||
|
previous->next = current->next;
|
||||||
|
}
|
||||||
|
gone = current;
|
||||||
|
current = current->next;
|
||||||
|
|
||||||
|
if (gone->data->channel) {
|
||||||
|
_close_socket(*gone->data);
|
||||||
|
ssh_remove_channel_callbacks(gone->data->channel, gone->data->cb_chan);
|
||||||
|
ssh_channel_free(gone->data->channel);
|
||||||
|
gone->data->channel = NULL;
|
||||||
|
|
||||||
|
SAFE_FREE(gone->data->p_fd);
|
||||||
|
SAFE_FREE(gone->data->cb_chan);
|
||||||
|
SAFE_FREE(gone->data);
|
||||||
|
SAFE_FREE(gone);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "channel already freed!\n");
|
||||||
|
}
|
||||||
|
_ssh_log(SSH_LOG_FUNCTIONS, "=== do_cleanup", "Freed.");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ssh_channel_close(current->data->channel);
|
||||||
|
previous = current;
|
||||||
|
current = current->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int auth_password(ssh_session session, const char *user,
|
||||||
|
const char *password, void *userdata) {
|
||||||
|
(void)userdata;
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== auth_password", "Authenticating user %s pwd %s",user, password);
|
||||||
|
if (strcmp(user,USER) == 0 && strcmp(password, PASSWORD) == 0){
|
||||||
|
authenticated = true;
|
||||||
|
printf("Authenticated\n");
|
||||||
|
return SSH_AUTH_SUCCESS;
|
||||||
|
}
|
||||||
|
if (tries >= 3){
|
||||||
|
printf("Too many authentication tries\n");
|
||||||
|
ssh_disconnect(session);
|
||||||
|
error_set = true;
|
||||||
|
return SSH_AUTH_DENIED;
|
||||||
|
}
|
||||||
|
tries++;
|
||||||
|
return SSH_AUTH_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int auth_gssapi_mic(ssh_session session, const char *user, const char *principal, void *userdata) {
|
||||||
|
ssh_gssapi_creds creds = ssh_gssapi_get_creds(session);
|
||||||
|
(void)userdata;
|
||||||
|
printf("Authenticating user %s with gssapi principal %s\n", user, principal);
|
||||||
|
if (creds != NULL)
|
||||||
|
printf("Received some gssapi credentials\n");
|
||||||
|
else
|
||||||
|
printf("Not received any forwardable creds\n");
|
||||||
|
printf("authenticated\n");
|
||||||
|
authenticated = true;
|
||||||
|
return SSH_AUTH_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int subsystem_request(ssh_session session, ssh_channel channel, const char *subsystem, void *userdata) {
|
||||||
|
(void)session;
|
||||||
|
(void)channel;
|
||||||
|
//(void)subsystem;
|
||||||
|
(void)userdata;
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== subsystem_request", "Channel subsystem reqeuest: %s", subsystem);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ssh_channel_callbacks_struct channel_cb = {
|
||||||
|
.channel_subsystem_request_function = subsystem_request
|
||||||
|
};
|
||||||
|
|
||||||
|
static ssh_channel new_session_channel(ssh_session session, void *userdata) {
|
||||||
|
(void)session;
|
||||||
|
(void)userdata;
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== subsystem_request", "Session channel request");
|
||||||
|
/* For TCP forward only there seems to be no need for a session channel */
|
||||||
|
/*if(chan != NULL)
|
||||||
|
return NULL;
|
||||||
|
printf("Session channel request\n");
|
||||||
|
chan = ssh_channel_new(session);
|
||||||
|
ssh_callbacks_init(&channel_cb);
|
||||||
|
ssh_set_channel_callbacks(chan, &channel_cb);
|
||||||
|
return chan;*/
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void stack_socket_close(UNUSED_PARAM(ssh_session session),
|
||||||
|
struct event_fd_data_struct *event_fd_data)
|
||||||
|
{
|
||||||
|
if (event_fd_data->stacked != 1) {
|
||||||
|
_ssh_log(SSH_LOG_FUNCTIONS, "=== stack_socket_close", "Closing fd = %d sockets_cnt = %d", *event_fd_data->p_fd, sockets_cnt);
|
||||||
|
event_fd_data->stacked = 1;
|
||||||
|
cleanup_push(&cleanup_stack, event_fd_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _close_socket(struct event_fd_data_struct event_fd_data) {
|
||||||
|
_ssh_log(SSH_LOG_FUNCTIONS, "=== close_socket", "Closing fd = %d sockets_cnt = %d", *event_fd_data.p_fd, sockets_cnt);
|
||||||
|
ssh_event_remove_fd(mainloop, *event_fd_data.p_fd);
|
||||||
|
sockets_cnt--;
|
||||||
|
#ifdef _WIN32
|
||||||
|
closesocket(*event_fd_data.p_fd);
|
||||||
|
#else
|
||||||
|
close(*event_fd_data.p_fd);
|
||||||
|
#endif // _WIN32
|
||||||
|
(*event_fd_data.p_fd) = SSH_INVALID_SOCKET;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int service_request(ssh_session session, const char *service, void *userdata) {
|
||||||
|
(void)session;
|
||||||
|
//(void)service;
|
||||||
|
(void)userdata;
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== service_request", "Service request: %s", service);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void global_request(ssh_session session, ssh_message message, void *userdata) {
|
||||||
|
(void)session;
|
||||||
|
(void)userdata;
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== global_request", "Global request, message type: %d", ssh_message_type(message));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void my_channel_close_function(ssh_session session, ssh_channel channel, void *userdata) {
|
||||||
|
struct event_fd_data_struct *event_fd_data = (struct event_fd_data_struct *)userdata;
|
||||||
|
(void)session;
|
||||||
|
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== my_channel_close_function", "Channel %d:%d closed by remote. State=%d", channel->local_channel, channel->remote_channel, channel->state);
|
||||||
|
|
||||||
|
stack_socket_close(session, event_fd_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void my_channel_eof_function(ssh_session session, ssh_channel channel, void *userdata) {
|
||||||
|
struct event_fd_data_struct *event_fd_data = (struct event_fd_data_struct *)userdata;
|
||||||
|
(void)session;
|
||||||
|
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== my_channel_eof_function", "Got EOF on channel %d:%d. Shuting down write on socket (fd = %d).", channel->local_channel, channel->remote_channel, *event_fd_data->p_fd);
|
||||||
|
|
||||||
|
stack_socket_close(session, event_fd_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void my_channel_exit_status_function(ssh_session session, ssh_channel channel, int exit_status, void *userdata) {
|
||||||
|
struct event_fd_data_struct *event_fd_data = (struct event_fd_data_struct *)userdata;
|
||||||
|
(void)session;
|
||||||
|
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== my_channel_exit_status_function", "Got exit status %d on channel %d:%d fd = %d.", exit_status, channel->local_channel, channel->remote_channel, *event_fd_data->p_fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int my_channel_data_function(ssh_session session,
|
||||||
|
ssh_channel channel,
|
||||||
|
void *data,
|
||||||
|
uint32_t len,
|
||||||
|
UNUSED_PARAM(int is_stderr),
|
||||||
|
void *userdata)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
struct event_fd_data_struct *event_fd_data = (struct event_fd_data_struct *)userdata;
|
||||||
|
|
||||||
|
if (event_fd_data->channel == NULL) {
|
||||||
|
fprintf(stderr, "Why we're here? Stacked = %d\n", event_fd_data->stacked);
|
||||||
|
}
|
||||||
|
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== my_channel_data_function", "%d bytes waiting on channel %d:%d for reading. Fd = %d",len, channel->local_channel, channel->remote_channel, *event_fd_data->p_fd);
|
||||||
|
if (len > 0) {
|
||||||
|
i = send(*event_fd_data->p_fd, data, len, 0);
|
||||||
|
}
|
||||||
|
if (i < 0) {
|
||||||
|
_ssh_log(SSH_LOG_WARNING, "=== my_channel_data_function", "Writing to tcp socket %d: %s", *event_fd_data->p_fd, strerror(errno));
|
||||||
|
stack_socket_close(session, event_fd_data);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_ssh_log(SSH_LOG_FUNCTIONS, "=== my_channel_data_function", "Sent %d bytes", i);
|
||||||
|
}
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int my_fd_data_function(UNUSED_PARAM(socket_t fd),
|
||||||
|
int revents,
|
||||||
|
void *userdata)
|
||||||
|
{
|
||||||
|
struct event_fd_data_struct *event_fd_data = (struct event_fd_data_struct *)userdata;
|
||||||
|
ssh_channel channel = event_fd_data->channel;
|
||||||
|
ssh_session session;
|
||||||
|
int len, i, wr;
|
||||||
|
char buf[16384];
|
||||||
|
int blocking;
|
||||||
|
|
||||||
|
if (channel == NULL) {
|
||||||
|
_ssh_log(SSH_LOG_FUNCTIONS, "=== my_fd_data_function", "channel == NULL!");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
session = ssh_channel_get_session(channel);
|
||||||
|
|
||||||
|
if (ssh_channel_is_closed(channel)) {
|
||||||
|
_ssh_log(SSH_LOG_FUNCTIONS, "=== my_fd_data_function", "channel is closed!");
|
||||||
|
stack_socket_close(session, event_fd_data);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(revents & POLLIN)) {
|
||||||
|
if (revents & POLLPRI) {
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== my_fd_data_function", "poll revents & POLLPRI");
|
||||||
|
}
|
||||||
|
if (revents & POLLOUT) {
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== my_fd_data_function", "poll revents & POLLOUT");
|
||||||
|
}
|
||||||
|
if (revents & POLLHUP) {
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== my_fd_data_function", "poll revents & POLLHUP");
|
||||||
|
}
|
||||||
|
if (revents & POLLNVAL) {
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== my_fd_data_function", "poll revents & POLLNVAL");
|
||||||
|
}
|
||||||
|
if (revents & POLLERR) {
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== my_fd_data_function", "poll revents & POLLERR");
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
blocking = ssh_is_blocking(session);
|
||||||
|
ssh_set_blocking(session, 0);
|
||||||
|
|
||||||
|
_ssh_log(SSH_LOG_FUNCTIONS, "=== my_fd_data_function", "Trying to read from tcp socket fd = %d... (Channel %d:%d state=%d)",
|
||||||
|
*event_fd_data->p_fd, channel->local_channel, channel->remote_channel, channel->state);
|
||||||
|
#ifdef _WIN32
|
||||||
|
struct sockaddr from;
|
||||||
|
int fromlen = sizeof(from);
|
||||||
|
len = recvfrom(*event_fd_data->p_fd, buf, sizeof(buf), 0, &from, &fromlen);
|
||||||
|
#else
|
||||||
|
len = recv(*event_fd_data->p_fd, buf, sizeof(buf), 0);
|
||||||
|
#endif // _WIN32
|
||||||
|
if (len < 0) {
|
||||||
|
_ssh_log(SSH_LOG_WARNING, "=== my_fd_data_function", "Reading from tcp socket: %s", strerror(errno));
|
||||||
|
|
||||||
|
ssh_channel_send_eof(channel);
|
||||||
|
}
|
||||||
|
else if (len > 0) {
|
||||||
|
if (ssh_channel_is_open(channel)) {
|
||||||
|
wr = 0;
|
||||||
|
do {
|
||||||
|
i = ssh_channel_write(channel, buf, len);
|
||||||
|
if (i < 0) {
|
||||||
|
_ssh_log(SSH_LOG_WARNING, "=== my_fd_data_function", "Error writing on the direct-tcpip channel: %d", i);
|
||||||
|
len = wr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
wr += i;
|
||||||
|
_ssh_log(SSH_LOG_FUNCTIONS, "=== my_fd_data_function", "channel_write (%d from %d)", wr, len);
|
||||||
|
} while (i > 0 && wr < len);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_ssh_log(SSH_LOG_WARNING, "=== my_fd_data_function", "Can't write on closed channel!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== my_fd_data_function", "The destination host has disconnected!");
|
||||||
|
|
||||||
|
ssh_channel_close(channel);
|
||||||
|
#ifdef _WIN32
|
||||||
|
shutdown(*event_fd_data->p_fd, SD_RECEIVE);
|
||||||
|
#else
|
||||||
|
shutdown(*event_fd_data->p_fd, SHUT_RD);
|
||||||
|
#endif // _WIN32
|
||||||
|
}
|
||||||
|
ssh_set_blocking(session, blocking);
|
||||||
|
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int open_tcp_socket(ssh_message msg) {
|
||||||
|
struct sockaddr_in sin;
|
||||||
|
int forwardsock = -1;
|
||||||
|
struct hostent *host;
|
||||||
|
const char *dest_hostname;
|
||||||
|
int dest_port;
|
||||||
|
|
||||||
|
forwardsock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
if (forwardsock < 0) {
|
||||||
|
_ssh_log(SSH_LOG_WARNING, "=== open_tcp_socket", "ERROR opening socket: %s", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
dest_hostname = ssh_message_channel_request_open_destination(msg);
|
||||||
|
dest_port = ssh_message_channel_request_open_destination_port(msg);
|
||||||
|
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== open_tcp_socket", "Connecting to %s on port %d", dest_hostname, dest_port);
|
||||||
|
|
||||||
|
host = gethostbyname(dest_hostname);
|
||||||
|
if (host == NULL) {
|
||||||
|
close(forwardsock);
|
||||||
|
_ssh_log(SSH_LOG_WARNING, "=== open_tcp_socket", "ERROR, no such host: %s", dest_hostname);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset((char *)&sin, '\0', sizeof(sin));
|
||||||
|
sin.sin_family = AF_INET;
|
||||||
|
memcpy((char *)&sin.sin_addr.s_addr, (char *)host->h_addr, host->h_length);
|
||||||
|
sin.sin_port = htons(dest_port);
|
||||||
|
|
||||||
|
if (connect(forwardsock, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
|
||||||
|
close(forwardsock);
|
||||||
|
_ssh_log(SSH_LOG_WARNING, "=== open_tcp_socket", "ERROR connecting: %s", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sockets_cnt++;
|
||||||
|
_ssh_log(SSH_LOG_FUNCTIONS, "=== open_tcp_socket", "Connected. sockets_cnt = %d", sockets_cnt);
|
||||||
|
return forwardsock;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int message_callback(ssh_session session, ssh_message message, void *userdata) {
|
||||||
|
ssh_channel channel;
|
||||||
|
int socket_fd, *pFd;
|
||||||
|
struct ssh_channel_callbacks_struct *cb_chan;
|
||||||
|
struct event_fd_data_struct *event_fd_data;
|
||||||
|
(void)session;
|
||||||
|
(void)message;
|
||||||
|
(void)userdata;
|
||||||
|
|
||||||
|
_ssh_log(SSH_LOG_PACKET, "=== message_callback", "Message type: %d", ssh_message_type(message));
|
||||||
|
_ssh_log(SSH_LOG_PACKET, "=== message_callback", "Message Subtype: %d", ssh_message_subtype(message));
|
||||||
|
if (ssh_message_type(message) == SSH_REQUEST_CHANNEL_OPEN) {
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== message_callback", "channel_request_open");
|
||||||
|
|
||||||
|
if (ssh_message_subtype(message) == SSH_CHANNEL_DIRECT_TCPIP) {
|
||||||
|
channel = ssh_message_channel_request_open_reply_accept(message);
|
||||||
|
|
||||||
|
if (channel == NULL) {
|
||||||
|
_ssh_log(SSH_LOG_WARNING, "=== message_callback", "Accepting direct-tcpip channel failed!");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
_ssh_log(SSH_LOG_PROTOCOL, "=== message_callback", "Connected to channel!");
|
||||||
|
|
||||||
|
socket_fd = open_tcp_socket(message);
|
||||||
|
if (-1 == socket_fd) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFd = malloc(sizeof *pFd);
|
||||||
|
cb_chan = malloc(sizeof *cb_chan);
|
||||||
|
event_fd_data = malloc(sizeof *event_fd_data);
|
||||||
|
|
||||||
|
(*pFd) = socket_fd;
|
||||||
|
event_fd_data->channel = channel;
|
||||||
|
event_fd_data->p_fd = pFd;
|
||||||
|
event_fd_data->stacked = 0;
|
||||||
|
event_fd_data->cb_chan = cb_chan;
|
||||||
|
|
||||||
|
cb_chan->userdata = event_fd_data;
|
||||||
|
cb_chan->channel_eof_function = my_channel_eof_function;
|
||||||
|
cb_chan->channel_close_function = my_channel_close_function;
|
||||||
|
cb_chan->channel_data_function = my_channel_data_function;
|
||||||
|
cb_chan->channel_exit_status_function = my_channel_exit_status_function;
|
||||||
|
|
||||||
|
ssh_callbacks_init(cb_chan);
|
||||||
|
ssh_set_channel_callbacks(channel, cb_chan);
|
||||||
|
|
||||||
|
ssh_event_add_fd(mainloop, (socket_t)*pFd, POLLIN, my_fd_data_function, event_fd_data);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ARGP_H
|
||||||
|
const char *argp_program_version = "libssh server example "
|
||||||
|
SSH_STRINGIFY(LIBSSH_VERSION);
|
||||||
|
const char *argp_program_bug_address = "<libssh@libssh.org>";
|
||||||
|
|
||||||
|
/* Program documentation. */
|
||||||
|
static char doc[] = "libssh -- a Secure Shell protocol implementation";
|
||||||
|
|
||||||
|
/* A description of the arguments we accept. */
|
||||||
|
static char args_doc[] = "BINDADDR";
|
||||||
|
|
||||||
|
/* The options we understand. */
|
||||||
|
static struct argp_option options[] = {
|
||||||
|
{
|
||||||
|
.name = "port",
|
||||||
|
.key = 'p',
|
||||||
|
.arg = "PORT",
|
||||||
|
.flags = 0,
|
||||||
|
.doc = "Set the port to bind.",
|
||||||
|
.group = 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "hostkey",
|
||||||
|
.key = 'k',
|
||||||
|
.arg = "FILE",
|
||||||
|
.flags = 0,
|
||||||
|
.doc = "Set the host key.",
|
||||||
|
.group = 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "dsakey",
|
||||||
|
.key = 'd',
|
||||||
|
.arg = "FILE",
|
||||||
|
.flags = 0,
|
||||||
|
.doc = "Set the dsa key.",
|
||||||
|
.group = 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "rsakey",
|
||||||
|
.key = 'r',
|
||||||
|
.arg = "FILE",
|
||||||
|
.flags = 0,
|
||||||
|
.doc = "Set the rsa key.",
|
||||||
|
.group = 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "verbose",
|
||||||
|
.key = 'v',
|
||||||
|
.arg = NULL,
|
||||||
|
.flags = 0,
|
||||||
|
.doc = "Get verbose output.",
|
||||||
|
.group = 0
|
||||||
|
},
|
||||||
|
{NULL, 0, NULL, 0, NULL, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Parse a single option. */
|
||||||
|
static error_t parse_opt (int key, char *arg, struct argp_state *state) {
|
||||||
|
/* Get the input argument from argp_parse, which we
|
||||||
|
* know is a pointer to our arguments structure.
|
||||||
|
*/
|
||||||
|
ssh_bind sshbind = state->input;
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 'p':
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDPORT_STR, arg);
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_DSAKEY, arg);
|
||||||
|
break;
|
||||||
|
case 'k':
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, arg);
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY, arg);
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_LOG_VERBOSITY_STR, "1");
|
||||||
|
break;
|
||||||
|
case ARGP_KEY_ARG:
|
||||||
|
if (state->arg_num >= 1) {
|
||||||
|
/* Too many arguments. */
|
||||||
|
argp_usage (state);
|
||||||
|
}
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_BINDADDR, arg);
|
||||||
|
break;
|
||||||
|
case ARGP_KEY_END:
|
||||||
|
if (state->arg_num < 1) {
|
||||||
|
/* Not enough arguments. */
|
||||||
|
argp_usage (state);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return ARGP_ERR_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Our argp parser. */
|
||||||
|
static struct argp argp = {options, parse_opt, args_doc, doc, NULL, NULL, NULL};
|
||||||
|
#endif /* HAVE_ARGP_H */
|
||||||
|
|
||||||
|
int main(int argc, char **argv){
|
||||||
|
ssh_session session;
|
||||||
|
ssh_bind sshbind;
|
||||||
|
struct ssh_server_callbacks_struct cb = {
|
||||||
|
.userdata = NULL,
|
||||||
|
.auth_password_function = auth_password,
|
||||||
|
.auth_gssapi_mic_function = auth_gssapi_mic,
|
||||||
|
.channel_open_request_session_function = new_session_channel,
|
||||||
|
.service_request_function = service_request
|
||||||
|
};
|
||||||
|
struct ssh_callbacks_struct cb_gen = {
|
||||||
|
.userdata = NULL,
|
||||||
|
.global_request_function = global_request
|
||||||
|
};
|
||||||
|
|
||||||
|
int ret = 1;
|
||||||
|
|
||||||
|
sshbind = ssh_bind_new();
|
||||||
|
session = ssh_new();
|
||||||
|
mainloop = ssh_event_new();
|
||||||
|
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_DSAKEY, KEYS_FOLDER "ssh_host_dsa_key");
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY, KEYS_FOLDER "ssh_host_rsa_key");
|
||||||
|
|
||||||
|
#ifdef HAVE_ARGP_H
|
||||||
|
/*
|
||||||
|
* Parse our arguments; every option seen by parse_opt will
|
||||||
|
* be reflected in arguments.
|
||||||
|
*/
|
||||||
|
argp_parse (&argp, argc, argv, 0, 0, sshbind);
|
||||||
|
#else
|
||||||
|
(void)argc;
|
||||||
|
(void)argv;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (ssh_bind_listen(sshbind) < 0) {
|
||||||
|
printf("Error listening to socket: %s\n", ssh_get_error(sshbind));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ssh_bind_accept(sshbind, session) == SSH_ERROR) {
|
||||||
|
printf("error accepting a connection : %s\n", ssh_get_error(sshbind));
|
||||||
|
ret = 1;
|
||||||
|
goto shutdown;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_callbacks_init(&cb);
|
||||||
|
ssh_callbacks_init(&cb_gen);
|
||||||
|
ssh_set_server_callbacks(session, &cb);
|
||||||
|
ssh_set_callbacks(session, &cb_gen);
|
||||||
|
ssh_set_message_callback(session, message_callback, (void *)NULL);
|
||||||
|
|
||||||
|
if (ssh_handle_key_exchange(session)) {
|
||||||
|
printf("ssh_handle_key_exchange: %s\n", ssh_get_error(session));
|
||||||
|
ret = 1;
|
||||||
|
goto shutdown;
|
||||||
|
}
|
||||||
|
ssh_set_auth_methods(session, SSH_AUTH_METHOD_PASSWORD | SSH_AUTH_METHOD_GSSAPI_MIC);
|
||||||
|
ssh_event_add_session(mainloop, session);
|
||||||
|
|
||||||
|
while (!authenticated) {
|
||||||
|
if (error_set) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ssh_event_dopoll(mainloop, -1) == SSH_ERROR) {
|
||||||
|
printf("Error : %s\n", ssh_get_error(session));
|
||||||
|
ret = 1;
|
||||||
|
goto shutdown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (error_set) {
|
||||||
|
printf("Error, exiting loop\n");
|
||||||
|
} else {
|
||||||
|
printf("Authenticated and got a channel\n");
|
||||||
|
|
||||||
|
while (!error_set) {
|
||||||
|
if (ssh_event_dopoll(mainloop, 100) == SSH_ERROR) {
|
||||||
|
printf("Error : %s\n", ssh_get_error(session));
|
||||||
|
ret = 1;
|
||||||
|
goto shutdown;
|
||||||
|
}
|
||||||
|
do_cleanup(&cleanup_stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
shutdown:
|
||||||
|
ssh_disconnect(session);
|
||||||
|
ssh_bind_free(sshbind);
|
||||||
|
ssh_finalize();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
@@ -43,7 +43,8 @@ const char *port="22";
|
|||||||
char *pcap_file=NULL;
|
char *pcap_file=NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void usage(){
|
static void usage(void)
|
||||||
|
{
|
||||||
fprintf(stderr,"Usage : sshnetcat [user@]host forwarded_host forwarded_port\n");
|
fprintf(stderr,"Usage : sshnetcat [user@]host forwarded_host forwarded_port\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -89,6 +90,7 @@ static void select_loop(ssh_session session,ssh_channel channel){
|
|||||||
do{
|
do{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
|
ZERO_STRUCT(fds);
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
if(!eof)
|
if(!eof)
|
||||||
FD_SET(0,&fds);
|
FD_SET(0,&fds);
|
||||||
|
|||||||
@@ -66,6 +66,9 @@
|
|||||||
#define SSH_COM_AGENT2_FAILURE 102
|
#define SSH_COM_AGENT2_FAILURE 102
|
||||||
|
|
||||||
#define SSH_AGENT_OLD_SIGNATURE 0x01
|
#define SSH_AGENT_OLD_SIGNATURE 0x01
|
||||||
|
/* Signature flags from draft-miller-ssh-agent-02 */
|
||||||
|
#define SSH_AGENT_RSA_SHA2_256 0x02
|
||||||
|
#define SSH_AGENT_RSA_SHA2_512 0x04
|
||||||
|
|
||||||
struct ssh_agent_struct {
|
struct ssh_agent_struct {
|
||||||
struct ssh_socket_struct *sock;
|
struct ssh_socket_struct *sock;
|
||||||
|
|||||||
@@ -76,6 +76,14 @@ enum ssh_auth_state_e {
|
|||||||
SSH_AUTH_STATE_GSSAPI_TOKEN,
|
SSH_AUTH_STATE_GSSAPI_TOKEN,
|
||||||
/** We have sent the MIC and expecting to be authenticated */
|
/** We have sent the MIC and expecting to be authenticated */
|
||||||
SSH_AUTH_STATE_GSSAPI_MIC_SENT,
|
SSH_AUTH_STATE_GSSAPI_MIC_SENT,
|
||||||
|
/** We have offered a pubkey to check if it is supported */
|
||||||
|
SSH_AUTH_STATE_PUBKEY_OFFER_SENT,
|
||||||
|
/** We have sent pubkey and signature expecting to be authenticated */
|
||||||
|
SSH_AUTH_STATE_PUBKEY_AUTH_SENT,
|
||||||
|
/** We have sent a password expecting to be authenticated */
|
||||||
|
SSH_AUTH_STATE_PASSWORD_AUTH_SENT,
|
||||||
|
/** We have sent a request without auth information (method 'none') */
|
||||||
|
SSH_AUTH_STATE_AUTH_NONE_SENT,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @internal
|
/** @internal
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "libssh/libmbedcrypto.h"
|
#include "libssh/libmbedcrypto.h"
|
||||||
|
|
||||||
bignum ssh_make_string_bn(ssh_string string);
|
bignum ssh_make_string_bn(ssh_string string);
|
||||||
void ssh_make_string_bn_inplace(ssh_string string, bignum bnout);
|
|
||||||
ssh_string ssh_make_bignum_string(bignum num);
|
ssh_string ssh_make_bignum_string(bignum num);
|
||||||
void ssh_print_bignum(const char *which, const bignum num);
|
void ssh_print_bignum(const char *which, const bignum num);
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ struct ssh_bind_struct {
|
|||||||
unsigned int bindport;
|
unsigned int bindport;
|
||||||
int blocking;
|
int blocking;
|
||||||
int toaccept;
|
int toaccept;
|
||||||
|
bool config_processed;
|
||||||
|
char *config_dir;
|
||||||
|
char *pubkey_accepted_key_types;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ssh_poll_handle_struct *ssh_bind_get_poll(struct ssh_bind_struct
|
struct ssh_poll_handle_struct *ssh_bind_get_poll(struct ssh_bind_struct
|
||||||
|
|||||||
64
include/libssh/bind_config.h
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* bind_config.h - Parse the SSH server configuration file
|
||||||
|
*
|
||||||
|
* This file is part of the SSH Library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 by Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Author: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
|
||||||
|
*
|
||||||
|
* The SSH Library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* The SSH Library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with the SSH Library; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
|
* MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BIND_CONFIG_H_
|
||||||
|
#define BIND_CONFIG_H_
|
||||||
|
|
||||||
|
#include "libssh/server.h"
|
||||||
|
|
||||||
|
enum ssh_bind_config_opcode_e {
|
||||||
|
/* Known but not allowed in Match block */
|
||||||
|
BIND_CFG_NOT_ALLOWED_IN_MATCH = -4,
|
||||||
|
/* Unknown opcode */
|
||||||
|
BIND_CFG_UNKNOWN = -3,
|
||||||
|
/* Known and not applicable to libssh */
|
||||||
|
BIND_CFG_NA = -2,
|
||||||
|
/* Known but not supported by current libssh version */
|
||||||
|
BIND_CFG_UNSUPPORTED = -1,
|
||||||
|
BIND_CFG_INCLUDE,
|
||||||
|
BIND_CFG_HOSTKEY,
|
||||||
|
BIND_CFG_LISTENADDRESS,
|
||||||
|
BIND_CFG_PORT,
|
||||||
|
BIND_CFG_LOGLEVEL,
|
||||||
|
BIND_CFG_CIPHERS,
|
||||||
|
BIND_CFG_MACS,
|
||||||
|
BIND_CFG_KEXALGORITHMS,
|
||||||
|
BIND_CFG_MATCH,
|
||||||
|
BIND_CFG_PUBKEY_ACCEPTED_KEY_TYPES,
|
||||||
|
BIND_CFG_HOSTKEY_ALGORITHMS,
|
||||||
|
|
||||||
|
BIND_CFG_MAX /* Keep this one last in the list */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* @brief Parse configuration file and set the options to the given ssh_bind
|
||||||
|
*
|
||||||
|
* @params[in] sshbind The ssh_bind context to be configured
|
||||||
|
* @params[in] filename The path to the configuration file
|
||||||
|
*
|
||||||
|
* @returns 0 on successful parsing the configuration file, -1 on error
|
||||||
|
*/
|
||||||
|
int ssh_bind_config_parse_file(ssh_bind sshbind, const char *filename);
|
||||||
|
|
||||||
|
#endif /* BIND_CONFIG_H_ */
|
||||||
@@ -24,20 +24,6 @@
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "libssh/libssh.h"
|
#include "libssh/libssh.h"
|
||||||
/*
|
|
||||||
* Describes a buffer state
|
|
||||||
* [XXXXXXXXXXXXDATA PAYLOAD XXXXXXXXXXXXXXXXXXXXXXXX]
|
|
||||||
* ^ ^ ^ ^]
|
|
||||||
* \_data points\_pos points here \_used points here | /
|
|
||||||
* here Allocated
|
|
||||||
*/
|
|
||||||
struct ssh_buffer_struct {
|
|
||||||
char *data;
|
|
||||||
uint32_t used;
|
|
||||||
uint32_t allocated;
|
|
||||||
uint32_t pos;
|
|
||||||
int secure;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define SSH_BUFFER_PACK_END ((uint32_t) 0x4f65feb3)
|
#define SSH_BUFFER_PACK_END ((uint32_t) 0x4f65feb3)
|
||||||
|
|
||||||
@@ -54,21 +40,21 @@ void *ssh_buffer_allocate(struct ssh_buffer_struct *buffer, uint32_t len);
|
|||||||
int ssh_buffer_allocate_size(struct ssh_buffer_struct *buffer, uint32_t len);
|
int ssh_buffer_allocate_size(struct ssh_buffer_struct *buffer, uint32_t len);
|
||||||
int ssh_buffer_pack_va(struct ssh_buffer_struct *buffer,
|
int ssh_buffer_pack_va(struct ssh_buffer_struct *buffer,
|
||||||
const char *format,
|
const char *format,
|
||||||
int argc,
|
size_t argc,
|
||||||
va_list ap);
|
va_list ap);
|
||||||
int _ssh_buffer_pack(struct ssh_buffer_struct *buffer,
|
int _ssh_buffer_pack(struct ssh_buffer_struct *buffer,
|
||||||
const char *format,
|
const char *format,
|
||||||
int argc,
|
size_t argc,
|
||||||
...);
|
...);
|
||||||
#define ssh_buffer_pack(buffer, format, ...) \
|
#define ssh_buffer_pack(buffer, format, ...) \
|
||||||
_ssh_buffer_pack((buffer), (format), __VA_NARG__(__VA_ARGS__), __VA_ARGS__, SSH_BUFFER_PACK_END)
|
_ssh_buffer_pack((buffer), (format), __VA_NARG__(__VA_ARGS__), __VA_ARGS__, SSH_BUFFER_PACK_END)
|
||||||
|
|
||||||
int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer,
|
int ssh_buffer_unpack_va(struct ssh_buffer_struct *buffer,
|
||||||
const char *format, int argc,
|
const char *format, size_t argc,
|
||||||
va_list ap);
|
va_list ap);
|
||||||
int _ssh_buffer_unpack(struct ssh_buffer_struct *buffer,
|
int _ssh_buffer_unpack(struct ssh_buffer_struct *buffer,
|
||||||
const char *format,
|
const char *format,
|
||||||
int argc,
|
size_t argc,
|
||||||
...);
|
...);
|
||||||
#define ssh_buffer_unpack(buffer, format, ...) \
|
#define ssh_buffer_unpack(buffer, format, ...) \
|
||||||
_ssh_buffer_unpack((buffer), (format), __VA_NARG__(__VA_ARGS__), __VA_ARGS__, SSH_BUFFER_PACK_END)
|
_ssh_buffer_unpack((buffer), (format), __VA_NARG__(__VA_ARGS__), __VA_ARGS__, SSH_BUFFER_PACK_END)
|
||||||
|
|||||||
90
include/libssh/bytearray.h
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the SSH Library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
#ifndef _BYTEARRAY_H
|
||||||
|
#define _BYTEARRAY_H
|
||||||
|
|
||||||
|
#define _DATA_BYTE_CONST(data, pos) \
|
||||||
|
((uint8_t)(((const uint8_t *)(data))[(pos)]))
|
||||||
|
|
||||||
|
#define _DATA_BYTE(data, pos) \
|
||||||
|
(((uint8_t *)(data))[(pos)])
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These macros pull or push integer values from byte arrays stored in
|
||||||
|
* little-endian byte order.
|
||||||
|
*/
|
||||||
|
#define PULL_LE_U8(data, pos) \
|
||||||
|
(_DATA_BYTE_CONST(data, pos))
|
||||||
|
|
||||||
|
#define PULL_LE_U16(data, pos) \
|
||||||
|
((uint16_t)PULL_LE_U8(data, pos) | ((uint16_t)(PULL_LE_U8(data, (pos) + 1))) << 8)
|
||||||
|
|
||||||
|
#define PULL_LE_U32(data, pos) \
|
||||||
|
((uint32_t)(PULL_LE_U16(data, pos) | ((uint32_t)PULL_LE_U16(data, (pos) + 2)) << 16))
|
||||||
|
|
||||||
|
#define PULL_LE_U64(data, pos) \
|
||||||
|
((uint64_t)(PULL_LE_U32(data, pos) | ((uint64_t)PULL_LE_U32(data, (pos) + 4)) << 32))
|
||||||
|
|
||||||
|
|
||||||
|
#define PUSH_LE_U8(data, pos, val) \
|
||||||
|
(_DATA_BYTE(data, pos) = ((uint8_t)(val)))
|
||||||
|
|
||||||
|
#define PUSH_LE_U16(data, pos, val) \
|
||||||
|
(PUSH_LE_U8((data), (pos), (uint8_t)((uint16_t)(val) & 0xff)), PUSH_LE_U8((data), (pos) + 1, (uint8_t)((uint16_t)(val) >> 8)))
|
||||||
|
|
||||||
|
#define PUSH_LE_U32(data, pos, val) \
|
||||||
|
(PUSH_LE_U16((data), (pos), (uint16_t)((uint32_t)(val) & 0xffff)), PUSH_LE_U16((data), (pos) + 2, (uint16_t)((uint32_t)(val) >> 16)))
|
||||||
|
|
||||||
|
#define PUSH_LE_U64(data, pos, val) \
|
||||||
|
(PUSH_LE_U32((data), (pos), (uint32_t)((uint64_t)(val) & 0xffffffff)), PUSH_LE_U32((data), (pos) + 4, (uint32_t)((uint64_t)(val) >> 32)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* These macros pull or push integer values from byte arrays stored in
|
||||||
|
* big-endian byte order (network byte order).
|
||||||
|
*/
|
||||||
|
#define PULL_BE_U8(data, pos) \
|
||||||
|
(_DATA_BYTE_CONST(data, pos))
|
||||||
|
|
||||||
|
#define PULL_BE_U16(data, pos) \
|
||||||
|
((((uint16_t)(PULL_BE_U8(data, pos))) << 8) | (uint16_t)PULL_BE_U8(data, (pos) + 1))
|
||||||
|
|
||||||
|
#define PULL_BE_U32(data, pos) \
|
||||||
|
((((uint32_t)PULL_BE_U16(data, pos)) << 16) | (uint32_t)(PULL_BE_U16(data, (pos) + 2)))
|
||||||
|
|
||||||
|
#define PULL_BE_U64(data, pos) \
|
||||||
|
((((uint64_t)PULL_BE_U32(data, pos)) << 32) | (uint64_t)(PULL_BE_U32(data, (pos) + 4)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define PUSH_BE_U8(data, pos, val) \
|
||||||
|
(_DATA_BYTE(data, pos) = ((uint8_t)(val)))
|
||||||
|
|
||||||
|
#define PUSH_BE_U16(data, pos, val) \
|
||||||
|
(PUSH_BE_U8((data), (pos), (uint8_t)(((uint16_t)(val)) >> 8)), PUSH_BE_U8((data), (pos) + 1, (uint8_t)((val) & 0xff)))
|
||||||
|
|
||||||
|
#define PUSH_BE_U32(data, pos, val) \
|
||||||
|
(PUSH_BE_U16((data), (pos), (uint16_t)(((uint32_t)(val)) >> 16)), PUSH_BE_U16((data), (pos) + 2, (uint16_t)((val) & 0xffff)))
|
||||||
|
|
||||||
|
#define PUSH_BE_U64(data, pos, val) \
|
||||||
|
(PUSH_BE_U32((data), (pos), (uint32_t)(((uint64_t)(val)) >> 32)), PUSH_BE_U32((data), (pos) + 4, (uint32_t)((val) & 0xffffffff)))
|
||||||
|
|
||||||
|
#endif /* _BYTEARRAY_H */
|
||||||
@@ -854,7 +854,7 @@ typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
|
|||||||
* @code
|
* @code
|
||||||
* struct ssh_channel_callbacks_struct cb = {
|
* struct ssh_channel_callbacks_struct cb = {
|
||||||
* .userdata = data,
|
* .userdata = data,
|
||||||
* .channel_data = my_channel_data_function
|
* .channel_data_function = my_channel_data_function
|
||||||
* };
|
* };
|
||||||
* ssh_callbacks_init(&cb);
|
* ssh_callbacks_init(&cb);
|
||||||
* ssh_set_channel_callbacks(channel, &cb);
|
* ssh_set_channel_callbacks(channel, &cb);
|
||||||
@@ -944,9 +944,20 @@ LIBSSH_API int ssh_threads_set_callbacks(struct ssh_threads_callbacks_struct
|
|||||||
*cb);
|
*cb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief returns a pointer on the pthread threads callbacks, to be used with
|
* @brief Returns a pointer to the appropriate callbacks structure for the
|
||||||
|
* environment, to be used with ssh_threads_set_callbacks.
|
||||||
|
*
|
||||||
|
* @returns A pointer to a ssh_threads_callbacks_struct to be used with
|
||||||
* ssh_threads_set_callbacks.
|
* ssh_threads_set_callbacks.
|
||||||
* @warning you have to link with the library ssh_threads.
|
*
|
||||||
|
* @see ssh_threads_set_callbacks
|
||||||
|
*/
|
||||||
|
LIBSSH_API struct ssh_threads_callbacks_struct *ssh_threads_get_default(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a pointer on the pthread threads callbacks, to be used with
|
||||||
|
* ssh_threads_set_callbacks.
|
||||||
|
*
|
||||||
* @see ssh_threads_set_callbacks
|
* @see ssh_threads_set_callbacks
|
||||||
*/
|
*/
|
||||||
LIBSSH_API struct ssh_threads_callbacks_struct *ssh_threads_get_pthread(void);
|
LIBSSH_API struct ssh_threads_callbacks_struct *ssh_threads_get_pthread(void);
|
||||||
|
|||||||
@@ -48,11 +48,16 @@ enum ssh_channel_state_e {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* The channel has been closed by the remote side */
|
/* The channel has been closed by the remote side */
|
||||||
#define SSH_CHANNEL_FLAG_CLOSED_REMOTE 0x1
|
#define SSH_CHANNEL_FLAG_CLOSED_REMOTE 0x0001
|
||||||
|
|
||||||
|
/* The channel has been closed locally */
|
||||||
|
#define SSH_CHANNEL_FLAG_CLOSED_LOCAL 0x0002
|
||||||
|
|
||||||
/* The channel has been freed by the calling program */
|
/* The channel has been freed by the calling program */
|
||||||
#define SSH_CHANNEL_FLAG_FREED_LOCAL 0x2
|
#define SSH_CHANNEL_FLAG_FREED_LOCAL 0x0004
|
||||||
|
|
||||||
/* the channel has not yet been bound to a remote one */
|
/* the channel has not yet been bound to a remote one */
|
||||||
#define SSH_CHANNEL_FLAG_NOT_BOUND 0x4
|
#define SSH_CHANNEL_FLAG_NOT_BOUND 0x0008
|
||||||
|
|
||||||
struct ssh_channel_struct {
|
struct ssh_channel_struct {
|
||||||
ssh_session session; /* SSH_SESSION pointer */
|
ssh_session session; /* SSH_SESSION pointer */
|
||||||
@@ -92,12 +97,15 @@ SSH_PACKET_CALLBACK(channel_rcv_close);
|
|||||||
SSH_PACKET_CALLBACK(channel_rcv_request);
|
SSH_PACKET_CALLBACK(channel_rcv_request);
|
||||||
SSH_PACKET_CALLBACK(channel_rcv_data);
|
SSH_PACKET_CALLBACK(channel_rcv_data);
|
||||||
|
|
||||||
ssh_channel ssh_channel_new(ssh_session session);
|
|
||||||
int channel_default_bufferize(ssh_channel channel, void *data, int len,
|
int channel_default_bufferize(ssh_channel channel, void *data, int len,
|
||||||
int is_stderr);
|
int is_stderr);
|
||||||
int ssh_channel_flush(ssh_channel channel);
|
int ssh_channel_flush(ssh_channel channel);
|
||||||
uint32_t ssh_channel_new_id(ssh_session session);
|
uint32_t ssh_channel_new_id(ssh_session session);
|
||||||
ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id);
|
ssh_channel ssh_channel_from_local(ssh_session session, uint32_t id);
|
||||||
void ssh_channel_do_free(ssh_channel channel);
|
void ssh_channel_do_free(ssh_channel channel);
|
||||||
|
int ssh_global_request(ssh_session session,
|
||||||
|
const char *request,
|
||||||
|
ssh_buffer buffer,
|
||||||
|
int reply);
|
||||||
|
|
||||||
#endif /* CHANNELS_H_ */
|
#endif /* CHANNELS_H_ */
|
||||||
|
|||||||
68
include/libssh/config.h
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* config.h - parse the ssh config file
|
||||||
|
*
|
||||||
|
* This file is part of the SSH Library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2018 by Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
*
|
||||||
|
* The SSH Library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* The SSH Library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with the SSH Library; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
|
* MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LIBSSH_CONFIG_H_
|
||||||
|
#define LIBSSH_CONFIG_H_
|
||||||
|
|
||||||
|
|
||||||
|
enum ssh_config_opcode_e {
|
||||||
|
/* Unknown opcode */
|
||||||
|
SOC_UNKNOWN = -3,
|
||||||
|
/* Known and not applicable to libssh */
|
||||||
|
SOC_NA = -2,
|
||||||
|
/* Known but not supported by current libssh version */
|
||||||
|
SOC_UNSUPPORTED = -1,
|
||||||
|
SOC_HOST,
|
||||||
|
SOC_MATCH,
|
||||||
|
SOC_HOSTNAME,
|
||||||
|
SOC_PORT,
|
||||||
|
SOC_USERNAME,
|
||||||
|
SOC_IDENTITY,
|
||||||
|
SOC_CIPHERS,
|
||||||
|
SOC_MACS,
|
||||||
|
SOC_COMPRESSION,
|
||||||
|
SOC_TIMEOUT,
|
||||||
|
SOC_PROTOCOL,
|
||||||
|
SOC_STRICTHOSTKEYCHECK,
|
||||||
|
SOC_KNOWNHOSTS,
|
||||||
|
SOC_PROXYCOMMAND,
|
||||||
|
SOC_PROXYJUMP,
|
||||||
|
SOC_GSSAPISERVERIDENTITY,
|
||||||
|
SOC_GSSAPICLIENTIDENTITY,
|
||||||
|
SOC_GSSAPIDELEGATECREDENTIALS,
|
||||||
|
SOC_INCLUDE,
|
||||||
|
SOC_BINDADDRESS,
|
||||||
|
SOC_GLOBALKNOWNHOSTSFILE,
|
||||||
|
SOC_LOGLEVEL,
|
||||||
|
SOC_HOSTKEYALGORITHMS,
|
||||||
|
SOC_KEXALGORITHMS,
|
||||||
|
SOC_GSSAPIAUTHENTICATION,
|
||||||
|
SOC_KBDINTERACTIVEAUTHENTICATION,
|
||||||
|
SOC_PASSWORDAUTHENTICATION,
|
||||||
|
SOC_PUBKEYAUTHENTICATION,
|
||||||
|
SOC_PUBKEYACCEPTEDTYPES,
|
||||||
|
SOC_REKEYLIMIT,
|
||||||
|
|
||||||
|
SOC_MAX /* Keep this one last in the list */
|
||||||
|
};
|
||||||
|
#endif /* LIBSSH_CONFIG_H_ */
|
||||||
57
include/libssh/config_parser.h
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
/*
|
||||||
|
* config_parser.h - Common configuration file parser functions
|
||||||
|
*
|
||||||
|
* This file is part of the SSH Library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 by Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Author: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
|
||||||
|
*
|
||||||
|
* The SSH Library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* The SSH Library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with the SSH Library; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
|
* MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CONFIG_PARSER_H_
|
||||||
|
#define CONFIG_PARSER_H_
|
||||||
|
|
||||||
|
char *ssh_config_get_cmd(char **str);
|
||||||
|
|
||||||
|
char *ssh_config_get_token(char **str);
|
||||||
|
|
||||||
|
long ssh_config_get_long(char **str, long notfound);
|
||||||
|
|
||||||
|
const char *ssh_config_get_str_tok(char **str, const char *def);
|
||||||
|
|
||||||
|
int ssh_config_get_yesno(char **str, int notfound);
|
||||||
|
|
||||||
|
/* @brief Parse SSH URI in format [user@]host[:port] from the given string
|
||||||
|
*
|
||||||
|
* @param[in] tok String to parse
|
||||||
|
* @param[out] username Pointer to the location, where the new username will
|
||||||
|
* be stored or NULL if we do not care about the result.
|
||||||
|
* @param[out] hostname Pointer to the location, where the new hostname will
|
||||||
|
* be stored or NULL if we do not care about the result.
|
||||||
|
* @param[out] port Pointer to the location, where the new port will
|
||||||
|
* be stored or NULL if we do not care about the result.
|
||||||
|
*
|
||||||
|
* @returns SSH_OK if the provided string is in format of SSH URI,
|
||||||
|
* SSH_ERROR on failure
|
||||||
|
*/
|
||||||
|
int ssh_config_parse_uri(const char *tok,
|
||||||
|
char **username,
|
||||||
|
char **hostname,
|
||||||
|
char **port);
|
||||||
|
|
||||||
|
#endif /* LIBSSH_CONFIG_H_ */
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* crc32.c - simple CRC32 code
|
|
||||||
*
|
|
||||||
* This file is part of the SSH Library
|
|
||||||
*
|
|
||||||
* Copyright (c) 2005 by Aris Adamantiadis
|
|
||||||
*
|
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 2.1 of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Lesser General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
|
||||||
* License along with this library; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _CRC32_H
|
|
||||||
#define _CRC32_H
|
|
||||||
|
|
||||||
uint32_t ssh_crc32(const char *buf, uint32_t len);
|
|
||||||
|
|
||||||
#endif /* _CRC32_H */
|
|
||||||
@@ -25,10 +25,13 @@
|
|||||||
#ifndef _CRYPTO_H_
|
#ifndef _CRYPTO_H_
|
||||||
#define _CRYPTO_H_
|
#define _CRYPTO_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBGCRYPT
|
#ifdef HAVE_LIBGCRYPT
|
||||||
#include <gcrypt.h>
|
#include <gcrypt.h>
|
||||||
|
#elif defined(HAVE_LIBMBEDCRYPTO)
|
||||||
|
#include <mbedtls/gcm.h>
|
||||||
#endif
|
#endif
|
||||||
#include "libssh/wrapper.h"
|
#include "libssh/wrapper.h"
|
||||||
|
|
||||||
@@ -42,17 +45,27 @@
|
|||||||
#ifdef HAVE_OPENSSL_ECDH_H
|
#ifdef HAVE_OPENSSL_ECDH_H
|
||||||
#include <openssl/ecdh.h>
|
#include <openssl/ecdh.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include "libssh/dh.h"
|
||||||
#include "libssh/ecdh.h"
|
#include "libssh/ecdh.h"
|
||||||
#include "libssh/kex.h"
|
#include "libssh/kex.h"
|
||||||
#include "libssh/curve25519.h"
|
#include "libssh/curve25519.h"
|
||||||
|
|
||||||
#define DIGEST_MAX_LEN 64
|
#define DIGEST_MAX_LEN 64
|
||||||
|
|
||||||
|
#define AES_GCM_TAGLEN 16
|
||||||
|
#define AES_GCM_IVLEN 12
|
||||||
|
|
||||||
enum ssh_key_exchange_e {
|
enum ssh_key_exchange_e {
|
||||||
/* diffie-hellman-group1-sha1 */
|
/* diffie-hellman-group1-sha1 */
|
||||||
SSH_KEX_DH_GROUP1_SHA1=1,
|
SSH_KEX_DH_GROUP1_SHA1=1,
|
||||||
/* diffie-hellman-group14-sha1 */
|
/* diffie-hellman-group14-sha1 */
|
||||||
SSH_KEX_DH_GROUP14_SHA1,
|
SSH_KEX_DH_GROUP14_SHA1,
|
||||||
|
#ifdef WITH_GEX
|
||||||
|
/* diffie-hellman-group-exchange-sha1 */
|
||||||
|
SSH_KEX_DH_GEX_SHA1,
|
||||||
|
/* diffie-hellman-group-exchange-sha256 */
|
||||||
|
SSH_KEX_DH_GEX_SHA256,
|
||||||
|
#endif /* WITH_GEX */
|
||||||
/* ecdh-sha2-nistp256 */
|
/* ecdh-sha2-nistp256 */
|
||||||
SSH_KEX_ECDH_SHA2_NISTP256,
|
SSH_KEX_ECDH_SHA2_NISTP256,
|
||||||
/* ecdh-sha2-nistp384 */
|
/* ecdh-sha2-nistp384 */
|
||||||
@@ -62,23 +75,38 @@ enum ssh_key_exchange_e {
|
|||||||
/* curve25519-sha256@libssh.org */
|
/* curve25519-sha256@libssh.org */
|
||||||
SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG,
|
SSH_KEX_CURVE25519_SHA256_LIBSSH_ORG,
|
||||||
/* curve25519-sha256 */
|
/* curve25519-sha256 */
|
||||||
SSH_KEX_CURVE25519_SHA256
|
SSH_KEX_CURVE25519_SHA256,
|
||||||
|
/* diffie-hellman-group16-sha512 */
|
||||||
|
SSH_KEX_DH_GROUP16_SHA512,
|
||||||
|
/* diffie-hellman-group18-sha512 */
|
||||||
|
SSH_KEX_DH_GROUP18_SHA512,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ssh_cipher_e {
|
enum ssh_cipher_e {
|
||||||
SSH_NO_CIPHER=0,
|
SSH_NO_CIPHER=0,
|
||||||
|
#ifdef WITH_BLOWFISH_CIPHER
|
||||||
SSH_BLOWFISH_CBC,
|
SSH_BLOWFISH_CBC,
|
||||||
|
#endif /* WITH_BLOWFISH_CIPHER */
|
||||||
SSH_3DES_CBC,
|
SSH_3DES_CBC,
|
||||||
SSH_AES128_CBC,
|
SSH_AES128_CBC,
|
||||||
SSH_AES192_CBC,
|
SSH_AES192_CBC,
|
||||||
SSH_AES256_CBC,
|
SSH_AES256_CBC,
|
||||||
SSH_AES128_CTR,
|
SSH_AES128_CTR,
|
||||||
SSH_AES192_CTR,
|
SSH_AES192_CTR,
|
||||||
SSH_AES256_CTR
|
SSH_AES256_CTR,
|
||||||
|
SSH_AEAD_AES128_GCM,
|
||||||
|
SSH_AEAD_AES256_GCM,
|
||||||
|
SSH_AEAD_CHACHA20_POLY1305
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct dh_ctx;
|
||||||
|
|
||||||
struct ssh_crypto_struct {
|
struct ssh_crypto_struct {
|
||||||
bignum e,f,x,k,y;
|
bignum shared_secret;
|
||||||
|
struct dh_ctx *dh_ctx;
|
||||||
|
#ifdef WITH_GEX
|
||||||
|
size_t dh_pmin; int dh_pn; int dh_pmax; /* preferred group parameters */
|
||||||
|
#endif /* WITH_GEX */
|
||||||
#ifdef HAVE_ECDH
|
#ifdef HAVE_ECDH
|
||||||
#ifdef HAVE_OPENSSL_ECC
|
#ifdef HAVE_OPENSSL_ECC
|
||||||
EC_KEY *ecdh_privkey;
|
EC_KEY *ecdh_privkey;
|
||||||
@@ -96,7 +124,7 @@ struct ssh_crypto_struct {
|
|||||||
ssh_curve25519_pubkey curve25519_server_pubkey;
|
ssh_curve25519_pubkey curve25519_server_pubkey;
|
||||||
#endif
|
#endif
|
||||||
ssh_string dh_server_signature; /* information used by dh_handshake. */
|
ssh_string dh_server_signature; /* information used by dh_handshake. */
|
||||||
size_t digest_len; /* len of all the fields below */
|
size_t digest_len; /* len of the two fields below */
|
||||||
unsigned char *session_id;
|
unsigned char *session_id;
|
||||||
unsigned char *secret_hash; /* Secret hash is same as session id until re-kex */
|
unsigned char *secret_hash; /* Secret hash is same as session id until re-kex */
|
||||||
unsigned char *encryptIV;
|
unsigned char *encryptIV;
|
||||||
@@ -108,6 +136,7 @@ struct ssh_crypto_struct {
|
|||||||
unsigned char hmacbuf[DIGEST_MAX_LEN];
|
unsigned char hmacbuf[DIGEST_MAX_LEN];
|
||||||
struct ssh_cipher_struct *in_cipher, *out_cipher; /* the cipher structures/objects */
|
struct ssh_cipher_struct *in_cipher, *out_cipher; /* the cipher structures/objects */
|
||||||
enum ssh_hmac_e in_hmac, out_hmac; /* the MAC algorithms used */
|
enum ssh_hmac_e in_hmac, out_hmac; /* the MAC algorithms used */
|
||||||
|
bool in_hmac_etm, out_hmac_etm; /* Whether EtM mode is used or not */
|
||||||
|
|
||||||
ssh_key server_pubkey;
|
ssh_key server_pubkey;
|
||||||
int do_compress_out; /* idem */
|
int do_compress_out; /* idem */
|
||||||
@@ -121,7 +150,8 @@ struct ssh_crypto_struct {
|
|||||||
struct ssh_kex_struct client_kex;
|
struct ssh_kex_struct client_kex;
|
||||||
char *kex_methods[SSH_KEX_METHODS];
|
char *kex_methods[SSH_KEX_METHODS];
|
||||||
enum ssh_key_exchange_e kex_type;
|
enum ssh_key_exchange_e kex_type;
|
||||||
enum ssh_mac_e mac_type; /* Mac operations to use for key gen */
|
enum ssh_kdf_digest digest_type; /* Digest type for session keys derivation */
|
||||||
|
enum ssh_crypto_direction_e used; /* Is this crypto still used for either of directions? */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ssh_cipher_struct {
|
struct ssh_cipher_struct {
|
||||||
@@ -132,6 +162,7 @@ struct ssh_cipher_struct {
|
|||||||
size_t keylen; /* length of the key structure */
|
size_t keylen; /* length of the key structure */
|
||||||
#ifdef HAVE_LIBGCRYPT
|
#ifdef HAVE_LIBGCRYPT
|
||||||
gcry_cipher_hd_t *key;
|
gcry_cipher_hd_t *key;
|
||||||
|
unsigned char last_iv[AES_GCM_IVLEN];
|
||||||
#elif defined HAVE_LIBCRYPTO
|
#elif defined HAVE_LIBCRYPTO
|
||||||
struct ssh_3des_key_schedule *des3_key;
|
struct ssh_3des_key_schedule *des3_key;
|
||||||
struct ssh_aes_key_schedule *aes_key;
|
struct ssh_aes_key_schedule *aes_key;
|
||||||
@@ -141,17 +172,30 @@ struct ssh_cipher_struct {
|
|||||||
mbedtls_cipher_context_t encrypt_ctx;
|
mbedtls_cipher_context_t encrypt_ctx;
|
||||||
mbedtls_cipher_context_t decrypt_ctx;
|
mbedtls_cipher_context_t decrypt_ctx;
|
||||||
mbedtls_cipher_type_t type;
|
mbedtls_cipher_type_t type;
|
||||||
|
#ifdef MBEDTLS_GCM_C
|
||||||
|
mbedtls_gcm_context gcm_ctx;
|
||||||
|
unsigned char last_iv[AES_GCM_IVLEN];
|
||||||
|
#endif /* MBEDTLS_GCM_C */
|
||||||
#endif
|
#endif
|
||||||
struct chacha20_poly1305_keysched *chacha20_schedule;
|
struct chacha20_poly1305_keysched *chacha20_schedule;
|
||||||
unsigned int keysize; /* bytes of key used. != keylen */
|
unsigned int keysize; /* bytes of key used. != keylen */
|
||||||
size_t tag_size; /* overhead required for tag */
|
size_t tag_size; /* overhead required for tag */
|
||||||
|
/* Counters for rekeying initialization */
|
||||||
|
uint32_t packets;
|
||||||
|
uint64_t blocks;
|
||||||
|
/* Rekeying limit for the cipher or manually enforced */
|
||||||
|
uint64_t max_blocks;
|
||||||
/* sets the new key for immediate use */
|
/* sets the new key for immediate use */
|
||||||
int (*set_encrypt_key)(struct ssh_cipher_struct *cipher, void *key, void *IV);
|
int (*set_encrypt_key)(struct ssh_cipher_struct *cipher, void *key, void *IV);
|
||||||
int (*set_decrypt_key)(struct ssh_cipher_struct *cipher, void *key, void *IV);
|
int (*set_decrypt_key)(struct ssh_cipher_struct *cipher, void *key, void *IV);
|
||||||
void (*encrypt)(struct ssh_cipher_struct *cipher, void *in, void *out,
|
void (*encrypt)(struct ssh_cipher_struct *cipher,
|
||||||
unsigned long len);
|
void *in,
|
||||||
void (*decrypt)(struct ssh_cipher_struct *cipher, void *in, void *out,
|
void *out,
|
||||||
unsigned long len);
|
size_t len);
|
||||||
|
void (*decrypt)(struct ssh_cipher_struct *cipher,
|
||||||
|
void *in,
|
||||||
|
void *out,
|
||||||
|
size_t len);
|
||||||
void (*aead_encrypt)(struct ssh_cipher_struct *cipher, void *in, void *out,
|
void (*aead_encrypt)(struct ssh_cipher_struct *cipher, void *in, void *out,
|
||||||
size_t len, uint8_t *mac, uint64_t seq);
|
size_t len, uint8_t *mac, uint64_t seq);
|
||||||
int (*aead_decrypt_length)(struct ssh_cipher_struct *cipher, void *in,
|
int (*aead_decrypt_length)(struct ssh_cipher_struct *cipher, void *in,
|
||||||
@@ -162,5 +206,9 @@ struct ssh_cipher_struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const struct ssh_cipher_struct *ssh_get_chacha20poly1305_cipher(void);
|
const struct ssh_cipher_struct *ssh_get_chacha20poly1305_cipher(void);
|
||||||
|
int sshkdf_derive_key(struct ssh_crypto_struct *crypto,
|
||||||
|
unsigned char *key, size_t key_len,
|
||||||
|
int key_type, unsigned char *output,
|
||||||
|
size_t requested_len);
|
||||||
|
|
||||||
#endif /* _CRYPTO_H_ */
|
#endif /* _CRYPTO_H_ */
|
||||||
|
|||||||
@@ -48,10 +48,9 @@ typedef unsigned char ssh_curve25519_privkey[CURVE25519_PRIVKEY_SIZE];
|
|||||||
|
|
||||||
|
|
||||||
int ssh_client_curve25519_init(ssh_session session);
|
int ssh_client_curve25519_init(ssh_session session);
|
||||||
int ssh_client_curve25519_reply(ssh_session session, ssh_buffer packet);
|
|
||||||
|
|
||||||
#ifdef WITH_SERVER
|
#ifdef WITH_SERVER
|
||||||
int ssh_server_curve25519_init(ssh_session session, ssh_buffer packet);
|
void ssh_server_curve25519_init(ssh_session session);
|
||||||
#endif /* WITH_SERVER */
|
#endif /* WITH_SERVER */
|
||||||
|
|
||||||
#endif /* CURVE25519_H_ */
|
#endif /* CURVE25519_H_ */
|
||||||
|
|||||||
32
include/libssh/dh-gex.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the SSH Library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2016 by Aris Adamantiadis <aris@0xbadc0de.be>
|
||||||
|
*
|
||||||
|
* The SSH Library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* The SSH Library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with the SSH Library; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
|
* MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SRC_DH_GEX_H_
|
||||||
|
#define SRC_DH_GEX_H_
|
||||||
|
|
||||||
|
int ssh_client_dhgex_init(ssh_session session);
|
||||||
|
|
||||||
|
#ifdef WITH_SERVER
|
||||||
|
void ssh_server_dhgex_init(ssh_session session);
|
||||||
|
#endif /* WITH_SERVER */
|
||||||
|
|
||||||
|
#endif /* SRC_DH_GEX_H_ */
|
||||||
@@ -25,25 +25,35 @@
|
|||||||
|
|
||||||
#include "libssh/crypto.h"
|
#include "libssh/crypto.h"
|
||||||
|
|
||||||
int ssh_dh_generate_e(ssh_session session);
|
struct dh_ctx;
|
||||||
int ssh_dh_generate_f(ssh_session session);
|
|
||||||
int ssh_dh_generate_x(ssh_session session);
|
|
||||||
int ssh_dh_generate_y(ssh_session session);
|
|
||||||
|
|
||||||
|
#define DH_CLIENT_KEYPAIR 0
|
||||||
|
#define DH_SERVER_KEYPAIR 1
|
||||||
|
|
||||||
|
/* functions implemented by crypto backends */
|
||||||
|
int ssh_dh_init_common(struct ssh_crypto_struct *crypto);
|
||||||
|
void ssh_dh_cleanup(struct ssh_crypto_struct *crypto);
|
||||||
|
|
||||||
|
int ssh_dh_get_parameters(struct dh_ctx *ctx,
|
||||||
|
const_bignum *modulus, const_bignum *generator);
|
||||||
|
int ssh_dh_set_parameters(struct dh_ctx *ctx,
|
||||||
|
const bignum modulus, const bignum generator);
|
||||||
|
|
||||||
|
int ssh_dh_keypair_gen_keys(struct dh_ctx *ctx, int peer);
|
||||||
|
int ssh_dh_keypair_get_keys(struct dh_ctx *ctx, int peer,
|
||||||
|
const_bignum *priv, const_bignum *pub);
|
||||||
|
int ssh_dh_keypair_set_keys(struct dh_ctx *ctx, int peer,
|
||||||
|
const bignum priv, const bignum pub);
|
||||||
|
|
||||||
|
int ssh_dh_compute_shared_secret(struct dh_ctx *ctx, int local, int remote,
|
||||||
|
bignum *dest);
|
||||||
|
|
||||||
|
/* common functions */
|
||||||
int ssh_dh_init(void);
|
int ssh_dh_init(void);
|
||||||
void ssh_dh_finalize(void);
|
void ssh_dh_finalize(void);
|
||||||
|
|
||||||
ssh_string ssh_dh_get_e(ssh_session session);
|
int ssh_dh_import_next_pubkey_blob(ssh_session session,
|
||||||
ssh_string ssh_dh_get_f(ssh_session session);
|
ssh_string pubkey_blob);
|
||||||
int ssh_dh_import_f(ssh_session session,ssh_string f_string);
|
|
||||||
int ssh_dh_import_e(ssh_session session, ssh_string e_string);
|
|
||||||
|
|
||||||
int ssh_dh_import_pubkey_blob(ssh_session session, ssh_string pubkey_blob);
|
|
||||||
int ssh_dh_import_next_pubkey_blob(ssh_session session, ssh_string pubkey_blob);
|
|
||||||
|
|
||||||
int ssh_dh_build_k(ssh_session session);
|
|
||||||
int ssh_client_dh_init(ssh_session session);
|
|
||||||
int ssh_client_dh_reply(ssh_session session, ssh_buffer packet);
|
|
||||||
|
|
||||||
ssh_key ssh_dh_get_current_server_publickey(ssh_session session);
|
ssh_key ssh_dh_get_current_server_publickey(ssh_session session);
|
||||||
int ssh_dh_get_current_server_publickey_blob(ssh_session session,
|
int ssh_dh_get_current_server_publickey_blob(ssh_session session,
|
||||||
@@ -52,10 +62,12 @@ ssh_key ssh_dh_get_next_server_publickey(ssh_session session);
|
|||||||
int ssh_dh_get_next_server_publickey_blob(ssh_session session,
|
int ssh_dh_get_next_server_publickey_blob(ssh_session session,
|
||||||
ssh_string *pubkey_blob);
|
ssh_string *pubkey_blob);
|
||||||
|
|
||||||
int ssh_make_sessionid(ssh_session session);
|
int ssh_client_dh_init(ssh_session session);
|
||||||
/* add data for the final cookie */
|
#ifdef WITH_SERVER
|
||||||
int ssh_hashbufin_add_cookie(ssh_session session, unsigned char *cookie);
|
void ssh_server_dh_init(ssh_session session);
|
||||||
int ssh_hashbufout_add_cookie(ssh_session session);
|
#endif /* WITH_SERVER */
|
||||||
int ssh_generate_session_keys(ssh_session session);
|
int ssh_server_dh_process_init(ssh_session session, ssh_buffer packet);
|
||||||
|
int ssh_fallback_group(uint32_t pmax, bignum *p, bignum *g);
|
||||||
|
bool ssh_dh_is_known_group(bignum modulus, bignum generator);
|
||||||
|
|
||||||
#endif /* DH_H_ */
|
#endif /* DH_H_ */
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
#define ECDH_H_
|
#define ECDH_H_
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "libssh/callbacks.h"
|
||||||
|
|
||||||
#ifdef HAVE_LIBCRYPTO
|
#ifdef HAVE_LIBCRYPTO
|
||||||
#ifdef HAVE_OPENSSL_ECDH_H
|
#ifdef HAVE_OPENSSL_ECDH_H
|
||||||
@@ -41,15 +42,15 @@
|
|||||||
#define HAVE_ECDH 1
|
#define HAVE_ECDH 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Common functions. */
|
extern struct ssh_packet_callbacks_struct ssh_ecdh_client_callbacks;
|
||||||
int ssh_client_ecdh_reply(ssh_session session, ssh_buffer packet);
|
|
||||||
|
|
||||||
/* Backend-specific functions. */
|
/* Backend-specific functions. */
|
||||||
int ssh_client_ecdh_init(ssh_session session);
|
int ssh_client_ecdh_init(ssh_session session);
|
||||||
int ecdh_build_k(ssh_session session);
|
int ecdh_build_k(ssh_session session);
|
||||||
|
|
||||||
#ifdef WITH_SERVER
|
#ifdef WITH_SERVER
|
||||||
int ssh_server_ecdh_init(ssh_session session, ssh_buffer packet);
|
extern struct ssh_packet_callbacks_struct ssh_ecdh_server_callbacks;
|
||||||
|
void ssh_server_ecdh_init(ssh_session session);
|
||||||
|
SSH_PACKET_CALLBACK(ssh_packet_server_ecdh_init);
|
||||||
#endif /* WITH_SERVER */
|
#endif /* WITH_SERVER */
|
||||||
|
|
||||||
#endif /* ECDH_H_ */
|
#endif /* ECDH_H_ */
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ int crypto_sign_ed25519_keypair(ed25519_pubkey pk, ed25519_privkey sk);
|
|||||||
* @return 0 on success.
|
* @return 0 on success.
|
||||||
*/
|
*/
|
||||||
int crypto_sign_ed25519(
|
int crypto_sign_ed25519(
|
||||||
unsigned char *sm,unsigned long long *smlen,
|
unsigned char *sm, uint64_t *smlen,
|
||||||
const unsigned char *m,unsigned long long mlen,
|
const unsigned char *m, uint64_t mlen,
|
||||||
const ed25519_privkey sk);
|
const ed25519_privkey sk);
|
||||||
|
|
||||||
/** @internal
|
/** @internal
|
||||||
@@ -71,8 +71,8 @@ int crypto_sign_ed25519(
|
|||||||
* @returns 0 on success (supposedly).
|
* @returns 0 on success (supposedly).
|
||||||
*/
|
*/
|
||||||
int crypto_sign_ed25519_open(
|
int crypto_sign_ed25519_open(
|
||||||
unsigned char *m,unsigned long long *mlen,
|
unsigned char *m, uint64_t *mlen,
|
||||||
const unsigned char *sm,unsigned long long smlen,
|
const unsigned char *sm, uint64_t smlen,
|
||||||
const ed25519_pubkey pk);
|
const ed25519_pubkey pk);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|||||||
@@ -39,10 +39,21 @@ int ssh_set_client_kex(ssh_session session);
|
|||||||
int ssh_kex_select_methods(ssh_session session);
|
int ssh_kex_select_methods(ssh_session session);
|
||||||
int ssh_verify_existing_algo(enum ssh_kex_types_e algo, const char *name);
|
int ssh_verify_existing_algo(enum ssh_kex_types_e algo, const char *name);
|
||||||
char *ssh_keep_known_algos(enum ssh_kex_types_e algo, const char *list);
|
char *ssh_keep_known_algos(enum ssh_kex_types_e algo, const char *list);
|
||||||
|
char *ssh_keep_fips_algos(enum ssh_kex_types_e algo, const char *list);
|
||||||
char **ssh_space_tokenize(const char *chain);
|
char **ssh_space_tokenize(const char *chain);
|
||||||
int ssh_get_kex1(ssh_session session);
|
int ssh_get_kex1(ssh_session session);
|
||||||
char *ssh_find_matching(const char *in_d, const char *what_d);
|
char *ssh_find_matching(const char *in_d, const char *what_d);
|
||||||
const char *ssh_kex_get_supported_method(uint32_t algo);
|
const char *ssh_kex_get_supported_method(uint32_t algo);
|
||||||
|
const char *ssh_kex_get_default_methods(uint32_t algo);
|
||||||
|
const char *ssh_kex_get_fips_methods(uint32_t algo);
|
||||||
const char *ssh_kex_get_description(uint32_t algo);
|
const char *ssh_kex_get_description(uint32_t algo);
|
||||||
|
char *ssh_client_select_hostkeys(ssh_session session);
|
||||||
|
int ssh_send_rekex(ssh_session session);
|
||||||
|
int server_set_kex(ssh_session session);
|
||||||
|
int ssh_make_sessionid(ssh_session session);
|
||||||
|
/* add data for the final cookie */
|
||||||
|
int ssh_hashbufin_add_cookie(ssh_session session, unsigned char *cookie);
|
||||||
|
int ssh_hashbufout_add_cookie(ssh_session session);
|
||||||
|
int ssh_generate_session_keys(ssh_session session);
|
||||||
|
|
||||||
#endif /* KEX_H_ */
|
#endif /* KEX_H_ */
|
||||||
|
|||||||
@@ -23,5 +23,9 @@
|
|||||||
#define SSH_KNOWNHOSTS_H_
|
#define SSH_KNOWNHOSTS_H_
|
||||||
|
|
||||||
struct ssh_list *ssh_known_hosts_get_algorithms(ssh_session session);
|
struct ssh_list *ssh_known_hosts_get_algorithms(ssh_session session);
|
||||||
|
enum ssh_known_hosts_e
|
||||||
|
ssh_session_get_known_hosts_entry_file(ssh_session session,
|
||||||
|
const char *filename,
|
||||||
|
struct ssh_knownhosts_entry **pentry);
|
||||||
|
|
||||||
#endif /* SSH_KNOWNHOSTS_H_ */
|
#endif /* SSH_KNOWNHOSTS_H_ */
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include <openssl/md5.h>
|
#include <openssl/md5.h>
|
||||||
#include <openssl/hmac.h>
|
#include <openssl/hmac.h>
|
||||||
#include <openssl/evp.h>
|
#include <openssl/evp.h>
|
||||||
|
#include <openssl/crypto.h>
|
||||||
|
|
||||||
typedef EVP_MD_CTX* SHACTX;
|
typedef EVP_MD_CTX* SHACTX;
|
||||||
typedef EVP_MD_CTX* SHA256CTX;
|
typedef EVP_MD_CTX* SHA256CTX;
|
||||||
@@ -64,6 +65,7 @@ typedef void *EVPCTX;
|
|||||||
#define BROKEN_AES_CTR
|
#define BROKEN_AES_CTR
|
||||||
#endif
|
#endif
|
||||||
typedef BIGNUM* bignum;
|
typedef BIGNUM* bignum;
|
||||||
|
typedef const BIGNUM* const_bignum;
|
||||||
typedef BN_CTX* bignum_CTX;
|
typedef BN_CTX* bignum_CTX;
|
||||||
|
|
||||||
#define bignum_new() BN_new()
|
#define bignum_new() BN_new()
|
||||||
@@ -74,19 +76,43 @@ typedef BN_CTX* bignum_CTX;
|
|||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
#define bignum_set_word(bn,n) BN_set_word(bn,n)
|
#define bignum_set_word(bn,n) BN_set_word(bn,n)
|
||||||
#define bignum_bin2bn(bn,datalen,data) BN_bin2bn(bn,datalen,data)
|
#define bignum_bin2bn(data, datalen, dest) \
|
||||||
|
do { \
|
||||||
|
(*dest) = BN_new(); \
|
||||||
|
if ((*dest) != NULL) { \
|
||||||
|
BN_bin2bn(data,datalen,(*dest)); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
#define bignum_bn2dec(num) BN_bn2dec(num)
|
#define bignum_bn2dec(num) BN_bn2dec(num)
|
||||||
#define bignum_dec2bn(bn,data) BN_dec2bn(data,bn)
|
#define bignum_dec2bn(data, bn) BN_dec2bn(bn, data)
|
||||||
#define bignum_bn2hex(num) BN_bn2hex(num)
|
#define bignum_hex2bn(data, bn) BN_hex2bn(bn, data)
|
||||||
|
#define bignum_bn2hex(num, dest) (*dest)=(unsigned char *)BN_bn2hex(num)
|
||||||
#define bignum_rand(rnd, bits) BN_rand(rnd, bits, 0, 1)
|
#define bignum_rand(rnd, bits) BN_rand(rnd, bits, 0, 1)
|
||||||
|
#define bignum_rand_range(rnd, max) BN_rand_range(rnd, max)
|
||||||
#define bignum_ctx_new() BN_CTX_new()
|
#define bignum_ctx_new() BN_CTX_new()
|
||||||
#define bignum_ctx_free(num) BN_CTX_free(num)
|
#define bignum_ctx_free(num) BN_CTX_free(num)
|
||||||
|
#define bignum_ctx_invalid(ctx) ((ctx) == NULL)
|
||||||
#define bignum_mod_exp(dest,generator,exp,modulo,ctx) BN_mod_exp(dest,generator,exp,modulo,ctx)
|
#define bignum_mod_exp(dest,generator,exp,modulo,ctx) BN_mod_exp(dest,generator,exp,modulo,ctx)
|
||||||
|
#define bignum_add(dest, a, b) BN_add(dest, a, b)
|
||||||
|
#define bignum_sub(dest, a, b) BN_sub(dest, a, b)
|
||||||
|
#define bignum_mod(dest, a, b, ctx) BN_mod(dest, a, b, ctx)
|
||||||
#define bignum_num_bytes(num) BN_num_bytes(num)
|
#define bignum_num_bytes(num) BN_num_bytes(num)
|
||||||
#define bignum_num_bits(num) BN_num_bits(num)
|
#define bignum_num_bits(num) BN_num_bits(num)
|
||||||
#define bignum_is_bit_set(num,bit) BN_is_bit_set(num,bit)
|
#define bignum_is_bit_set(num,bit) BN_is_bit_set(num,bit)
|
||||||
#define bignum_bn2bin(num,ptr) BN_bn2bin(num,ptr)
|
#define bignum_bn2bin(num,len, ptr) BN_bn2bin(num, ptr)
|
||||||
#define bignum_cmp(num1,num2) BN_cmp(num1,num2)
|
#define bignum_cmp(num1,num2) BN_cmp(num1,num2)
|
||||||
|
#define bignum_rshift1(dest, src) BN_rshift1(dest, src)
|
||||||
|
#define bignum_dup(orig, dest) do { \
|
||||||
|
if (*(dest) == NULL) { \
|
||||||
|
*(dest) = BN_dup(orig); \
|
||||||
|
} else { \
|
||||||
|
BN_copy(*(dest), orig); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
|
/* Returns true if the OpenSSL is operating in FIPS mode */
|
||||||
|
#define ssh_fips_mode() (FIPS_mode() != 0)
|
||||||
|
|
||||||
#endif /* HAVE_LIBCRYPTO */
|
#endif /* HAVE_LIBCRYPTO */
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ typedef gcry_md_hd_t EVPCTX;
|
|||||||
#define EVP_DIGEST_LEN EVP_MAX_MD_SIZE
|
#define EVP_DIGEST_LEN EVP_MAX_MD_SIZE
|
||||||
|
|
||||||
typedef gcry_mpi_t bignum;
|
typedef gcry_mpi_t bignum;
|
||||||
|
typedef const struct gcry_mpi *const_bignum;
|
||||||
|
typedef void* bignum_CTX;
|
||||||
|
|
||||||
/* Constants for curves. */
|
/* Constants for curves. */
|
||||||
#define NID_gcrypt_nistp256 0
|
#define NID_gcrypt_nistp256 0
|
||||||
@@ -59,6 +61,7 @@ typedef gcry_mpi_t bignum;
|
|||||||
/* missing gcrypt functions */
|
/* missing gcrypt functions */
|
||||||
int ssh_gcry_dec2bn(bignum *bn, const char *data);
|
int ssh_gcry_dec2bn(bignum *bn, const char *data);
|
||||||
char *ssh_gcry_bn2dec(bignum bn);
|
char *ssh_gcry_bn2dec(bignum bn);
|
||||||
|
int ssh_gcry_rand_range(bignum rnd, bignum max);
|
||||||
|
|
||||||
#define bignum_new() gcry_mpi_new(0)
|
#define bignum_new() gcry_mpi_new(0)
|
||||||
#define bignum_safe_free(num) do { \
|
#define bignum_safe_free(num) do { \
|
||||||
@@ -67,20 +70,35 @@ char *ssh_gcry_bn2dec(bignum bn);
|
|||||||
(num)=NULL; \
|
(num)=NULL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define bignum_set_word(bn,n) gcry_mpi_set_ui(bn,n)
|
#define bignum_free(num) gcry_mpi_release(num)
|
||||||
#define bignum_bin2bn(bn,datalen,data) gcry_mpi_scan(data,GCRYMPI_FMT_USG,bn,datalen,NULL)
|
#define bignum_ctx_new() NULL
|
||||||
|
#define bignum_ctx_free(ctx) do {(ctx) = NULL;} while(0)
|
||||||
|
#define bignum_ctx_invalid(ctx) (ctx != NULL)
|
||||||
|
#define bignum_set_word(bn,n) (gcry_mpi_set_ui(bn,n)!=NULL ? 1 : 0)
|
||||||
|
#define bignum_bin2bn(data,datalen,dest) gcry_mpi_scan(dest,GCRYMPI_FMT_USG,data,datalen,NULL)
|
||||||
#define bignum_bn2dec(num) ssh_gcry_bn2dec(num)
|
#define bignum_bn2dec(num) ssh_gcry_bn2dec(num)
|
||||||
#define bignum_dec2bn(num, data) ssh_gcry_dec2bn(data, num)
|
#define bignum_dec2bn(num, data) ssh_gcry_dec2bn(data, num)
|
||||||
#define bignum_bn2hex(num,data) gcry_mpi_aprint(GCRYMPI_FMT_HEX,data,NULL,num)
|
#define bignum_bn2hex(num,data) gcry_mpi_aprint(GCRYMPI_FMT_HEX,data,NULL,num)
|
||||||
#define bignum_hex2bn(num,datalen,data) gcry_mpi_scan(num,GCRYMPI_FMT_HEX,data,datalen,NULL)
|
#define bignum_hex2bn(data, num) (gcry_mpi_scan(num,GCRYMPI_FMT_HEX,data,0,NULL)==0?1:0)
|
||||||
#define bignum_rand(num,bits) gcry_mpi_randomize(num,bits,GCRY_STRONG_RANDOM),gcry_mpi_set_bit(num,bits-1),gcry_mpi_set_bit(num,0)
|
#define bignum_rand(num,bits) 1,gcry_mpi_randomize(num,bits,GCRY_STRONG_RANDOM),gcry_mpi_set_bit(num,bits-1),gcry_mpi_set_bit(num,0)
|
||||||
#define bignum_mod_exp(dest,generator,exp,modulo) gcry_mpi_powm(dest,generator,exp,modulo)
|
#define bignum_mod_exp(dest,generator,exp,modulo, ctx) 1,gcry_mpi_powm(dest,generator,exp,modulo)
|
||||||
#define bignum_num_bits(num) gcry_mpi_get_nbits(num)
|
#define bignum_num_bits(num) gcry_mpi_get_nbits(num)
|
||||||
#define bignum_num_bytes(num) ((gcry_mpi_get_nbits(num)+7)/8)
|
#define bignum_num_bytes(num) ((gcry_mpi_get_nbits(num)+7)/8)
|
||||||
#define bignum_is_bit_set(num,bit) gcry_mpi_test_bit(num,bit)
|
#define bignum_is_bit_set(num,bit) gcry_mpi_test_bit(num,bit)
|
||||||
#define bignum_bn2bin(num,datalen,data) gcry_mpi_print(GCRYMPI_FMT_USG,data,datalen,NULL,num)
|
#define bignum_bn2bin(num,datalen,data) gcry_mpi_print(GCRYMPI_FMT_USG,data,datalen,NULL,num)
|
||||||
#define bignum_cmp(num1,num2) gcry_mpi_cmp(num1,num2)
|
#define bignum_cmp(num1,num2) gcry_mpi_cmp(num1,num2)
|
||||||
|
#define bignum_rshift1(dest, src) gcry_mpi_rshift (dest, src, 1)
|
||||||
|
#define bignum_add(dst, a, b) gcry_mpi_add(dst, a, b)
|
||||||
|
#define bignum_sub(dst, a, b) gcry_mpi_sub(dst, a, b)
|
||||||
|
#define bignum_mod(dst, a, b, ctx) 1,gcry_mpi_mod(dst, a, b)
|
||||||
|
#define bignum_rand_range(rnd, max) ssh_gcry_rand_range(rnd, max);
|
||||||
|
#define bignum_dup(orig, dest) do { \
|
||||||
|
if (*(dest) == NULL) { \
|
||||||
|
*(dest) = gcry_mpi_copy(orig); \
|
||||||
|
} else { \
|
||||||
|
gcry_mpi_set(*(dest), orig); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
/* Helper functions for data conversions. */
|
/* Helper functions for data conversions. */
|
||||||
|
|
||||||
/* Extract an MPI from the given s-expression SEXP named NAME which is
|
/* Extract an MPI from the given s-expression SEXP named NAME which is
|
||||||
@@ -91,6 +109,8 @@ ssh_string ssh_sexp_extract_mpi(const gcry_sexp_t sexp,
|
|||||||
enum gcry_mpi_format informat,
|
enum gcry_mpi_format informat,
|
||||||
enum gcry_mpi_format outformat);
|
enum gcry_mpi_format outformat);
|
||||||
|
|
||||||
|
#define ssh_fips_mode() false
|
||||||
|
|
||||||
#endif /* HAVE_LIBGCRYPT */
|
#endif /* HAVE_LIBGCRYPT */
|
||||||
|
|
||||||
#endif /* LIBGCRYPT_H_ */
|
#endif /* LIBGCRYPT_H_ */
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ typedef mbedtls_md_context_t *EVPCTX;
|
|||||||
#define EVP_DIGEST_LEN EVP_MAX_MD_SIZE
|
#define EVP_DIGEST_LEN EVP_MAX_MD_SIZE
|
||||||
|
|
||||||
typedef mbedtls_mpi *bignum;
|
typedef mbedtls_mpi *bignum;
|
||||||
|
typedef const mbedtls_mpi *const_bignum;
|
||||||
|
typedef void* bignum_CTX;
|
||||||
|
|
||||||
/* Constants for curves */
|
/* Constants for curves */
|
||||||
#define NID_mbedtls_nistp256 0
|
#define NID_mbedtls_nistp256 0
|
||||||
@@ -73,9 +75,11 @@ struct mbedtls_ecdsa_sig {
|
|||||||
|
|
||||||
bignum ssh_mbedcry_bn_new(void);
|
bignum ssh_mbedcry_bn_new(void);
|
||||||
void ssh_mbedcry_bn_free(bignum num);
|
void ssh_mbedcry_bn_free(bignum num);
|
||||||
char *ssh_mbedcry_bn2num(bignum num, int radix);
|
unsigned char *ssh_mbedcry_bn2num(bignum num, int radix);
|
||||||
int ssh_mbedcry_rand(bignum rnd, int bits, int top, int bottom);
|
int ssh_mbedcry_rand(bignum rnd, int bits, int top, int bottom);
|
||||||
int ssh_mbedcry_is_bit_set(bignum num, size_t pos);
|
int ssh_mbedcry_is_bit_set(bignum num, size_t pos);
|
||||||
|
int ssh_mbedcry_rand_range(bignum dest, bignum max);
|
||||||
|
int ssh_mbedcry_hex2bn(bignum *dest, char *data);
|
||||||
|
|
||||||
#define bignum_new() ssh_mbedcry_bn_new()
|
#define bignum_new() ssh_mbedcry_bn_new()
|
||||||
#define bignum_safe_free(num) do { \
|
#define bignum_safe_free(num) do { \
|
||||||
@@ -84,30 +88,53 @@ int ssh_mbedcry_is_bit_set(bignum num, size_t pos);
|
|||||||
(num)=NULL; \
|
(num)=NULL; \
|
||||||
} \
|
} \
|
||||||
} while(0)
|
} while(0)
|
||||||
#define bignum_set_word(bn, n) mbedtls_mpi_lset(bn, n) /* TODO fix
|
#define bignum_ctx_new() NULL
|
||||||
|
#define bignum_ctx_free(num) do {(num) = NULL;} while(0)
|
||||||
|
#define bignum_ctx_invalid(ctx) (ctx == NULL?0:1)
|
||||||
|
#define bignum_set_word(bn, n) (mbedtls_mpi_lset(bn, n)==0?1:0) /* TODO fix
|
||||||
overflow/underflow */
|
overflow/underflow */
|
||||||
#define bignum_bin2bn(data, datalen, bn) mbedtls_mpi_read_binary(bn, data, \
|
#define bignum_bin2bn(data, datalen, bn) do { \
|
||||||
datalen)
|
*(bn) = bignum_new(); \
|
||||||
|
if (*(bn) != NULL) { \
|
||||||
|
mbedtls_mpi_read_binary(*(bn), data, datalen); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
#define bignum_bn2dec(num) ssh_mbedcry_bn2num(num, 10)
|
#define bignum_bn2dec(num) ssh_mbedcry_bn2num(num, 10)
|
||||||
#define bignum_dec2bn(data, bn) mbedtls_mpi_read_string(bn, 10, data)
|
#define bignum_dec2bn(data, bn) mbedtls_mpi_read_string(bn, 10, data)
|
||||||
#define bignum_bn2hex(num) ssh_mbedcry_bn2num(num, 16)
|
#define bignum_bn2hex(num, dest) (*dest)=ssh_mbedcry_bn2num(num, 16)
|
||||||
|
#define bignum_hex2bn(data, dest) ssh_mbedcry_hex2bn(dest, data)
|
||||||
#define bignum_rand(rnd, bits) ssh_mbedcry_rand((rnd), (bits), 0, 1)
|
#define bignum_rand(rnd, bits) ssh_mbedcry_rand((rnd), (bits), 0, 1)
|
||||||
|
#define bignum_rand_range(rnd, max) ssh_mbedcry_rand_range(rnd, max)
|
||||||
#define bignum_mod_exp(dest, generator, exp, modulo, ctx) \
|
#define bignum_mod_exp(dest, generator, exp, modulo, ctx) \
|
||||||
mbedtls_mpi_exp_mod(dest, generator, exp, modulo, NULL)
|
(mbedtls_mpi_exp_mod(dest, generator, exp, modulo, NULL)==0?1:0)
|
||||||
|
#define bignum_add(dest, a, b) mbedtls_mpi_add_mpi(dest, a, b)
|
||||||
|
#define bignum_sub(dest, a, b) mbedtls_mpi_sub_mpi(dest, a, b)
|
||||||
|
#define bignum_mod(dest, a, b, ctx) \
|
||||||
|
(mbedtls_mpi_mod_mpi(dest, a, b) == 0 ? 1 : 0)
|
||||||
#define bignum_num_bytes(num) mbedtls_mpi_size(num)
|
#define bignum_num_bytes(num) mbedtls_mpi_size(num)
|
||||||
#define bignum_num_bits(num) mbedtls_mpi_bitlen(num)
|
#define bignum_num_bits(num) mbedtls_mpi_bitlen(num)
|
||||||
#define bignum_is_bit_set(num, bit) ssh_mbedcry_is_bit_set(num, bit)
|
#define bignum_is_bit_set(num, bit) ssh_mbedcry_is_bit_set(num, bit)
|
||||||
#define bignum_bn2bin(num, ptr) mbedtls_mpi_write_binary(num, ptr, \
|
#define bignum_bn2bin(num, len, ptr) mbedtls_mpi_write_binary(num, ptr, \
|
||||||
mbedtls_mpi_size(num))
|
mbedtls_mpi_size(num))
|
||||||
#define bignum_cmp(num1, num2) mbedtls_mpi_cmp_mpi(num1, num2)
|
#define bignum_cmp(num1, num2) mbedtls_mpi_cmp_mpi(num1, num2)
|
||||||
|
#define bignum_rshift1(dest, src) mbedtls_mpi_copy(dest, src), mbedtls_mpi_shift_r(dest, 1)
|
||||||
|
#define bignum_dup(orig, dest) do { \
|
||||||
|
if (*(dest) == NULL) { \
|
||||||
|
*(dest) = bignum_new(); \
|
||||||
|
} \
|
||||||
|
if (*(dest) != NULL) { \
|
||||||
|
mbedtls_mpi_copy(orig, *(dest)); \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
mbedtls_entropy_context ssh_mbedtls_entropy;
|
mbedtls_ctr_drbg_context *ssh_get_mbedtls_ctr_drbg_context(void);
|
||||||
mbedtls_ctr_drbg_context ssh_mbedtls_ctr_drbg;
|
|
||||||
|
|
||||||
int ssh_mbedtls_random(void *where, int len, int strong);
|
int ssh_mbedtls_random(void *where, int len, int strong);
|
||||||
|
|
||||||
ssh_string make_ecpoint_string(const mbedtls_ecp_group *g, const
|
ssh_string make_ecpoint_string(const mbedtls_ecp_group *g, const
|
||||||
mbedtls_ecp_point *p);
|
mbedtls_ecp_point *p);
|
||||||
|
|
||||||
|
#define ssh_fips_mode() false
|
||||||
|
|
||||||
#endif /* HAVE_LIBMBEDCRYPTO */
|
#endif /* HAVE_LIBMBEDCRYPTO */
|
||||||
#endif /* LIBMBEDCRYPTO_H_ */
|
#endif /* LIBMBEDCRYPTO_H_ */
|
||||||
|
|||||||
@@ -78,8 +78,8 @@
|
|||||||
|
|
||||||
/* libssh version */
|
/* libssh version */
|
||||||
#define LIBSSH_VERSION_MAJOR 0
|
#define LIBSSH_VERSION_MAJOR 0
|
||||||
#define LIBSSH_VERSION_MINOR 7
|
#define LIBSSH_VERSION_MINOR 9
|
||||||
#define LIBSSH_VERSION_MICRO 90
|
#define LIBSSH_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \
|
#define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \
|
||||||
LIBSSH_VERSION_MINOR, \
|
LIBSSH_VERSION_MINOR, \
|
||||||
@@ -239,11 +239,39 @@ enum ssh_server_known_e {
|
|||||||
};
|
};
|
||||||
|
|
||||||
enum ssh_known_hosts_e {
|
enum ssh_known_hosts_e {
|
||||||
|
/**
|
||||||
|
* There had been an error checking the host.
|
||||||
|
*/
|
||||||
SSH_KNOWN_HOSTS_ERROR = -2,
|
SSH_KNOWN_HOSTS_ERROR = -2,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The known host file does not exist. The host is thus unknown. File will
|
||||||
|
* be created if host key is accepted.
|
||||||
|
*/
|
||||||
SSH_KNOWN_HOSTS_NOT_FOUND = -1,
|
SSH_KNOWN_HOSTS_NOT_FOUND = -1,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server is unknown. User should confirm the public key hash is
|
||||||
|
* correct.
|
||||||
|
*/
|
||||||
SSH_KNOWN_HOSTS_UNKNOWN = 0,
|
SSH_KNOWN_HOSTS_UNKNOWN = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server is known and has not changed.
|
||||||
|
*/
|
||||||
SSH_KNOWN_HOSTS_OK,
|
SSH_KNOWN_HOSTS_OK,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server key has changed. Either you are under attack or the
|
||||||
|
* administrator changed the key. You HAVE to warn the user about a
|
||||||
|
* possible attack.
|
||||||
|
*/
|
||||||
SSH_KNOWN_HOSTS_CHANGED,
|
SSH_KNOWN_HOSTS_CHANGED,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The server gave use a key of a type while we had an other type recorded.
|
||||||
|
* It is a possible attack.
|
||||||
|
*/
|
||||||
SSH_KNOWN_HOSTS_OTHER,
|
SSH_KNOWN_HOSTS_OTHER,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -265,10 +293,17 @@ enum ssh_keytypes_e{
|
|||||||
SSH_KEYTYPE_DSS=1,
|
SSH_KEYTYPE_DSS=1,
|
||||||
SSH_KEYTYPE_RSA,
|
SSH_KEYTYPE_RSA,
|
||||||
SSH_KEYTYPE_RSA1,
|
SSH_KEYTYPE_RSA1,
|
||||||
SSH_KEYTYPE_ECDSA,
|
SSH_KEYTYPE_ECDSA, /* deprecated */
|
||||||
SSH_KEYTYPE_ED25519,
|
SSH_KEYTYPE_ED25519,
|
||||||
SSH_KEYTYPE_DSS_CERT01,
|
SSH_KEYTYPE_DSS_CERT01,
|
||||||
SSH_KEYTYPE_RSA_CERT01
|
SSH_KEYTYPE_RSA_CERT01,
|
||||||
|
SSH_KEYTYPE_ECDSA_P256,
|
||||||
|
SSH_KEYTYPE_ECDSA_P384,
|
||||||
|
SSH_KEYTYPE_ECDSA_P521,
|
||||||
|
SSH_KEYTYPE_ECDSA_P256_CERT01,
|
||||||
|
SSH_KEYTYPE_ECDSA_P384_CERT01,
|
||||||
|
SSH_KEYTYPE_ECDSA_P521_CERT01,
|
||||||
|
SSH_KEYTYPE_ED25519_CERT01,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ssh_keycmp_e {
|
enum ssh_keycmp_e {
|
||||||
@@ -376,6 +411,10 @@ enum ssh_options_e {
|
|||||||
SSH_OPTIONS_GSSAPI_AUTH,
|
SSH_OPTIONS_GSSAPI_AUTH,
|
||||||
SSH_OPTIONS_GLOBAL_KNOWNHOSTS,
|
SSH_OPTIONS_GLOBAL_KNOWNHOSTS,
|
||||||
SSH_OPTIONS_NODELAY,
|
SSH_OPTIONS_NODELAY,
|
||||||
|
SSH_OPTIONS_PUBLICKEY_ACCEPTED_TYPES,
|
||||||
|
SSH_OPTIONS_PROCESS_CONFIG,
|
||||||
|
SSH_OPTIONS_REKEY_DATA,
|
||||||
|
SSH_OPTIONS_REKEY_TIME,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -422,6 +461,8 @@ LIBSSH_API ssh_channel ssh_channel_new(ssh_session session);
|
|||||||
LIBSSH_API int ssh_channel_open_auth_agent(ssh_channel channel);
|
LIBSSH_API int ssh_channel_open_auth_agent(ssh_channel channel);
|
||||||
LIBSSH_API int ssh_channel_open_forward(ssh_channel channel, const char *remotehost,
|
LIBSSH_API int ssh_channel_open_forward(ssh_channel channel, const char *remotehost,
|
||||||
int remoteport, const char *sourcehost, int localport);
|
int remoteport, const char *sourcehost, int localport);
|
||||||
|
LIBSSH_API int ssh_channel_open_forward_unix(ssh_channel channel, const char *remotepath,
|
||||||
|
const char *sourcehost, int localport);
|
||||||
LIBSSH_API int ssh_channel_open_session(ssh_channel channel);
|
LIBSSH_API int ssh_channel_open_session(ssh_channel channel);
|
||||||
LIBSSH_API int ssh_channel_open_x11(ssh_channel channel, const char *orig_addr, int orig_port);
|
LIBSSH_API int ssh_channel_open_x11(ssh_channel channel, const char *orig_addr, int orig_port);
|
||||||
LIBSSH_API int ssh_channel_poll(ssh_channel channel, int is_stderr);
|
LIBSSH_API int ssh_channel_poll(ssh_channel channel, int is_stderr);
|
||||||
@@ -500,7 +541,8 @@ LIBSSH_API int ssh_get_server_publickey(ssh_session session, ssh_key *key);
|
|||||||
|
|
||||||
enum ssh_publickey_hash_type {
|
enum ssh_publickey_hash_type {
|
||||||
SSH_PUBLICKEY_HASH_SHA1,
|
SSH_PUBLICKEY_HASH_SHA1,
|
||||||
SSH_PUBLICKEY_HASH_MD5
|
SSH_PUBLICKEY_HASH_MD5,
|
||||||
|
SSH_PUBLICKEY_HASH_SHA256
|
||||||
};
|
};
|
||||||
LIBSSH_API int ssh_get_publickey_hash(const ssh_key key,
|
LIBSSH_API int ssh_get_publickey_hash(const ssh_key key,
|
||||||
enum ssh_publickey_hash_type type,
|
enum ssh_publickey_hash_type type,
|
||||||
@@ -513,6 +555,11 @@ SSH_DEPRECATED LIBSSH_API ssh_channel ssh_forward_accept(ssh_session session, in
|
|||||||
SSH_DEPRECATED LIBSSH_API int ssh_forward_cancel(ssh_session session, const char *address, int port);
|
SSH_DEPRECATED LIBSSH_API int ssh_forward_cancel(ssh_session session, const char *address, int port);
|
||||||
SSH_DEPRECATED LIBSSH_API int ssh_forward_listen(ssh_session session, const char *address, int port, int *bound_port);
|
SSH_DEPRECATED LIBSSH_API int ssh_forward_listen(ssh_session session, const char *address, int port, int *bound_port);
|
||||||
SSH_DEPRECATED LIBSSH_API int ssh_get_publickey(ssh_session session, ssh_key *key);
|
SSH_DEPRECATED LIBSSH_API int ssh_get_publickey(ssh_session session, ssh_key *key);
|
||||||
|
SSH_DEPRECATED LIBSSH_API int ssh_write_knownhost(ssh_session session);
|
||||||
|
SSH_DEPRECATED LIBSSH_API char *ssh_dump_knownhost(ssh_session session);
|
||||||
|
SSH_DEPRECATED LIBSSH_API int ssh_is_server_known(ssh_session session);
|
||||||
|
SSH_DEPRECATED LIBSSH_API void ssh_print_hexa(const char *descr, const unsigned char *what, size_t len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LIBSSH_API int ssh_get_random(void *where,int len,int strong);
|
LIBSSH_API int ssh_get_random(void *where,int len,int strong);
|
||||||
@@ -522,7 +569,6 @@ LIBSSH_API int ssh_get_poll_flags(ssh_session session);
|
|||||||
LIBSSH_API int ssh_init(void);
|
LIBSSH_API int ssh_init(void);
|
||||||
LIBSSH_API int ssh_is_blocking(ssh_session session);
|
LIBSSH_API int ssh_is_blocking(ssh_session session);
|
||||||
LIBSSH_API int ssh_is_connected(ssh_session session);
|
LIBSSH_API int ssh_is_connected(ssh_session session);
|
||||||
LIBSSH_API int ssh_is_server_known(ssh_session session);
|
|
||||||
|
|
||||||
/* KNOWN HOSTS */
|
/* KNOWN HOSTS */
|
||||||
LIBSSH_API void ssh_knownhosts_entry_free(struct ssh_knownhosts_entry *entry);
|
LIBSSH_API void ssh_knownhosts_entry_free(struct ssh_knownhosts_entry *entry);
|
||||||
@@ -542,9 +588,8 @@ LIBSSH_API int ssh_session_export_known_hosts_entry(ssh_session session,
|
|||||||
char **pentry_string);
|
char **pentry_string);
|
||||||
LIBSSH_API int ssh_session_update_known_hosts(ssh_session session);
|
LIBSSH_API int ssh_session_update_known_hosts(ssh_session session);
|
||||||
|
|
||||||
LIBSSH_API enum ssh_known_hosts_e
|
LIBSSH_API enum ssh_known_hosts_e ssh_session_get_known_hosts_entry(ssh_session session,
|
||||||
ssh_session_get_known_hosts_entry(ssh_session session,
|
struct ssh_knownhosts_entry **pentry);
|
||||||
struct ssh_knownhosts_entry **pentry);
|
|
||||||
LIBSSH_API enum ssh_known_hosts_e ssh_session_is_known_server(ssh_session session);
|
LIBSSH_API enum ssh_known_hosts_e ssh_session_is_known_server(ssh_session session);
|
||||||
|
|
||||||
/* LOGGING */
|
/* LOGGING */
|
||||||
@@ -562,7 +607,10 @@ SSH_DEPRECATED LIBSSH_API void ssh_log(ssh_session session,
|
|||||||
const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
|
const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
|
||||||
|
|
||||||
LIBSSH_API ssh_channel ssh_message_channel_request_open_reply_accept(ssh_message msg);
|
LIBSSH_API ssh_channel ssh_message_channel_request_open_reply_accept(ssh_message msg);
|
||||||
|
LIBSSH_API int ssh_message_channel_request_open_reply_accept_channel(ssh_message msg, ssh_channel chan);
|
||||||
LIBSSH_API int ssh_message_channel_request_reply_success(ssh_message msg);
|
LIBSSH_API int ssh_message_channel_request_reply_success(ssh_message msg);
|
||||||
|
#define SSH_MESSAGE_FREE(x) \
|
||||||
|
do { if ((x) != NULL) { ssh_message_free(x); (x) = NULL; } } while(0)
|
||||||
LIBSSH_API void ssh_message_free(ssh_message msg);
|
LIBSSH_API void ssh_message_free(ssh_message msg);
|
||||||
LIBSSH_API ssh_message ssh_message_get(ssh_session session);
|
LIBSSH_API ssh_message ssh_message_get(ssh_session session);
|
||||||
LIBSSH_API int ssh_message_subtype(ssh_message msg);
|
LIBSSH_API int ssh_message_subtype(ssh_message msg);
|
||||||
@@ -600,6 +648,8 @@ typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len,
|
|||||||
int echo, int verify, void *userdata);
|
int echo, int verify, void *userdata);
|
||||||
|
|
||||||
LIBSSH_API ssh_key ssh_key_new(void);
|
LIBSSH_API ssh_key ssh_key_new(void);
|
||||||
|
#define SSH_KEY_FREE(x) \
|
||||||
|
do { if ((x) != NULL) { ssh_key_free(x); x = NULL; } } while(0)
|
||||||
LIBSSH_API void ssh_key_free (ssh_key key);
|
LIBSSH_API void ssh_key_free (ssh_key key);
|
||||||
LIBSSH_API enum ssh_keytypes_e ssh_key_type(const ssh_key key);
|
LIBSSH_API enum ssh_keytypes_e ssh_key_type(const ssh_key key);
|
||||||
LIBSSH_API const char *ssh_key_type_to_char(enum ssh_keytypes_e type);
|
LIBSSH_API const char *ssh_key_type_to_char(enum ssh_keytypes_e type);
|
||||||
@@ -617,6 +667,11 @@ LIBSSH_API int ssh_pki_import_privkey_base64(const char *b64_key,
|
|||||||
ssh_auth_callback auth_fn,
|
ssh_auth_callback auth_fn,
|
||||||
void *auth_data,
|
void *auth_data,
|
||||||
ssh_key *pkey);
|
ssh_key *pkey);
|
||||||
|
LIBSSH_API int ssh_pki_export_privkey_base64(const ssh_key privkey,
|
||||||
|
const char *passphrase,
|
||||||
|
ssh_auth_callback auth_fn,
|
||||||
|
void *auth_data,
|
||||||
|
char **b64_key);
|
||||||
LIBSSH_API int ssh_pki_import_privkey_file(const char *filename,
|
LIBSSH_API int ssh_pki_import_privkey_file(const char *filename,
|
||||||
const char *passphrase,
|
const char *passphrase,
|
||||||
ssh_auth_callback auth_fn,
|
ssh_auth_callback auth_fn,
|
||||||
@@ -652,7 +707,10 @@ LIBSSH_API int ssh_pki_export_pubkey_file(const ssh_key key,
|
|||||||
|
|
||||||
LIBSSH_API const char *ssh_pki_key_ecdsa_name(const ssh_key key);
|
LIBSSH_API const char *ssh_pki_key_ecdsa_name(const ssh_key key);
|
||||||
|
|
||||||
LIBSSH_API void ssh_print_hexa(const char *descr, const unsigned char *what, size_t len);
|
LIBSSH_API char *ssh_get_fingerprint_hash(enum ssh_publickey_hash_type type,
|
||||||
|
unsigned char *hash,
|
||||||
|
size_t len);
|
||||||
|
LIBSSH_API void ssh_print_hash(enum ssh_publickey_hash_type type, unsigned char *hash, size_t len);
|
||||||
LIBSSH_API int ssh_send_ignore (ssh_session session, const char *data);
|
LIBSSH_API int ssh_send_ignore (ssh_session session, const char *data);
|
||||||
LIBSSH_API int ssh_send_debug (ssh_session session, const char *message, int always_display);
|
LIBSSH_API int ssh_send_debug (ssh_session session, const char *message, int always_display);
|
||||||
LIBSSH_API void ssh_gssapi_set_creds(ssh_session session, const ssh_gssapi_creds creds);
|
LIBSSH_API void ssh_gssapi_set_creds(ssh_session session, const ssh_gssapi_creds creds);
|
||||||
@@ -719,19 +777,21 @@ LIBSSH_API int ssh_userauth_kbdint_setanswer(ssh_session session, unsigned int i
|
|||||||
const char *answer);
|
const char *answer);
|
||||||
LIBSSH_API int ssh_userauth_gssapi(ssh_session session);
|
LIBSSH_API int ssh_userauth_gssapi(ssh_session session);
|
||||||
LIBSSH_API const char *ssh_version(int req_version);
|
LIBSSH_API const char *ssh_version(int req_version);
|
||||||
LIBSSH_API int ssh_write_knownhost(ssh_session session);
|
|
||||||
LIBSSH_API char *ssh_dump_knownhost(ssh_session session);
|
|
||||||
|
|
||||||
LIBSSH_API void ssh_string_burn(ssh_string str);
|
LIBSSH_API void ssh_string_burn(ssh_string str);
|
||||||
LIBSSH_API ssh_string ssh_string_copy(ssh_string str);
|
LIBSSH_API ssh_string ssh_string_copy(ssh_string str);
|
||||||
LIBSSH_API void *ssh_string_data(ssh_string str);
|
LIBSSH_API void *ssh_string_data(ssh_string str);
|
||||||
LIBSSH_API int ssh_string_fill(ssh_string str, const void *data, size_t len);
|
LIBSSH_API int ssh_string_fill(ssh_string str, const void *data, size_t len);
|
||||||
|
#define SSH_STRING_FREE(x) \
|
||||||
|
do { if ((x) != NULL) { ssh_string_free(x); x = NULL; } } while(0)
|
||||||
LIBSSH_API void ssh_string_free(ssh_string str);
|
LIBSSH_API void ssh_string_free(ssh_string str);
|
||||||
LIBSSH_API ssh_string ssh_string_from_char(const char *what);
|
LIBSSH_API ssh_string ssh_string_from_char(const char *what);
|
||||||
LIBSSH_API size_t ssh_string_len(ssh_string str);
|
LIBSSH_API size_t ssh_string_len(ssh_string str);
|
||||||
LIBSSH_API ssh_string ssh_string_new(size_t size);
|
LIBSSH_API ssh_string ssh_string_new(size_t size);
|
||||||
LIBSSH_API const char *ssh_string_get_char(ssh_string str);
|
LIBSSH_API const char *ssh_string_get_char(ssh_string str);
|
||||||
LIBSSH_API char *ssh_string_to_char(ssh_string str);
|
LIBSSH_API char *ssh_string_to_char(ssh_string str);
|
||||||
|
#define SSH_STRING_FREE_CHAR(x) \
|
||||||
|
do { if ((x) != NULL) { ssh_string_free_char(x); x = NULL; } } while(0)
|
||||||
LIBSSH_API void ssh_string_free_char(char *s);
|
LIBSSH_API void ssh_string_free_char(char *s);
|
||||||
|
|
||||||
LIBSSH_API int ssh_getpass(const char *prompt, char *buf, size_t len, int echo,
|
LIBSSH_API int ssh_getpass(const char *prompt, char *buf, size_t len, int echo,
|
||||||
@@ -760,6 +820,8 @@ LIBSSH_API const char* ssh_get_hmac_out(ssh_session session);
|
|||||||
|
|
||||||
LIBSSH_API ssh_buffer ssh_buffer_new(void);
|
LIBSSH_API ssh_buffer ssh_buffer_new(void);
|
||||||
LIBSSH_API void ssh_buffer_free(ssh_buffer buffer);
|
LIBSSH_API void ssh_buffer_free(ssh_buffer buffer);
|
||||||
|
#define SSH_BUFFER_FREE(x) \
|
||||||
|
do { if ((x) != NULL) { ssh_buffer_free(x); x = NULL; } } while(0)
|
||||||
LIBSSH_API int ssh_buffer_reinit(ssh_buffer buffer);
|
LIBSSH_API int ssh_buffer_reinit(ssh_buffer buffer);
|
||||||
LIBSSH_API int ssh_buffer_add_data(ssh_buffer buffer, const void *data, uint32_t len);
|
LIBSSH_API int ssh_buffer_add_data(ssh_buffer buffer, const void *data, uint32_t len);
|
||||||
LIBSSH_API uint32_t ssh_buffer_get_data(ssh_buffer buffer, void *data, uint32_t requestedlen);
|
LIBSSH_API uint32_t ssh_buffer_get_data(ssh_buffer buffer, void *data, uint32_t requestedlen);
|
||||||
|
|||||||
@@ -195,15 +195,24 @@ public:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Authenticate through the "keyboard-interactive" method.
|
/**
|
||||||
* @param[in] The username to authenticate. You can specify NULL if ssh_option_set_username() has been used. You cannot try two different logins in a row.
|
* @brief Authenticate through the "keyboard-interactive" method.
|
||||||
* @param[in] Undocumented. Set it to NULL.
|
*
|
||||||
|
* @param[in] username The username to authenticate. You can specify NULL if
|
||||||
|
* ssh_option_set_username() has been used. You cannot
|
||||||
|
* try two different logins in a row.
|
||||||
|
*
|
||||||
|
* @param[in] submethods Undocumented. Set it to NULL.
|
||||||
|
*
|
||||||
* @throws SshException on error
|
* @throws SshException on error
|
||||||
* @returns SSH_AUTH_SUCCESS, SSH_AUTH_PARTIAL, SSH_AUTH_DENIED, SSH_AUTH_ERROR, SSH_AUTH_INFO, SSH_AUTH_AGAIN
|
*
|
||||||
|
* @returns SSH_AUTH_SUCCESS, SSH_AUTH_PARTIAL, SSH_AUTH_DENIED,
|
||||||
|
* SSH_AUTH_ERROR, SSH_AUTH_INFO, SSH_AUTH_AGAIN
|
||||||
|
*
|
||||||
* @see ssh_userauth_kbdint
|
* @see ssh_userauth_kbdint
|
||||||
*/
|
*/
|
||||||
int userauthKbdint(const char* username, const char* submethods){
|
int userauthKbdint(const char* username, const char* submethods){
|
||||||
int ret=ssh_userauth_kbdint(c_session,NULL,NULL);
|
int ret = ssh_userauth_kbdint(c_session, username, submethods);
|
||||||
ssh_throw(ret);
|
ssh_throw(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -216,15 +225,25 @@ public:
|
|||||||
return ssh_userauth_kbdint_getnprompts(c_session);
|
return ssh_userauth_kbdint_getnprompts(c_session);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @brief Set the answer for a question from a message block..
|
/**
|
||||||
* @param[in] index The number of the ith prompt.
|
* @brief Set the answer for a question from a message block.
|
||||||
* @param[in] The answer to give to the server. The answer MUST be encoded UTF-8. It is up to the server how to interpret the value and validate it. However, if you read the answer in some other encoding, you MUST convert it to UTF-8.
|
*
|
||||||
|
* @param[in] index The index number of the prompt.
|
||||||
|
* @param[in] answer The answer to give to the server. The answer MUST be
|
||||||
|
* encoded UTF-8. It is up to the server how to interpret
|
||||||
|
* the value and validate it. However, if you read the
|
||||||
|
* answer in some other encoding, you MUST convert it to
|
||||||
|
* UTF-8.
|
||||||
|
*
|
||||||
* @throws SshException on error
|
* @throws SshException on error
|
||||||
|
*
|
||||||
* @returns 0 on success, < 0 on error
|
* @returns 0 on success, < 0 on error
|
||||||
|
*
|
||||||
* @see ssh_userauth_kbdint_setanswer
|
* @see ssh_userauth_kbdint_setanswer
|
||||||
*/
|
*/
|
||||||
int userauthKbdintSetAnswer(unsigned int i, const char* answer){
|
int userauthKbdintSetAnswer(unsigned int index, const char *answer)
|
||||||
int ret=ssh_userauth_kbdint_setanswer(c_session, i, answer);
|
{
|
||||||
|
int ret = ssh_userauth_kbdint_setanswer(c_session, index, answer);
|
||||||
ssh_throw(ret);
|
ssh_throw(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -316,11 +335,10 @@ public:
|
|||||||
* @see ssh_get_issue_banner
|
* @see ssh_get_issue_banner
|
||||||
*/
|
*/
|
||||||
std::string getIssueBanner(){
|
std::string getIssueBanner(){
|
||||||
char *banner=ssh_get_issue_banner(c_session);
|
char *banner = ssh_get_issue_banner(c_session);
|
||||||
std::string ret;
|
std::string ret = "";
|
||||||
if (banner)
|
if (banner != NULL) {
|
||||||
{
|
ret = std::string(banner);
|
||||||
ret= std::string(banner);
|
|
||||||
::free(banner);
|
::free(banner);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@@ -389,7 +407,7 @@ public:
|
|||||||
* @see ssh_write_knownhost
|
* @see ssh_write_knownhost
|
||||||
*/
|
*/
|
||||||
int writeKnownhost(){
|
int writeKnownhost(){
|
||||||
int ret = ssh_write_knownhost(c_session);
|
int ret = ssh_session_update_known_hosts(c_session);
|
||||||
ssh_throw(ret);
|
ssh_throw(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -438,9 +456,9 @@ private:
|
|||||||
class Channel {
|
class Channel {
|
||||||
friend class Session;
|
friend class Session;
|
||||||
public:
|
public:
|
||||||
Channel(Session &session){
|
Channel(Session &ssh_session){
|
||||||
channel=ssh_channel_new(session.getCSession());
|
channel = ssh_channel_new(ssh_session.getCSession());
|
||||||
this->session=&session;
|
this->session = &ssh_session;
|
||||||
}
|
}
|
||||||
~Channel(){
|
~Channel(){
|
||||||
ssh_channel_free(channel);
|
ssh_channel_free(channel);
|
||||||
@@ -641,9 +659,9 @@ protected:
|
|||||||
ssh_channel channel;
|
ssh_channel channel;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Channel (Session &session, ssh_channel c_channel){
|
Channel (Session &ssh_session, ssh_channel c_channel){
|
||||||
this->channel=c_channel;
|
this->channel=c_channel;
|
||||||
this->session=&session;
|
this->session = &ssh_session;
|
||||||
}
|
}
|
||||||
/* No copy and no = operator */
|
/* No copy and no = operator */
|
||||||
Channel(const Channel &);
|
Channel(const Channel &);
|
||||||
|
|||||||
@@ -101,8 +101,6 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_request);
|
|||||||
|
|
||||||
int ssh_message_handle_channel_request(ssh_session session, ssh_channel channel, ssh_buffer packet,
|
int ssh_message_handle_channel_request(ssh_session session, ssh_channel channel, ssh_buffer packet,
|
||||||
const char *request, uint8_t want_reply);
|
const char *request, uint8_t want_reply);
|
||||||
void ssh_message_queue(ssh_session session, ssh_message message);
|
|
||||||
ssh_message ssh_message_pop_head(ssh_session session);
|
ssh_message ssh_message_pop_head(ssh_session session);
|
||||||
int ssh_message_channel_request_open_reply_accept_channel(ssh_message msg, ssh_channel chan);
|
|
||||||
|
|
||||||
#endif /* MESSAGES_H_ */
|
#endif /* MESSAGES_H_ */
|
||||||
|
|||||||
@@ -81,4 +81,6 @@ int ssh_timeout_update(struct ssh_timestamp *ts, int timeout);
|
|||||||
|
|
||||||
int ssh_match_group(const char *group, const char *object);
|
int ssh_match_group(const char *group, const char *object);
|
||||||
|
|
||||||
|
void uint64_inc(unsigned char *counter);
|
||||||
|
|
||||||
#endif /* MISC_H_ */
|
#endif /* MISC_H_ */
|
||||||
|
|||||||
@@ -43,6 +43,12 @@ enum ssh_packet_state_e {
|
|||||||
PACKET_STATE_PROCESSING
|
PACKET_STATE_PROCESSING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ssh_packet_filter_result_e {
|
||||||
|
SSH_PACKET_UNKNOWN,
|
||||||
|
SSH_PACKET_ALLOWED,
|
||||||
|
SSH_PACKET_DENIED
|
||||||
|
};
|
||||||
|
|
||||||
int ssh_packet_send(ssh_session session);
|
int ssh_packet_send(ssh_session session);
|
||||||
|
|
||||||
SSH_PACKET_CALLBACK(ssh_packet_unimplemented);
|
SSH_PACKET_CALLBACK(ssh_packet_unimplemented);
|
||||||
@@ -51,6 +57,7 @@ SSH_PACKET_CALLBACK(ssh_packet_ignore_callback);
|
|||||||
SSH_PACKET_CALLBACK(ssh_packet_dh_reply);
|
SSH_PACKET_CALLBACK(ssh_packet_dh_reply);
|
||||||
SSH_PACKET_CALLBACK(ssh_packet_newkeys);
|
SSH_PACKET_CALLBACK(ssh_packet_newkeys);
|
||||||
SSH_PACKET_CALLBACK(ssh_packet_service_accept);
|
SSH_PACKET_CALLBACK(ssh_packet_service_accept);
|
||||||
|
SSH_PACKET_CALLBACK(ssh_packet_ext_info);
|
||||||
|
|
||||||
#ifdef WITH_SERVER
|
#ifdef WITH_SERVER
|
||||||
SSH_PACKET_CALLBACK(ssh_packet_kexdh_init);
|
SSH_PACKET_CALLBACK(ssh_packet_kexdh_init);
|
||||||
@@ -63,6 +70,7 @@ int ssh_packet_parse_type(ssh_session session);
|
|||||||
int ssh_packet_socket_callback(const void *data, size_t len, void *user);
|
int ssh_packet_socket_callback(const void *data, size_t len, void *user);
|
||||||
void ssh_packet_register_socket_callback(ssh_session session, struct ssh_socket_struct *s);
|
void ssh_packet_register_socket_callback(ssh_session session, struct ssh_socket_struct *s);
|
||||||
void ssh_packet_set_callbacks(ssh_session session, ssh_packet_callbacks callbacks);
|
void ssh_packet_set_callbacks(ssh_session session, ssh_packet_callbacks callbacks);
|
||||||
|
void ssh_packet_remove_callbacks(ssh_session session, ssh_packet_callbacks callbacks);
|
||||||
void ssh_packet_set_default_callbacks(ssh_session session);
|
void ssh_packet_set_default_callbacks(ssh_session session);
|
||||||
void ssh_packet_process(ssh_session session, uint8_t type);
|
void ssh_packet_process(ssh_session session, uint8_t type);
|
||||||
|
|
||||||
@@ -73,7 +81,11 @@ int ssh_packet_decrypt(ssh_session session, uint8_t *destination, uint8_t *sourc
|
|||||||
unsigned char *ssh_packet_encrypt(ssh_session session,
|
unsigned char *ssh_packet_encrypt(ssh_session session,
|
||||||
void *packet,
|
void *packet,
|
||||||
unsigned int len);
|
unsigned int len);
|
||||||
int ssh_packet_hmac_verify(ssh_session session,ssh_buffer buffer,
|
int ssh_packet_hmac_verify(ssh_session session, const void *data, size_t len,
|
||||||
unsigned char *mac, enum ssh_hmac_e type);
|
unsigned char *mac, enum ssh_hmac_e type);
|
||||||
|
int ssh_packet_set_newkeys(ssh_session session,
|
||||||
|
enum ssh_crypto_direction_e direction);
|
||||||
|
struct ssh_crypto_struct *ssh_packet_get_current_crypto(ssh_session session,
|
||||||
|
enum ssh_crypto_direction_e direction);
|
||||||
|
|
||||||
#endif /* PACKET_H_ */
|
#endif /* PACKET_H_ */
|
||||||
|
|||||||
@@ -44,23 +44,23 @@ struct ssh_key_struct {
|
|||||||
int flags;
|
int flags;
|
||||||
const char *type_c; /* Don't free it ! it is static */
|
const char *type_c; /* Don't free it ! it is static */
|
||||||
int ecdsa_nid;
|
int ecdsa_nid;
|
||||||
#ifdef HAVE_LIBGCRYPT
|
#if defined(HAVE_LIBGCRYPT)
|
||||||
gcry_sexp_t dsa;
|
gcry_sexp_t dsa;
|
||||||
gcry_sexp_t rsa;
|
gcry_sexp_t rsa;
|
||||||
gcry_sexp_t ecdsa;
|
gcry_sexp_t ecdsa;
|
||||||
#elif HAVE_LIBMBEDCRYPTO
|
#elif defined(HAVE_LIBMBEDCRYPTO)
|
||||||
mbedtls_pk_context *rsa;
|
mbedtls_pk_context *rsa;
|
||||||
mbedtls_ecdsa_context *ecdsa;
|
mbedtls_ecdsa_context *ecdsa;
|
||||||
void *dsa;
|
void *dsa;
|
||||||
#elif HAVE_LIBCRYPTO
|
#elif defined(HAVE_LIBCRYPTO)
|
||||||
DSA *dsa;
|
DSA *dsa;
|
||||||
RSA *rsa;
|
RSA *rsa;
|
||||||
#ifdef HAVE_OPENSSL_ECC
|
# if defined(HAVE_OPENSSL_ECC)
|
||||||
EC_KEY *ecdsa;
|
EC_KEY *ecdsa;
|
||||||
#else
|
# else
|
||||||
void *ecdsa;
|
void *ecdsa;
|
||||||
#endif /* HAVE_OPENSSL_EC_H */
|
# endif /* HAVE_OPENSSL_EC_H */
|
||||||
#endif
|
#endif /* HAVE_LIBGCRYPT */
|
||||||
ed25519_pubkey *ed25519_pubkey;
|
ed25519_pubkey *ed25519_pubkey;
|
||||||
ed25519_privkey *ed25519_privkey;
|
ed25519_privkey *ed25519_privkey;
|
||||||
void *cert;
|
void *cert;
|
||||||
@@ -69,24 +69,18 @@ struct ssh_key_struct {
|
|||||||
|
|
||||||
struct ssh_signature_struct {
|
struct ssh_signature_struct {
|
||||||
enum ssh_keytypes_e type;
|
enum ssh_keytypes_e type;
|
||||||
|
enum ssh_digest_e hash_type;
|
||||||
const char *type_c;
|
const char *type_c;
|
||||||
#ifdef HAVE_LIBGCRYPT
|
#if defined(HAVE_LIBGCRYPT)
|
||||||
gcry_sexp_t dsa_sig;
|
gcry_sexp_t dsa_sig;
|
||||||
gcry_sexp_t rsa_sig;
|
gcry_sexp_t rsa_sig;
|
||||||
gcry_sexp_t ecdsa_sig;
|
gcry_sexp_t ecdsa_sig;
|
||||||
#elif defined HAVE_LIBCRYPTO
|
#elif defined(HAVE_LIBMBEDCRYPTO)
|
||||||
DSA_SIG *dsa_sig;
|
|
||||||
ssh_string rsa_sig;
|
|
||||||
# ifdef HAVE_OPENSSL_ECC
|
|
||||||
ECDSA_SIG *ecdsa_sig;
|
|
||||||
# else
|
|
||||||
void *ecdsa_sig;
|
|
||||||
# endif
|
|
||||||
#elif defined HAVE_LIBMBEDCRYPTO
|
|
||||||
ssh_string rsa_sig;
|
ssh_string rsa_sig;
|
||||||
struct mbedtls_ecdsa_sig ecdsa_sig;
|
struct mbedtls_ecdsa_sig ecdsa_sig;
|
||||||
#endif
|
#endif /* HAVE_LIBGCRYPT */
|
||||||
ed25519_signature *ed25519_sig;
|
ed25519_signature *ed25519_sig;
|
||||||
|
ssh_string raw_sig;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ssh_signature_struct *ssh_signature;
|
typedef struct ssh_signature_struct *ssh_signature;
|
||||||
@@ -95,6 +89,23 @@ typedef struct ssh_signature_struct *ssh_signature;
|
|||||||
ssh_key ssh_key_dup(const ssh_key key);
|
ssh_key ssh_key_dup(const ssh_key key);
|
||||||
void ssh_key_clean (ssh_key key);
|
void ssh_key_clean (ssh_key key);
|
||||||
|
|
||||||
|
const char *
|
||||||
|
ssh_key_get_signature_algorithm(ssh_session session,
|
||||||
|
enum ssh_keytypes_e type);
|
||||||
|
enum ssh_keytypes_e ssh_key_type_from_signature_name(const char *name);
|
||||||
|
enum ssh_keytypes_e ssh_key_type_plain(enum ssh_keytypes_e type);
|
||||||
|
enum ssh_digest_e ssh_key_type_to_hash(ssh_session session,
|
||||||
|
enum ssh_keytypes_e type);
|
||||||
|
|
||||||
|
#define is_ecdsa_key_type(t) \
|
||||||
|
((t) >= SSH_KEYTYPE_ECDSA_P256 && (t) <= SSH_KEYTYPE_ECDSA_P521)
|
||||||
|
|
||||||
|
#define is_cert_type(kt)\
|
||||||
|
((kt) == SSH_KEYTYPE_DSS_CERT01 ||\
|
||||||
|
(kt) == SSH_KEYTYPE_RSA_CERT01 ||\
|
||||||
|
((kt) >= SSH_KEYTYPE_ECDSA_P256_CERT01 &&\
|
||||||
|
(kt) <= SSH_KEYTYPE_ED25519_CERT01))
|
||||||
|
|
||||||
/* SSH Signature Functions */
|
/* SSH Signature Functions */
|
||||||
ssh_signature ssh_signature_new(void);
|
ssh_signature ssh_signature_new(void);
|
||||||
void ssh_signature_free(ssh_signature sign);
|
void ssh_signature_free(ssh_signature sign);
|
||||||
@@ -104,11 +115,11 @@ int ssh_pki_export_signature_blob(const ssh_signature sign,
|
|||||||
int ssh_pki_import_signature_blob(const ssh_string sig_blob,
|
int ssh_pki_import_signature_blob(const ssh_string sig_blob,
|
||||||
const ssh_key pubkey,
|
const ssh_key pubkey,
|
||||||
ssh_signature *psig);
|
ssh_signature *psig);
|
||||||
int ssh_pki_signature_verify_blob(ssh_session session,
|
int ssh_pki_signature_verify(ssh_session session,
|
||||||
ssh_string sig_blob,
|
ssh_signature sig,
|
||||||
const ssh_key key,
|
const ssh_key key,
|
||||||
unsigned char *digest,
|
unsigned char *digest,
|
||||||
size_t dlen);
|
size_t dlen);
|
||||||
|
|
||||||
/* SSH Public Key Functions */
|
/* SSH Public Key Functions */
|
||||||
int ssh_pki_export_pubkey_blob(const ssh_key key,
|
int ssh_pki_export_pubkey_blob(const ssh_key key,
|
||||||
@@ -122,7 +133,7 @@ int ssh_pki_import_cert_blob(const ssh_string cert_blob,
|
|||||||
|
|
||||||
/* SSH Signing Functions */
|
/* SSH Signing Functions */
|
||||||
ssh_string ssh_pki_do_sign(ssh_session session, ssh_buffer sigbuf,
|
ssh_string ssh_pki_do_sign(ssh_session session, ssh_buffer sigbuf,
|
||||||
const ssh_key privatekey);
|
const ssh_key privatekey, enum ssh_digest_e hash_type);
|
||||||
ssh_string ssh_pki_do_sign_agent(ssh_session session,
|
ssh_string ssh_pki_do_sign_agent(ssh_session session,
|
||||||
struct ssh_buffer_struct *buf,
|
struct ssh_buffer_struct *buf,
|
||||||
const ssh_key pubkey);
|
const ssh_key pubkey);
|
||||||
@@ -133,4 +144,5 @@ ssh_string ssh_srv_pki_do_sign_sessionid(ssh_session session,
|
|||||||
ssh_public_key ssh_pki_convert_key_to_publickey(const ssh_key key);
|
ssh_public_key ssh_pki_convert_key_to_publickey(const ssh_key key);
|
||||||
ssh_private_key ssh_pki_convert_key_to_privatekey(const ssh_key key);
|
ssh_private_key ssh_pki_convert_key_to_privatekey(const ssh_key key);
|
||||||
|
|
||||||
|
int ssh_key_algorithm_allowed(ssh_session session, const char *type);
|
||||||
#endif /* PKI_H_ */
|
#endif /* PKI_H_ */
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ int bcrypt_pbkdf(const char *pass,
|
|||||||
|
|
||||||
int pki_key_ecdsa_nid_from_name(const char *name);
|
int pki_key_ecdsa_nid_from_name(const char *name);
|
||||||
const char *pki_key_ecdsa_nid_to_name(int nid);
|
const char *pki_key_ecdsa_nid_to_name(int nid);
|
||||||
|
const char *ssh_key_signature_to_char(enum ssh_keytypes_e type,
|
||||||
|
enum ssh_digest_e hash_type);
|
||||||
|
enum ssh_digest_e ssh_key_type_to_hash(ssh_session session,
|
||||||
|
enum ssh_keytypes_e type);
|
||||||
|
|
||||||
/* SSH Key Functions */
|
/* SSH Key Functions */
|
||||||
ssh_key pki_key_dup(const ssh_key key, int demote);
|
ssh_key pki_key_dup(const ssh_key key, int demote);
|
||||||
@@ -57,6 +61,8 @@ int pki_key_compare(const ssh_key k1,
|
|||||||
const ssh_key k2,
|
const ssh_key k2,
|
||||||
enum ssh_keycmp_e what);
|
enum ssh_keycmp_e what);
|
||||||
|
|
||||||
|
int pki_key_check_hash_compatible(ssh_key key,
|
||||||
|
enum ssh_digest_e hash_type);
|
||||||
/* SSH Private Key Functions */
|
/* SSH Private Key Functions */
|
||||||
enum ssh_keytypes_e pki_privatekey_type_from_string(const char *privkey);
|
enum ssh_keytypes_e pki_privatekey_type_from_string(const char *privkey);
|
||||||
ssh_key pki_private_key_from_base64(const char *b64_key,
|
ssh_key pki_private_key_from_base64(const char *b64_key,
|
||||||
@@ -68,6 +74,9 @@ ssh_string pki_private_key_to_pem(const ssh_key key,
|
|||||||
const char *passphrase,
|
const char *passphrase,
|
||||||
ssh_auth_callback auth_fn,
|
ssh_auth_callback auth_fn,
|
||||||
void *auth_data);
|
void *auth_data);
|
||||||
|
int pki_import_privkey_buffer(enum ssh_keytypes_e type,
|
||||||
|
ssh_buffer buffer,
|
||||||
|
ssh_key *pkey);
|
||||||
|
|
||||||
/* SSH Public Key Functions */
|
/* SSH Public Key Functions */
|
||||||
int pki_pubkey_build_dss(ssh_key key,
|
int pki_pubkey_build_dss(ssh_key key,
|
||||||
@@ -81,24 +90,55 @@ int pki_pubkey_build_rsa(ssh_key key,
|
|||||||
int pki_pubkey_build_ecdsa(ssh_key key, int nid, ssh_string e);
|
int pki_pubkey_build_ecdsa(ssh_key key, int nid, ssh_string e);
|
||||||
ssh_string pki_publickey_to_blob(const ssh_key key);
|
ssh_string pki_publickey_to_blob(const ssh_key key);
|
||||||
|
|
||||||
|
/* SSH Private Key Functions */
|
||||||
|
int pki_privkey_build_dss(ssh_key key,
|
||||||
|
ssh_string p,
|
||||||
|
ssh_string q,
|
||||||
|
ssh_string g,
|
||||||
|
ssh_string pubkey,
|
||||||
|
ssh_string privkey);
|
||||||
|
int pki_privkey_build_rsa(ssh_key key,
|
||||||
|
ssh_string n,
|
||||||
|
ssh_string e,
|
||||||
|
ssh_string d,
|
||||||
|
ssh_string iqmp,
|
||||||
|
ssh_string p,
|
||||||
|
ssh_string q);
|
||||||
|
int pki_privkey_build_ecdsa(ssh_key key,
|
||||||
|
int nid,
|
||||||
|
ssh_string e,
|
||||||
|
ssh_string exp);
|
||||||
|
ssh_string pki_publickey_to_blob(const ssh_key key);
|
||||||
|
|
||||||
/* SSH Signature Functions */
|
/* SSH Signature Functions */
|
||||||
|
ssh_signature pki_sign_data(const ssh_key privkey,
|
||||||
|
enum ssh_digest_e hash_type,
|
||||||
|
const unsigned char *input,
|
||||||
|
size_t input_len);
|
||||||
|
int pki_verify_data_signature(ssh_signature signature,
|
||||||
|
const ssh_key pubkey,
|
||||||
|
const unsigned char *input,
|
||||||
|
size_t input_len);
|
||||||
ssh_string pki_signature_to_blob(const ssh_signature sign);
|
ssh_string pki_signature_to_blob(const ssh_signature sign);
|
||||||
ssh_signature pki_signature_from_blob(const ssh_key pubkey,
|
ssh_signature pki_signature_from_blob(const ssh_key pubkey,
|
||||||
const ssh_string sig_blob,
|
const ssh_string sig_blob,
|
||||||
enum ssh_keytypes_e type);
|
enum ssh_keytypes_e type,
|
||||||
|
enum ssh_digest_e hash_type);
|
||||||
int pki_signature_verify(ssh_session session,
|
int pki_signature_verify(ssh_session session,
|
||||||
const ssh_signature sig,
|
const ssh_signature sig,
|
||||||
const ssh_key key,
|
const ssh_key key,
|
||||||
const unsigned char *hash,
|
const unsigned char *input,
|
||||||
size_t hlen);
|
size_t input_len);
|
||||||
|
|
||||||
/* SSH Signing Functions */
|
/* SSH Signing Functions */
|
||||||
ssh_signature pki_do_sign(const ssh_key privkey,
|
ssh_signature pki_do_sign(const ssh_key privkey,
|
||||||
const unsigned char *hash,
|
const unsigned char *input,
|
||||||
size_t hlen);
|
size_t input_len,
|
||||||
ssh_signature pki_do_sign_sessionid(const ssh_key key,
|
enum ssh_digest_e hash_type);
|
||||||
const unsigned char *hash,
|
ssh_signature pki_do_sign_hash(const ssh_key privkey,
|
||||||
size_t hlen);
|
const unsigned char *hash,
|
||||||
|
size_t hlen,
|
||||||
|
enum ssh_digest_e hash_type);
|
||||||
int pki_ed25519_sign(const ssh_key privkey, ssh_signature sig,
|
int pki_ed25519_sign(const ssh_key privkey, ssh_signature sig,
|
||||||
const unsigned char *hash, size_t hlen);
|
const unsigned char *hash, size_t hlen);
|
||||||
int pki_ed25519_verify(const ssh_key pubkey, ssh_signature sig,
|
int pki_ed25519_verify(const ssh_key pubkey, ssh_signature sig,
|
||||||
@@ -110,8 +150,12 @@ int pki_ed25519_key_dup(ssh_key new, const ssh_key key);
|
|||||||
int pki_ed25519_public_key_to_blob(ssh_buffer buffer, ssh_key key);
|
int pki_ed25519_public_key_to_blob(ssh_buffer buffer, ssh_key key);
|
||||||
ssh_string pki_ed25519_sig_to_blob(ssh_signature sig);
|
ssh_string pki_ed25519_sig_to_blob(ssh_signature sig);
|
||||||
int pki_ed25519_sig_from_blob(ssh_signature sig, ssh_string sig_blob);
|
int pki_ed25519_sig_from_blob(ssh_signature sig, ssh_string sig_blob);
|
||||||
|
int pki_privkey_build_ed25519(ssh_key key,
|
||||||
|
ssh_string pubkey,
|
||||||
|
ssh_string privkey);
|
||||||
|
|
||||||
/* PKI Container OpenSSH */
|
/* PKI Container OpenSSH */
|
||||||
|
ssh_key ssh_pki_openssh_pubkey_import(const char *text_key);
|
||||||
ssh_key ssh_pki_openssh_privkey_import(const char *text_key,
|
ssh_key ssh_pki_openssh_privkey_import(const char *text_key,
|
||||||
const char *passphrase, ssh_auth_callback auth_fn, void *auth_data);
|
const char *passphrase, ssh_auth_callback auth_fn, void *auth_data);
|
||||||
ssh_string ssh_pki_openssh_privkey_export(const ssh_key privkey,
|
ssh_string ssh_pki_openssh_privkey_export(const ssh_key privkey,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
#ifndef _LIBSSH_PRIV_H
|
#ifndef _LIBSSH_PRIV_H
|
||||||
#define _LIBSSH_PRIV_H
|
#define _LIBSSH_PRIV_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -44,6 +45,10 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif /* !defined(HAVE_STRTOULL) */
|
#endif /* !defined(HAVE_STRTOULL) */
|
||||||
|
|
||||||
|
#if !defined(HAVE_STRNDUP)
|
||||||
|
char *strndup(const char *s, size_t n);
|
||||||
|
#endif /* ! HAVE_STRNDUP */
|
||||||
|
|
||||||
#ifdef HAVE_BYTESWAP_H
|
#ifdef HAVE_BYTESWAP_H
|
||||||
#include <byteswap.h>
|
#include <byteswap.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -73,6 +78,22 @@
|
|||||||
# endif /* __WORDSIZE */
|
# endif /* __WORDSIZE */
|
||||||
# endif /* PRIu64 */
|
# endif /* PRIu64 */
|
||||||
|
|
||||||
|
# ifndef PRIu32
|
||||||
|
# define PRIu32 "u"
|
||||||
|
# endif /* PRIu32 */
|
||||||
|
|
||||||
|
# ifndef PRIx64
|
||||||
|
# if __WORDSIZE == 64
|
||||||
|
# define PRIx64 "lx"
|
||||||
|
# else
|
||||||
|
# define PRIx64 "llx"
|
||||||
|
# endif /* __WORDSIZE */
|
||||||
|
# endif /* PRIx64 */
|
||||||
|
|
||||||
|
# ifndef PRIx32
|
||||||
|
# define PRIx32 "x"
|
||||||
|
# endif /* PRIx32 */
|
||||||
|
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <stdarg.h> /* va_copy define check */
|
# include <stdarg.h> /* va_copy define check */
|
||||||
@@ -124,6 +145,13 @@
|
|||||||
# endif /* HAVE__VSNPRINTF */
|
# endif /* HAVE__VSNPRINTF */
|
||||||
# endif /* HAVE__VSNPRINTF_S */
|
# endif /* HAVE__VSNPRINTF_S */
|
||||||
|
|
||||||
|
# ifndef _SSIZE_T_DEFINED
|
||||||
|
# undef ssize_t
|
||||||
|
# include <BaseTsd.h>
|
||||||
|
typedef _W64 SSIZE_T ssize_t;
|
||||||
|
# define _SSIZE_T_DEFINED
|
||||||
|
# endif /* _SSIZE_T_DEFINED */
|
||||||
|
|
||||||
# endif /* _MSC_VER */
|
# endif /* _MSC_VER */
|
||||||
|
|
||||||
struct timeval;
|
struct timeval;
|
||||||
@@ -232,6 +260,7 @@ void _ssh_set_error_oom(void *error, const char *function);
|
|||||||
_ssh_set_error_invalid(error, __func__)
|
_ssh_set_error_invalid(error, __func__)
|
||||||
void _ssh_set_error_invalid(void *error, const char *function);
|
void _ssh_set_error_invalid(void *error, const char *function);
|
||||||
|
|
||||||
|
void ssh_reset_error(void *error);
|
||||||
|
|
||||||
/* server.c */
|
/* server.c */
|
||||||
#ifdef WITH_SERVER
|
#ifdef WITH_SERVER
|
||||||
@@ -243,8 +272,6 @@ int ssh_auth_reply_success(ssh_session session, int partial);
|
|||||||
int ssh_send_banner(ssh_session session, int is_server);
|
int ssh_send_banner(ssh_session session, int is_server);
|
||||||
|
|
||||||
/* connect.c */
|
/* connect.c */
|
||||||
socket_t ssh_connect_host(ssh_session session, const char *host,const char
|
|
||||||
*bind_addr, int port, long timeout, long usec);
|
|
||||||
socket_t ssh_connect_host_nonblocking(ssh_session session, const char *host,
|
socket_t ssh_connect_host_nonblocking(ssh_session session, const char *host,
|
||||||
const char *bind_addr, int port);
|
const char *bind_addr, int port);
|
||||||
|
|
||||||
@@ -257,6 +284,8 @@ int compress_buffer(ssh_session session,ssh_buffer buf);
|
|||||||
int decompress_buffer(ssh_session session,ssh_buffer buf, size_t maxlen);
|
int decompress_buffer(ssh_session session,ssh_buffer buf, size_t maxlen);
|
||||||
|
|
||||||
/* match.c */
|
/* match.c */
|
||||||
|
int match_pattern_list(const char *string, const char *pattern,
|
||||||
|
unsigned int len, int dolower);
|
||||||
int match_hostname(const char *host, const char *pattern, unsigned int len);
|
int match_hostname(const char *host, const char *pattern, unsigned int len);
|
||||||
|
|
||||||
/* connector.c */
|
/* connector.c */
|
||||||
@@ -309,7 +338,6 @@ void explicit_bzero(void *s, size_t n);
|
|||||||
/**
|
/**
|
||||||
* Get the argument cound of variadic arguments
|
* Get the argument cound of variadic arguments
|
||||||
*/
|
*/
|
||||||
#ifdef HAVE_GCC_NARG_MACRO
|
|
||||||
/*
|
/*
|
||||||
* Since MSVC 2010 there is a bug in passing __VA_ARGS__ to subsequent
|
* Since MSVC 2010 there is a bug in passing __VA_ARGS__ to subsequent
|
||||||
* macros as a single token, which results in:
|
* macros as a single token, which results in:
|
||||||
@@ -319,7 +347,7 @@ void explicit_bzero(void *s, size_t n);
|
|||||||
#define VA_APPLY_VARIADIC_MACRO(macro, tuple) macro tuple
|
#define VA_APPLY_VARIADIC_MACRO(macro, tuple) macro tuple
|
||||||
|
|
||||||
#define __VA_NARG__(...) \
|
#define __VA_NARG__(...) \
|
||||||
(__VA_NARG_(_0, ## __VA_ARGS__, __RSEQ_N()) - 1)
|
(__VA_NARG_(__VA_ARGS__, __RSEQ_N()))
|
||||||
#define __VA_NARG_(...) \
|
#define __VA_NARG_(...) \
|
||||||
VA_APPLY_VARIADIC_MACRO(__VA_ARG_N, (__VA_ARGS__))
|
VA_APPLY_VARIADIC_MACRO(__VA_ARG_N, (__VA_ARGS__))
|
||||||
#define __VA_ARG_N( \
|
#define __VA_ARG_N( \
|
||||||
@@ -338,10 +366,6 @@ void explicit_bzero(void *s, size_t n);
|
|||||||
29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \
|
29, 28, 27, 26, 25, 24, 23, 22, 21, 20, \
|
||||||
19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
|
19, 18, 17, 16, 15, 14, 13, 12, 11, 10, \
|
||||||
9, 8, 7, 6, 5, 4, 3, 2, 1, 0
|
9, 8, 7, 6, 5, 4, 3, 2, 1, 0
|
||||||
#else
|
|
||||||
/* clang does not support the above construction */
|
|
||||||
#define __VA_NARG__(...) (-1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CLOSE_SOCKET(s) do { if ((s) != SSH_INVALID_SOCKET) { _XCLOSESOCKET(s); (s) = SSH_INVALID_SOCKET;} } while(0)
|
#define CLOSE_SOCKET(s) do { if ((s) != SSH_INVALID_SOCKET) { _XCLOSESOCKET(s); (s) = SSH_INVALID_SOCKET;} } while(0)
|
||||||
|
|
||||||
@@ -371,6 +395,22 @@ void explicit_bzero(void *s, size_t n);
|
|||||||
# endif /* HAVE_FALLTHROUGH_ATTRIBUTE */
|
# endif /* HAVE_FALLTHROUGH_ATTRIBUTE */
|
||||||
#endif /* FALL_THROUGH */
|
#endif /* FALL_THROUGH */
|
||||||
|
|
||||||
|
#ifndef __unused__
|
||||||
|
# ifdef HAVE_UNUSED_ATTRIBUTE
|
||||||
|
# define __unused__ __attribute__((unused))
|
||||||
|
# else /* HAVE_UNUSED_ATTRIBUTE */
|
||||||
|
# define __unused__
|
||||||
|
# endif /* HAVE_UNUSED_ATTRIBUTE */
|
||||||
|
#endif /* __unused__ */
|
||||||
|
|
||||||
|
#ifndef UNUSED_PARAM
|
||||||
|
#define UNUSED_PARAM(param) param __unused__
|
||||||
|
#endif /* UNUSED_PARAM */
|
||||||
|
|
||||||
|
#ifndef UNUSED_VAR
|
||||||
|
#define UNUSED_VAR(var) __unused__ var
|
||||||
|
#endif /* UNUSED_VAR */
|
||||||
|
|
||||||
void ssh_agent_state_free(void *data);
|
void ssh_agent_state_free(void *data);
|
||||||
|
|
||||||
#endif /* _LIBSSH_PRIV_H */
|
#endif /* _LIBSSH_PRIV_H */
|
||||||
|
|||||||
@@ -46,7 +46,16 @@ enum ssh_bind_options_e {
|
|||||||
SSH_BIND_OPTIONS_LOG_VERBOSITY,
|
SSH_BIND_OPTIONS_LOG_VERBOSITY,
|
||||||
SSH_BIND_OPTIONS_LOG_VERBOSITY_STR,
|
SSH_BIND_OPTIONS_LOG_VERBOSITY_STR,
|
||||||
SSH_BIND_OPTIONS_ECDSAKEY,
|
SSH_BIND_OPTIONS_ECDSAKEY,
|
||||||
SSH_BIND_OPTIONS_IMPORT_KEY
|
SSH_BIND_OPTIONS_IMPORT_KEY,
|
||||||
|
SSH_BIND_OPTIONS_KEY_EXCHANGE,
|
||||||
|
SSH_BIND_OPTIONS_CIPHERS_C_S,
|
||||||
|
SSH_BIND_OPTIONS_CIPHERS_S_C,
|
||||||
|
SSH_BIND_OPTIONS_HMAC_C_S,
|
||||||
|
SSH_BIND_OPTIONS_HMAC_S_C,
|
||||||
|
SSH_BIND_OPTIONS_CONFIG_DIR,
|
||||||
|
SSH_BIND_OPTIONS_PUBKEY_ACCEPTED_KEY_TYPES,
|
||||||
|
SSH_BIND_OPTIONS_HOSTKEY_ALGORITHMS,
|
||||||
|
SSH_BIND_OPTIONS_PROCESS_CONFIG,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ssh_bind_struct* ssh_bind;
|
typedef struct ssh_bind_struct* ssh_bind;
|
||||||
@@ -85,6 +94,9 @@ LIBSSH_API ssh_bind ssh_bind_new(void);
|
|||||||
LIBSSH_API int ssh_bind_options_set(ssh_bind sshbind,
|
LIBSSH_API int ssh_bind_options_set(ssh_bind sshbind,
|
||||||
enum ssh_bind_options_e type, const void *value);
|
enum ssh_bind_options_e type, const void *value);
|
||||||
|
|
||||||
|
LIBSSH_API int ssh_bind_options_parse_config(ssh_bind sshbind,
|
||||||
|
const char *filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Start listening to the socket.
|
* @brief Start listening to the socket.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#ifndef SESSION_H_
|
#ifndef SESSION_H_
|
||||||
#define SESSION_H_
|
#define SESSION_H_
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "libssh/priv.h"
|
#include "libssh/priv.h"
|
||||||
#include "libssh/kex.h"
|
#include "libssh/kex.h"
|
||||||
#include "libssh/packet.h"
|
#include "libssh/packet.h"
|
||||||
@@ -27,6 +29,8 @@
|
|||||||
#include "libssh/auth.h"
|
#include "libssh/auth.h"
|
||||||
#include "libssh/channels.h"
|
#include "libssh/channels.h"
|
||||||
#include "libssh/poll.h"
|
#include "libssh/poll.h"
|
||||||
|
#include "libssh/config.h"
|
||||||
|
#include "libssh/misc.h"
|
||||||
|
|
||||||
/* These are the different states a SSH session can be into its life */
|
/* These are the different states a SSH session can be into its life */
|
||||||
enum ssh_session_state_e {
|
enum ssh_session_state_e {
|
||||||
@@ -45,6 +49,8 @@ enum ssh_session_state_e {
|
|||||||
|
|
||||||
enum ssh_dh_state_e {
|
enum ssh_dh_state_e {
|
||||||
DH_STATE_INIT=0,
|
DH_STATE_INIT=0,
|
||||||
|
DH_STATE_GROUP_SENT,
|
||||||
|
DH_STATE_REQUEST_SENT,
|
||||||
DH_STATE_INIT_SENT,
|
DH_STATE_INIT_SENT,
|
||||||
DH_STATE_NEWKEYS_SENT,
|
DH_STATE_NEWKEYS_SENT,
|
||||||
DH_STATE_FINISHED
|
DH_STATE_FINISHED
|
||||||
@@ -86,6 +92,13 @@ enum ssh_pending_call_e {
|
|||||||
#define SSH_OPT_FLAG_KBDINT_AUTH 0x4
|
#define SSH_OPT_FLAG_KBDINT_AUTH 0x4
|
||||||
#define SSH_OPT_FLAG_GSSAPI_AUTH 0x8
|
#define SSH_OPT_FLAG_GSSAPI_AUTH 0x8
|
||||||
|
|
||||||
|
/* extensions flags */
|
||||||
|
/* negotiation enabled */
|
||||||
|
#define SSH_EXT_NEGOTIATION 0x01
|
||||||
|
/* server-sig-algs extension */
|
||||||
|
#define SSH_EXT_SIG_RSA_SHA256 0x02
|
||||||
|
#define SSH_EXT_SIG_RSA_SHA512 0x04
|
||||||
|
|
||||||
/* members that are common to ssh_session and ssh_bind */
|
/* members that are common to ssh_session and ssh_bind */
|
||||||
struct ssh_common_struct {
|
struct ssh_common_struct {
|
||||||
struct error_struct error;
|
struct error_struct error;
|
||||||
@@ -104,6 +117,7 @@ struct ssh_session_struct {
|
|||||||
int openssh;
|
int openssh;
|
||||||
uint32_t send_seq;
|
uint32_t send_seq;
|
||||||
uint32_t recv_seq;
|
uint32_t recv_seq;
|
||||||
|
struct ssh_timestamp last_rekey_time;
|
||||||
|
|
||||||
int connected;
|
int connected;
|
||||||
/* !=0 when the user got a session handle */
|
/* !=0 when the user got a session handle */
|
||||||
@@ -114,6 +128,9 @@ struct ssh_session_struct {
|
|||||||
/* session flags (SSH_SESSION_FLAG_*) */
|
/* session flags (SSH_SESSION_FLAG_*) */
|
||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
|
/* Extensions negotiated using RFC 8308 */
|
||||||
|
uint32_t extensions;
|
||||||
|
|
||||||
ssh_string banner; /* that's the issue banner from
|
ssh_string banner; /* that's the issue banner from
|
||||||
the server */
|
the server */
|
||||||
char *discon_msg; /* disconnect message from
|
char *discon_msg; /* disconnect message from
|
||||||
@@ -121,6 +138,8 @@ struct ssh_session_struct {
|
|||||||
ssh_buffer in_buffer;
|
ssh_buffer in_buffer;
|
||||||
PACKET in_packet;
|
PACKET in_packet;
|
||||||
ssh_buffer out_buffer;
|
ssh_buffer out_buffer;
|
||||||
|
struct ssh_list *out_queue; /* This list is used for delaying packets
|
||||||
|
when rekeying is required */
|
||||||
|
|
||||||
/* the states are used by the nonblocking stuff to remember */
|
/* the states are used by the nonblocking stuff to remember */
|
||||||
/* where it was before being interrupted */
|
/* where it was before being interrupted */
|
||||||
@@ -128,11 +147,16 @@ struct ssh_session_struct {
|
|||||||
enum ssh_session_state_e session_state;
|
enum ssh_session_state_e session_state;
|
||||||
int packet_state;
|
int packet_state;
|
||||||
enum ssh_dh_state_e dh_handshake_state;
|
enum ssh_dh_state_e dh_handshake_state;
|
||||||
enum ssh_auth_service_state_e auth_service_state;
|
|
||||||
enum ssh_auth_state_e auth_state;
|
|
||||||
enum ssh_channel_request_state_e global_req_state;
|
enum ssh_channel_request_state_e global_req_state;
|
||||||
struct ssh_agent_state_struct *agent_state;
|
struct ssh_agent_state_struct *agent_state;
|
||||||
struct ssh_auth_auto_state_struct *auth_auto_state;
|
|
||||||
|
struct {
|
||||||
|
struct ssh_auth_auto_state_struct *auto_state;
|
||||||
|
enum ssh_auth_service_state_e service_state;
|
||||||
|
enum ssh_auth_state_e state;
|
||||||
|
uint32_t supported_methods;
|
||||||
|
uint32_t current_method;
|
||||||
|
} auth;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* RFC 4253, 7.1: if the first_kex_packet_follows flag was set in
|
* RFC 4253, 7.1: if the first_kex_packet_follows flag was set in
|
||||||
@@ -150,8 +174,6 @@ struct ssh_session_struct {
|
|||||||
|
|
||||||
struct ssh_list *channels; /* linked list of channels */
|
struct ssh_list *channels; /* linked list of channels */
|
||||||
int maxchannel;
|
int maxchannel;
|
||||||
int exec_channel_opened; /* version 1 only. more
|
|
||||||
info in channels1.c */
|
|
||||||
ssh_agent agent; /* ssh agent */
|
ssh_agent agent; /* ssh agent */
|
||||||
|
|
||||||
/* keyb interactive data */
|
/* keyb interactive data */
|
||||||
@@ -167,8 +189,8 @@ struct ssh_session_struct {
|
|||||||
/* The type of host key wanted by client */
|
/* The type of host key wanted by client */
|
||||||
enum ssh_keytypes_e hostkey;
|
enum ssh_keytypes_e hostkey;
|
||||||
} srv;
|
} srv;
|
||||||
|
|
||||||
/* auths accepted by server */
|
/* auths accepted by server */
|
||||||
int auth_methods;
|
|
||||||
struct ssh_list *ssh_message_list; /* list of delayed SSH messages */
|
struct ssh_list *ssh_message_list; /* list of delayed SSH messages */
|
||||||
int (*ssh_message_callback)( struct ssh_session_struct *session, ssh_message msg, void *userdata);
|
int (*ssh_message_callback)( struct ssh_session_struct *session, ssh_message msg, void *userdata);
|
||||||
void *ssh_message_callback_data;
|
void *ssh_message_callback_data;
|
||||||
@@ -191,6 +213,7 @@ struct ssh_session_struct {
|
|||||||
char *knownhosts;
|
char *knownhosts;
|
||||||
char *global_knownhosts;
|
char *global_knownhosts;
|
||||||
char *wanted_methods[10];
|
char *wanted_methods[10];
|
||||||
|
char *pubkey_accepted_types;
|
||||||
char *ProxyCommand;
|
char *ProxyCommand;
|
||||||
char *custombanner;
|
char *custombanner;
|
||||||
unsigned long timeout; /* seconds */
|
unsigned long timeout; /* seconds */
|
||||||
@@ -204,6 +227,10 @@ struct ssh_session_struct {
|
|||||||
int gss_delegate_creds;
|
int gss_delegate_creds;
|
||||||
int flags;
|
int flags;
|
||||||
int nodelay;
|
int nodelay;
|
||||||
|
bool config_processed;
|
||||||
|
uint8_t options_seen[SOC_MAX];
|
||||||
|
uint64_t rekey_data;
|
||||||
|
uint32_t rekey_time;
|
||||||
} opts;
|
} opts;
|
||||||
/* counters */
|
/* counters */
|
||||||
ssh_counter socket_counter;
|
ssh_counter socket_counter;
|
||||||
@@ -217,8 +244,10 @@ struct ssh_session_struct {
|
|||||||
*/
|
*/
|
||||||
typedef int (*ssh_termination_function)(void *user);
|
typedef int (*ssh_termination_function)(void *user);
|
||||||
int ssh_handle_packets(ssh_session session, int timeout);
|
int ssh_handle_packets(ssh_session session, int timeout);
|
||||||
int ssh_handle_packets_termination(ssh_session session, int timeout,
|
int ssh_handle_packets_termination(ssh_session session,
|
||||||
ssh_termination_function fct, void *user);
|
long timeout,
|
||||||
|
ssh_termination_function fct,
|
||||||
|
void *user);
|
||||||
void ssh_socket_exception_callback(int code, int errno_code, void *user);
|
void ssh_socket_exception_callback(int code, int errno_code, void *user);
|
||||||
|
|
||||||
#endif /* SESSION_H_ */
|
#endif /* SESSION_H_ */
|
||||||
|
|||||||
@@ -53,9 +53,14 @@ extern "C" {
|
|||||||
typedef uint32_t gid_t;
|
typedef uint32_t gid_t;
|
||||||
#endif /* gid_t */
|
#endif /* gid_t */
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#ifndef ssize_t
|
|
||||||
typedef _W64 SSIZE_T ssize_t;
|
# ifndef _SSIZE_T_DEFINED
|
||||||
#endif /* ssize_t */
|
# undef ssize_t
|
||||||
|
# include <BaseTsd.h>
|
||||||
|
typedef _W64 SSIZE_T ssize_t;
|
||||||
|
# define _SSIZE_T_DEFINED
|
||||||
|
# endif /* _SSIZE_T_DEFINED */
|
||||||
|
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
@@ -84,6 +89,7 @@ struct sftp_session_struct {
|
|||||||
int errnum;
|
int errnum;
|
||||||
void **handles;
|
void **handles;
|
||||||
sftp_ext ext;
|
sftp_ext ext;
|
||||||
|
sftp_packet read_packet;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sftp_packet_struct {
|
struct sftp_packet_struct {
|
||||||
@@ -134,6 +140,7 @@ struct sftp_client_message_struct {
|
|||||||
ssh_string data; /* can be newpath of rename() */
|
ssh_string data; /* can be newpath of rename() */
|
||||||
ssh_buffer complete_message; /* complete message in case of retransmission*/
|
ssh_buffer complete_message; /* complete message in case of retransmission*/
|
||||||
char *str_data; /* cstring version of data */
|
char *str_data; /* cstring version of data */
|
||||||
|
char *submessage; /* for extended messages */
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sftp_request_queue_struct {
|
struct sftp_request_queue_struct {
|
||||||
@@ -811,7 +818,9 @@ LIBSSH_API int sftp_fsync(sftp_file file);
|
|||||||
*
|
*
|
||||||
* @param path The path to be canonicalized.
|
* @param path The path to be canonicalized.
|
||||||
*
|
*
|
||||||
* @return The canonicalize path, NULL on error.
|
* @return A pointer to the newly allocated canonicalized path,
|
||||||
|
* NULL on error. The caller needs to free the memory
|
||||||
|
* using ssh_string_free_char().
|
||||||
*/
|
*/
|
||||||
LIBSSH_API char *sftp_canonicalize_path(sftp_session sftp, const char *path);
|
LIBSSH_API char *sftp_canonicalize_path(sftp_session sftp, const char *path);
|
||||||
|
|
||||||
@@ -844,6 +853,13 @@ LIBSSH_API sftp_session sftp_server_new(ssh_session session, ssh_channel chan);
|
|||||||
* @return 0 on success, < 0 on error.
|
* @return 0 on success, < 0 on error.
|
||||||
*/
|
*/
|
||||||
LIBSSH_API int sftp_server_init(sftp_session sftp);
|
LIBSSH_API int sftp_server_init(sftp_session sftp);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Close and deallocate a sftp server session.
|
||||||
|
*
|
||||||
|
* @param sftp The sftp session handle to free.
|
||||||
|
*/
|
||||||
|
LIBSSH_API void sftp_server_free(sftp_session sftp);
|
||||||
#endif /* WITH_SERVER */
|
#endif /* WITH_SERVER */
|
||||||
|
|
||||||
/* this is not a public interface */
|
/* this is not a public interface */
|
||||||
@@ -862,6 +878,7 @@ LIBSSH_API const char *sftp_client_message_get_filename(sftp_client_message msg)
|
|||||||
LIBSSH_API void sftp_client_message_set_filename(sftp_client_message msg, const char *newname);
|
LIBSSH_API void sftp_client_message_set_filename(sftp_client_message msg, const char *newname);
|
||||||
LIBSSH_API const char *sftp_client_message_get_data(sftp_client_message msg);
|
LIBSSH_API const char *sftp_client_message_get_data(sftp_client_message msg);
|
||||||
LIBSSH_API uint32_t sftp_client_message_get_flags(sftp_client_message msg);
|
LIBSSH_API uint32_t sftp_client_message_get_flags(sftp_client_message msg);
|
||||||
|
LIBSSH_API const char *sftp_client_message_get_submessage(sftp_client_message msg);
|
||||||
LIBSSH_API int sftp_send_client_message(sftp_session sftp, sftp_client_message msg);
|
LIBSSH_API int sftp_send_client_message(sftp_session sftp, sftp_client_message msg);
|
||||||
LIBSSH_API int sftp_reply_name(sftp_client_message msg, const char *name,
|
LIBSSH_API int sftp_reply_name(sftp_client_message msg, const char *name,
|
||||||
sftp_attributes attr);
|
sftp_attributes attr);
|
||||||
@@ -1011,6 +1028,7 @@ LIBSSH_API void sftp_handle_remove(sftp_session sftp, void *handle);
|
|||||||
#define SFTP_RENAME SSH_FXP_RENAME
|
#define SFTP_RENAME SSH_FXP_RENAME
|
||||||
#define SFTP_READLINK SSH_FXP_READLINK
|
#define SFTP_READLINK SSH_FXP_READLINK
|
||||||
#define SFTP_SYMLINK SSH_FXP_SYMLINK
|
#define SFTP_SYMLINK SSH_FXP_SYMLINK
|
||||||
|
#define SFTP_EXTENDED SSH_FXP_EXTENDED
|
||||||
|
|
||||||
/* openssh flags */
|
/* openssh flags */
|
||||||
#define SSH_FXE_STATVFS_ST_RDONLY 0x1 /* read-only */
|
#define SSH_FXE_STATVFS_ST_RDONLY 0x1 /* read-only */
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ ssh_socket ssh_socket_new(ssh_session session);
|
|||||||
void ssh_socket_reset(ssh_socket s);
|
void ssh_socket_reset(ssh_socket s);
|
||||||
void ssh_socket_free(ssh_socket s);
|
void ssh_socket_free(ssh_socket s);
|
||||||
void ssh_socket_set_fd(ssh_socket s, socket_t fd);
|
void ssh_socket_set_fd(ssh_socket s, socket_t fd);
|
||||||
socket_t ssh_socket_get_fd_in(ssh_socket s);
|
socket_t ssh_socket_get_fd(ssh_socket s);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
int ssh_socket_unix(ssh_socket s, const char *path);
|
int ssh_socket_unix(ssh_socket s, const char *path);
|
||||||
void ssh_execute_command(const char *command, socket_t in, socket_t out);
|
void ssh_execute_command(const char *command, socket_t in, socket_t out);
|
||||||
@@ -61,8 +61,7 @@ int ssh_socket_set_blocking(socket_t fd);
|
|||||||
|
|
||||||
void ssh_socket_set_callbacks(ssh_socket s, ssh_socket_callbacks callbacks);
|
void ssh_socket_set_callbacks(ssh_socket s, ssh_socket_callbacks callbacks);
|
||||||
int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, socket_t fd, int revents, void *v_s);
|
int ssh_socket_pollcallback(struct ssh_poll_handle_struct *p, socket_t fd, int revents, void *v_s);
|
||||||
struct ssh_poll_handle_struct * ssh_socket_get_poll_handle_in(ssh_socket s);
|
struct ssh_poll_handle_struct * ssh_socket_get_poll_handle(ssh_socket s);
|
||||||
struct ssh_poll_handle_struct * ssh_socket_get_poll_handle_out(ssh_socket s);
|
|
||||||
|
|
||||||
int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bind_addr);
|
int ssh_socket_connect(ssh_socket s, const char *host, int port, const char *bind_addr);
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#define SSH2_MSG_DEBUG 4
|
#define SSH2_MSG_DEBUG 4
|
||||||
#define SSH2_MSG_SERVICE_REQUEST 5
|
#define SSH2_MSG_SERVICE_REQUEST 5
|
||||||
#define SSH2_MSG_SERVICE_ACCEPT 6
|
#define SSH2_MSG_SERVICE_ACCEPT 6
|
||||||
|
#define SSH2_MSG_EXT_INFO 7
|
||||||
|
|
||||||
#define SSH2_MSG_KEXINIT 20
|
#define SSH2_MSG_KEXINIT 20
|
||||||
#define SSH2_MSG_NEWKEYS 21
|
#define SSH2_MSG_NEWKEYS 21
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#define SSH_MUTEX pthread_mutex_t
|
#define SSH_MUTEX pthread_mutex_t
|
||||||
|
|
||||||
#if defined _GNU_SOURCE
|
#if defined(PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP)
|
||||||
#define SSH_MUTEX_STATIC_INIT PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
|
#define SSH_MUTEX_STATIC_INIT PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
|
||||||
#else
|
#else
|
||||||
#define SSH_MUTEX_STATIC_INIT PTHREAD_MUTEX_INITIALIZER
|
#define SSH_MUTEX_STATIC_INIT PTHREAD_MUTEX_INITIALIZER
|
||||||
|
|||||||
44
include/libssh/token.h
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* token.h - Tokens list handling
|
||||||
|
*
|
||||||
|
* This file is part of the SSH Library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 by Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Author: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
|
||||||
|
*
|
||||||
|
* The SSH Library is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* The SSH Library is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||||
|
* License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with the SSH Library; see the file COPYING. If not, write to
|
||||||
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||||
|
* MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TOKEN_H_
|
||||||
|
#define TOKEN_H_
|
||||||
|
|
||||||
|
struct ssh_tokens_st {
|
||||||
|
char *buffer;
|
||||||
|
char **tokens;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ssh_tokens_st *ssh_tokenize(const char *chain, char separator);
|
||||||
|
|
||||||
|
void ssh_tokens_free(struct ssh_tokens_st *tokens);
|
||||||
|
|
||||||
|
char *ssh_find_matching(const char *available_d,
|
||||||
|
const char *preferred_d);
|
||||||
|
|
||||||
|
|
||||||
|
char *ssh_find_all_matching(const char *available_d,
|
||||||
|
const char *preferred_d);
|
||||||
|
#endif /* TOKEN_H_ */
|
||||||
@@ -21,26 +21,36 @@
|
|||||||
#ifndef WRAPPER_H_
|
#ifndef WRAPPER_H_
|
||||||
#define WRAPPER_H_
|
#define WRAPPER_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "libssh/libssh.h"
|
#include "libssh/libssh.h"
|
||||||
#include "libssh/libcrypto.h"
|
#include "libssh/libcrypto.h"
|
||||||
#include "libssh/libgcrypt.h"
|
#include "libssh/libgcrypt.h"
|
||||||
#include "libssh/libmbedcrypto.h"
|
#include "libssh/libmbedcrypto.h"
|
||||||
|
|
||||||
enum ssh_mac_e {
|
enum ssh_digest_e {
|
||||||
SSH_MAC_SHA1=1,
|
SSH_DIGEST_AUTO=0,
|
||||||
SSH_MAC_SHA256,
|
SSH_DIGEST_SHA1=1,
|
||||||
SSH_MAC_SHA384,
|
SSH_DIGEST_SHA256,
|
||||||
SSH_MAC_SHA512
|
SSH_DIGEST_SHA384,
|
||||||
|
SSH_DIGEST_SHA512,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ssh_kdf_digest {
|
||||||
|
SSH_KDF_SHA1=1,
|
||||||
|
SSH_KDF_SHA256,
|
||||||
|
SSH_KDF_SHA384,
|
||||||
|
SSH_KDF_SHA512
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ssh_hmac_e {
|
enum ssh_hmac_e {
|
||||||
SSH_HMAC_SHA1 = 1,
|
SSH_HMAC_SHA1 = 1,
|
||||||
SSH_HMAC_SHA256,
|
SSH_HMAC_SHA256,
|
||||||
SSH_HMAC_SHA384,
|
|
||||||
SSH_HMAC_SHA512,
|
SSH_HMAC_SHA512,
|
||||||
SSH_HMAC_MD5,
|
SSH_HMAC_MD5,
|
||||||
SSH_HMAC_AEAD_POLY1305
|
SSH_HMAC_AEAD_POLY1305,
|
||||||
|
SSH_HMAC_AEAD_GCM
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ssh_des_e {
|
enum ssh_des_e {
|
||||||
@@ -51,9 +61,17 @@ enum ssh_des_e {
|
|||||||
struct ssh_hmac_struct {
|
struct ssh_hmac_struct {
|
||||||
const char* name;
|
const char* name;
|
||||||
enum ssh_hmac_e hmac_type;
|
enum ssh_hmac_e hmac_type;
|
||||||
|
bool etm;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ssh_crypto_direction_e {
|
||||||
|
SSH_DIRECTION_IN = 1,
|
||||||
|
SSH_DIRECTION_OUT = 2,
|
||||||
|
SSH_DIRECTION_BOTH = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ssh_cipher_struct;
|
struct ssh_cipher_struct;
|
||||||
|
struct ssh_crypto_struct;
|
||||||
|
|
||||||
typedef struct ssh_mac_ctx_struct *ssh_mac_ctx;
|
typedef struct ssh_mac_ctx_struct *ssh_mac_ctx;
|
||||||
MD5CTX md5_init(void);
|
MD5CTX md5_init(void);
|
||||||
@@ -63,37 +81,38 @@ void md5_final(unsigned char *md,MD5CTX c);
|
|||||||
SHACTX sha1_init(void);
|
SHACTX sha1_init(void);
|
||||||
void sha1_update(SHACTX c, const void *data, unsigned long len);
|
void sha1_update(SHACTX c, const void *data, unsigned long len);
|
||||||
void sha1_final(unsigned char *md,SHACTX c);
|
void sha1_final(unsigned char *md,SHACTX c);
|
||||||
void sha1(unsigned char *digest,int len,unsigned char *hash);
|
void sha1(const unsigned char *digest,int len,unsigned char *hash);
|
||||||
|
|
||||||
SHA256CTX sha256_init(void);
|
SHA256CTX sha256_init(void);
|
||||||
void sha256_update(SHA256CTX c, const void *data, unsigned long len);
|
void sha256_update(SHA256CTX c, const void *data, unsigned long len);
|
||||||
void sha256_final(unsigned char *md,SHA256CTX c);
|
void sha256_final(unsigned char *md,SHA256CTX c);
|
||||||
void sha256(unsigned char *digest, int len, unsigned char *hash);
|
void sha256(const unsigned char *digest, int len, unsigned char *hash);
|
||||||
|
|
||||||
SHA384CTX sha384_init(void);
|
SHA384CTX sha384_init(void);
|
||||||
void sha384_update(SHA384CTX c, const void *data, unsigned long len);
|
void sha384_update(SHA384CTX c, const void *data, unsigned long len);
|
||||||
void sha384_final(unsigned char *md,SHA384CTX c);
|
void sha384_final(unsigned char *md,SHA384CTX c);
|
||||||
void sha384(unsigned char *digest, int len, unsigned char *hash);
|
void sha384(const unsigned char *digest, int len, unsigned char *hash);
|
||||||
|
|
||||||
SHA512CTX sha512_init(void);
|
SHA512CTX sha512_init(void);
|
||||||
void sha512_update(SHA512CTX c, const void *data, unsigned long len);
|
void sha512_update(SHA512CTX c, const void *data, unsigned long len);
|
||||||
void sha512_final(unsigned char *md,SHA512CTX c);
|
void sha512_final(unsigned char *md,SHA512CTX c);
|
||||||
void sha512(unsigned char *digest, int len, unsigned char *hash);
|
void sha512(const unsigned char *digest, int len, unsigned char *hash);
|
||||||
|
|
||||||
void evp(int nid, unsigned char *digest, int len, unsigned char *hash, unsigned int *hlen);
|
void evp(int nid, unsigned char *digest, int len, unsigned char *hash, unsigned int *hlen);
|
||||||
EVPCTX evp_init(int nid);
|
EVPCTX evp_init(int nid);
|
||||||
void evp_update(EVPCTX ctx, const void *data, unsigned long len);
|
void evp_update(EVPCTX ctx, const void *data, unsigned long len);
|
||||||
void evp_final(EVPCTX ctx, unsigned char *md, unsigned int *mdlen);
|
void evp_final(EVPCTX ctx, unsigned char *md, unsigned int *mdlen);
|
||||||
|
|
||||||
ssh_mac_ctx ssh_mac_ctx_init(enum ssh_mac_e type);
|
|
||||||
void ssh_mac_update(ssh_mac_ctx ctx, const void *data, unsigned long len);
|
|
||||||
void ssh_mac_final(unsigned char *md, ssh_mac_ctx ctx);
|
|
||||||
|
|
||||||
HMACCTX hmac_init(const void *key,int len, enum ssh_hmac_e type);
|
HMACCTX hmac_init(const void *key,int len, enum ssh_hmac_e type);
|
||||||
void hmac_update(HMACCTX c, const void *data, unsigned long len);
|
void hmac_update(HMACCTX c, const void *data, unsigned long len);
|
||||||
void hmac_final(HMACCTX ctx,unsigned char *hashmacbuf,unsigned int *len);
|
void hmac_final(HMACCTX ctx,unsigned char *hashmacbuf,unsigned int *len);
|
||||||
size_t hmac_digest_len(enum ssh_hmac_e type);
|
size_t hmac_digest_len(enum ssh_hmac_e type);
|
||||||
|
|
||||||
|
int ssh_kdf(struct ssh_crypto_struct *crypto,
|
||||||
|
unsigned char *key, size_t key_len,
|
||||||
|
int key_type, unsigned char *output,
|
||||||
|
size_t requested_len);
|
||||||
|
|
||||||
int crypt_set_algorithms_client(ssh_session session);
|
int crypt_set_algorithms_client(ssh_session session);
|
||||||
int crypt_set_algorithms_server(ssh_session session);
|
int crypt_set_algorithms_server(ssh_session session);
|
||||||
struct ssh_crypto_struct *crypto_new(void);
|
struct ssh_crypto_struct *crypto_new(void);
|
||||||
@@ -106,6 +125,6 @@ void ssh_crypto_finalize(void);
|
|||||||
void ssh_cipher_clear(struct ssh_cipher_struct *cipher);
|
void ssh_cipher_clear(struct ssh_cipher_struct *cipher);
|
||||||
struct ssh_hmac_struct *ssh_get_hmactab(void);
|
struct ssh_hmac_struct *ssh_get_hmactab(void);
|
||||||
struct ssh_cipher_struct *ssh_get_ciphertab(void);
|
struct ssh_cipher_struct *ssh_get_ciphertab(void);
|
||||||
const char *ssh_hmac_type_to_string(enum ssh_hmac_e hmac_type);
|
const char *ssh_hmac_type_to_string(enum ssh_hmac_e hmac_type, bool etm);
|
||||||
|
|
||||||
#endif /* WRAPPER_H_ */
|
#endif /* WRAPPER_H_ */
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
set(LIBSSH_INLUDE_DIR @PROJECT_SOURCE_DIR@/include)
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
set(PACKAGE_VERSION @APPLICATION_VERSION@)
|
|
||||||
|
|
||||||
# Check whether the requested PACKAGE_FIND_VERSION is compatible
|
|
||||||
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
|
||||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
|
||||||
else()
|
|
||||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
|
||||||
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
|
|
||||||
set(PACKAGE_VERSION_EXACT TRUE)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||