Compare commits
1200 Commits
libssh-0.6
...
libssh-0.8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
efdd567a1b | ||
|
|
cff8f7c0b5 | ||
|
|
fe4a4b1b79 | ||
|
|
8caf653e97 | ||
|
|
88c4d532ab | ||
|
|
e69d063252 | ||
|
|
a35218da74 | ||
|
|
4d8e2cdc8b | ||
|
|
3d0f2977bf | ||
|
|
230929a4b2 | ||
|
|
c847216ca4 | ||
|
|
cacd2fa999 | ||
|
|
0b688e4829 | ||
|
|
27cf0ea06b | ||
|
|
e473108e1b | ||
|
|
c74cc9a606 | ||
|
|
619e60cf0e | ||
|
|
37b3657481 | ||
|
|
c1211a4e1a | ||
|
|
95d34b5937 | ||
|
|
6dc3f666c5 | ||
|
|
8e4491a532 | ||
|
|
492095b2a7 | ||
|
|
d516642980 | ||
|
|
193845ecdd | ||
|
|
598d04d5d9 | ||
|
|
06c5dd9c84 | ||
|
|
6632659907 | ||
|
|
86bf835d50 | ||
|
|
c9d0362a6b | ||
|
|
d2989f28db | ||
|
|
0bab6013d0 | ||
|
|
361d93586c | ||
|
|
0db13661b4 | ||
|
|
c866592d7d | ||
|
|
eb90325bed | ||
|
|
c878545977 | ||
|
|
741021513b | ||
|
|
97e8aba080 | ||
|
|
802d46d040 | ||
|
|
96718df15e | ||
|
|
89bd779e78 | ||
|
|
b5af3e74d7 | ||
|
|
2d3932d988 | ||
|
|
d0c1583ad2 | ||
|
|
59ff4064ba | ||
|
|
00a68c985f | ||
|
|
e862ea556c | ||
|
|
a4704cba0b | ||
|
|
455b3a7865 | ||
|
|
fabaab1540 | ||
|
|
8ac49ff181 | ||
|
|
cdf55a18d2 | ||
|
|
d158ca7101 | ||
|
|
664b7ebfa1 | ||
|
|
163c488e30 | ||
|
|
4b5bfa7a9d | ||
|
|
decbadda45 | ||
|
|
f00d780c16 | ||
|
|
1daa2e4609 | ||
|
|
d84bc3ad8e | ||
|
|
a9350e3205 | ||
|
|
95e3a7e7a3 | ||
|
|
e4cecee7d3 | ||
|
|
8b867b41d3 | ||
|
|
c6bd2fe734 | ||
|
|
d7e52b99bd | ||
|
|
a640d9472a | ||
|
|
b15103ef4e | ||
|
|
95071cd1fe | ||
|
|
18a888f9fb | ||
|
|
bbfc41948a | ||
|
|
c29a8cc084 | ||
|
|
54e7af83e6 | ||
|
|
3483d6327d | ||
|
|
5869345899 | ||
|
|
0cad2778b4 | ||
|
|
24de1fbde8 | ||
|
|
131728a680 | ||
|
|
e949e135b6 | ||
|
|
1510b63d20 | ||
|
|
0db4d9bd46 | ||
|
|
1e17e084bf | ||
|
|
a2c14c5ec5 | ||
|
|
b99849c831 | ||
|
|
c7d4286ca1 | ||
|
|
434e2b7212 | ||
|
|
acf0f0fa6e | ||
|
|
220e6b66e8 | ||
|
|
c4d4731ddf | ||
|
|
139ccaa78c | ||
|
|
c42410b560 | ||
|
|
120f11812d | ||
|
|
500486d501 | ||
|
|
6708debd4c | ||
|
|
852a8b4875 | ||
|
|
9c6b4ecb48 | ||
|
|
d66ea0b3b1 | ||
|
|
1d93b94086 | ||
|
|
efc427fdce | ||
|
|
0f64bc78a8 | ||
|
|
2dbb7ff091 | ||
|
|
b77fa93551 | ||
|
|
8ce4004260 | ||
|
|
8c11367410 | ||
|
|
460026459b | ||
|
|
6c87316a9c | ||
|
|
96476f74af | ||
|
|
52b57077de | ||
|
|
2839d48cb8 | ||
|
|
5ea81166bf | ||
|
|
a86d1d335b | ||
|
|
18dd902307 | ||
|
|
d85827f646 | ||
|
|
6e74c6c1dc | ||
|
|
ec6df9896a | ||
|
|
ab7c5c448c | ||
|
|
5871d604cd | ||
|
|
f6fe7488e3 | ||
|
|
24aef4fbf1 | ||
|
|
fbfe002460 | ||
|
|
c7525c056c | ||
|
|
1509693cce | ||
|
|
67ef808a95 | ||
|
|
aeefcd8199 | ||
|
|
9bc050d07d | ||
|
|
c2776f70c1 | ||
|
|
e6020f94bf | ||
|
|
9305762fcd | ||
|
|
e0e0d62a71 | ||
|
|
708f127788 | ||
|
|
dd3d867452 | ||
|
|
5443863723 | ||
|
|
edcdef94ee | ||
|
|
04cc7b769a | ||
|
|
83b43443e5 | ||
|
|
6a077fe750 | ||
|
|
b2a681bd29 | ||
|
|
18077673ac | ||
|
|
25407209b0 | ||
|
|
0e886ba803 | ||
|
|
c8429113fa | ||
|
|
e1d2454dd7 | ||
|
|
ed738bee34 | ||
|
|
12284b75fa | ||
|
|
afa4021ded | ||
|
|
c425082394 | ||
|
|
db9da99a36 | ||
|
|
c3dac948c9 | ||
|
|
c866768da4 | ||
|
|
2b40ad29c0 | ||
|
|
38c53db953 | ||
|
|
c503bb572e | ||
|
|
36a727e656 | ||
|
|
7b9a07c363 | ||
|
|
4b298ca770 | ||
|
|
8e211c0689 | ||
|
|
d25b8fb550 | ||
|
|
f1b36c18f6 | ||
|
|
b3a7e86a4a | ||
|
|
d316390825 | ||
|
|
3141dec632 | ||
|
|
539d7ba249 | ||
|
|
83a46c7756 | ||
|
|
2d90bc9d6b | ||
|
|
de44fdfd35 | ||
|
|
65a5154eff | ||
|
|
613dcc95e6 | ||
|
|
77e1761734 | ||
|
|
e49e4e13f3 | ||
|
|
e73ae60e1a | ||
|
|
584c345451 | ||
|
|
bfbd574098 | ||
|
|
b4462bdea0 | ||
|
|
6b8d1aa836 | ||
|
|
d90b88588f | ||
|
|
6a715b80d6 | ||
|
|
084769b88c | ||
|
|
f4408f38a3 | ||
|
|
6dd9303729 | ||
|
|
a19513b87a | ||
|
|
21962dd154 | ||
|
|
8917b84840 | ||
|
|
4b0fd10a99 | ||
|
|
3350fd7479 | ||
|
|
c98b00a5f4 | ||
|
|
88673b2d1f | ||
|
|
f425ebb098 | ||
|
|
f6284eafd6 | ||
|
|
cf250171de | ||
|
|
a82e24f024 | ||
|
|
60450ef936 | ||
|
|
d11d764c9d | ||
|
|
ac5c90d771 | ||
|
|
14045f516e | ||
|
|
3e70f06fc8 | ||
|
|
a2a6dddacf | ||
|
|
a366bb3b45 | ||
|
|
a4a6017e6e | ||
|
|
e60cb2ee10 | ||
|
|
da0f360478 | ||
|
|
206f3ff895 | ||
|
|
81b4320318 | ||
|
|
bed60f9b84 | ||
|
|
10728f8577 | ||
|
|
72141cae0b | ||
|
|
ec842c3ca3 | ||
|
|
054d2dffc1 | ||
|
|
d971983d5e | ||
|
|
946f8f64ef | ||
|
|
84ac7d1de0 | ||
|
|
f4ddf9df53 | ||
|
|
d7477dc745 | ||
|
|
1444ae5add | ||
|
|
aa95eb1965 | ||
|
|
649a7490a6 | ||
|
|
c089b700c6 | ||
|
|
c8d6445d44 | ||
|
|
d4a4ce4d44 | ||
|
|
7a2624dee4 | ||
|
|
f827833d82 | ||
|
|
6f38e0b771 | ||
|
|
622ff855f5 | ||
|
|
26734a547a | ||
|
|
1ece5a849c | ||
|
|
23accdde1a | ||
|
|
321ec2cb1c | ||
|
|
27711f6a4c | ||
|
|
238202d380 | ||
|
|
8a735d5eb7 | ||
|
|
d038c4dee7 | ||
|
|
ebd76bf347 | ||
|
|
acc1ade74a | ||
|
|
72e4500da9 | ||
|
|
c4f3bf4ffa | ||
|
|
c563ed636a | ||
|
|
f3de2974a9 | ||
|
|
1b8ce5a6ed | ||
|
|
deb7630c67 | ||
|
|
cbd9569b99 | ||
|
|
a45a04ff4d | ||
|
|
7aa496d844 | ||
|
|
bf10a66b5d | ||
|
|
adc817cf13 | ||
|
|
787a649390 | ||
|
|
54690e6cdd | ||
|
|
4e3fb81172 | ||
|
|
6273c409e3 | ||
|
|
7798d39187 | ||
|
|
58ef1e96b8 | ||
|
|
732818ebb2 | ||
|
|
448de134ac | ||
|
|
fd3d8d6496 | ||
|
|
0b90ab102e | ||
|
|
cd3170fcb1 | ||
|
|
9eaf55898e | ||
|
|
10e1e396fc | ||
|
|
c1db283c39 | ||
|
|
6c97122120 | ||
|
|
0dd33d8ed1 | ||
|
|
0db12d7f75 | ||
|
|
c1d8ba47dd | ||
|
|
dc4cc08c3a | ||
|
|
e880cafed0 | ||
|
|
1ae014f52a | ||
|
|
1369559385 | ||
|
|
7ef72ec91f | ||
|
|
b74a184172 | ||
|
|
b50fb638f7 | ||
|
|
e06ae8e096 | ||
|
|
0940b0f29b | ||
|
|
03b05c8a5e | ||
|
|
9e4f9a26d4 | ||
|
|
f5f8c0fc76 | ||
|
|
c4dbe3b863 | ||
|
|
669678119c | ||
|
|
34e7a3cf8c | ||
|
|
1001cbbb99 | ||
|
|
36d52ee205 | ||
|
|
0ad462102a | ||
|
|
c6ee41bff3 | ||
|
|
5012a9c146 | ||
|
|
93781f9d5a | ||
|
|
4550c99222 | ||
|
|
a209f928d2 | ||
|
|
f23dbe6f42 | ||
|
|
974e1831a0 | ||
|
|
963c46e4fb | ||
|
|
32c49ea134 | ||
|
|
a465ea2d49 | ||
|
|
702e9e8ad5 | ||
|
|
250bf37a28 | ||
|
|
952c64b4c0 | ||
|
|
bcaeaf17af | ||
|
|
f4e57a6e22 | ||
|
|
8457580f61 | ||
|
|
f1ff9ae00c | ||
|
|
ed4ea51bb8 | ||
|
|
22a92da30d | ||
|
|
362b20a0bc | ||
|
|
72f6b34dbc | ||
|
|
816234350d | ||
|
|
4aeb0cfd9c | ||
|
|
be414423d7 | ||
|
|
abd1a1f372 | ||
|
|
c705fb6e3b | ||
|
|
1a36aa21ba | ||
|
|
c2f8010b60 | ||
|
|
64985f7bea | ||
|
|
3f562ee586 | ||
|
|
eb796b4bbb | ||
|
|
87b8d232bd | ||
|
|
6f1f8d2bdb | ||
|
|
a95bc8a016 | ||
|
|
f3a19d8c96 | ||
|
|
e005fd310f | ||
|
|
fb2fefb3c6 | ||
|
|
6026fc8036 | ||
|
|
2cc5b5865c | ||
|
|
8d65edb41f | ||
|
|
1247ba3398 | ||
|
|
be22c0d442 | ||
|
|
467d78a442 | ||
|
|
a4aeee972c | ||
|
|
16217454d5 | ||
|
|
7e1e0e5098 | ||
|
|
3fa0e3959c | ||
|
|
dd20253fec | ||
|
|
85ab4ee53a | ||
|
|
25f31760aa | ||
|
|
d11869bdb6 | ||
|
|
81847bf513 | ||
|
|
bba40abc76 | ||
|
|
0c12643466 | ||
|
|
1319d2ceb2 | ||
|
|
cc1f496741 | ||
|
|
963111b836 | ||
|
|
ebcff9fd63 | ||
|
|
25ff1214a4 | ||
|
|
d84b0926f0 | ||
|
|
f19158cadf | ||
|
|
459677e20e | ||
|
|
43bd7b6eee | ||
|
|
d7c47f529f | ||
|
|
2cff66c155 | ||
|
|
78ce67f579 | ||
|
|
2fb8198c48 | ||
|
|
2ea3683347 | ||
|
|
aaeb938ca4 | ||
|
|
ef4a81ea0c | ||
|
|
e9073a6bdb | ||
|
|
9086d5ca33 | ||
|
|
3c65057fad | ||
|
|
f9b1dece41 | ||
|
|
f7a2330de7 | ||
|
|
67b8f3d6df | ||
|
|
b0af812710 | ||
|
|
d13a17a27c | ||
|
|
ddfc36aa56 | ||
|
|
a5997d180d | ||
|
|
51875db70c | ||
|
|
5ad7da7fd2 | ||
|
|
59308bc269 | ||
|
|
fd2ef07f37 | ||
|
|
e19163eabb | ||
|
|
37acd3eca8 | ||
|
|
cc13e85202 | ||
|
|
720739bc2a | ||
|
|
ea99215664 | ||
|
|
c3c492a190 | ||
|
|
778652460f | ||
|
|
5c3b1ee0a4 | ||
|
|
4dec2f989c | ||
|
|
5fdfa8fe44 | ||
|
|
176b92a4f4 | ||
|
|
afc6a4e973 | ||
|
|
53d84abb17 | ||
|
|
dab8985c05 | ||
|
|
0bd6ccc066 | ||
|
|
5c7b8802f2 | ||
|
|
b8e301ade3 | ||
|
|
99c5160cb5 | ||
|
|
110da49504 | ||
|
|
f3754dc072 | ||
|
|
78a3ab2eaa | ||
|
|
4da7985204 | ||
|
|
2a66c38efa | ||
|
|
2e31dffdb7 | ||
|
|
88e43d2502 | ||
|
|
4166bb2a26 | ||
|
|
f818e63f8f | ||
|
|
094aa5eb02 | ||
|
|
5d3ab421e1 | ||
|
|
f8f7989c3d | ||
|
|
b92c499626 | ||
|
|
9fce33a2e3 | ||
|
|
7a65f7f028 | ||
|
|
f525fdb2e1 | ||
|
|
01994ea302 | ||
|
|
c4ddf62f7e | ||
|
|
2ec633f33d | ||
|
|
748d749675 | ||
|
|
77f632a559 | ||
|
|
54165a394a | ||
|
|
16818bd0e4 | ||
|
|
d29d199592 | ||
|
|
17c03005d8 | ||
|
|
509fa8a7b2 | ||
|
|
954da14c15 | ||
|
|
7527876fad | ||
|
|
9d79b7629c | ||
|
|
538f1bc00e | ||
|
|
f0ddde4826 | ||
|
|
d3834f69bc | ||
|
|
f7b8394127 | ||
|
|
72cf2e3ae2 | ||
|
|
164cee66ee | ||
|
|
9003f92e8f | ||
|
|
8d7563a9c3 | ||
|
|
4c4a03f056 | ||
|
|
73d76a2638 | ||
|
|
1c9eb4dfb9 | ||
|
|
94fa1e382f | ||
|
|
2e70077bbc | ||
|
|
2493e962fe | ||
|
|
a9846ccc0d | ||
|
|
7204d2f485 | ||
|
|
6252aab88a | ||
|
|
4c602f2255 | ||
|
|
6803c2f86d | ||
|
|
316ee071cf | ||
|
|
895055ab38 | ||
|
|
de35212789 | ||
|
|
337306600b | ||
|
|
efb7635162 | ||
|
|
8ecd65bcdb | ||
|
|
74d17a6531 | ||
|
|
b9b89ef7c6 | ||
|
|
a4dc74064c | ||
|
|
fa86229673 | ||
|
|
c317d95911 | ||
|
|
380390c4b6 | ||
|
|
e66f370682 | ||
|
|
a5bc81d406 | ||
|
|
2f42296edd | ||
|
|
d9ff44b46e | ||
|
|
c480ac8522 | ||
|
|
a89a67e008 | ||
|
|
a97db12f4f | ||
|
|
14d8e940e6 | ||
|
|
effd7ba13c | ||
|
|
a64ddff3fe | ||
|
|
25384e9558 | ||
|
|
0cb2974bd8 | ||
|
|
87527adada | ||
|
|
0cffb88b80 | ||
|
|
b0c2ca1b66 | ||
|
|
c50f2d1356 | ||
|
|
48e7b098f8 | ||
|
|
5333be5988 | ||
|
|
e4f80bd142 | ||
|
|
abbd6e304a | ||
|
|
7c79b5c154 | ||
|
|
5eb41492c4 | ||
|
|
c78c6c6542 | ||
|
|
d5d8349224 | ||
|
|
67a2ba6f99 | ||
|
|
79437fa0c9 | ||
|
|
76ba2b0055 | ||
|
|
68b7ca6e92 | ||
|
|
c165c396de | ||
|
|
f21ddefedb | ||
|
|
0cf1c85542 | ||
|
|
57550e6211 | ||
|
|
34bdc1ca78 | ||
|
|
5f202d7ffa | ||
|
|
c3a8b5009f | ||
|
|
9ef7e90821 | ||
|
|
38cb19268a | ||
|
|
72fdb4867e | ||
|
|
9dc650b7fb | ||
|
|
3ec8babfaf | ||
|
|
462c7726c3 | ||
|
|
e0fa48d2ed | ||
|
|
73e8277072 | ||
|
|
c7e9dc2ee3 | ||
|
|
166b9f7709 | ||
|
|
de369b46b1 | ||
|
|
043560d7dd | ||
|
|
4b33c6bb97 | ||
|
|
2f6a866373 | ||
|
|
f8ef200e76 | ||
|
|
3daf1760a1 | ||
|
|
2dff359a33 | ||
|
|
3341f49a49 | ||
|
|
5d2e9ee66e | ||
|
|
607c671f67 | ||
|
|
cf1e808e2f | ||
|
|
b6cfde8987 | ||
|
|
d73f665edd | ||
|
|
52efbc3a23 | ||
|
|
639dc3b5fd | ||
|
|
cff7882391 | ||
|
|
5d1a8cd88b | ||
|
|
528b9c5323 | ||
|
|
fab85b495e | ||
|
|
293ab4bd40 | ||
|
|
a45db022e9 | ||
|
|
02be4802d5 | ||
|
|
5437deed1b | ||
|
|
422271bd40 | ||
|
|
801bc29494 | ||
|
|
857ce2376e | ||
|
|
1bf6c965e4 | ||
|
|
fa2332354b | ||
|
|
e9aebb1198 | ||
|
|
fbe8ccdf3b | ||
|
|
34241cbb2b | ||
|
|
e9ba2da9e9 | ||
|
|
5b84772343 | ||
|
|
d8474207b6 | ||
|
|
b78f2ed75d | ||
|
|
2af88a679d | ||
|
|
ad0ac12c40 | ||
|
|
e3a866b8c1 | ||
|
|
f62cded9f0 | ||
|
|
7e315629b9 | ||
|
|
3c2ea78a09 | ||
|
|
85bcfab719 | ||
|
|
67ffe26dea | ||
|
|
bc78383fac | ||
|
|
1ec528b048 | ||
|
|
2a9c396603 | ||
|
|
4f392ebc7e | ||
|
|
1cc1a352fc | ||
|
|
cfe7065ce1 | ||
|
|
f561e6bcb3 | ||
|
|
83421c0e8c | ||
|
|
095733ed9c | ||
|
|
155a155d1d | ||
|
|
dbf72ffba2 | ||
|
|
47d21b6420 | ||
|
|
72eb4adbf0 | ||
|
|
3f9ce10525 | ||
|
|
412c501442 | ||
|
|
5c70dd8b85 | ||
|
|
d5068ed07d | ||
|
|
bc2db86d1c | ||
|
|
2fe9c2e352 | ||
|
|
d4e3401c23 | ||
|
|
2bd6501552 | ||
|
|
4f7be0dbb2 | ||
|
|
1da5c94b44 | ||
|
|
3d1edffe77 | ||
|
|
cb52ed7b12 | ||
|
|
22799b107d | ||
|
|
c3ce3d5cc3 | ||
|
|
32eea120af | ||
|
|
8e42d3959c | ||
|
|
f8be4d1b3b | ||
|
|
9b3648ded0 | ||
|
|
0701745cbc | ||
|
|
bbe437dbb1 | ||
|
|
5c67530f1e | ||
|
|
e40e6e8686 | ||
|
|
6f3a7d36bb | ||
|
|
5dddebd338 | ||
|
|
80d88dd3d9 | ||
|
|
0faffac020 | ||
|
|
5aaae4cb6b | ||
|
|
c092101e01 | ||
|
|
d7df4429eb | ||
|
|
ffe8b98cc2 | ||
|
|
aa5c7c3b0c | ||
|
|
886fdc8bc2 | ||
|
|
33ecaaac01 | ||
|
|
3c69092cde | ||
|
|
e8b28f978e | ||
|
|
92fdf31d29 | ||
|
|
878a650c7a | ||
|
|
e518ec1cb7 | ||
|
|
ed34425306 | ||
|
|
1d7f87fc0e | ||
|
|
735e34f932 | ||
|
|
fea9e3050c | ||
|
|
bbd0522026 | ||
|
|
e37fd83254 | ||
|
|
926b9e937b | ||
|
|
fc9434465c | ||
|
|
ba3ee9f007 | ||
|
|
38d8befcd0 | ||
|
|
e1d36314a2 | ||
|
|
9a54f91bb7 | ||
|
|
16d58e93af | ||
|
|
2384236849 | ||
|
|
252cd6eae9 | ||
|
|
8fe8dbb378 | ||
|
|
8923a01264 | ||
|
|
6cbab4936d | ||
|
|
0310cba2b6 | ||
|
|
0b9804a95b | ||
|
|
7c2db045a8 | ||
|
|
5027627344 | ||
|
|
4d43fbfb50 | ||
|
|
4e6ff36a9a | ||
|
|
f8bde7156f | ||
|
|
66c6ae1a55 | ||
|
|
1bc4176d65 | ||
|
|
de309c51a7 | ||
|
|
f128ffd88b | ||
|
|
063430744d | ||
|
|
cbd75c3e35 | ||
|
|
1729d4a168 | ||
|
|
773771659e | ||
|
|
c365ff3d05 | ||
|
|
1bbfe058f9 | ||
|
|
02d9b05f54 | ||
|
|
5c5b1aaaa7 | ||
|
|
6953c8ec91 | ||
|
|
58aff4495e | ||
|
|
3e2a61cc47 | ||
|
|
120d2b5333 | ||
|
|
d1d003c232 | ||
|
|
3cf72e5258 | ||
|
|
05fd0acf45 | ||
|
|
25707e9752 | ||
|
|
9774b1062d | ||
|
|
954341dd1f | ||
|
|
56d0e91e10 | ||
|
|
d7349d04d0 | ||
|
|
1226add976 | ||
|
|
234b05708c | ||
|
|
e368d01385 | ||
|
|
310c41a89a | ||
|
|
1102ea4c55 | ||
|
|
c487f5db5b | ||
|
|
501faacf8e | ||
|
|
adc8c20ac1 | ||
|
|
63e52afd5b | ||
|
|
6f60449e18 | ||
|
|
77052d3a1e | ||
|
|
898be61fc6 | ||
|
|
9ccb6864be | ||
|
|
2379ddff17 | ||
|
|
41a10699e6 | ||
|
|
b1c0121507 | ||
|
|
f6bea8d061 | ||
|
|
9bb7e68b86 | ||
|
|
20718ec52b | ||
|
|
a3557b81de | ||
|
|
485d78d768 | ||
|
|
7aa84318ae | ||
|
|
0e98f1214d | ||
|
|
6e7eae968a | ||
|
|
5bb9b570f4 | ||
|
|
571f547556 | ||
|
|
af3de262b6 | ||
|
|
bd4a0aa705 | ||
|
|
4bc6af6c17 | ||
|
|
27834cce2c | ||
|
|
a30d16c48a | ||
|
|
e4653b82bd | ||
|
|
b65dcb3a35 | ||
|
|
c1fb948397 | ||
|
|
be25b58380 | ||
|
|
66f51df9df | ||
|
|
3014e3c458 | ||
|
|
dd0d04ae8d | ||
|
|
112d4cc7e6 | ||
|
|
ee8664418a | ||
|
|
ae89b6c078 | ||
|
|
d403c01a30 | ||
|
|
14f1ce2e5b | ||
|
|
62b0f58d24 | ||
|
|
c3f963e71e | ||
|
|
fd09c4cb29 | ||
|
|
13f68fc2d5 | ||
|
|
7a523597ad | ||
|
|
c2d636270c | ||
|
|
21b0d29e38 | ||
|
|
6596d27e19 | ||
|
|
ed6294b4bb | ||
|
|
12da51ac5a | ||
|
|
b3ad6a015b | ||
|
|
be36586d74 | ||
|
|
0d7da3207f | ||
|
|
71ce6592e4 | ||
|
|
a5d6ccdc2c | ||
|
|
378fcccc0a | ||
|
|
3ed3833a38 | ||
|
|
5450b478f5 | ||
|
|
94d00009cc | ||
|
|
21bf499bb4 | ||
|
|
8ec46cbd42 | ||
|
|
0409a302bb | ||
|
|
84a85803b4 | ||
|
|
d46fe6a51c | ||
|
|
e83b4e8129 | ||
|
|
392e09e3de | ||
|
|
06b9901e64 | ||
|
|
677fa8ced2 | ||
|
|
3c333aa9b4 | ||
|
|
73d8c919b7 | ||
|
|
747e7d05db | ||
|
|
1f3a9105ff | ||
|
|
b0f22fde62 | ||
|
|
11f43df873 | ||
|
|
1254ed1833 | ||
|
|
f55b10e4ed | ||
|
|
d8be35de7f | ||
|
|
bdfe6870f6 | ||
|
|
9775f78ab2 | ||
|
|
6da4e21065 | ||
|
|
7bfe8d2f03 | ||
|
|
3b0b1c3ee3 | ||
|
|
82a80b205b | ||
|
|
5b586fdfec | ||
|
|
2f193b5cbb | ||
|
|
e6f93c887b | ||
|
|
36d9b62f1f | ||
|
|
da4bebbe1e | ||
|
|
d54a1ab798 | ||
|
|
e1081796af | ||
|
|
672c3be9ed | ||
|
|
dc9c4d22ab | ||
|
|
71d86be42e | ||
|
|
267fe02088 | ||
|
|
52b5258ed4 | ||
|
|
2bf6e66ffe | ||
|
|
728c2fbd01 | ||
|
|
613b71b385 | ||
|
|
70cc11618a | ||
|
|
387fd2cf53 | ||
|
|
0423057424 | ||
|
|
cc25d747d4 | ||
|
|
7637351065 | ||
|
|
7aeba71a92 | ||
|
|
e020dd8d59 | ||
|
|
a65af1b3b8 | ||
|
|
5478de1a64 | ||
|
|
fa9fbb1d67 | ||
|
|
ef751a26d0 | ||
|
|
30a7229fc5 | ||
|
|
1d69e073af | ||
|
|
c480a29052 | ||
|
|
4aef82237d | ||
|
|
8a4a22d7b7 | ||
|
|
5eb7a6ca38 | ||
|
|
3f4b5436e5 | ||
|
|
82cf5ea24c | ||
|
|
90e4786523 | ||
|
|
f65f41acc2 | ||
|
|
8979150745 | ||
|
|
f81d296e54 | ||
|
|
57afe78167 | ||
|
|
ee460dc04b | ||
|
|
f134cb3d57 | ||
|
|
3eaad77de2 | ||
|
|
9244750a63 | ||
|
|
e8720a30e2 | ||
|
|
ad09009201 | ||
|
|
e4e3b3052f | ||
|
|
96882cc58c | ||
|
|
7c79959e94 | ||
|
|
ca501df8c8 | ||
|
|
a4cecf59d5 | ||
|
|
244881b87d | ||
|
|
cf05e653de | ||
|
|
4b9916136d | ||
|
|
33ecff11dd | ||
|
|
83d3ee7fdb | ||
|
|
b1a3f4ee33 | ||
|
|
05498e0e33 | ||
|
|
4948fe21cd | ||
|
|
fe8fcb805c | ||
|
|
c4af6fbce3 | ||
|
|
3091025472 | ||
|
|
bf0c7ae0ae | ||
|
|
b5dc8197f7 | ||
|
|
19e23e6128 | ||
|
|
195f25cfbd | ||
|
|
1cb940c44a | ||
|
|
3f04367fb8 | ||
|
|
6c7e552509 | ||
|
|
b1cb8de385 | ||
|
|
69c9cd029f | ||
|
|
c699b9ca94 | ||
|
|
53586ed4ba | ||
|
|
5236358a48 | ||
|
|
d6fe9dc220 | ||
|
|
e0a73d3dbe | ||
|
|
dbe7df7571 | ||
|
|
a3357b8920 | ||
|
|
7ec798d3e7 | ||
|
|
f32e5f2191 | ||
|
|
cd078c7085 | ||
|
|
2e445d5871 | ||
|
|
5c46fbc680 | ||
|
|
2a780afc57 | ||
|
|
940cb233ce | ||
|
|
a653e27a2e | ||
|
|
d3f30da158 | ||
|
|
760d93e87b | ||
|
|
d42a1a35b0 | ||
|
|
8af829a42a | ||
|
|
ad8fa427dd | ||
|
|
de10a7754b | ||
|
|
6789170799 | ||
|
|
afc9988c93 | ||
|
|
2490404d45 | ||
|
|
fbdb940c46 | ||
|
|
c8d0b724b3 | ||
|
|
9e4700cdc0 | ||
|
|
b76d37b341 | ||
|
|
423fa6818b | ||
|
|
61e2c8f0f7 | ||
|
|
c02b260e7e | ||
|
|
01a6004171 | ||
|
|
4f5660e081 | ||
|
|
46bc11f977 | ||
|
|
119840b0a9 | ||
|
|
4343ac5b08 | ||
|
|
6b9183a20b | ||
|
|
3ec3a926e5 | ||
|
|
2f7886837f | ||
|
|
7febad5821 | ||
|
|
b235c380f2 | ||
|
|
f6a50aff4c | ||
|
|
6b7f275c32 | ||
|
|
4bde48bb2e | ||
|
|
f4154c503b | ||
|
|
8db4520d89 | ||
|
|
9a7d450098 | ||
|
|
7070117dc3 | ||
|
|
433f8fd550 | ||
|
|
c6590bd189 | ||
|
|
929868c691 | ||
|
|
06a0d8ff1c | ||
|
|
af0dd3fb02 | ||
|
|
ce02f6576a | ||
|
|
68e720a3da | ||
|
|
c224508bf8 | ||
|
|
15d71a8c51 | ||
|
|
8536cd9808 | ||
|
|
353751e3e3 | ||
|
|
159ef828dd | ||
|
|
3dd069c0c8 | ||
|
|
a198193723 | ||
|
|
e051135a05 | ||
|
|
bb18442fe8 | ||
|
|
c2aed4ca78 | ||
|
|
b7b535816d | ||
|
|
d8e691b58a | ||
|
|
52968b1a11 | ||
|
|
b35f1f488c | ||
|
|
10f71c6769 | ||
|
|
014fde0542 | ||
|
|
ca2acec34a | ||
|
|
bb197de75d | ||
|
|
03095f1516 | ||
|
|
6895d0b727 | ||
|
|
4745d652b5 | ||
|
|
a48711ae7e | ||
|
|
a25790d343 | ||
|
|
cd2dc3770a | ||
|
|
250f506487 | ||
|
|
9dc932c02b | ||
|
|
aaae6cd97d | ||
|
|
509676e3a4 | ||
|
|
a6d412f0d7 | ||
|
|
59da8dab50 | ||
|
|
7edbedf0dd | ||
|
|
af25c5e668 | ||
|
|
092fe0b727 | ||
|
|
1ddb99c46f | ||
|
|
93c7b81b4e | ||
|
|
93e82fa0c0 | ||
|
|
e9b2d164e0 | ||
|
|
86ae6b2251 | ||
|
|
2cb2587b55 | ||
|
|
86294ad3ea | ||
|
|
173994786b | ||
|
|
81123d6a91 | ||
|
|
25eb9c4914 | ||
|
|
c6210f5aef | ||
|
|
c673543e54 | ||
|
|
edca9d6e96 | ||
|
|
83aed7610c | ||
|
|
5fa4721c6e | ||
|
|
8b7627efd5 | ||
|
|
662217f409 | ||
|
|
19433dca00 | ||
|
|
6961dd79ad | ||
|
|
1b6375ce89 | ||
|
|
64f6abead7 | ||
|
|
f20a6d0a82 | ||
|
|
97c6b76863 | ||
|
|
6019cf1bed | ||
|
|
228dc08038 | ||
|
|
33cd594f1f | ||
|
|
0cd0f685c9 | ||
|
|
664b94d1c5 | ||
|
|
3b4b0f01ec | ||
|
|
7bd62dd652 | ||
|
|
c341da03d3 | ||
|
|
c238136010 | ||
|
|
5a08ddcff2 | ||
|
|
a182926024 | ||
|
|
9457685320 | ||
|
|
e9fd14c7f0 | ||
|
|
cfd2e4894e | ||
|
|
3703389feb | ||
|
|
673990f568 | ||
|
|
97638a1465 | ||
|
|
506e11fa8b | ||
|
|
1dd95675df | ||
|
|
cb10ad0c84 | ||
|
|
1f2c61d6ad | ||
|
|
1d97f75b0a | ||
|
|
835e34d1eb | ||
|
|
13c42bff3f | ||
|
|
59a1799501 | ||
|
|
d9c47a8cfa | ||
|
|
987991a3f2 | ||
|
|
a738507ad2 | ||
|
|
142b2e4ede | ||
|
|
517a01b7ad | ||
|
|
83633d539e | ||
|
|
c2ee63431b | ||
|
|
9e4bc10525 | ||
|
|
f37c844bf7 | ||
|
|
2c7dfb02a8 | ||
|
|
2884bbf5b1 | ||
|
|
f48a99b97c | ||
|
|
11cfb2903e | ||
|
|
c520d97dd9 | ||
|
|
6c74d6f891 | ||
|
|
262c82ac06 | ||
|
|
164b8e99cc | ||
|
|
4a08902664 | ||
|
|
d6e6a453fc | ||
|
|
eb86fd8cdf | ||
|
|
099e2e8438 | ||
|
|
291312c5e4 | ||
|
|
e2805abbf7 | ||
|
|
79d51099ac | ||
|
|
adf23533e0 | ||
|
|
927cd90dc1 | ||
|
|
b5efbe75cd | ||
|
|
01311dd419 | ||
|
|
5865b9436f | ||
|
|
ad1313c2e5 | ||
|
|
0cb9f792b8 | ||
|
|
efe785e711 | ||
|
|
48aca98cd5 | ||
|
|
89e154f78c | ||
|
|
491b407d17 | ||
|
|
2f4589b765 | ||
|
|
acb7161c81 | ||
|
|
437a39c798 | ||
|
|
b3e6d5df53 | ||
|
|
53644a14ac | ||
|
|
aa05248ca8 | ||
|
|
04543c9dbc | ||
|
|
d5aeebe323 | ||
|
|
47bd0b6d1f | ||
|
|
8e2590b535 | ||
|
|
c51f42a566 | ||
|
|
00d4fbe753 | ||
|
|
dee8e5688b | ||
|
|
40d81bb7ca | ||
|
|
10bc5ac203 | ||
|
|
8ba9402282 | ||
|
|
a2fe341da5 | ||
|
|
dbb2de272b | ||
|
|
9423a3a065 | ||
|
|
0c5d4954a7 | ||
|
|
0b8d24f800 | ||
|
|
48354f56ec | ||
|
|
5c0c95bd34 | ||
|
|
c82dd2eb81 | ||
|
|
f6276fe739 | ||
|
|
2a1089d607 | ||
|
|
fbf73ede1e | ||
|
|
577840d7f7 | ||
|
|
3d9b1693eb | ||
|
|
15f3988bc8 | ||
|
|
9c2127b798 | ||
|
|
0bb779904d | ||
|
|
5eeac3566e | ||
|
|
e99246246b | ||
|
|
c96e862c08 | ||
|
|
7021a46617 | ||
|
|
c7cb2d0657 | ||
|
|
fd50a4dd9f | ||
|
|
afe97d6cab | ||
|
|
00949383f4 | ||
|
|
2a1cb323f7 | ||
|
|
4463d89a4a | ||
|
|
9e0fb9f29b | ||
|
|
a277dd9277 | ||
|
|
370d4b014d | ||
|
|
7bd5e4101c | ||
|
|
352c7381a8 | ||
|
|
3e57b54688 | ||
|
|
2a183440c7 | ||
|
|
bb0023b7c7 | ||
|
|
398e8d50b5 | ||
|
|
fa34d11749 | ||
|
|
93370d61ba | ||
|
|
22d6c36800 | ||
|
|
c28ad814d0 | ||
|
|
fdc660f313 | ||
|
|
57418dd2cc | ||
|
|
4e04ec8bf5 | ||
|
|
79a80cdc77 | ||
|
|
95782ada1f | ||
|
|
f7b61bf557 | ||
|
|
adf4d4f147 | ||
|
|
dc93edc932 | ||
|
|
6bbdaceaca | ||
|
|
eedecd0269 | ||
|
|
d904784489 | ||
|
|
31fb4e1e69 | ||
|
|
3bdc2b1d4f | ||
|
|
1e37430dbe | ||
|
|
671f1979a6 | ||
|
|
fdaa42da1a | ||
|
|
8d450ef81a | ||
|
|
c433ac02bd | ||
|
|
1c24a0508f | ||
|
|
f0d6ce8958 | ||
|
|
75be42df75 | ||
|
|
3224506fe0 | ||
|
|
d4d30d0375 | ||
|
|
7ff6b3537f | ||
|
|
368509f5d1 | ||
|
|
7eff889384 | ||
|
|
465816f4a0 | ||
|
|
9fff70fa41 | ||
|
|
d3e081ba44 | ||
|
|
086847f997 | ||
|
|
cb9786b3ae | ||
|
|
9c4144689d | ||
|
|
e745236ae5 | ||
|
|
13eef19000 | ||
|
|
2fe59071b2 | ||
|
|
a7157b7907 | ||
|
|
6007c3c43f | ||
|
|
9d1ddd0547 | ||
|
|
5229253f86 | ||
|
|
a1c4fc07d4 | ||
|
|
6d09104ad3 | ||
|
|
57ef959aa3 | ||
|
|
b617d7fa29 | ||
|
|
4b3363ecf2 | ||
|
|
6fe51b13fb | ||
|
|
8bcbfb1642 | ||
|
|
aecd952d18 | ||
|
|
fedb1b3def | ||
|
|
8fdfa13227 | ||
|
|
9d90d15e91 | ||
|
|
09a715b147 | ||
|
|
42ad55377f | ||
|
|
d771dafe04 | ||
|
|
09af855b6f | ||
|
|
0571360f37 | ||
|
|
f3e3700063 | ||
|
|
41fe03e0d6 | ||
|
|
b514957af7 | ||
|
|
d9c5d0767c | ||
|
|
8f162e3b13 | ||
|
|
32ba84dac7 | ||
|
|
7f806b7c68 | ||
|
|
a6107f7432 | ||
|
|
9829aa2236 | ||
|
|
f8debe9a19 | ||
|
|
8b407f1ca2 | ||
|
|
20b5734649 | ||
|
|
0557f57c63 | ||
|
|
4f4e917187 | ||
|
|
a1f0b2acfc | ||
|
|
d65777b570 | ||
|
|
2df00fd84c | ||
|
|
d1d3beac33 | ||
|
|
ad0abff8b3 | ||
|
|
cdd7a6cb8d | ||
|
|
004240af48 | ||
|
|
4e3d16e291 | ||
|
|
7933aef747 | ||
|
|
136efd6ed5 | ||
|
|
94969cf263 | ||
|
|
68c3c26029 | ||
|
|
fd185acbea | ||
|
|
7a4e8e58f0 | ||
|
|
cbeb2a9de7 | ||
|
|
d61fcbf7b2 | ||
|
|
75e61f498b | ||
|
|
09edee123a | ||
|
|
060171028c | ||
|
|
7ecdc3e0d5 | ||
|
|
67a080874b | ||
|
|
7b63fe2f22 | ||
|
|
3d934f3ddc | ||
|
|
06cc94eecf | ||
|
|
f6443b725a | ||
|
|
d8ead516de | ||
|
|
ccdc0f1805 | ||
|
|
66e7e7023b | ||
|
|
b4fc5d9524 | ||
|
|
811c645f2a | ||
|
|
c2312f9dda | ||
|
|
440d2ec0ea | ||
|
|
47e53deebd | ||
|
|
095a01b70c | ||
|
|
503c729bb0 | ||
|
|
41d99d32e8 | ||
|
|
c481f9dafd | ||
|
|
f240ecf328 | ||
|
|
1972a27fe0 | ||
|
|
097760db17 | ||
|
|
b3a08ba8d3 | ||
|
|
fef7e1dffe | ||
|
|
6d7bbe63fe | ||
|
|
387e26c837 | ||
|
|
e8e99ec6de | ||
|
|
13c4499449 | ||
|
|
4cc7f4ad03 | ||
|
|
a8dc67ded8 | ||
|
|
aa33d18930 | ||
|
|
8c5777554a | ||
|
|
06cd9bc4dc | ||
|
|
0c8984ba9f | ||
|
|
6f0f1ef292 | ||
|
|
b12f3f38c7 | ||
|
|
cb165df64e | ||
|
|
e4c4f57f05 | ||
|
|
c5ef5ed18f | ||
|
|
ebf4a03908 | ||
|
|
4f3ee2fc7e | ||
|
|
f565aeebfa | ||
|
|
04cb94a2dd | ||
|
|
754152aa22 | ||
|
|
1ef00045dd | ||
|
|
a466a624e2 | ||
|
|
643a3b7cc3 | ||
|
|
d2dea8dc2e | ||
|
|
6edb6bcca1 | ||
|
|
d4f5a0e6ab | ||
|
|
ce1d73e0f0 | ||
|
|
20caa68b84 | ||
|
|
b00a6e3885 | ||
|
|
ffc33ca28c | ||
|
|
ee95c05c08 | ||
|
|
cfea381307 | ||
|
|
099b914fd9 | ||
|
|
afd35fa98c | ||
|
|
f02bc4768e | ||
|
|
bcb162816e | ||
|
|
5baa6aed6b | ||
|
|
6a6e85752e | ||
|
|
4421540b7b | ||
|
|
d3c186b04c | ||
|
|
e30acdb58a | ||
|
|
b0cbe88b0b | ||
|
|
3afba83134 | ||
|
|
b8d47a438c | ||
|
|
5201c5850e | ||
|
|
bd8ab422d0 | ||
|
|
33890daf41 | ||
|
|
ac4c5699b1 | ||
|
|
15e31eb464 | ||
|
|
2e81dd61dd | ||
|
|
f2c2687ca6 | ||
|
|
4c300313c3 | ||
|
|
bec13a6ac0 | ||
|
|
423d8c9b6a | ||
|
|
685fe1d0b6 | ||
|
|
e588e2325d | ||
|
|
04fd756c49 | ||
|
|
4cb6afcbd4 | ||
|
|
4eae4d592c | ||
|
|
566d842405 | ||
|
|
5e2fbbc202 | ||
|
|
8e703b9974 | ||
|
|
89853607c5 | ||
|
|
20658abc78 | ||
|
|
8823dee51a | ||
|
|
3e07359a35 | ||
|
|
e9242a7a31 | ||
|
|
b9ada25296 | ||
|
|
33cb1bc08b | ||
|
|
6da54688eb | ||
|
|
ef6d19fbb1 | ||
|
|
acbca6a562 | ||
|
|
fc8081cd06 | ||
|
|
7a64dd1b9a | ||
|
|
5045133dc2 | ||
|
|
7f2049b0d5 | ||
|
|
aa3eeb38f9 |
4
.arcconfig
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"phabricator.uri" : "https://bugs.libssh.org/",
|
||||||
|
"history.immutable": true
|
||||||
|
}
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
-DWITH_SERVER=1
|
|
||||||
-DWITH_GSSAPI=1
|
|
||||||
-DWITH_ZLIB=1
|
|
||||||
-DWITH_SFTP=1
|
|
||||||
-DWITH_SSH1=1
|
|
||||||
-DWITH_PCAP=1
|
|
||||||
-Iinclude/libssh
|
|
||||||
-Iinclude
|
|
||||||
-Ibuild
|
|
||||||
-Itests
|
|
||||||
-Isrc
|
|
||||||
3
.gitignore
vendored
@@ -3,6 +3,7 @@
|
|||||||
.*
|
.*
|
||||||
*.swp
|
*.swp
|
||||||
*~$
|
*~$
|
||||||
build
|
|
||||||
cscope.*
|
cscope.*
|
||||||
tags
|
tags
|
||||||
|
/build
|
||||||
|
/obj*
|
||||||
|
|||||||
360
.gitlab-ci.yml
Normal file
@@ -0,0 +1,360 @@
|
|||||||
|
variables:
|
||||||
|
BUILD_IMAGES_PROJECT: libssh/build-images
|
||||||
|
FEDORA_BUILD: buildenv-fedora
|
||||||
|
CENTOS7_BUILD: buildenv-centos7
|
||||||
|
TUMBLEWEED_BUILD: buildenv-tumbleweed
|
||||||
|
MINGW_BUILD: buildenv-mingw
|
||||||
|
DEBIAN_CROSS_BUILD: buildenv-debian-cross
|
||||||
|
|
||||||
|
# torture_auth fails on centos7 docker images, so we don't use -DCLIENT_TESTING=ON
|
||||||
|
centos7/openssl_1.0.x/x86-64:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$CENTOS7_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake3 -DUNIT_TESTING=ON -DCMAKE_BUILD_TYPE=Debug
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON
|
||||||
|
-DWITH_PCAP=ON .. && make -j$(nproc) && 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:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake -DCMAKE_BUILD_TYPE=Debug
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
||||||
|
-DPICKY_DEVELOPER=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/
|
||||||
|
|
||||||
|
fedora/openssl_1.1.x/x86-64/release:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake -DCMAKE_BUILD_TYPE=Release
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
||||||
|
-DPICKY_DEVELOPER=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/
|
||||||
|
|
||||||
|
# Address sanitizer doesn't mix well with LD_PRELOAD used in the testsuite
|
||||||
|
.fedora/address-sanitizer:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_C_FLAGS="-O2 -g -fsanitize=address"
|
||||||
|
-DCMAKE_LINK_FLAGS="-fsanitize=address -static-libasan"
|
||||||
|
-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/
|
||||||
|
|
||||||
|
fedora/undefined-sanitizer:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_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/
|
||||||
|
|
||||||
|
fedora/static-analysis:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_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
|
||||||
|
|
||||||
|
# That is a specific runner that we cannot enable universally.
|
||||||
|
# We restrict it to builds under the $BUILD_IMAGES_PROJECT project.
|
||||||
|
freebsd/x86-64:
|
||||||
|
image:
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake -DCMAKE_BUILD_TYPE=Debug
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DUNIT_TESTING=ON .. &&
|
||||||
|
make && ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- freebsd
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
only:
|
||||||
|
- branches@libssh/libssh-mirror
|
||||||
|
- branches@cryptomilk/libssh-mirror
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
fedora/libgcrypt/x86-64:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && 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
|
||||||
|
-DWITH_GCRYPT=ON .. &&
|
||||||
|
make -j$(nproc) && ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
fedora/mbedtls/x86-64:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$FEDORA_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && 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
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DWITH_MBEDTLS=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:
|
||||||
|
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
|
||||||
|
-DPICKY_DEVELOPER=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/openssl_1.1.x/x86-64/release:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$TUMBLEWEED_BUILD
|
||||||
|
script:
|
||||||
|
- mkdir -p obj && cd obj && cmake -DCMAKE_BUILD_TYPE=Release
|
||||||
|
-DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON --DWITH_PCAP=ON
|
||||||
|
-DKRB5_CONFIG=/usr/lib/mit/bin/krb5-config
|
||||||
|
-DPICKY_DEVELOPER=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/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/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
|
||||||
|
-DPICKY_DEVELOPER=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
|
||||||
|
# for MinGW
|
||||||
|
mingw64:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$MINGW_BUILD
|
||||||
|
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
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DUNIT_TESTING=ON .. &&
|
||||||
|
make -j$(nproc)
|
||||||
|
- export WINEPATH=/usr/x86_64-w64-mingw32/sys-root/mingw/bin
|
||||||
|
- ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
# Unit testing only, no client and pkd testing, because cwrap is not available
|
||||||
|
# for MinGW
|
||||||
|
mingw32:
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$MINGW_BUILD
|
||||||
|
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
|
||||||
|
-DPICKY_DEVELOPER=ON
|
||||||
|
-DUNIT_TESTING=ON .. &&
|
||||||
|
make -j$(nproc)
|
||||||
|
- export WINEPATH=/usr/i686-w64-mingw32/sys-root/mingw/bin
|
||||||
|
- ctest --output-on-failure
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
.Debian.cross.template: &Debian_cross_template
|
||||||
|
stage: test
|
||||||
|
image: $CI_REGISTRY/$BUILD_IMAGES_PROJECT:$DEBIAN_CROSS_BUILD
|
||||||
|
script:
|
||||||
|
- build=$(dpkg-architecture -qDEB_HOST_GNU_TYPE)
|
||||||
|
- host="${CI_JOB_NAME#*.cross.}"
|
||||||
|
- mkdir -p obj && cd obj && cmake
|
||||||
|
-DCMAKE_C_COMPILER="$(which $host-gcc)"
|
||||||
|
-DCMAKE_CXX_COMPILER="$(which $host-g++)"
|
||||||
|
-DCMAKE_BUILD_TYPE=Debug
|
||||||
|
-DUNIT_TESTING=ON -DWITH_SFTP=ON -DWITH_SERVER=ON -DWITH_ZLIB=ON
|
||||||
|
-DWITH_PCAP=ON .. && make -j$(nproc)
|
||||||
|
- ctest --output-on-failure -j$(nproc)
|
||||||
|
tags:
|
||||||
|
- shared
|
||||||
|
except:
|
||||||
|
- tags
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 week
|
||||||
|
when: on_failure
|
||||||
|
paths:
|
||||||
|
- obj/
|
||||||
|
|
||||||
|
Debian.cross.mips-linux-gnu:
|
||||||
|
<<: *Debian_cross_template
|
||||||
2
AUTHORS
@@ -1,7 +1,7 @@
|
|||||||
Author(s):
|
Author(s):
|
||||||
Aris Adamantiadis <aris@0xbadc0de.be> (project initiator)
|
Aris Adamantiadis <aris@0xbadc0de.be> (project initiator)
|
||||||
|
|
||||||
Andreas Schneider <mail@cynapses.org> (developer)
|
Andreas Schneider <asn@cryptomilk.org> (developer)
|
||||||
|
|
||||||
Nick Zitzmann <seiryu (at) comcast (dot) net> (mostly client SFTP stuff)
|
Nick Zitzmann <seiryu (at) comcast (dot) net> (mostly client SFTP stuff)
|
||||||
|
|
||||||
|
|||||||
148
CMakeLists.txt
@@ -1,17 +1,11 @@
|
|||||||
project(libssh C)
|
cmake_minimum_required(VERSION 3.3.0)
|
||||||
|
cmake_policy(SET CMP0048 NEW)
|
||||||
|
|
||||||
# Required cmake version
|
project(libssh VERSION 0.8.2 LANGUAGES C)
|
||||||
cmake_minimum_required(VERSION 2.6.0)
|
|
||||||
|
|
||||||
# global needed variables
|
# global needed variable
|
||||||
set(APPLICATION_NAME ${PROJECT_NAME})
|
set(APPLICATION_NAME ${PROJECT_NAME})
|
||||||
|
|
||||||
set(APPLICATION_VERSION_MAJOR "0")
|
|
||||||
set(APPLICATION_VERSION_MINOR "5")
|
|
||||||
set(APPLICATION_VERSION_PATCH "90")
|
|
||||||
|
|
||||||
set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
|
|
||||||
|
|
||||||
# SOVERSION scheme: CURRENT.AGE.REVISION
|
# SOVERSION scheme: CURRENT.AGE.REVISION
|
||||||
# If there was an incompatible interface change:
|
# If there was an incompatible interface change:
|
||||||
# Increment CURRENT. Set AGE and REVISION to 0
|
# Increment CURRENT. Set AGE and REVISION to 0
|
||||||
@@ -19,30 +13,27 @@ set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINO
|
|||||||
# 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.3.0")
|
set(LIBRARY_VERSION "4.6.0")
|
||||||
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
|
set(CMAKE_MODULE_PATH
|
||||||
${CMAKE_SOURCE_DIR}/cmake/Modules
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules
|
||||||
)
|
)
|
||||||
|
|
||||||
# add definitions
|
# add definitions
|
||||||
include(DefineCMakeDefaults)
|
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.")
|
||||||
|
|
||||||
# add macros
|
|
||||||
include(MacroAddPlugin)
|
|
||||||
include(MacroCopyFile)
|
|
||||||
|
|
||||||
# search for libraries
|
# search for libraries
|
||||||
if (WITH_ZLIB)
|
if (WITH_ZLIB)
|
||||||
find_package(ZLIB REQUIRED)
|
find_package(ZLIB REQUIRED)
|
||||||
@@ -53,24 +44,51 @@ if (WITH_GCRYPT)
|
|||||||
if (NOT GCRYPT_FOUND)
|
if (NOT GCRYPT_FOUND)
|
||||||
message(FATAL_ERROR "Could not find GCrypt")
|
message(FATAL_ERROR "Could not find GCrypt")
|
||||||
endif (NOT GCRYPT_FOUND)
|
endif (NOT GCRYPT_FOUND)
|
||||||
|
elseif(WITH_MBEDTLS)
|
||||||
|
find_package(MbedTLS REQUIRED)
|
||||||
|
if (NOT MBEDTLS_FOUND)
|
||||||
|
message(FATAL_ERROR "Could not find mbedTLS")
|
||||||
|
endif (NOT MBEDTLS_FOUND)
|
||||||
else (WITH_GCRYPT)
|
else (WITH_GCRYPT)
|
||||||
find_package(OpenSSL)
|
find_package(OpenSSL)
|
||||||
if (NOT OPENSSL_FOUND)
|
if (NOT OPENSSL_FOUND)
|
||||||
find_package(GCrypt)
|
find_package(GCrypt)
|
||||||
if (NOT GCRYPT_FOUND)
|
if (NOT GCRYPT_FOUND)
|
||||||
message(FATAL_ERROR "Could not find OpenSSL or GCrypt")
|
find_package(MbedTLS)
|
||||||
|
if (NOT MBEDTLS_FOUND)
|
||||||
|
message(FATAL_ERROR "Could not find OpenSSL, GCrypt or mbedTLS")
|
||||||
|
endif (NOT MBEDTLS_FOUND)
|
||||||
endif (NOT GCRYPT_FOUND)
|
endif (NOT GCRYPT_FOUND)
|
||||||
endif (NOT OPENSSL_FOUND)
|
endif (NOT OPENSSL_FOUND)
|
||||||
endif(WITH_GCRYPT)
|
endif(WITH_GCRYPT)
|
||||||
|
|
||||||
# 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)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
||||||
if (WITH_GSSAPI)
|
if (WITH_GSSAPI)
|
||||||
find_package(GSSAPI)
|
find_package(GSSAPI)
|
||||||
endif (WITH_GSSAPI)
|
endif (WITH_GSSAPI)
|
||||||
|
|
||||||
|
if (WITH_NACL)
|
||||||
|
find_package(NaCl)
|
||||||
|
if (NOT NACL_FOUND)
|
||||||
|
set(WITH_NACL OFF)
|
||||||
|
endif (NOT NACL_FOUND)
|
||||||
|
endif (WITH_NACL)
|
||||||
|
|
||||||
|
if (BSD OR SOLARIS OR OSX)
|
||||||
|
find_package(Argp)
|
||||||
|
endif (BSD OR SOLARIS OR OSX)
|
||||||
|
|
||||||
|
# Disable symbol versioning in non UNIX platforms
|
||||||
|
if (UNIX)
|
||||||
|
find_package(ABIMap 0.3.1)
|
||||||
|
else (UNIX)
|
||||||
|
set(WITH_SYMBOL_VERSIONING OFF)
|
||||||
|
endif (UNIX)
|
||||||
|
|
||||||
# config.h checks
|
# config.h checks
|
||||||
include(ConfigureChecks.cmake)
|
include(ConfigureChecks.cmake)
|
||||||
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||||
@@ -81,61 +99,129 @@ add_subdirectory(include)
|
|||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
# pkg-config file
|
# pkg-config file
|
||||||
|
if (UNIX)
|
||||||
configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc)
|
configure_file(libssh.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh.pc)
|
||||||
configure_file(libssh_threads.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libssh_threads.pc)
|
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
|
${CMAKE_CURRENT_BINARY_DIR}/libssh.pc
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libssh_threads.pc
|
|
||||||
DESTINATION
|
DESTINATION
|
||||||
${LIB_INSTALL_DIR}/pkgconfig
|
${LIB_INSTALL_DIR}/pkgconfig
|
||||||
COMPONENT
|
COMPONENT
|
||||||
pkgconfig
|
pkgconfig
|
||||||
)
|
)
|
||||||
|
endif (UNIX)
|
||||||
|
|
||||||
# cmake config files
|
# cmake config files
|
||||||
configure_file(libssh-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libssh-config.cmake @ONLY)
|
set(LIBSSH_LIBRARY_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}ssh${CMAKE_SHARED_LIBRARY_SUFFIX})
|
||||||
configure_file(libssh-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libssh-config-version.cmake @ONLY)
|
|
||||||
|
configure_file(${PROJECT_NAME}-config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake @ONLY)
|
||||||
|
configure_file(${PROJECT_NAME}-config-version.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake @ONLY)
|
||||||
install(
|
install(
|
||||||
FILES
|
FILES
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libssh-config.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libssh-config-version.cmake
|
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake
|
||||||
DESTINATION
|
DESTINATION
|
||||||
${CMAKE_INSTALL_DIR}
|
${CMAKE_INSTALL_DIR}/${PROJECT_NAME}
|
||||||
COMPONENT
|
COMPONENT
|
||||||
devel
|
devel
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# in tree build settings
|
# in tree build settings
|
||||||
configure_file(libssh-build-tree-settings.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libssh-build-tree-settings.cmake @ONLY)
|
configure_file(libssh-build-tree-settings.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/libssh-build-tree-settings.cmake @ONLY)
|
||||||
|
|
||||||
add_subdirectory(examples)
|
if (WITH_EXAMPLES)
|
||||||
|
add_subdirectory(examples)
|
||||||
|
endif (WITH_EXAMPLES)
|
||||||
|
|
||||||
if (WITH_TESTING)
|
if (UNIT_TESTING)
|
||||||
find_package(CMocka REQUIRED)
|
find_package(CMocka REQUIRED)
|
||||||
include(AddCMockaTest)
|
include(AddCMockaTest)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif (WITH_TESTING)
|
endif (UNIT_TESTING)
|
||||||
|
|
||||||
|
### SOURCE PACKAGE
|
||||||
|
if (WITH_SYMBOL_VERSIONING AND ABIMAP_FOUND)
|
||||||
|
# Get the current ABI version from source
|
||||||
|
get_filename_component(current_abi_path
|
||||||
|
"${CMAKE_SOURCE_DIR}/src/ABI/current"
|
||||||
|
ABSOLUTE)
|
||||||
|
|
||||||
|
# Check if the ABI version should be updated
|
||||||
|
file(READ ${current_abi_path} CURRENT_ABI_CONTENT)
|
||||||
|
string(STRIP "${CURRENT_ABI_CONTENT}" CURRENT_ABI_VERSION)
|
||||||
|
|
||||||
|
if (LIBRARY_VERSION VERSION_GREATER CURRENT_ABI_VERSION)
|
||||||
|
set(UPDATE_ABI TRUE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
if (UPDATE_ABI)
|
||||||
|
message(STATUS "Library version bumped to ${LIBRARY_VERSION}: Updating ABI")
|
||||||
|
|
||||||
|
# Get the list of header files
|
||||||
|
get_file_list(${PROJECT_NAME}_header_list
|
||||||
|
DIRECTORIES "${CMAKE_SOURCE_DIR}/include/libssh"
|
||||||
|
FILES_PATTERNS "*.h")
|
||||||
|
|
||||||
|
# Extract the symbols marked as "LIBSSH_API" from the header files
|
||||||
|
extract_symbols(${PROJECT_NAME}.symbols
|
||||||
|
HEADERS_LIST ${PROJECT_NAME}_header_list
|
||||||
|
FILTER_PATTERN "LIBSSH_API"
|
||||||
|
COPY_TO "${CMAKE_SOURCE_DIR}/src/ABI/${PROJECT_NAME}-${LIBRARY_VERSION}.symbols")
|
||||||
|
|
||||||
|
if (WITH_ABI_BREAK)
|
||||||
|
set(ALLOW_ABI_BREAK "BREAK_ABI")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Target we can depend on in 'make dist'
|
||||||
|
set(_SYMBOL_TARGET "${PROJECT_NAME}.map")
|
||||||
|
|
||||||
|
# Set the path to the current map file
|
||||||
|
set(MAP_PATH "${CMAKE_SOURCE_DIR}/src/${_SYMBOL_TARGET}")
|
||||||
|
|
||||||
|
# Generate the symbol version map file
|
||||||
|
generate_map_file(${_SYMBOL_TARGET}
|
||||||
|
SYMBOLS ${PROJECT_NAME}.symbols
|
||||||
|
RELEASE_NAME_VERSION ${PROJECT_NAME}_${LIBRARY_VERSION}
|
||||||
|
CURRENT_MAP ${MAP_PATH}
|
||||||
|
COPY_TO ${MAP_PATH}
|
||||||
|
FINAL
|
||||||
|
${ALLOW_ABI_BREAK})
|
||||||
|
|
||||||
|
# Write the current version to the source
|
||||||
|
file(WRITE ${current_abi_path} ${LIBRARY_VERSION})
|
||||||
|
endif(UPDATE_ABI)
|
||||||
|
endif (WITH_SYMBOL_VERSIONING AND ABIMAP_FOUND)
|
||||||
|
|
||||||
|
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source DEPENDS ${_SYMBOL_TARGET})
|
||||||
|
|
||||||
message(STATUS "********************************************")
|
message(STATUS "********************************************")
|
||||||
message(STATUS "********** ${PROJECT_NAME} build options : **********")
|
message(STATUS "********** ${PROJECT_NAME} build options : **********")
|
||||||
|
|
||||||
message(STATUS "zlib support: ${WITH_ZLIB}")
|
message(STATUS "zlib support: ${WITH_ZLIB}")
|
||||||
message(STATUS "libgcrypt support: ${WITH_GCRYPT}")
|
message(STATUS "libgcrypt support: ${WITH_GCRYPT}")
|
||||||
message(STATUS "SSH-1 support: ${WITH_SSH1}")
|
message(STATUS "libmbedTLS support: ${WITH_MBEDTLS}")
|
||||||
|
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 "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: ${WITH_TESTING}")
|
message(STATUS "Unit testing: ${UNIT_TESTING}")
|
||||||
message(STATUS "Client code Unit testing: ${WITH_CLIENT_TESTING}")
|
message(STATUS "Client code testing: ${CLIENT_TESTING}")
|
||||||
|
set(_SERVER_TESTING OFF)
|
||||||
|
if (WITH_SERVER)
|
||||||
|
set(_SERVER_TESTING ${SERVER_TESTING})
|
||||||
|
endif()
|
||||||
|
message(STATUS "Server code testing: ${_SERVER_TESTING}")
|
||||||
if (WITH_INTERNAL_DOC)
|
if (WITH_INTERNAL_DOC)
|
||||||
message(STATUS "Internal documentation generation")
|
message(STATUS "Internal documentation generation")
|
||||||
else (WITH_INTERNAL_DOC)
|
else (WITH_INTERNAL_DOC)
|
||||||
message(STATUS "Public API documentation generation")
|
message(STATUS "Public API documentation generation")
|
||||||
endif (WITH_INTERNAL_DOC)
|
endif (WITH_INTERNAL_DOC)
|
||||||
message(STATUS "Benchmarks: ${WITH_BENCHMARKS}")
|
message(STATUS "Benchmarks: ${WITH_BENCHMARKS}")
|
||||||
|
message(STATUS "Symbol versioning: ${WITH_SYMBOL_VERSIONING}")
|
||||||
|
message(STATUS "Allow ABI break: ${WITH_ABI_BREAK}")
|
||||||
|
message(STATUS "Release is final: ${WITH_FINAL}")
|
||||||
message(STATUS "********************************************")
|
message(STATUS "********************************************")
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,19 @@
|
|||||||
# For help take a look at:
|
### GENERAL SETTINGS
|
||||||
# http://www.cmake.org/Wiki/CMake:CPackConfiguration
|
set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The SSH Library")
|
||||||
### general settings
|
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
|
||||||
set(CPACK_PACKAGE_NAME ${APPLICATION_NAME})
|
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The SSH library")
|
|
||||||
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
|
|
||||||
set(CPACK_PACKAGE_VENDOR "The SSH Library Development Team")
|
set(CPACK_PACKAGE_VENDOR "The SSH Library Development Team")
|
||||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
|
||||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING")
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
|
||||||
|
|
||||||
### versions
|
# SOURCE GENERATOR
|
||||||
set(CPACK_PACKAGE_VERSION_MAJOR "0")
|
set(CPACK_SOURCE_GENERATOR "TXZ")
|
||||||
set(CPACK_PACKAGE_VERSION_MINOR "5")
|
set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]git/;.gitignore;/build*;/obj*;tags;cscope.*")
|
||||||
set(CPACK_PACKAGE_VERSION_PATCH "90")
|
|
||||||
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
|
|
||||||
|
|
||||||
|
|
||||||
### source generator
|
|
||||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
|
||||||
set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;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
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
set(CPACK_GENERATOR "ZIP")
|
set(CPACK_GENERATOR "ZIP")
|
||||||
|
|
||||||
@@ -46,7 +38,6 @@ set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION
|
|||||||
set(CPACK_COMPONENT_HEADERS_DESCRIPTION
|
set(CPACK_COMPONENT_HEADERS_DESCRIPTION
|
||||||
"C/C++ header files for use with libssh")
|
"C/C++ header files for use with libssh")
|
||||||
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
|
set(CPACK_COMPONENT_HEADERS_DEPENDS libraries)
|
||||||
#set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime")
|
|
||||||
set(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
|
set(CPACK_COMPONENT_LIBRARIES_GROUP "Development")
|
||||||
set(CPACK_COMPONENT_HEADERS_GROUP "Development")
|
set(CPACK_COMPONENT_HEADERS_GROUP "Development")
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ set(UPDATE_TYPE "true")
|
|||||||
set(CTEST_PROJECT_NAME "libssh")
|
set(CTEST_PROJECT_NAME "libssh")
|
||||||
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
|
set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
|
||||||
|
|
||||||
set(CTEST_DROP_METHOD "http")
|
set(CTEST_DROP_METHOD "https")
|
||||||
set(CTEST_DROP_SITE "test.libssh.org")
|
set(CTEST_DROP_SITE "test.libssh.org")
|
||||||
set(CTEST_DROP_LOCATION "/submit.php?project=libssh")
|
set(CTEST_DROP_LOCATION "/submit.php?project=libssh")
|
||||||
set(CTEST_DROP_SITE_CDASH TRUE)
|
set(CTEST_DROP_SITE_CDASH TRUE)
|
||||||
|
|||||||
127
ChangeLog
@@ -1,16 +1,141 @@
|
|||||||
ChangeLog
|
ChangeLog
|
||||||
==========
|
==========
|
||||||
|
|
||||||
version 0.6.0 (released 2013-XX-XX)
|
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)
|
||||||
|
* Removed support for deprecated SSHv1 protocol
|
||||||
|
* Added new connector API for clients
|
||||||
|
* Added new known_hosts parsing API
|
||||||
|
* Added support for OpenSSL 1.1
|
||||||
|
* Added support for chacha20-poly1305 cipher
|
||||||
|
* Added crypto backend for mbedtls crypto library
|
||||||
|
* Added ECDSA support with gcrypt backend
|
||||||
|
* Added advanced client and server testing using cwrap.org
|
||||||
|
* Added support for curve25519-sha256 alias
|
||||||
|
* Added support for global known_hosts file
|
||||||
|
* Added support for symbol versioning
|
||||||
|
* Improved ssh_config parsing
|
||||||
|
* Improved threading support
|
||||||
|
|
||||||
|
version 0.7.5 (released 2017-04-13)
|
||||||
|
* Fixed a memory allocation issue with buffers
|
||||||
|
* Fixed PKI on Windows
|
||||||
|
* Fixed some SSHv1 functions
|
||||||
|
* Fixed config hostname expansion
|
||||||
|
|
||||||
|
version 0.7.4 (released 2017-02-03)
|
||||||
|
* Added id_ed25519 to the default identity list
|
||||||
|
* Fixed sftp EOF packet handling
|
||||||
|
* Fixed ssh_send_banner() to confirm with RFC 4253
|
||||||
|
* Fixed some memory leaks
|
||||||
|
|
||||||
|
version 0.7.3 (released 2016-01-23)
|
||||||
|
* Fixed CVE-2016-0739
|
||||||
|
* Fixed ssh-agent on big endian
|
||||||
|
* Fixed some documentation issues
|
||||||
|
|
||||||
|
version 0.7.2 (released 2015-09-15)
|
||||||
|
* Fixed OpenSSL detection on Windows
|
||||||
|
* Fixed return status for ssh_userauth_agent()
|
||||||
|
* Fixed KEX to prefer hmac-sha2-256
|
||||||
|
* Fixed sftp packet handling
|
||||||
|
* Fixed return values of ssh_key_is_(public|private)
|
||||||
|
* Fixed bug in global success reply
|
||||||
|
|
||||||
|
version 0.7.1 (released 2015-06-30)
|
||||||
|
* Fixed SSH_AUTH_PARTIAL auth with auto public key
|
||||||
|
* Fixed memory leak in session options
|
||||||
|
* Fixed allocation of ed25519 public keys
|
||||||
|
* Fixed channel exit-status and exit-signal
|
||||||
|
* Reintroduce ssh_forward_listen()
|
||||||
|
|
||||||
|
version 0.7.0 (released 2015-05-11)
|
||||||
|
* Added support for ed25519 keys
|
||||||
|
* Added SHA2 algorithms for HMAC
|
||||||
|
* Added improved and more secure buffer handling code
|
||||||
|
* Added callback for auth_none_function
|
||||||
|
* Added support for ECDSA private key signing
|
||||||
|
* Added more tests
|
||||||
|
* Fixed a lot of bugs
|
||||||
|
* Improved API documentation
|
||||||
|
|
||||||
|
version 0.6.5 (released 2015-04-29)
|
||||||
|
* Fixed CVE-2015-3146
|
||||||
|
* Fixed port handling in config file
|
||||||
|
* Fixed the build with libgcrypt
|
||||||
|
* Fixed SFTP endian issues (rlo #179)
|
||||||
|
* Fixed uninitilized sig variable (rlo #167)
|
||||||
|
* Fixed polling issues which could result in a hang
|
||||||
|
* Fixed handling of EINTR in ssh_poll() (rlo #186)
|
||||||
|
* Fixed C99 issues with __func__
|
||||||
|
* Fixed some memory leaks
|
||||||
|
* Improved macro detection on Windows
|
||||||
|
|
||||||
|
version 0.6.4 (released 2014-12-19)
|
||||||
|
* Fixed CVE-2014-8132.
|
||||||
|
* Added SHA-2 for session ID signing with ECDSA keys.
|
||||||
|
* Added support for ECDSA host keys.
|
||||||
|
* Added support for more ECDSA hostkey algorithms.
|
||||||
|
* Added ssh_pki_key_ecdsa_name() API.
|
||||||
|
* Fixed setting the bindfd only after successful listen.
|
||||||
|
* Fixed issues with user created sockets.
|
||||||
|
* Fixed several issues in libssh C++ wrapper.
|
||||||
|
* Fixed several documentation issues.
|
||||||
|
* Fixed channel exit-signal request.
|
||||||
|
* Fixed X11 request screen number in messages.
|
||||||
|
* Fixed several memory leaks.
|
||||||
|
|
||||||
|
version 0.6.3 (released 2014-03-04)
|
||||||
|
* Fixed CVE-2014-0017.
|
||||||
|
* Fixed memory leak with ecdsa signatures.
|
||||||
|
|
||||||
|
version 0.6.2 (released 2014-03-04)
|
||||||
|
* security: fix for vulnerability CVE-2014-0017
|
||||||
|
|
||||||
|
version 0.6.1 (released 2014-02-08)
|
||||||
|
* Added support for libgcrypt 1.6.
|
||||||
|
* Added ssh_channel_accept_forward().
|
||||||
|
* Added known_hosts heuristic during connection (#138).
|
||||||
|
* Added getters for session cipher names.
|
||||||
|
* Fixed decrypt of zero length buffer.
|
||||||
|
* Fixed padding in RSA signature blobs.
|
||||||
|
* Fixed DSA signature extraction.
|
||||||
|
* Fixed some memory leaks.
|
||||||
|
* Fixed read of non-connected socket.
|
||||||
|
* Fixed thread dectection.
|
||||||
|
|
||||||
|
version 0.6.0 (released 2014-01-08)
|
||||||
* Added new publicy key API.
|
* Added new publicy key API.
|
||||||
* Added new userauth API.
|
* Added new userauth API.
|
||||||
|
* Added ssh_get_publickey_hash() function.
|
||||||
|
* Added ssh_get_poll_flags() function.
|
||||||
* Added gssapi-mic userauth.
|
* Added gssapi-mic userauth.
|
||||||
|
* Added GSSAPIServerIdentity option.
|
||||||
|
* Added GSSAPIClientIdentity option.
|
||||||
|
* Added GSSAPIDelegateCredentials option.
|
||||||
* Added new callback based server API.
|
* Added new callback based server API.
|
||||||
* Added Elliptic Curve DSA (ECDSA) support (with OpenSSL).
|
* Added Elliptic Curve DSA (ECDSA) support (with OpenSSL).
|
||||||
* Added Elliptic Curve Diffie Hellman (ECDH) support.
|
* Added Elliptic Curve Diffie Hellman (ECDH) support.
|
||||||
|
* Added Curve25519 for ECDH key exchange.
|
||||||
* Added improved logging system.
|
* Added improved logging system.
|
||||||
* Added SSH-agent forwarding.
|
* Added SSH-agent forwarding.
|
||||||
* Added key-reexchange.
|
* Added key-reexchange.
|
||||||
|
* Added more unit tests.
|
||||||
* Improved documentation.
|
* Improved documentation.
|
||||||
* Fixed timeout handling.
|
* Fixed timeout handling.
|
||||||
|
|
||||||
|
|||||||
59
CodingStyle
@@ -1,59 +0,0 @@
|
|||||||
Coding Style Conventions
|
|
||||||
========================
|
|
||||||
|
|
||||||
Coding style guidelines are about reducing the number of unnecessary
|
|
||||||
reformatting patches and making things easier for developers to work together.
|
|
||||||
|
|
||||||
You don't have to like them or even agree with them, but once put in place we
|
|
||||||
all have to abide by them (or vote to change them). However, coding style
|
|
||||||
should never outweigh coding itself and so the guidelines described here are
|
|
||||||
hopefully easy enough to follow as they are very common and supported by tools
|
|
||||||
and editors.
|
|
||||||
|
|
||||||
The basic style for C code is the Linux kernel coding style [1] with one
|
|
||||||
excecption, we use 4 spaces instead of tabs. This closely matches what most
|
|
||||||
libssh developers use already anyways, with a few exceptions as mentioned
|
|
||||||
below.
|
|
||||||
|
|
||||||
To shorthen this here are the highlights:
|
|
||||||
|
|
||||||
* Maximum line width is 80 characters
|
|
||||||
|
|
||||||
The reason is not about people with low-res screens but rather sticking
|
|
||||||
to 80 columns prevents you from easily nesting more than one level of
|
|
||||||
if statements or other code blocks.
|
|
||||||
|
|
||||||
* Use 4 spaces to indent
|
|
||||||
|
|
||||||
* No trailing whitespaces
|
|
||||||
|
|
||||||
* Follow the K&R guidelines. We won't go through all of them here. Do you
|
|
||||||
have a copy of "The C Programming Language" anyways right?
|
|
||||||
|
|
||||||
Editors
|
|
||||||
========
|
|
||||||
|
|
||||||
VIM
|
|
||||||
----
|
|
||||||
|
|
||||||
set ts=4 sw=4 et cindent
|
|
||||||
|
|
||||||
For Vim, the following settings in $HOME/.vimrc will also deal with
|
|
||||||
displaying trailing whitespace:
|
|
||||||
|
|
||||||
if has("syntax") && (&t_Co > 2 || has("gui_running"))
|
|
||||||
syntax on
|
|
||||||
function! ActivateInvisibleCharIndicator()
|
|
||||||
syntax match TrailingSpace "[ \t]\+$" display containedin=ALL
|
|
||||||
highlight TrailingSpace ctermbg=Red
|
|
||||||
endf
|
|
||||||
autocmd BufNewFile,BufRead * call ActivateInvisibleCharIndicator()
|
|
||||||
endif
|
|
||||||
" Show tabs, trailing whitespace, and continued lines visually
|
|
||||||
set list listchars=tab:»·,trail:·,extends:…
|
|
||||||
|
|
||||||
" highlight overly long lines same as TODOs.
|
|
||||||
set textwidth=80
|
|
||||||
autocmd BufNewFile,BufRead *.c,*.h exec 'match Todo /\%>' . &textwidth . 'v.\+/'
|
|
||||||
|
|
||||||
[1] https://www.kernel.org/doc/Documentation/CodingStyle
|
|
||||||
93
CompilerChecks.cmake
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
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("-pedantic" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
add_c_compiler_flag("-pedantic-errors" 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)
|
||||||
|
|
||||||
|
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
|
||||||
|
add_c_compiler_flag("-Wno-gnu-zero-variadic-macro-arguments" SUPPORTED_COMPILER_FLAGS)
|
||||||
|
|
||||||
|
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" WITH_STACK_PROTECTOR)
|
||||||
|
if (WITH_STACK_PROTECTOR)
|
||||||
|
list(APPEND SUPPORTED_COMPILER_FLAGS "-fstack-protector")
|
||||||
|
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()
|
||||||
|
|
||||||
|
# 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)
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
|
include(CheckIncludeFiles)
|
||||||
include(CheckSymbolExists)
|
include(CheckSymbolExists)
|
||||||
include(CheckFunctionExists)
|
include(CheckFunctionExists)
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
@@ -6,8 +7,8 @@ include(CheckTypeSize)
|
|||||||
include(CheckCXXSourceCompiles)
|
include(CheckCXXSourceCompiles)
|
||||||
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}")
|
||||||
@@ -41,17 +42,32 @@ if(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW AND NOT OS2)
|
|||||||
"void __attribute__((visibility(\"default\"))) test() {}
|
"void __attribute__((visibility(\"default\"))) test() {}
|
||||||
int main(void){ return 0; }
|
int main(void){ return 0; }
|
||||||
" WITH_VISIBILITY_HIDDEN)
|
" WITH_VISIBILITY_HIDDEN)
|
||||||
set(CMAKE_REQUIRED_FLAGS "")
|
unset(CMAKE_REQUIRED_FLAGS)
|
||||||
endif (NOT GNUCC_VERSION EQUAL 34)
|
endif (NOT GNUCC_VERSION EQUAL 34)
|
||||||
endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW AND NOT OS2)
|
endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW AND NOT OS2)
|
||||||
|
|
||||||
# HEADER FILES
|
# HEADER FILES
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ARGP_INCLUDE_DIR})
|
||||||
check_include_file(argp.h HAVE_ARGP_H)
|
check_include_file(argp.h HAVE_ARGP_H)
|
||||||
|
unset(CMAKE_REQUIRED_INCLUDES)
|
||||||
|
|
||||||
check_include_file(pty.h HAVE_PTY_H)
|
check_include_file(pty.h HAVE_PTY_H)
|
||||||
|
check_include_file(utmp.h HAVE_UTMP_H)
|
||||||
check_include_file(termios.h HAVE_TERMIOS_H)
|
check_include_file(termios.h HAVE_TERMIOS_H)
|
||||||
check_include_file(unistd.h HAVE_UNISTD_H)
|
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||||
|
check_include_file(stdint.h HAVE_STDINT_H)
|
||||||
|
check_include_file(util.h HAVE_UTIL_H)
|
||||||
|
check_include_file(libutil.h HAVE_LIBUTIL_H)
|
||||||
|
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
||||||
|
check_include_file(sys/utime.h HAVE_SYS_UTIME_H)
|
||||||
|
check_include_file(sys/param.h HAVE_SYS_PARAM_H)
|
||||||
|
check_include_file(arpa/inet.h HAVE_ARPA_INET_H)
|
||||||
|
check_include_file(byteswap.h HAVE_BYTESWAP_H)
|
||||||
|
check_include_file(glob.h HAVE_GLOB_H)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
|
check_include_file(io.h HAVE_IO_H)
|
||||||
|
|
||||||
check_include_files("winsock2.h;ws2tcpip.h;wspiapi.h" HAVE_WSPIAPI_H)
|
check_include_files("winsock2.h;ws2tcpip.h;wspiapi.h" HAVE_WSPIAPI_H)
|
||||||
if (NOT HAVE_WSPIAPI_H)
|
if (NOT HAVE_WSPIAPI_H)
|
||||||
message(STATUS "WARNING: Without wspiapi.h, this build will only work on Windows XP and newer versions")
|
message(STATUS "WARNING: Without wspiapi.h, this build will only work on Windows XP and newer versions")
|
||||||
@@ -59,29 +75,64 @@ if (WIN32)
|
|||||||
check_include_files("winsock2.h;ws2tcpip.h" HAVE_WS2TCPIP_H)
|
check_include_files("winsock2.h;ws2tcpip.h" HAVE_WS2TCPIP_H)
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
if (OPENSSL_FOUND)
|
||||||
check_include_file(openssl/aes.h HAVE_OPENSSL_AES_H)
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
|
check_include_file(openssl/des.h HAVE_OPENSSL_DES_H)
|
||||||
|
if (NOT HAVE_OPENSSL_DES_H)
|
||||||
|
message(FATAL_ERROR "Could not detect openssl/des.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
check_include_file(openssl/blowfish.h HAVE_OPENSSL_BLOWFISH_H)
|
check_include_file(openssl/aes.h HAVE_OPENSSL_AES_H)
|
||||||
|
if (NOT HAVE_OPENSSL_AES_H)
|
||||||
|
message(FATAL_ERROR "Could not detect openssl/aes.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
check_include_file(openssl/des.h HAVE_OPENSSL_DES_H)
|
check_include_file(openssl/blowfish.h HAVE_OPENSSL_BLOWFISH_H)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
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)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
check_include_file(openssl/ec.h HAVE_OPENSSL_EC_H)
|
check_include_file(openssl/ec.h HAVE_OPENSSL_EC_H)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIRS})
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
check_include_file(openssl/ecdsa.h HAVE_OPENSSL_ECDSA_H)
|
check_include_file(openssl/ecdsa.h HAVE_OPENSSL_ECDSA_H)
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
check_function_exists(EVP_aes_128_ctr HAVE_OPENSSL_EVP_AES_CTR)
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
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(CRYPTO_THREADID_set_callback HAVE_OPENSSL_CRYPTO_THREADID_SET_CALLBACK)
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
check_function_exists(CRYPTO_ctr128_encrypt HAVE_OPENSSL_CRYPTO_CTR128_ENCRYPT)
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||||
|
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(RAND_priv_bytes HAVE_OPENSSL_RAND_PRIV_BYTES)
|
||||||
|
|
||||||
|
unset(CMAKE_REQUIRED_INCLUDES)
|
||||||
|
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (CMAKE_HAVE_PTHREAD_H)
|
if (CMAKE_HAVE_PTHREAD_H)
|
||||||
set(HAVE_PTHREAD_H 1)
|
set(HAVE_PTHREAD_H 1)
|
||||||
endif (CMAKE_HAVE_PTHREAD_H)
|
endif (CMAKE_HAVE_PTHREAD_H)
|
||||||
|
|
||||||
if (NOT WITH_GCRYPT)
|
if (NOT WITH_GCRYPT AND NOT WITH_MBEDTLS)
|
||||||
if (HAVE_OPENSSL_EC_H AND HAVE_OPENSSL_ECDSA_H)
|
if (HAVE_OPENSSL_EC_H AND HAVE_OPENSSL_ECDSA_H)
|
||||||
set(HAVE_OPENSSL_ECC 1)
|
set(HAVE_OPENSSL_ECC 1)
|
||||||
endif (HAVE_OPENSSL_EC_H AND HAVE_OPENSSL_ECDSA_H)
|
endif (HAVE_OPENSSL_EC_H AND HAVE_OPENSSL_ECDSA_H)
|
||||||
@@ -89,52 +140,79 @@ if (NOT WITH_GCRYPT)
|
|||||||
if (HAVE_OPENSSL_ECC)
|
if (HAVE_OPENSSL_ECC)
|
||||||
set(HAVE_ECC 1)
|
set(HAVE_ECC 1)
|
||||||
endif (HAVE_OPENSSL_ECC)
|
endif (HAVE_OPENSSL_ECC)
|
||||||
endif (NOT WITH_GCRYPT)
|
endif ()
|
||||||
|
|
||||||
|
if (NOT WITH_MBEDTLS)
|
||||||
|
set(HAVE_DSA 1)
|
||||||
|
endif (NOT WITH_MBEDTLS)
|
||||||
|
|
||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
|
|
||||||
|
check_function_exists(isblank HAVE_ISBLANK)
|
||||||
check_function_exists(strncpy HAVE_STRNCPY)
|
check_function_exists(strncpy HAVE_STRNCPY)
|
||||||
check_function_exists(vsnprintf HAVE_VSNPRINTF)
|
check_function_exists(strndup HAVE_STRNDUP)
|
||||||
check_function_exists(snprintf HAVE_SNPRINTF)
|
check_function_exists(strtoull HAVE_STRTOULL)
|
||||||
check_function_exists(poll HAVE_POLL)
|
check_function_exists(explicit_bzero HAVE_EXPLICIT_BZERO)
|
||||||
check_function_exists(select HAVE_SELECT)
|
check_function_exists(memset_s HAVE_MEMSET_S)
|
||||||
check_function_exists(getaddrinfo HAVE_GETADDRINFO)
|
|
||||||
check_function_exists(ntohll HAVE_NTOHLL)
|
if (HAVE_GLOB_H)
|
||||||
check_function_exists(htonll HAVE_HTONLL)
|
check_function_exists(glob HAVE_GLOB)
|
||||||
|
endif (HAVE_GLOB_H)
|
||||||
|
|
||||||
|
if (NOT WIN32)
|
||||||
|
check_function_exists(vsnprintf HAVE_VSNPRINTF)
|
||||||
|
check_function_exists(snprintf HAVE_SNPRINTF)
|
||||||
|
endif (NOT WIN32)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
check_function_exists(_strtoui64 HAVE__STRTOUI64)
|
check_symbol_exists(vsnprintf "stdio.h" HAVE_VSNPRINTF)
|
||||||
|
check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
|
||||||
|
|
||||||
check_function_exists(_vsnprintf_s HAVE__VSNPRINTF_S)
|
check_symbol_exists(_vsnprintf_s "stdio.h" HAVE__VSNPRINTF_S)
|
||||||
check_function_exists(_vsnprintf HAVE__VSNPRINTF)
|
check_symbol_exists(_vsnprintf "stdio.h" HAVE__VSNPRINTF)
|
||||||
check_function_exists(_snprintf HAVE__SNPRINTF)
|
check_symbol_exists(_snprintf "stdio.h" HAVE__SNPRINTF)
|
||||||
check_function_exists(_snprintf_s HAVE__SNPRINTF_S)
|
check_symbol_exists(_snprintf_s "stdio.h" HAVE__SNPRINTF_S)
|
||||||
|
|
||||||
if (HAVE_WSPIAPI_H OR HAVE_WS2TCPIP_H)
|
if (HAVE_WSPIAPI_H OR HAVE_WS2TCPIP_H)
|
||||||
set(HAVE_GETADDRINFO TRUE)
|
check_symbol_exists(ntohll winsock2.h HAVE_NTOHLL)
|
||||||
set(HAVE_GETHOSTBYNAME TRUE)
|
check_symbol_exists(htonll winsock2.h HAVE_HTONLL)
|
||||||
if (MSVC)
|
|
||||||
set(HAVE_NTOHLL TRUE)
|
set(CMAKE_REQUIRED_LIBRARIES ws2_32)
|
||||||
set(HAVE_HTONLL TRUE)
|
check_symbol_exists(select "winsock2.h;ws2tcpip.h" HAVE_SELECT)
|
||||||
endif (MSVC)
|
check_symbol_exists(poll "winsock2.h;ws2tcpip.h" HAVE_SELECT)
|
||||||
|
# The getaddrinfo function is defined to the WspiapiGetAddrInfo inline function
|
||||||
|
check_symbol_exists(getaddrinfo "winsock2.h;ws2tcpip.h" HAVE_GETADDRINFO)
|
||||||
|
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||||
endif (HAVE_WSPIAPI_H OR HAVE_WS2TCPIP_H)
|
endif (HAVE_WSPIAPI_H OR HAVE_WS2TCPIP_H)
|
||||||
|
|
||||||
|
check_function_exists(_strtoui64 HAVE__STRTOUI64)
|
||||||
|
|
||||||
set(HAVE_SELECT TRUE)
|
set(HAVE_SELECT TRUE)
|
||||||
|
|
||||||
|
check_symbol_exists(SecureZeroMemory "windows.h" HAVE_SECURE_ZERO_MEMORY)
|
||||||
|
else (WIN32)
|
||||||
|
check_function_exists(poll HAVE_POLL)
|
||||||
|
check_function_exists(select HAVE_SELECT)
|
||||||
|
check_function_exists(getaddrinfo HAVE_GETADDRINFO)
|
||||||
|
|
||||||
|
check_symbol_exists(ntohll arpa/inet.h HAVE_NTOHLL)
|
||||||
|
check_symbol_exists(htonll arpa/inet.h HAVE_HTONLL)
|
||||||
endif (WIN32)
|
endif (WIN32)
|
||||||
|
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
if (NOT LINUX)
|
if (NOT LINUX)
|
||||||
# libsocket (Solaris)
|
# libsocket (Solaris)
|
||||||
check_library_exists(socket getaddrinfo "" HAVE_LIBSOCKET)
|
check_library_exists(socket getaddrinfo "" HAVE_LIBSOCKET)
|
||||||
if (HAVE_LIBSOCKET)
|
if (HAVE_LIBSOCKET)
|
||||||
set(HAVE_GETADDRINFO TRUE)
|
set(HAVE_GETADDRINFO TRUE)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} socket)
|
set(_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} socket)
|
||||||
endif (HAVE_LIBSOCKET)
|
endif (HAVE_LIBSOCKET)
|
||||||
|
|
||||||
# libnsl/inet_pton (Solaris)
|
# libnsl/inet_pton (Solaris)
|
||||||
check_library_exists(nsl inet_pton "" HAVE_LIBNSL)
|
check_library_exists(nsl inet_pton "" HAVE_LIBNSL)
|
||||||
if (HAVE_LIBNSL)
|
if (HAVE_LIBNSL)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} nsl)
|
set(_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} nsl)
|
||||||
endif (HAVE_LIBNSL)
|
endif (HAVE_LIBNSL)
|
||||||
|
|
||||||
# librt
|
# librt
|
||||||
@@ -143,16 +221,15 @@ if (UNIX)
|
|||||||
|
|
||||||
check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
|
check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
|
||||||
if (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
|
if (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} rt)
|
set(_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} rt)
|
||||||
endif (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
|
endif (HAVE_LIBRT OR HAVE_CLOCK_GETTIME)
|
||||||
|
|
||||||
check_library_exists(util forkpty "" HAVE_LIBUTIL)
|
check_library_exists(util forkpty "" HAVE_LIBUTIL)
|
||||||
check_function_exists(cfmakeraw HAVE_CFMAKERAW)
|
check_function_exists(cfmakeraw HAVE_CFMAKERAW)
|
||||||
check_function_exists(strtoull HAVE_STRTOULL)
|
|
||||||
check_function_exists(__strtoull HAVE___STRTOULL)
|
check_function_exists(__strtoull HAVE___STRTOULL)
|
||||||
endif (UNIX)
|
endif (UNIX)
|
||||||
|
|
||||||
set(LIBSSH_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CACHE INTERNAL "libssh required system libraries")
|
set(LIBSSH_REQUIRED_LIBRARIES ${_REQUIRED_LIBRARIES} CACHE INTERNAL "libssh required system libraries")
|
||||||
|
|
||||||
# LIBRARIES
|
# LIBRARIES
|
||||||
if (OPENSSL_FOUND)
|
if (OPENSSL_FOUND)
|
||||||
@@ -162,16 +239,19 @@ endif (OPENSSL_FOUND)
|
|||||||
if (GCRYPT_FOUND)
|
if (GCRYPT_FOUND)
|
||||||
set(HAVE_LIBGCRYPT 1)
|
set(HAVE_LIBGCRYPT 1)
|
||||||
if (GCRYPT_VERSION VERSION_GREATER "1.4.6")
|
if (GCRYPT_VERSION VERSION_GREATER "1.4.6")
|
||||||
#set(HAVE_GCRYPT_ECC 1)
|
set(HAVE_GCRYPT_ECC 1)
|
||||||
#set(HAVE_ECC 1)
|
set(HAVE_ECC 1)
|
||||||
endif (GCRYPT_VERSION VERSION_GREATER "1.4.6")
|
endif (GCRYPT_VERSION VERSION_GREATER "1.4.6")
|
||||||
endif (GCRYPT_FOUND)
|
endif (GCRYPT_FOUND)
|
||||||
|
|
||||||
if (CMAKE_HAVE_THREADS_LIBRARY)
|
if (MBEDTLS_FOUND)
|
||||||
if (CMAKE_USE_PTHREADS_INIT)
|
set(HAVE_LIBMBEDCRYPTO 1)
|
||||||
set(HAVE_PTHREAD 1)
|
set(HAVE_ECC 1)
|
||||||
endif (CMAKE_USE_PTHREADS_INIT)
|
endif (MBEDTLS_FOUND)
|
||||||
endif (CMAKE_HAVE_THREADS_LIBRARY)
|
|
||||||
|
if (CMAKE_USE_PTHREADS_INIT)
|
||||||
|
set(HAVE_PTHREAD 1)
|
||||||
|
endif (CMAKE_USE_PTHREADS_INIT)
|
||||||
|
|
||||||
# OPTIONS
|
# OPTIONS
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
@@ -188,6 +268,58 @@ 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)
|
||||||
|
check_c_compiler_flag("-Werror" REQUIRED_FLAGS_WERROR)
|
||||||
|
if (REQUIRED_FLAGS_WERROR)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-Werror")
|
||||||
|
endif()
|
||||||
|
endif (UNIX)
|
||||||
|
|
||||||
|
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("
|
||||||
|
#define FALL_THROUGH __attribute__((fallthrough))
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
int i = 2;
|
||||||
|
|
||||||
|
switch (i) {
|
||||||
|
case 0:
|
||||||
|
FALL_THROUGH;
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}" HAVE_FALLTHROUGH_ATTRIBUTE)
|
||||||
|
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -195,15 +327,71 @@ int main(void)
|
|||||||
{
|
{
|
||||||
char buf[] = \"This is some content\";
|
char buf[] = \"This is some content\";
|
||||||
|
|
||||||
memset(buf, '\\\\0', sizeof(buf)); __asm__ volatile(\"\" : : \"r\"(&buf) : \"memory\");
|
memset(buf, '\\\\0', sizeof(buf)); __asm__ volatile(\"\" : : \"g\"(&buf) : \"memory\");
|
||||||
|
|
||||||
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("
|
||||||
|
#include <stdio.h>
|
||||||
|
int main(void) {
|
||||||
|
printf(\"%s\", __func__);
|
||||||
|
return 0;
|
||||||
|
}" HAVE_COMPILER__FUNC__)
|
||||||
|
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <stdio.h>
|
||||||
|
int main(void) {
|
||||||
|
printf(\"%s\", __FUNCTION__);
|
||||||
|
return 0;
|
||||||
|
}" HAVE_COMPILER__FUNCTION__)
|
||||||
|
|
||||||
|
check_c_source_compiles("
|
||||||
|
#define ARRAY_LEN 16
|
||||||
|
void test_attr(const unsigned char *k)
|
||||||
|
__attribute__((__bounded__(__minbytes__, 2, 16)));
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
return 0;
|
||||||
|
}" HAVE_GCC_BOUNDED_ATTRIBUTE)
|
||||||
|
|
||||||
|
# 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)
|
||||||
endif (WITH_DEBUG_CRYPTO)
|
endif (WITH_DEBUG_CRYPTO)
|
||||||
|
|
||||||
|
if (WITH_DEBUG_PACKET)
|
||||||
|
set(DEBUG_PACKET 1)
|
||||||
|
endif (WITH_DEBUG_PACKET)
|
||||||
|
|
||||||
if (WITH_DEBUG_CALLTRACE)
|
if (WITH_DEBUG_CALLTRACE)
|
||||||
set(DEBUG_CALLTRACE 1)
|
set(DEBUG_CALLTRACE 1)
|
||||||
endif (WITH_DEBUG_CALLTRACE)
|
endif (WITH_DEBUG_CALLTRACE)
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
option(WITH_GSSAPI "Build with GSSAPI support" ON)
|
option(WITH_GSSAPI "Build with GSSAPI support" ON)
|
||||||
option(WITH_ZLIB "Build with ZLIB support" ON)
|
option(WITH_ZLIB "Build with ZLIB support" ON)
|
||||||
option(WITH_SSH1 "Build with SSH1 support" OFF)
|
|
||||||
option(WITH_SFTP "Build with SFTP support" ON)
|
option(WITH_SFTP "Build with SFTP support" ON)
|
||||||
option(WITH_SERVER "Build with SSH server support" ON)
|
option(WITH_SERVER "Build with SSH server support" ON)
|
||||||
option(WITH_STATIC_LIB "Build with a static library" OFF)
|
option(WITH_STATIC_LIB "Build with a static library" OFF)
|
||||||
option(WITH_DEBUG_CRYPTO "Build with cryto debug output" OFF)
|
option(WITH_DEBUG_CRYPTO "Build with cryto debug output" OFF)
|
||||||
|
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_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(WITH_TESTING "Build with unit tests" OFF)
|
option(UNIT_TESTING "Build with unit tests" OFF)
|
||||||
option(WITH_CLIENT_TESTING "Build with client tests; requires a running sshd" OFF)
|
option(CLIENT_TESTING "Build with client tests; requires openssh" OFF)
|
||||||
|
option(SERVER_TESTING "Build with server tests; requires openssh and dropbear" OFF)
|
||||||
option(WITH_BENCHMARKS "Build benchmarks tools" OFF)
|
option(WITH_BENCHMARKS "Build benchmarks tools" OFF)
|
||||||
|
option(WITH_EXAMPLES "Build examples" ON)
|
||||||
|
option(WITH_NACL "Build with libnacl (curve25519)" ON)
|
||||||
|
option(WITH_SYMBOL_VERSIONING "Build with symbol versioning" ON)
|
||||||
|
option(WITH_ABI_BREAK "Allow ABI break" 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)
|
||||||
@@ -20,9 +28,21 @@ else (WITH_ZLIB)
|
|||||||
endif (WITH_ZLIB)
|
endif (WITH_ZLIB)
|
||||||
|
|
||||||
if(WITH_BENCHMARKS)
|
if(WITH_BENCHMARKS)
|
||||||
set(WITH_TESTING ON)
|
set(UNIT_TESTING ON)
|
||||||
endif(WITH_BENCHMARKS)
|
endif(WITH_BENCHMARKS)
|
||||||
|
|
||||||
if (WITH_TESTING)
|
if (WITH_STATIC_LIB)
|
||||||
set(WITH_STATIC_LIB ON)
|
set(BUILD_STATIC_LIB ON)
|
||||||
endif (WITH_TESTING)
|
endif (WITH_STATIC_LIB)
|
||||||
|
|
||||||
|
if (UNIT_TESTING)
|
||||||
|
set(BUILD_STATIC_LIB ON)
|
||||||
|
endif (UNIT_TESTING)
|
||||||
|
|
||||||
|
if (WITH_NACL)
|
||||||
|
set(WITH_NACL ON)
|
||||||
|
endif (WITH_NACL)
|
||||||
|
|
||||||
|
if (WITH_ABI_BREAK)
|
||||||
|
set(WITH_SYMBOL_VERSIONING ON)
|
||||||
|
endif (WITH_ABI_BREAK)
|
||||||
|
|||||||
20
INSTALL
@@ -14,6 +14,10 @@ or
|
|||||||
|
|
||||||
optional:
|
optional:
|
||||||
- [libz](http://www.zlib.net) >= 1.2
|
- [libz](http://www.zlib.net) >= 1.2
|
||||||
|
- [socket_wrapper](https://cwrap.org/) >= 1.1.5
|
||||||
|
- [nss_wrapper](https://cwrap.org/) >= 1.1.2
|
||||||
|
- [uid_wrapper](https://cwrap.org/) >= 1.2.0
|
||||||
|
- [pam_wrapper](https://cwrap.org/) >= 1.0.1
|
||||||
|
|
||||||
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.
|
||||||
@@ -31,13 +35,27 @@ First, you need to configure the compilation, using CMake. Go inside the
|
|||||||
|
|
||||||
GNU/Linux, MacOS X, MSYS/MinGW:
|
GNU/Linux, MacOS X, MSYS/MinGW:
|
||||||
|
|
||||||
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
|
cmake -DUNIT_TESTING=ON -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
make
|
make
|
||||||
|
|
||||||
On Windows you should choose a makefile gernerator with -G or use
|
On Windows you should choose a makefile gernerator with -G or use
|
||||||
|
|
||||||
cmake-gui.exe ..
|
cmake-gui.exe ..
|
||||||
|
|
||||||
|
To enable additional client tests against a local OpenSSH server, add the
|
||||||
|
compile option -DCLIENT_TESTING=ON. These tests require an OpenSSH
|
||||||
|
server package and some wrapper libraries (see optional requirements) to
|
||||||
|
be installed.
|
||||||
|
|
||||||
|
If you're interested in server testing, then a OpenSSH client should be
|
||||||
|
installed on the system and if possible also dropbear. Once that is done
|
||||||
|
enable server support with -DWITH_SERVER=ON and enable testing of it with
|
||||||
|
-DSERVER_TESTING=ON.
|
||||||
|
|
||||||
|
## Testing build
|
||||||
|
|
||||||
|
make test
|
||||||
|
|
||||||
### CMake standard options
|
### CMake standard options
|
||||||
Here is a list of the most interesting options provided out of the box by
|
Here is a list of the most interesting options provided out of the box by
|
||||||
CMake.
|
CMake.
|
||||||
|
|||||||
125
README
@@ -33,130 +33,11 @@ If you ask yourself how to compile libssh, please read INSTALL before anything.
|
|||||||
|
|
||||||
http://www.libssh.org
|
http://www.libssh.org
|
||||||
|
|
||||||
4* API Changes !
|
4* Contributing
|
||||||
-_-_-_-_-_-_-_-_-_
|
-_-_-_-_-_-_-_-_-_
|
||||||
|
|
||||||
Changes between 0.4 and 0.5
|
Please read the file 'SubmittingPatches' next to this README file. It explains
|
||||||
---------------------------
|
our copyright policy and how you should send patches for upstream inclusion.
|
||||||
|
|
||||||
We use the ssh_ prefix as namespace for every function now. There is a legacy.h
|
|
||||||
which could be used to get the old function names.
|
|
||||||
|
|
||||||
Changes between 0.3 and 0.4
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
We changed libssh to be typesafe now:
|
|
||||||
|
|
||||||
SSH_SESSION *session -> ssh_session session
|
|
||||||
SFTP_SESSION *sftp -> sftp_session sftp
|
|
||||||
CHANNEL *channel -> ssh_channel channel
|
|
||||||
STRING *string -> ssh_string string
|
|
||||||
...
|
|
||||||
|
|
||||||
The options structure has been removed and there is a new function. This
|
|
||||||
function can set all available options now. You can find the enum in the
|
|
||||||
header file and it is documented. Example:
|
|
||||||
|
|
||||||
ssh_options_set(session, SSH_OPTIONS_HOST, "localhost");
|
|
||||||
|
|
||||||
5* Copyright policy
|
|
||||||
-_-_-_-_-_-_-_-_-_-_
|
|
||||||
|
|
||||||
libssh is a project with distributed copyright ownership, which means we prefer
|
|
||||||
the copyright on parts of libssh to be held by individuals rather than
|
|
||||||
corporations if possible. There are historical legal reasons for this, but one
|
|
||||||
of the best ways to explain it is that it’s much easier to work with
|
|
||||||
individuals who have ownership than corporate legal departments if we ever need
|
|
||||||
to make reasonable compromises with people using and working with libssh.
|
|
||||||
|
|
||||||
We track the ownership of every part of libssh via git, our source code control
|
|
||||||
system, so we know the provenance of every piece of code that is committed to
|
|
||||||
libssh.
|
|
||||||
|
|
||||||
So if possible, if you’re doing libssh changes on behalf of a company who
|
|
||||||
normally owns all the work you do please get them to assign personal copyright
|
|
||||||
ownership of your changes to you as an individual, that makes things very easy
|
|
||||||
for us to work with and avoids bringing corporate legal departments into the
|
|
||||||
picture.
|
|
||||||
|
|
||||||
If you can’t do this we can still accept patches from you owned by your
|
|
||||||
employer under a standard employment contract with corporate copyright
|
|
||||||
ownership. It just requires a simple set-up process first.
|
|
||||||
|
|
||||||
We use a process very similar to the way things are done in the Linux Kernel
|
|
||||||
community, so it should be very easy to get a sign off from your corporate
|
|
||||||
legal department. The only changes we’ve made are to accommodate the license we
|
|
||||||
use, which is LGPLv2 (or later) whereas the Linux kernel uses GPLv2.
|
|
||||||
|
|
||||||
The process is called signing.
|
|
||||||
|
|
||||||
How to sign your work
|
|
||||||
----------------------
|
|
||||||
|
|
||||||
Once you have permission to contribute to libssh from your employer, simply
|
|
||||||
email a copy of the following text from your corporate email address to:
|
|
||||||
|
|
||||||
contributing@libssh.org
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------
|
|
||||||
libssh Developer's Certificate of Origin. Version 1.0
|
|
||||||
|
|
||||||
By making a contribution to this project, I certify that:
|
|
||||||
|
|
||||||
(a) The contribution was created in whole or in part by me and I
|
|
||||||
have the right to submit it under the appropriate
|
|
||||||
version of the GNU General Public License; or
|
|
||||||
|
|
||||||
(b) The contribution is based upon previous work that, to the best of
|
|
||||||
my knowledge, is covered under an appropriate open source license
|
|
||||||
and I have the right under that license to submit that work with
|
|
||||||
modifications, whether created in whole or in part by me, under
|
|
||||||
the GNU General Public License, in the appropriate version; or
|
|
||||||
|
|
||||||
(c) The contribution was provided directly to me by some other
|
|
||||||
person who certified (a) or (b) and I have not modified it.
|
|
||||||
|
|
||||||
(d) I understand and agree that this project and the contribution are
|
|
||||||
public and that a record of the contribution (including all
|
|
||||||
metadata and personal information I submit with it, including my
|
|
||||||
sign-off) is maintained indefinitely and may be redistributed
|
|
||||||
consistent with the libssh Team's policies and the requirements of
|
|
||||||
the GNU GPL where they are relevant.
|
|
||||||
|
|
||||||
(e) I am granting this work to this project 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 the option of the project) any later version.
|
|
||||||
|
|
||||||
http://www.gnu.org/licenses/lgpl-2.1.html
|
|
||||||
--------------------------------------------------------------------------
|
|
||||||
|
|
||||||
We will maintain a copy of that email as a record that you have the rights to
|
|
||||||
contribute code to libssh under the required licenses whilst working for the
|
|
||||||
company where the email came from.
|
|
||||||
|
|
||||||
Then when sending in a patch via the normal mechanisms described above, add a
|
|
||||||
line that states:
|
|
||||||
|
|
||||||
|
|
||||||
Signed-off-by: Random J Developer <random@developer.example.org>
|
|
||||||
|
|
||||||
|
|
||||||
using your real name and the email address you sent the original email you used
|
|
||||||
to send the libssh Developer’s Certificate of Origin to us (sorry, no
|
|
||||||
pseudonyms or anonymous contributions.)
|
|
||||||
|
|
||||||
That’s it! Such code can then quite happily contain changes that have copyright
|
|
||||||
messages such as:
|
|
||||||
|
|
||||||
|
|
||||||
(c) Example Corporation.
|
|
||||||
|
|
||||||
|
|
||||||
and can be merged into the libssh codebase in the same way as patches from any
|
|
||||||
other individual. You don’t need to send in a copy of the libssh Developer’s
|
|
||||||
Certificate of Origin for each patch, or inside each patch. Just the sign-off
|
|
||||||
message is all that is required once we’ve received the initial email.
|
|
||||||
|
|
||||||
Have fun and happy libssh hacking!
|
Have fun and happy libssh hacking!
|
||||||
|
|
||||||
|
|||||||
375
README.CodingStyle
Normal file
@@ -0,0 +1,375 @@
|
|||||||
|
Coding conventions in the libssh tree
|
||||||
|
======================================
|
||||||
|
|
||||||
|
===========
|
||||||
|
Quick Start
|
||||||
|
===========
|
||||||
|
|
||||||
|
Coding style guidelines are about reducing the number of unnecessary
|
||||||
|
reformatting patches and making things easier for developers to work together.
|
||||||
|
|
||||||
|
You don't have to like them or even agree with them, but once put in place we
|
||||||
|
all have to abide by them (or vote to change them). However, coding style
|
||||||
|
should never outweigh coding itself and so the guidelines described here are
|
||||||
|
hopefully easy enough to follow as they are very common and supported by tools
|
||||||
|
and editors.
|
||||||
|
|
||||||
|
The basic style for C code, is the Linux kernel coding style (See
|
||||||
|
Documentation/CodingStyle in the kernel source tree). This closely matches what
|
||||||
|
libssh developers use already anyways, with a few exceptions as mentioned
|
||||||
|
below.
|
||||||
|
|
||||||
|
But to save you the trouble of reading the Linux kernel style guide, here
|
||||||
|
are the highlights.
|
||||||
|
|
||||||
|
* Maximum Line Width is 80 Characters
|
||||||
|
The reason is not about people with low-res screens but rather sticking
|
||||||
|
to 80 columns prevents you from easily nesting more than one level of
|
||||||
|
if statements or other code blocks.
|
||||||
|
|
||||||
|
* Use 4 Spaces to Indent
|
||||||
|
|
||||||
|
* No Trailing Whitespace
|
||||||
|
Clean up your files before committing.
|
||||||
|
|
||||||
|
* Follow the K&R guidelines. We won't go through all of them here. Do you
|
||||||
|
have a copy of "The C Programming Language" anyways right?
|
||||||
|
|
||||||
|
|
||||||
|
=============
|
||||||
|
Editor Hints
|
||||||
|
=============
|
||||||
|
|
||||||
|
Emacs
|
||||||
|
------
|
||||||
|
Add the follow to your $HOME/.emacs file:
|
||||||
|
|
||||||
|
(add-hook 'c-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(c-set-style "linux")
|
||||||
|
(c-toggle-auto-state)))
|
||||||
|
|
||||||
|
|
||||||
|
Vim
|
||||||
|
----
|
||||||
|
|
||||||
|
For the basic vi editor included with all variants of \*nix, add the
|
||||||
|
following to $HOME/.vimrc:
|
||||||
|
|
||||||
|
set ts=4 sw=4 et cindent
|
||||||
|
|
||||||
|
You can use the Vim gitmodline plugin to store this in the git config:
|
||||||
|
|
||||||
|
http://git.cryptomilk.org/projects/vim-gitmodeline.git/
|
||||||
|
|
||||||
|
For Vim, the following settings in $HOME/.vimrc will also deal with
|
||||||
|
displaying trailing whitespace:
|
||||||
|
|
||||||
|
if has("syntax") && (&t_Co > 2 || has("gui_running"))
|
||||||
|
syntax on
|
||||||
|
function! ActivateInvisibleCharIndicator()
|
||||||
|
syntax match TrailingSpace "[ \t]\+$" display containedin=ALL
|
||||||
|
highlight TrailingSpace ctermbg=Red
|
||||||
|
endf
|
||||||
|
autocmd BufNewFile,BufRead * call ActivateInvisibleCharIndicator()
|
||||||
|
endif
|
||||||
|
" Show tabs, trailing whitespace, and continued lines visually
|
||||||
|
set list listchars=tab:»·,trail:·,extends:…
|
||||||
|
|
||||||
|
" highlight overly long lines same as TODOs.
|
||||||
|
set textwidth=80
|
||||||
|
autocmd BufNewFile,BufRead *.c,*.h exec 'match Todo /\%>' . &textwidth . 'v.\+/'
|
||||||
|
|
||||||
|
|
||||||
|
==========================
|
||||||
|
FAQ & Statement Reference
|
||||||
|
==========================
|
||||||
|
|
||||||
|
Comments
|
||||||
|
---------
|
||||||
|
|
||||||
|
Comments should always use the standard C syntax. C++ style comments are not
|
||||||
|
currently allowed.
|
||||||
|
|
||||||
|
The lines before a comment should be empty. If the comment directly belongs to
|
||||||
|
the following code, there should be no empty line after the comment, except if
|
||||||
|
the comment contains a summary of multiple following code blocks.
|
||||||
|
|
||||||
|
This is good:
|
||||||
|
|
||||||
|
...
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a multi line comment,
|
||||||
|
* which explains the logical steps we have to do:
|
||||||
|
*
|
||||||
|
* 1. We need to set i=5, because...
|
||||||
|
* 2. We need to call complex_fn1
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* This is a one line comment about i = 5. */
|
||||||
|
i = 5;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a multi line comment,
|
||||||
|
* explaining the call to complex_fn1()
|
||||||
|
*/
|
||||||
|
ret = complex_fn1();
|
||||||
|
if (ret != 0) {
|
||||||
|
...
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This is a doxygen comment.
|
||||||
|
*
|
||||||
|
* This is a more detailed explanation of
|
||||||
|
* this simple function.
|
||||||
|
*
|
||||||
|
* @param[in] param1 The parameter value of the function.
|
||||||
|
*
|
||||||
|
* @param[out] result1 The result value of the function.
|
||||||
|
*
|
||||||
|
* @return 0 on success and -1 on error.
|
||||||
|
*/
|
||||||
|
int example(int param1, int *result1);
|
||||||
|
|
||||||
|
This is bad:
|
||||||
|
|
||||||
|
...
|
||||||
|
int i;
|
||||||
|
/*
|
||||||
|
* This is a multi line comment,
|
||||||
|
* which explains the logical steps we have to do:
|
||||||
|
*
|
||||||
|
* 1. We need to set i=5, because...
|
||||||
|
* 2. We need to call complex_fn1
|
||||||
|
*/
|
||||||
|
/* This is a one line comment about i = 5. */
|
||||||
|
i = 5;
|
||||||
|
/*
|
||||||
|
* This is a multi line comment,
|
||||||
|
* explaining the call to complex_fn1()
|
||||||
|
*/
|
||||||
|
ret = complex_fn1();
|
||||||
|
if (ret != 0) {
|
||||||
|
...
|
||||||
|
|
||||||
|
/*This is a one line comment.*/
|
||||||
|
|
||||||
|
/* This is a multi line comment,
|
||||||
|
with some more words...*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a multi line comment,
|
||||||
|
* with some more words...*/
|
||||||
|
|
||||||
|
Indention & Whitespace & 80 columns
|
||||||
|
------------------------------------
|
||||||
|
|
||||||
|
To avoid confusion, indentations have to be 4 spaces. Do not use tabs!. When
|
||||||
|
wrapping parameters for function calls, align the parameter list with the first
|
||||||
|
parameter on the previous line. For example,
|
||||||
|
|
||||||
|
var1 = foo(arg1,
|
||||||
|
arg2,
|
||||||
|
arg3);
|
||||||
|
|
||||||
|
The previous example is intended to illustrate alignment of function
|
||||||
|
parameters across lines and not as encourage for gratuitous line
|
||||||
|
splitting. Never split a line before columns 70 - 79 unless you
|
||||||
|
have a really good reason. Be smart about formatting.
|
||||||
|
|
||||||
|
|
||||||
|
If, switch, & Code blocks
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
Always follow an 'if' keyword with a space but don't include additional
|
||||||
|
spaces following or preceding the parentheses in the conditional.
|
||||||
|
This is good:
|
||||||
|
|
||||||
|
if (x == 1)
|
||||||
|
|
||||||
|
This is bad:
|
||||||
|
|
||||||
|
if ( x == 1 )
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
if (x==1)
|
||||||
|
|
||||||
|
Yes we have a lot of code that uses the second and third form and we are trying
|
||||||
|
to clean it up without being overly intrusive.
|
||||||
|
|
||||||
|
Note that this is a rule about parentheses following keywords and not
|
||||||
|
functions. Don't insert a space between the name and left parentheses when
|
||||||
|
invoking functions.
|
||||||
|
|
||||||
|
Braces for code blocks used by for, if, switch, while, do..while, etc. should
|
||||||
|
begin on the same line as the statement keyword and end on a line of their own.
|
||||||
|
You should always include braces, even if the block only contains one
|
||||||
|
statement. NOTE: Functions are different and the beginning left brace should
|
||||||
|
be located in the first column on the next line.
|
||||||
|
|
||||||
|
If the beginning statement has to be broken across lines due to length, the
|
||||||
|
beginning brace should be on a line of its own.
|
||||||
|
|
||||||
|
The exception to the ending rule is when the closing brace is followed by
|
||||||
|
another language keyword such as else or the closing while in a do..while loop.
|
||||||
|
|
||||||
|
Good examples:
|
||||||
|
|
||||||
|
if (x == 1) {
|
||||||
|
printf("good\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (x = 1; x < 10; x++) {
|
||||||
|
print("%d\n", x);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (really_really_really_really_long_var_name = 0;
|
||||||
|
really_really_really_really_long_var_name < 10;
|
||||||
|
really_really_really_really_long_var_name++)
|
||||||
|
{
|
||||||
|
print("%d\n", really_really_really_really_long_var_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
printf("also good\n");
|
||||||
|
} while (1);
|
||||||
|
|
||||||
|
Bad examples:
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
print("I'm in a loop!\n"); }
|
||||||
|
|
||||||
|
for (x=1;
|
||||||
|
x<10;
|
||||||
|
x++)
|
||||||
|
{
|
||||||
|
print("no good\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i < 10)
|
||||||
|
print("I should be in braces.\n");
|
||||||
|
|
||||||
|
|
||||||
|
Goto
|
||||||
|
-----
|
||||||
|
|
||||||
|
While many people have been academically taught that "goto"s are fundamentally
|
||||||
|
evil, they can greatly enhance readability and reduce memory leaks when used as
|
||||||
|
the single exit point from a function. But in no libssh world what so ever is a
|
||||||
|
goto outside of a function or block of code a good idea.
|
||||||
|
|
||||||
|
Good Examples:
|
||||||
|
|
||||||
|
int function foo(int y)
|
||||||
|
{
|
||||||
|
int *z = NULL;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
if (y < 10) {
|
||||||
|
z = malloc(sizeof(int)*y);
|
||||||
|
if (z == NULL) {
|
||||||
|
rc = 1;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print("Allocated %d elements.\n", y);
|
||||||
|
|
||||||
|
done:
|
||||||
|
if (z != NULL) {
|
||||||
|
free(z);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
Initialize pointers
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
All pointer variables MUST be initialized to NULL. History has
|
||||||
|
demonstrated that uninitialized pointer variables have lead to various
|
||||||
|
bugs and security issues.
|
||||||
|
|
||||||
|
Pointers MUST be initialized even if the assignment directly follows
|
||||||
|
the declaration, like pointer2 in the example below, because the
|
||||||
|
instructions sequence may change over time.
|
||||||
|
|
||||||
|
Good Example:
|
||||||
|
|
||||||
|
char *pointer1 = NULL;
|
||||||
|
char *pointer2 = NULL;
|
||||||
|
|
||||||
|
pointer2 = some_func2();
|
||||||
|
|
||||||
|
...
|
||||||
|
|
||||||
|
pointer1 = some_func1();
|
||||||
|
|
||||||
|
Typedefs
|
||||||
|
---------
|
||||||
|
|
||||||
|
libssh tries to avoid "typedef struct { .. } x_t;" so we do always try to use
|
||||||
|
"struct x { .. };". We know there are still such typedefs in the code, but for
|
||||||
|
new code, please don't do that anymore.
|
||||||
|
|
||||||
|
Make use of helper variables
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Please try to avoid passing function calls as function parameters in new code.
|
||||||
|
This makes the code much easier to read and it's also easier to use the "step"
|
||||||
|
command within gdb.
|
||||||
|
|
||||||
|
Good Example:
|
||||||
|
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
name = get_some_name();
|
||||||
|
if (name == NULL) {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = some_function_my_name(name);
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
Bad Example:
|
||||||
|
|
||||||
|
rc = some_function_my_name(get_some_name());
|
||||||
|
...
|
||||||
|
|
||||||
|
Please try to avoid passing function return values to if- or while-conditions.
|
||||||
|
The reason for this is better handling of code under a debugger.
|
||||||
|
|
||||||
|
Good example:
|
||||||
|
|
||||||
|
x = malloc(sizeof(short) * 10);
|
||||||
|
if (x == NULL) {
|
||||||
|
fprintf(stderr, "Unable to alloc memory!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
Bad example:
|
||||||
|
|
||||||
|
if ((x = malloc(sizeof(short)*10)) == NULL ) {
|
||||||
|
fprintf(stderr, "Unable to alloc memory!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
There are exceptions to this rule. One example is walking a data structure in
|
||||||
|
an iterator style:
|
||||||
|
|
||||||
|
while ((opt = poptGetNextOpt(pc)) != -1) {
|
||||||
|
... do something with opt ...
|
||||||
|
}
|
||||||
|
|
||||||
|
But in general, please try to avoid this pattern.
|
||||||
|
|
||||||
|
|
||||||
|
Control-Flow changing macros
|
||||||
|
-----------------------------
|
||||||
|
|
||||||
|
Macros like STATUS_NOT_OK_RETURN that change control flow (return/goto/etc)
|
||||||
|
from within the macro are considered bad, because they look like function calls
|
||||||
|
that never change control flow. Please do not introduce them.
|
||||||
11
README.mbedtls
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
mbedTLS and libssh in multithreaded applications
|
||||||
|
==================================================
|
||||||
|
|
||||||
|
To use libssh with mbedTLS in a multithreaded application, mbedTLS has to be
|
||||||
|
built with threading support enabled.
|
||||||
|
|
||||||
|
If threading support is not available and multi threading is used, ssh_init
|
||||||
|
will fail.
|
||||||
|
|
||||||
|
More information about building mbedTLS with threading support can be found
|
||||||
|
in the mbedTLS documentation.
|
||||||
44
README.md
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
[](https://gitlab.com/libssh/libssh-mirror/commits/master)
|
||||||
|
|
||||||
|
```
|
||||||
|
_ _ _ _
|
||||||
|
(_) (_) (_) (_)
|
||||||
|
(_) _ (_) _ _ _ _ _ (_) _
|
||||||
|
(_) (_) (_)(_) _ (_)(_) (_)(_) (_)(_) _
|
||||||
|
(_) (_) (_) (_) _ (_) _ (_) (_) (_)
|
||||||
|
(_) (_) (_)(_)(_) (_)(_) (_)(_) (_) (_).org
|
||||||
|
|
||||||
|
The SSH library
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
# Why?
|
||||||
|
|
||||||
|
Why not ? :) I've began to work on my own implementation of the ssh protocol
|
||||||
|
because i didn't like the currently public ones.
|
||||||
|
Not any allowed you to import and use the functions as a powerful library,
|
||||||
|
and so i worked on a library-based SSH implementation which was non-existing
|
||||||
|
in the free and open source software world.
|
||||||
|
|
||||||
|
|
||||||
|
# How/Who?
|
||||||
|
|
||||||
|
If you downloaded this file, you must know what it is : a library for
|
||||||
|
accessing ssh client services through C libraries calls in a simple manner.
|
||||||
|
Everybody can use this software under the terms of the LGPL - see the COPYING
|
||||||
|
file
|
||||||
|
|
||||||
|
If you ask yourself how to compile libssh, please read INSTALL before anything.
|
||||||
|
|
||||||
|
# Where ?
|
||||||
|
|
||||||
|
https://www.libssh.org
|
||||||
|
|
||||||
|
# Contributing
|
||||||
|
|
||||||
|
Please read the file 'SubmittingPatches' next to this README file. It explains
|
||||||
|
our copyright policy and how you should send patches for upstream inclusion.
|
||||||
|
|
||||||
|
Have fun and happy libssh hacking!
|
||||||
|
|
||||||
|
The libssh Team
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
How to contribute a patch to libssh
|
How to contribute a patch to libssh
|
||||||
====================================
|
====================================
|
||||||
|
|
||||||
Simple, just make the code change, and email it as either a "diff -u"
|
Please checkout the libssh source code using git. Change the code and then
|
||||||
change, or as a "git format-patch" change against the original source
|
use "git format-patch" to create a patch. The patch should be signed (see
|
||||||
code to libssh@libssh.org, or attach it to a bug report at
|
below) and send it to libssh@libssh.org, or attach it to a bug report at
|
||||||
https://red.libssh.org/
|
https://red.libssh.org/
|
||||||
|
|
||||||
For larger code changes, breaking the changes up into a set of simple
|
For larger code changes, breaking the changes up into a set of simple
|
||||||
|
|||||||
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,7 +1,7 @@
|
|||||||
# - ADD_CHECK_TEST(test_name test_source linklib1 ... linklibN)
|
# - 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@cynapses.org>
|
# Copyright (c) 2007-2010 Andreas Schneider <asn@cryptomilk.org>
|
||||||
#
|
#
|
||||||
# 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.
|
||||||
@@ -10,14 +10,29 @@ enable_testing()
|
|||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
|
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_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_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_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")
|
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)
|
endif(CMAKE_COMPILER_IS_GNUCC AND NOT MINGW)
|
||||||
|
|
||||||
|
if (CMAKE_CROSSCOMPILING)
|
||||||
|
if (WIN32)
|
||||||
|
find_program(WINE_EXECUTABLE
|
||||||
|
NAMES wine)
|
||||||
|
set(TARGET_SYSTEM_EMULATOR ${WINE_EXECUTABLE})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
function (ADD_CMOCKA_TEST _testName _testSource)
|
function (ADD_CMOCKA_TEST _testName _testSource)
|
||||||
add_executable(${_testName} ${_testSource})
|
add_executable(${_testName} ${_testSource})
|
||||||
target_link_libraries(${_testName} ${ARGN})
|
target_link_libraries(${_testName} ${ARGN})
|
||||||
add_test(${_testName} ${CMAKE_CURRENT_BINARY_DIR}/${_testName})
|
add_test(${_testName} ${TARGET_SYSTEM_EMULATOR} ${CMAKE_CURRENT_BINARY_DIR}/${_testName}${CMAKE_EXECUTABLE_SUFFIX})
|
||||||
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)
|
||||||
|
|||||||
@@ -25,3 +25,6 @@ if (NOT CMAKE_BUILD_TYPE)
|
|||||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||||
)
|
)
|
||||||
endif (NOT CMAKE_BUILD_TYPE)
|
endif (NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
||||||
|
# Create the compile command database for clang by default
|
||||||
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||||
|
|||||||
@@ -1,77 +0,0 @@
|
|||||||
# define system dependent compiler flags
|
|
||||||
|
|
||||||
include(CheckCCompilerFlag)
|
|
||||||
include(CheckCCompilerFlagSSP)
|
|
||||||
|
|
||||||
if (UNIX AND NOT WIN32)
|
|
||||||
#
|
|
||||||
# Define GNUCC compiler flags
|
|
||||||
#
|
|
||||||
if (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
|
|
||||||
|
|
||||||
# add -Wconversion ?
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -pedantic-errors")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wshadow -Wmissing-prototypes -Wdeclaration-after-statement")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wfloat-equal -Wpointer-arith -Wwrite-strings -Wformat-security")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-format-attribute")
|
|
||||||
|
|
||||||
# with -fPIC
|
|
||||||
check_c_compiler_flag("-fPIC" WITH_FPIC)
|
|
||||||
if (WITH_FPIC)
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
|
||||||
endif (WITH_FPIC)
|
|
||||||
|
|
||||||
check_c_compiler_flag_ssp("-fstack-protector" WITH_STACK_PROTECTOR)
|
|
||||||
if (WITH_STACK_PROTECTOR)
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
|
|
||||||
endif (WITH_STACK_PROTECTOR)
|
|
||||||
|
|
||||||
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)
|
|
||||||
@@ -26,3 +26,7 @@ endif (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
|
|||||||
if (CMAKE_SYSTEM_NAME MATCHES "OS2")
|
if (CMAKE_SYSTEM_NAME MATCHES "OS2")
|
||||||
set(OS2 TRUE)
|
set(OS2 TRUE)
|
||||||
endif (CMAKE_SYSTEM_NAME MATCHES "OS2")
|
endif (CMAKE_SYSTEM_NAME MATCHES "OS2")
|
||||||
|
|
||||||
|
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
set (OSX TRUE)
|
||||||
|
endif (CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
|
|||||||
92
cmake/Modules/ExtractSymbols.cmake
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2018 Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
#.rst:
|
||||||
|
# ExtractSymbols
|
||||||
|
# --------------
|
||||||
|
#
|
||||||
|
# This is a helper script for FindABImap.cmake.
|
||||||
|
#
|
||||||
|
# Extract symbols from header files and output a list to a file.
|
||||||
|
# This script is run in build time to extract symbols from the provided header
|
||||||
|
# files. This way, symbols added or removed can be checked and used to update
|
||||||
|
# the symbol version script.
|
||||||
|
#
|
||||||
|
# All symbols followed by the character ``'('`` are extracted. If a
|
||||||
|
# ``FILTER_PATTERN`` is provided, only the lines containing the given string are
|
||||||
|
# considered.
|
||||||
|
#
|
||||||
|
# Expected defined variables
|
||||||
|
# --------------------------
|
||||||
|
#
|
||||||
|
# ``HEADERS_LIST_FILE``:
|
||||||
|
# Required, expects a file containing the list of header files to be parsed.
|
||||||
|
#
|
||||||
|
# ``OUTPUT_PATH``:
|
||||||
|
# Required, expects the output file path.
|
||||||
|
#
|
||||||
|
# Optionally defined variables
|
||||||
|
# ----------------------------
|
||||||
|
#
|
||||||
|
# ``FILTER_PATTERN``:
|
||||||
|
# Expects a string. Only lines containing the given string will be considered
|
||||||
|
# when extracting symbols.
|
||||||
|
#
|
||||||
|
|
||||||
|
if (NOT DEFINED OUTPUT_PATH)
|
||||||
|
message(SEND_ERROR "OUTPUT_PATH not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED HEADERS_LIST_FILE)
|
||||||
|
message(SEND_ERROR "HEADERS not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
file(READ ${HEADERS_LIST_FILE} HEADERS_LIST)
|
||||||
|
|
||||||
|
set(symbols)
|
||||||
|
foreach(header ${HEADERS_LIST})
|
||||||
|
|
||||||
|
# Filter only lines containing the FILTER_PATTERN
|
||||||
|
file(STRINGS ${header} contain_filter
|
||||||
|
REGEX "^.*${FILTER_PATTERN}.*[(]"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Remove function-like macros
|
||||||
|
foreach(line ${contain_filter})
|
||||||
|
if (NOT ${line} MATCHES ".*#[ ]*define")
|
||||||
|
list(APPEND not_macro ${line})
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(functions)
|
||||||
|
|
||||||
|
# Get only the function names followed by '('
|
||||||
|
foreach(line ${not_macro})
|
||||||
|
string(REGEX MATCHALL "[a-zA-Z0-9_]+[ ]*[(]" func ${line})
|
||||||
|
list(APPEND functions ${func})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
set(extracted_symbols)
|
||||||
|
|
||||||
|
# Remove '('
|
||||||
|
foreach(line ${functions})
|
||||||
|
string(REGEX REPLACE "[(]" "" symbol ${line})
|
||||||
|
string(STRIP "${symbol}" symbol)
|
||||||
|
list(APPEND extracted_symbols ${symbol})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
list(APPEND symbols ${extracted_symbols})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
list(REMOVE_DUPLICATES symbols)
|
||||||
|
|
||||||
|
list(SORT symbols)
|
||||||
|
|
||||||
|
string(REPLACE ";" "\n" symbols_list "${symbols}")
|
||||||
|
|
||||||
|
file(WRITE ${OUTPUT_PATH} "${symbols_list}")
|
||||||
486
cmake/Modules/FindABIMap.cmake
Normal file
@@ -0,0 +1,486 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2018 Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
#.rst:
|
||||||
|
# FindABIMap
|
||||||
|
# ----------
|
||||||
|
#
|
||||||
|
# This file provides functions to generate the symbol version script. It uses
|
||||||
|
# the ``abimap`` tool to generate and update the linker script file. It can be
|
||||||
|
# installed by calling::
|
||||||
|
#
|
||||||
|
# $ pip install abimap
|
||||||
|
#
|
||||||
|
# The ``function generate_map_file`` generates a symbol version script
|
||||||
|
# containing the provided symbols. It defines a custom command which sets
|
||||||
|
# ``target_name`` as its ``OUTPUT``.
|
||||||
|
#
|
||||||
|
# The experimental function ``extract_symbols()`` is provided as a simple
|
||||||
|
# parser to extract the symbols from C header files. It simply extracts symbols
|
||||||
|
# followed by an opening '``(``'. It is recommended to use a filter pattern to
|
||||||
|
# select the lines to be considered. It defines a custom command which sets
|
||||||
|
# ``target_name`` as its output.
|
||||||
|
#
|
||||||
|
# The helper function ``get_files_list()`` is provided to find files given a
|
||||||
|
# name pattern. It defines a custom command which sets ``target_name`` as its
|
||||||
|
# output.
|
||||||
|
#
|
||||||
|
# Functions provided
|
||||||
|
# ------------------
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# generate_map_file(target_name
|
||||||
|
# RELEASE_NAME_VERSION release_name
|
||||||
|
# SYMBOLS symbols_target
|
||||||
|
# [CURRENT_MAP cur_map]
|
||||||
|
# [FINAL]
|
||||||
|
# [BREAK_ABI]
|
||||||
|
# [COPY_TO output]
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# ``target_name``:
|
||||||
|
# Required, expects the name of the file to receive the generated symbol
|
||||||
|
# version script. It should be added as a dependency for the library. Use the
|
||||||
|
# linker option ``--version-script filename`` to add the version information
|
||||||
|
# to the symbols when building the library.
|
||||||
|
#
|
||||||
|
# ``RELEASE_NAME_VERSION``:
|
||||||
|
# Required, expects a string containing the name and version information to be
|
||||||
|
# added to the symbols in the format ``lib_name_1_2_3``.
|
||||||
|
#
|
||||||
|
# ``SYMBOLS``:
|
||||||
|
# Required, expects a target with the property ``LIST_FILE`` containing a path
|
||||||
|
# to a file containing the list of symbols to be added to the symbol version
|
||||||
|
# script.
|
||||||
|
#
|
||||||
|
# ``CURRENT_MAP``:
|
||||||
|
# Optional. If given, the new set of symbols will be checked against the
|
||||||
|
# ones contained in the ``cur_map`` file and updated properly. If an
|
||||||
|
# incompatible change is detected and ``BREAK_ABI`` is not defined, the build
|
||||||
|
# will fail.
|
||||||
|
#
|
||||||
|
# ``FINAL``:
|
||||||
|
# Optional. If given, will provide the ``--final`` option to ``abimap`` tool,
|
||||||
|
# which will mark the modified release in the symbol version script with a
|
||||||
|
# special comment, preventing later changes. This option should be set when
|
||||||
|
# creating a library release and the resulting map file should be stored with
|
||||||
|
# the source code.
|
||||||
|
#
|
||||||
|
# ``BREAK_ABI``:
|
||||||
|
# Optional. If provided, will use ``abimap`` ``--allow-abi-break`` option, which
|
||||||
|
# accepts incompatible changes to the set of symbols. This is necessary if any
|
||||||
|
# previously existing symbol were removed.
|
||||||
|
#
|
||||||
|
# ``COPY_TO``:
|
||||||
|
# Optional, expects a string containing the path to where the generated
|
||||||
|
# map file will be copied.
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
#
|
||||||
|
# .. code-block:: cmake
|
||||||
|
#
|
||||||
|
# find_package(ABIMap)
|
||||||
|
# generate_map_file("lib.map"
|
||||||
|
# RELEASE_NAME_VERSION "lib_1_0_0"
|
||||||
|
# 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
|
||||||
|
# ``${CMAKE_CURRENT_BINARY_DIR}/lib.map`` containing the provided symbols.
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# get_files_list(target_name
|
||||||
|
# DIRECTORIES dir1 [dir2 ...]
|
||||||
|
# FILES_PATTERNS exp1 [exp2 ...]
|
||||||
|
# [COPY_TO output]
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# ``target_name``:
|
||||||
|
# Required, expects the name of the target to be created. A file named as
|
||||||
|
# ``${target_name}.list`` will be created in
|
||||||
|
# ``${CMAKE_CURRENT_BINARY_DIR}`` to receive the list of files found.
|
||||||
|
#
|
||||||
|
# ``DIRECTORIES``:
|
||||||
|
# Required, expects a list of directories paths. Only absolute paths are
|
||||||
|
# supported.
|
||||||
|
#
|
||||||
|
# ``FILES_PATTERN``:
|
||||||
|
# Required, expects a list of matching expressions to find the files to be
|
||||||
|
# considered in the directories.
|
||||||
|
#
|
||||||
|
# ``COPY_TO``:
|
||||||
|
# Optional, expects a string containing the path to where the file containing
|
||||||
|
# the list of files will be copied.
|
||||||
|
#
|
||||||
|
# This command searches the directories provided in ``DIRECTORIES`` for files
|
||||||
|
# matching any of the patterns provided in ``FILES_PATTERNS``. The obtained list
|
||||||
|
# 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:
|
||||||
|
#
|
||||||
|
# .. code-block:: cmake
|
||||||
|
#
|
||||||
|
# find_package(ABIMap)
|
||||||
|
# get_files_list(target
|
||||||
|
# DIRECTORIES "/include/mylib"
|
||||||
|
# FILES_PATTERNS "*.h"
|
||||||
|
# COPY_TO "my_list.txt"
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# Consider that ``/include/mylib`` contains 3 files, ``h1.h``, ``h2.h``, and
|
||||||
|
# ``h3.hpp``
|
||||||
|
#
|
||||||
|
# Will result in a file ``my_list.txt`` containing::
|
||||||
|
#
|
||||||
|
# ``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
|
||||||
|
# HEADERS_LIST headers_list_target
|
||||||
|
# [FILTER_PATTERN pattern]
|
||||||
|
# [COPY_TO output]
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# ``target_name``:
|
||||||
|
# Required, expects the name of the target to be created. A file named after
|
||||||
|
# the string given in ``target_name`` will be created in
|
||||||
|
# ``${CMAKE_CURRENT_BINARY_DIR}`` to receive the list of symbols.
|
||||||
|
#
|
||||||
|
# ``HEADERS_LIST``:
|
||||||
|
# Required, expects a target with the property ``LIST_FILE`` set, containing a
|
||||||
|
# file path. Such file must contain a list of files paths.
|
||||||
|
#
|
||||||
|
# ``FILTER_PATTERN``:
|
||||||
|
# Optional, expects a string. Only the lines containing the filter pattern
|
||||||
|
# will be considered.
|
||||||
|
#
|
||||||
|
# ``COPY_TO``:
|
||||||
|
# Optional, expects a string containing the path to where the file containing
|
||||||
|
# the found symbols will be copied.
|
||||||
|
#
|
||||||
|
# This command extracts the symbols from the files listed in
|
||||||
|
# ``headers_list`` and write them on the ``output`` file. If ``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
|
||||||
|
# the lines containing exported function declaration, since this function is
|
||||||
|
# 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:
|
||||||
|
#
|
||||||
|
# .. code-block:: cmake
|
||||||
|
#
|
||||||
|
# find_package(ABIMap)
|
||||||
|
# extract_symbols("lib.symbols"
|
||||||
|
# HEADERS_LIST "headers_target"
|
||||||
|
# FILTER_PATTERN "API_FUNCTION"
|
||||||
|
# )
|
||||||
|
#
|
||||||
|
# Where ``LIST_FILE`` property in ``headers_target`` points to a file
|
||||||
|
# containing::
|
||||||
|
#
|
||||||
|
# header1.h;header2.h
|
||||||
|
#
|
||||||
|
# Where ``header1.h`` contains::
|
||||||
|
#
|
||||||
|
# API_FUNCTION int exported_func1(int a, int b);
|
||||||
|
#
|
||||||
|
# ``header2.h`` contains::
|
||||||
|
#
|
||||||
|
# API_FUNCTION int exported_func2(int a);
|
||||||
|
#
|
||||||
|
# int private_func2(int b);
|
||||||
|
#
|
||||||
|
# Will result in a file ``lib.symbols.list`` in ``${CMAKE_CURRENT_BINARY_DIR}``
|
||||||
|
# containing::
|
||||||
|
#
|
||||||
|
# ``exported_func1``
|
||||||
|
# ``exported_func2``
|
||||||
|
#
|
||||||
|
|
||||||
|
# Search for python which is required
|
||||||
|
if (ABIMap_FIND_REQURIED)
|
||||||
|
find_package(PythonInterp REQUIRED)
|
||||||
|
else()
|
||||||
|
find_package(PythonInterp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if (PYTHONINTERP_FOUND)
|
||||||
|
# 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)
|
||||||
|
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
|
||||||
|
set(_EXTRACT_SYMBOLS_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/ExtractSymbols.cmake)
|
||||||
|
set(_GENERATE_MAP_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/GenerateMap.cmake)
|
||||||
|
set(_GET_FILES_LIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/GetFilesList.cmake)
|
||||||
|
|
||||||
|
function(get_file_list _TARGET_NAME)
|
||||||
|
|
||||||
|
set(one_value_arguments
|
||||||
|
COPY_TO
|
||||||
|
)
|
||||||
|
|
||||||
|
set(multi_value_arguments
|
||||||
|
DIRECTORIES
|
||||||
|
FILES_PATTERNS
|
||||||
|
)
|
||||||
|
|
||||||
|
cmake_parse_arguments(_get_files_list
|
||||||
|
""
|
||||||
|
"${one_value_arguments}"
|
||||||
|
"${multi_value_arguments}"
|
||||||
|
${ARGN}
|
||||||
|
)
|
||||||
|
|
||||||
|
# The DIRS argument is required
|
||||||
|
if (NOT DEFINED _get_files_list_DIRECTORIES)
|
||||||
|
message(FATAL_ERROR "No directories paths provided. Provide a list of"
|
||||||
|
" directories paths containing header files.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# The FILES_PATTERNS argument is required
|
||||||
|
if (NOT DEFINED _get_files_list_FILES_PATTERNS)
|
||||||
|
message(FATAL_ERROR "No matching expressions provided. Provide a list"
|
||||||
|
" of matching patterns for the header files.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(_FILES_LIST_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${_TARGET_NAME}.list)
|
||||||
|
|
||||||
|
get_filename_component(_get_files_list_OUTPUT_PATH
|
||||||
|
"${_FILES_LIST_OUTPUT_PATH}"
|
||||||
|
ABSOLUTE)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
${_TARGET_NAME}_int ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DOUTPUT_PATH="${_get_files_list_OUTPUT_PATH}"
|
||||||
|
-DDIRECTORIES="${_get_files_list_DIRECTORIES}"
|
||||||
|
-DFILES_PATTERNS="${_get_files_list_FILES_PATTERNS}"
|
||||||
|
-P ${_GET_FILES_LIST_SCRIPT}
|
||||||
|
COMMENT
|
||||||
|
"Searching for files"
|
||||||
|
)
|
||||||
|
|
||||||
|
if (DEFINED _get_files_list_COPY_TO)
|
||||||
|
# Copy the generated file back to the COPY_TO
|
||||||
|
add_custom_target(${_TARGET_NAME} ALL
|
||||||
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${_FILES_LIST_OUTPUT_PATH} ${_get_files_list_COPY_TO}
|
||||||
|
DEPENDS ${_TARGET_NAME}_int
|
||||||
|
COMMENT "Copying ${_TARGET_NAME} to ${_get_files_list_COPY_TO}"
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_custom_target(${_TARGET_NAME} ALL
|
||||||
|
DEPENDS ${_TARGET_NAME}_int
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(${_TARGET_NAME}
|
||||||
|
PROPERTIES LIST_FILE ${_FILES_LIST_OUTPUT_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(extract_symbols _TARGET_NAME)
|
||||||
|
|
||||||
|
set(one_value_arguments
|
||||||
|
FILTER_PATTERN
|
||||||
|
HEADERS_LIST
|
||||||
|
COPY_TO
|
||||||
|
)
|
||||||
|
|
||||||
|
set(multi_value_arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
cmake_parse_arguments(_extract_symbols
|
||||||
|
""
|
||||||
|
"${one_value_arguments}"
|
||||||
|
"${multi_value_arguments}"
|
||||||
|
${ARGN}
|
||||||
|
)
|
||||||
|
|
||||||
|
# The HEADERS_LIST_FILE argument is required
|
||||||
|
if (NOT DEFINED _extract_symbols_HEADERS_LIST)
|
||||||
|
message(FATAL_ERROR "No target provided in HEADERS_LIST. Provide a"
|
||||||
|
" 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()
|
||||||
|
|
||||||
|
set_target_properties(${_TARGET_NAME}
|
||||||
|
PROPERTIES LIST_FILE ${_SYMBOLS_OUTPUT_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(generate_map_file _TARGET_NAME)
|
||||||
|
|
||||||
|
set(options
|
||||||
|
FINAL
|
||||||
|
BREAK_ABI
|
||||||
|
)
|
||||||
|
|
||||||
|
set(one_value_arguments
|
||||||
|
RELEASE_NAME_VERSION
|
||||||
|
SYMBOLS
|
||||||
|
CURRENT_MAP
|
||||||
|
COPY_TO
|
||||||
|
)
|
||||||
|
|
||||||
|
set(multi_value_arguments
|
||||||
|
)
|
||||||
|
|
||||||
|
cmake_parse_arguments(_generate_map_file
|
||||||
|
"${options}"
|
||||||
|
"${one_value_arguments}"
|
||||||
|
"${multi_value_arguments}"
|
||||||
|
${ARGN}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (NOT DEFINED _generate_map_file_SYMBOLS)
|
||||||
|
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()
|
||||||
|
|
||||||
|
if (NOT DEFINED _generate_map_file_RELEASE_NAME_VERSION)
|
||||||
|
message(FATAL_ERROR "Release name and version not provided."
|
||||||
|
" (e.g. libname_1_0_0)")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
get_target_property(_SYMBOLS_FILE
|
||||||
|
${_generate_map_file_SYMBOLS}
|
||||||
|
LIST_FILE
|
||||||
|
)
|
||||||
|
|
||||||
|
# Set generated map file path
|
||||||
|
get_filename_component(_MAP_OUTPUT_PATH
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/${_TARGET_NAME}"
|
||||||
|
ABSOLUTE
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_target(
|
||||||
|
${_TARGET_NAME}_int ALL
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DABIMAP_EXECUTABLE=${ABIMAP_EXECUTABLE}
|
||||||
|
-DSYMBOLS="${_SYMBOLS_FILE}"
|
||||||
|
-DCURRENT_MAP=${_generate_map_file_CURRENT_MAP}
|
||||||
|
-DOUTPUT_PATH="${_MAP_OUTPUT_PATH}"
|
||||||
|
-DFINAL=${_generate_map_file_FINAL}
|
||||||
|
-DBREAK_ABI=${_generate_map_file_BREAK_ABI}
|
||||||
|
-DRELEASE_NAME_VERSION=${_generate_map_file_RELEASE_NAME_VERSION}
|
||||||
|
-P ${_GENERATE_MAP_SCRIPT}
|
||||||
|
DEPENDS ${_generate_map_file_SYMBOLS}
|
||||||
|
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)
|
||||||
|
# Copy the generated map back to the COPY_TO
|
||||||
|
add_custom_target(${_TARGET_NAME} ALL
|
||||||
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} -E copy_if_different ${_MAP_OUTPUT_PATH}
|
||||||
|
${_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()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
endif (ABIMAP_FOUND)
|
||||||
@@ -1,60 +1,66 @@
|
|||||||
# - Try to find Argp
|
# - Try to find ARGP
|
||||||
# Once done this will define
|
# Once done this will define
|
||||||
#
|
#
|
||||||
# ARGP_FOUND - system has Argp
|
# ARGP_ROOT_DIR - Set this variable to the root installation of ARGP
|
||||||
# ARGP_INCLUDE_DIRS - the Argp include directory
|
|
||||||
# ARGP_LIBRARIES - Link these to use Argp
|
|
||||||
# ARGP_DEFINITIONS - Compiler switches required for using Argp
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2010 Andreas Schneider <asn@cynapses.org>
|
# Read-Only variables:
|
||||||
|
# ARGP_FOUND - system has ARGP
|
||||||
|
# ARGP_INCLUDE_DIR - the ARGP include directory
|
||||||
|
# ARGP_LIBRARIES - Link these to use ARGP
|
||||||
|
# ARGP_DEFINITIONS - Compiler switches required for using ARGP
|
||||||
#
|
#
|
||||||
# Redistribution and use is allowed according to the terms of the New
|
#=============================================================================
|
||||||
# BSD license.
|
# Copyright (c) 2011-2016 Andreas Schneider <asn@cryptomilk.org>
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
#
|
#
|
||||||
|
|
||||||
|
set(_ARGP_ROOT_HINTS
|
||||||
|
)
|
||||||
|
|
||||||
if (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS)
|
set(_ARGP_ROOT_PATHS
|
||||||
# in cache already
|
"$ENV{PROGRAMFILES}/argp"
|
||||||
set(ARGP_FOUND TRUE)
|
)
|
||||||
else (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
find_path(ARGP_INCLUDE_DIR
|
find_path(ARGP_ROOT_DIR
|
||||||
NAMES
|
NAMES
|
||||||
argp.h
|
include/argp.h
|
||||||
|
HINTS
|
||||||
|
${_ARGP_ROOT_HINTS}
|
||||||
PATHS
|
PATHS
|
||||||
/usr/include
|
${_ARGP_ROOT_PATHS}
|
||||||
/usr/local/include
|
)
|
||||||
/opt/local/include
|
mark_as_advanced(ARGP_ROOT_DIR)
|
||||||
/sw/include
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(ARGP_LIBRARY
|
find_path(ARGP_INCLUDE_DIR
|
||||||
NAMES
|
NAMES
|
||||||
argp
|
argp.h
|
||||||
PATHS
|
PATHS
|
||||||
/usr/lib
|
${ARGP_ROOT_DIR}/include
|
||||||
/usr/local/lib
|
)
|
||||||
/opt/local/lib
|
|
||||||
/sw/lib
|
find_library(ARGP_LIBRARY
|
||||||
|
NAMES
|
||||||
|
argp
|
||||||
|
PATHS
|
||||||
|
${ARGP_ROOT_DIR}/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
if (ARGP_LIBRARY)
|
||||||
|
set(ARGP_LIBRARIES
|
||||||
|
${ARGP_LIBRARIES}
|
||||||
|
${ARGP_LIBRARY}
|
||||||
)
|
)
|
||||||
|
endif (ARGP_LIBRARY)
|
||||||
|
|
||||||
set(ARGP_INCLUDE_DIRS
|
include(FindPackageHandleStandardArgs)
|
||||||
${ARGP_INCLUDE_DIR}
|
find_package_handle_standard_args(ARGP DEFAULT_MSG ARGP_LIBRARIES ARGP_INCLUDE_DIR)
|
||||||
)
|
|
||||||
|
|
||||||
if (ARGP_LIBRARY)
|
|
||||||
set(ARGP_LIBRARIES
|
|
||||||
${ARGP_LIBRARIES}
|
|
||||||
${ARGP_LIBRARY}
|
|
||||||
)
|
|
||||||
endif (ARGP_LIBRARY)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(Argp DEFAULT_MSG ARGP_LIBRARIES ARGP_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
# show the ARGP_INCLUDE_DIRS and ARGP_LIBRARIES variables only in the advanced view
|
|
||||||
mark_as_advanced(ARGP_INCLUDE_DIRS ARGP_LIBRARIES)
|
|
||||||
|
|
||||||
endif (ARGP_LIBRARIES AND ARGP_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
|
# show the ARGP_INCLUDE_DIR and ARGP_LIBRARIES variables only in the advanced view
|
||||||
|
mark_as_advanced(ARGP_INCLUDE_DIR ARGP_LIBRARIES)
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ find_path(GCRYPT_INCLUDE_DIR
|
|||||||
gcrypt.h
|
gcrypt.h
|
||||||
HINTS
|
HINTS
|
||||||
${_GCRYPT_ROOT_HINTS_AND_PATHS}
|
${_GCRYPT_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(GCRYPT_LIBRARY
|
find_library(GCRYPT_LIBRARY
|
||||||
@@ -44,13 +46,15 @@ find_library(GCRYPT_LIBRARY
|
|||||||
libgcrypt-11
|
libgcrypt-11
|
||||||
HINTS
|
HINTS
|
||||||
${_GCRYPT_ROOT_HINTS_AND_PATHS}
|
${_GCRYPT_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
)
|
)
|
||||||
set(GCRYPT_LIBRARIES ${GCRYPT_LIBRARY})
|
set(GCRYPT_LIBRARIES ${GCRYPT_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]")
|
||||||
|
|
||||||
string(REGEX REPLACE "^.*GCRYPT_VERSION.*([0-9]+.[0-9]+.[0-9]+).*" "\\1" GCRYPT_VERSION "${_gcrypt_version_str}")
|
string(REGEX REPLACE "^.*GCRYPT_VERSION.*([0-9]+\\.[0-9]+\\.[0-9]+).*" "\\1" GCRYPT_VERSION "${_gcrypt_version_str}")
|
||||||
endif (GCRYPT_INCLUDE_DIR)
|
endif (GCRYPT_INCLUDE_DIR)
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ if (UNIX)
|
|||||||
OUTPUT_VARIABLE
|
OUTPUT_VARIABLE
|
||||||
_GSSAPI_VENDOR_STRING)
|
_GSSAPI_VENDOR_STRING)
|
||||||
|
|
||||||
if (_GSSAPI_VENDOR_STRING MATCHES ".*Massachusetts.*")
|
if ((_GSSAPI_VENDOR_STRING MATCHES ".*Massachusetts.*") OR (_GSSAPI_VENDOR_STRING
|
||||||
|
MATCHES ".*MITKerberosShim.*"))
|
||||||
set(GSSAPI_FLAVOR_MIT TRUE)
|
set(GSSAPI_FLAVOR_MIT TRUE)
|
||||||
else()
|
else()
|
||||||
execute_process(
|
execute_process(
|
||||||
|
|||||||
104
cmake/Modules/FindMbedTLS.cmake
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
# - Try to find mbedTLS
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# MBEDTLS_FOUND - system has mbedTLS
|
||||||
|
# MBEDTLS_INCLUDE_DIRS - the mbedTLS include directory
|
||||||
|
# MBEDTLS_LIBRARIES - Link these to use mbedTLS
|
||||||
|
# MBEDTLS_DEFINITIONS - Compiler switches required for using mbedTLS
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright (c) 2017 Sartura d.o.o.
|
||||||
|
#
|
||||||
|
# Author: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
set(_MBEDTLS_ROOT_HINTS
|
||||||
|
$ENV{MBEDTLS_ROOT_DIR}
|
||||||
|
${MBEDTLS_ROOT_DIR})
|
||||||
|
|
||||||
|
set(_MBEDTLS_ROOT_PATHS
|
||||||
|
"$ENV{PROGRAMFILES}/libmbedtls")
|
||||||
|
|
||||||
|
set(_MBEDTLS_ROOT_HINTS_AND_PATHS
|
||||||
|
HINTS ${_MBEDTLS_ROOT_HINTS}
|
||||||
|
PATHS ${_MBEDTLS_ROOT_PATHS})
|
||||||
|
|
||||||
|
|
||||||
|
find_path(MBEDTLS_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
mbedtls/config.h
|
||||||
|
HINTS
|
||||||
|
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(MBEDTLS_SSL_LIBRARY
|
||||||
|
NAMES
|
||||||
|
mbedtls
|
||||||
|
HINTS
|
||||||
|
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(MBEDTLS_CRYPTO_LIBRARY
|
||||||
|
NAMES
|
||||||
|
mbedcrypto
|
||||||
|
HINTS
|
||||||
|
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(MBEDTLS_X509_LIBRARY
|
||||||
|
NAMES
|
||||||
|
mbedx509
|
||||||
|
HINTS
|
||||||
|
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||||
|
PATH_SUFFIXES
|
||||||
|
lib
|
||||||
|
)
|
||||||
|
|
||||||
|
set(MBEDTLS_LIBRARIES ${MBEDTLS_SSL_LIBRARY} ${MBEDTLS_CRYPTO_LIBRARY}
|
||||||
|
${MBEDTLS_X509_LIBRARY})
|
||||||
|
|
||||||
|
if (MBEDTLS_INCLUDE_DIR AND EXISTS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h")
|
||||||
|
file(STRINGS "${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h" _mbedtls_version_str REGEX
|
||||||
|
"^#[\t ]*define[\t ]+MBEDTLS_VERSION_STRING[\t ]+\"[0-9]+.[0-9]+.[0-9]+\"")
|
||||||
|
|
||||||
|
string(REGEX REPLACE "^.*MBEDTLS_VERSION_STRING.*([0-9]+.[0-9]+.[0-9]+).*"
|
||||||
|
"\\1" MBEDTLS_VERSION "${_mbedtls_version_str}")
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
if (MBEDTLS_VERSION)
|
||||||
|
find_package_handle_standard_args(MbedTLS
|
||||||
|
REQUIRED_VARS
|
||||||
|
MBEDTLS_INCLUDE_DIR
|
||||||
|
MBEDTLS_LIBRARIES
|
||||||
|
VERSION_VAR
|
||||||
|
MBEDTLS_VERSION
|
||||||
|
FAIL_MESSAGE
|
||||||
|
"Could NOT find mbedTLS, try to set the path to mbedTLS root folder
|
||||||
|
in the system variable MBEDTLS_ROOT_DIR"
|
||||||
|
)
|
||||||
|
else (MBEDTLS_VERSION)
|
||||||
|
find_package_handle_standard_args(MBedTLS
|
||||||
|
"Could NOT find mbedTLS, try to set the path to mbedLS root folder in
|
||||||
|
the system variable MBEDTLS_ROOT_DIR"
|
||||||
|
MBEDTLS_INCLUDE_DIR
|
||||||
|
MBEDTLS_LIBRARIES)
|
||||||
|
endif (MBEDTLS_VERSION)
|
||||||
|
|
||||||
|
# show the MBEDTLS_INCLUDE_DIRS and MBEDTLS_LIBRARIES variables only in the advanced view
|
||||||
|
mark_as_advanced(MBEDTLS_INCLUDE_DIR MBEDTLS_LIBRARIES)
|
||||||
@@ -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}
|
||||||
)
|
)
|
||||||
|
|||||||
61
cmake/Modules/FindNaCl.cmake
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# - Try to find NaCl
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# NACL_FOUND - system has NaCl
|
||||||
|
# NACL_INCLUDE_DIRS - the NaCl include directory
|
||||||
|
# NACL_LIBRARIES - Link these to use NaCl
|
||||||
|
# NACL_DEFINITIONS - Compiler switches required for using NaCl
|
||||||
|
#
|
||||||
|
# Copyright (c) 2010 Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
# Copyright (c) 2013 Aris Adamantiadis <aris@badcode.be>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
if (NACL_LIBRARIES AND NACL_INCLUDE_DIRS)
|
||||||
|
# in cache already
|
||||||
|
set(NACL_FOUND TRUE)
|
||||||
|
else (NACL_LIBRARIES AND NACL_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
find_path(NACL_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
nacl/crypto_box_curve25519xsalsa20poly1305.h
|
||||||
|
PATHS
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
/opt/local/include
|
||||||
|
/sw/include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(NACL_LIBRARY
|
||||||
|
NAMES
|
||||||
|
nacl
|
||||||
|
PATHS
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
set(NACL_INCLUDE_DIRS
|
||||||
|
${NACL_INCLUDE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (NACL_LIBRARY)
|
||||||
|
set(NACL_LIBRARIES
|
||||||
|
${NACL_LIBRARIES}
|
||||||
|
${NACL_LIBRARY}
|
||||||
|
)
|
||||||
|
endif (NACL_LIBRARY)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(NaCl DEFAULT_MSG NACL_LIBRARIES NACL_INCLUDE_DIRS)
|
||||||
|
|
||||||
|
# show the NACL_INCLUDE_DIRS and NACL_LIBRARIES variables only in the advanced view
|
||||||
|
mark_as_advanced(NACL_INCLUDE_DIRS NACL_LIBRARIES)
|
||||||
|
|
||||||
|
endif (NACL_LIBRARIES AND NACL_INCLUDE_DIRS)
|
||||||
|
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
# - Try to find OpenSSL
|
|
||||||
# Once done this will define
|
|
||||||
#
|
|
||||||
# OPENSSL_ROOT_DIR - Set this variable to the root installation of OpenSSL
|
|
||||||
#
|
|
||||||
# Read-Only variables:
|
|
||||||
# OPENSSL_FOUND - system has OpenSSL
|
|
||||||
# OPENSSL_INCLUDE_DIRS - the OpenSSL include directory
|
|
||||||
# OPENSSL_LIBRARIES - Link these to use OpenSSL
|
|
||||||
# OPENSSL_DEFINITIONS - Compiler switches required for using OpenSSL
|
|
||||||
#
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright (c) 2006-2009 Kitware, Inc.
|
|
||||||
# Copyright (c) 2006 Alexander Neundorf <neundorf@kde.org>
|
|
||||||
# Copyright (c) 2009-2010 Mathieu Malaterre <mathieu.malaterre@gmail.com>
|
|
||||||
# Copyright (c) 2011 Andreas Schneider <asn@cryptomilk.org>
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
#
|
|
||||||
|
|
||||||
if (OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIRS)
|
|
||||||
# in cache already
|
|
||||||
set(OPENSSL_FOUND TRUE)
|
|
||||||
else (OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
if (UNIX)
|
|
||||||
find_package(PkgConfig)
|
|
||||||
if (PKG_CONFIG_FOUND)
|
|
||||||
pkg_check_modules(_OPENSSL openssl)
|
|
||||||
endif (PKG_CONFIG_FOUND)
|
|
||||||
endif (UNIX)
|
|
||||||
|
|
||||||
# http://www.slproweb.com/products/Win32OpenSSL.html
|
|
||||||
set(_OPENSSL_ROOT_HINTS
|
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
|
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
|
|
||||||
)
|
|
||||||
|
|
||||||
set(_OPENSSL_ROOT_PATHS
|
|
||||||
"C:/OpenSSL/"
|
|
||||||
"C:/OpenSSL-Win32/"
|
|
||||||
"C:/OpenSSL-Win64/"
|
|
||||||
"$ENV{PROGRAMFILES}/OpenSSL"
|
|
||||||
"$ENV{PROGRAMFILES}/OpenSSL-Win32"
|
|
||||||
"$ENV{PROGRAMFILES}/OpenSSL-Win64"
|
|
||||||
)
|
|
||||||
|
|
||||||
find_path(OPENSSL_ROOT_DIR
|
|
||||||
NAMES
|
|
||||||
include/openssl/ssl.h
|
|
||||||
HINTS
|
|
||||||
${_OPENSSL_ROOT_HINTS}
|
|
||||||
PATHS
|
|
||||||
${_OPENSSL_ROOT_PATHS}
|
|
||||||
)
|
|
||||||
mark_as_advanced(OPENSSL_ROOT_DIR)
|
|
||||||
|
|
||||||
find_path(OPENSSL_INCLUDE_DIR
|
|
||||||
NAMES
|
|
||||||
openssl/ssl.h
|
|
||||||
PATHS
|
|
||||||
/usr/local/include
|
|
||||||
/opt/local/include
|
|
||||||
/sw/include
|
|
||||||
/usr/lib/sfw/include
|
|
||||||
${OPENSSL_ROOT_DIR}/include
|
|
||||||
)
|
|
||||||
|
|
||||||
set(OPENSSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
|
|
||||||
mark_as_advanced(OPENSSL_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
if (WIN32 AND NOT CYGWIN)
|
|
||||||
# MINGW should go here too
|
|
||||||
if (MSVC)
|
|
||||||
# /MD and /MDd are the standard values - if someone wants to use
|
|
||||||
# others, the libnames have to change here too
|
|
||||||
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
|
|
||||||
# TODO: handle /MT and static lib
|
|
||||||
# In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
|
|
||||||
# * MD for dynamic-release
|
|
||||||
# * MDd for dynamic-debug
|
|
||||||
# * MT for static-release
|
|
||||||
# * MTd for static-debug
|
|
||||||
|
|
||||||
# Implementation details:
|
|
||||||
# We are using the libraries located in the VC subdir instead of the parent directory eventhough :
|
|
||||||
# libeay32MD.lib is identical to ../libeay32.lib, and
|
|
||||||
# ssleay32MD.lib is identical to ../ssleay32.lib
|
|
||||||
find_library(LIB_EAY_DEBUG
|
|
||||||
NAMES
|
|
||||||
libeay32MDd
|
|
||||||
libeay32
|
|
||||||
PATHS
|
|
||||||
${OPENSSL_ROOT_DIR}/lib/VC
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(LIB_EAY_RELEASE
|
|
||||||
NAMES
|
|
||||||
libeay32MD
|
|
||||||
libeay32
|
|
||||||
PATHS
|
|
||||||
${OPENSSL_ROOT_DIR}/lib/VC
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(SSL_EAY_DEBUG
|
|
||||||
NAMES
|
|
||||||
ssleay32MDd
|
|
||||||
ssleay32
|
|
||||||
ssl
|
|
||||||
PATHS ${OPENSSL_ROOT_DIR}/lib/VC
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(SSL_EAY_RELEASE
|
|
||||||
NAMES
|
|
||||||
ssleay32MD
|
|
||||||
ssleay32
|
|
||||||
ssl
|
|
||||||
PATHS
|
|
||||||
${OPENSSL_ROOT_DIR}/lib/VC
|
|
||||||
)
|
|
||||||
|
|
||||||
if (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
|
|
||||||
set(OPENSSL_LIBRARIES
|
|
||||||
optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG}
|
|
||||||
optimized ${LIB_EAY_RELEASE} debug ${LIB_EAY_DEBUG}
|
|
||||||
)
|
|
||||||
else (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
|
|
||||||
set( OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} )
|
|
||||||
endif (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
|
|
||||||
|
|
||||||
mark_as_advanced(SSL_EAY_DEBUG SSL_EAY_RELEASE)
|
|
||||||
mark_as_advanced(LIB_EAY_DEBUG LIB_EAY_RELEASE)
|
|
||||||
elseif (MINGW)
|
|
||||||
# same player, for MingW
|
|
||||||
find_library(LIB_EAY
|
|
||||||
NAMES
|
|
||||||
libeay32
|
|
||||||
PATHS
|
|
||||||
${OPENSSL_ROOT_DIR}/lib/MinGW
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(SSL_EAY
|
|
||||||
NAMES
|
|
||||||
ssleay32
|
|
||||||
PATHS
|
|
||||||
${OPENSSL_ROOT_DIR}/lib/MinGW
|
|
||||||
)
|
|
||||||
|
|
||||||
mark_as_advanced(SSL_EAY LIB_EAY)
|
|
||||||
set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY})
|
|
||||||
else(MSVC)
|
|
||||||
# Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
|
|
||||||
find_library(LIB_EAY
|
|
||||||
NAMES
|
|
||||||
libeay32
|
|
||||||
PATHS
|
|
||||||
${OPENSSL_ROOT_DIR}/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(SSL_EAY
|
|
||||||
NAMES
|
|
||||||
ssleay32
|
|
||||||
PATHS
|
|
||||||
${OPENSSL_ROOT_DIR}/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
mark_as_advanced(SSL_EAY LIB_EAY)
|
|
||||||
set(OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY})
|
|
||||||
endif(MSVC)
|
|
||||||
else (WIN32 AND NOT CYGWIN)
|
|
||||||
find_library(OPENSSL_SSL_LIBRARIES
|
|
||||||
NAMES
|
|
||||||
ssl
|
|
||||||
ssleay32
|
|
||||||
ssleay32MD
|
|
||||||
PATHS
|
|
||||||
${_OPENSSL_LIBDIR}
|
|
||||||
/opt/local/lib
|
|
||||||
/sw/lib
|
|
||||||
/usr/sfw/lib/64
|
|
||||||
/usr/sfw/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
find_library(OPENSSL_CRYPTO_LIBRARIES
|
|
||||||
NAMES
|
|
||||||
crypto
|
|
||||||
PATHS
|
|
||||||
${_OPENSSL_LIBDIR}
|
|
||||||
/opt/local/lib
|
|
||||||
/sw/lib
|
|
||||||
/usr/sfw/lib/64
|
|
||||||
/usr/sfw/lib
|
|
||||||
)
|
|
||||||
|
|
||||||
mark_as_advanced(OPENSSL_CRYPTO_LIBRARIES OPENSSL_SSL_LIBRARIES)
|
|
||||||
set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES})
|
|
||||||
endif (WIN32 AND NOT CYGWIN)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(OpenSSL DEFAULT_MSG OPENSSL_LIBRARIES OPENSSL_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
endif (OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIRS)
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
# - Try to find ZLIB
|
|
||||||
# Once done this will define
|
|
||||||
#
|
|
||||||
# ZLIB_ROOT_DIR - Set this variable to the root installation of ZLIB
|
|
||||||
#
|
|
||||||
# Read-Only variables:
|
|
||||||
# ZLIB_FOUND - system has ZLIB
|
|
||||||
# ZLIB_INCLUDE_DIRS - the ZLIB include directory
|
|
||||||
# ZLIB_LIBRARIES - Link these to use ZLIB
|
|
||||||
#
|
|
||||||
# ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
|
|
||||||
# ZLIB_VERSION_MAJOR - The major version of zlib
|
|
||||||
# ZLIB_VERSION_MINOR - The minor version of zlib
|
|
||||||
# ZLIB_VERSION_PATCH - The patch version of zlib
|
|
||||||
# ZLIB_VERSION_TWEAK - The tweak version of zlib
|
|
||||||
#
|
|
||||||
# The following variable are provided for backward compatibility
|
|
||||||
#
|
|
||||||
# ZLIB_MAJOR_VERSION - The major version of zlib
|
|
||||||
# ZLIB_MINOR_VERSION - The minor version of zlib
|
|
||||||
# ZLIB_PATCH_VERSION - The patch version of zlib
|
|
||||||
#
|
|
||||||
#=============================================================================
|
|
||||||
# Copyright (c) 2001-2009 Kitware, Inc.
|
|
||||||
# Copyright (c) 2011 Andreas Schneider <asn@cryptomilk.org>
|
|
||||||
#
|
|
||||||
# Distributed under the OSI-approved BSD License (the "License");
|
|
||||||
# see accompanying file Copyright.txt for details.
|
|
||||||
#
|
|
||||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
# See the License for more information.
|
|
||||||
#=============================================================================
|
|
||||||
#
|
|
||||||
|
|
||||||
if (ZLIB_LIBRARIES AND ZLIB_INCLUDE_DIRS)
|
|
||||||
# in cache already
|
|
||||||
set(ZLIB_FOUND TRUE)
|
|
||||||
else (ZLIB_LIBRARIES AND ZLIB_INCLUDE_DIRS)
|
|
||||||
|
|
||||||
set(_ZLIB_ROOT_HINTS
|
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\Zlib;InstallPath]/include"
|
|
||||||
)
|
|
||||||
|
|
||||||
set(_ZLIB_ROOT_PATHS
|
|
||||||
"$ENV{PROGRAMFILES}/zlib"
|
|
||||||
)
|
|
||||||
|
|
||||||
find_path(ZLIB_ROOT_DIR
|
|
||||||
NAMES
|
|
||||||
include/zlib.h
|
|
||||||
HINTS
|
|
||||||
${_ZLIB_ROOT_HINTS}
|
|
||||||
PATHS
|
|
||||||
${_ZLIB_ROOT_PATHS}
|
|
||||||
)
|
|
||||||
mark_as_advanced(ZLIB_ROOT_DIR)
|
|
||||||
|
|
||||||
# check for header file
|
|
||||||
find_path(ZLIB_INCLUDE_DIR
|
|
||||||
NAMES
|
|
||||||
zlib.h
|
|
||||||
PATHS
|
|
||||||
/usr/local/include
|
|
||||||
/opt/local/include
|
|
||||||
/sw/include
|
|
||||||
/usr/lib/sfw/include
|
|
||||||
${ZLIB_ROOT_DIR}/include
|
|
||||||
)
|
|
||||||
mark_as_advanced(ZLIB_INCLUDE_DIR)
|
|
||||||
|
|
||||||
# check version number
|
|
||||||
if (ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
|
|
||||||
file(STRINGS "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H REGEX "^#define ZLIB_VERSION \"[^\"]*\"$")
|
|
||||||
|
|
||||||
string(REGEX REPLACE "^.*ZLIB_VERSION \"([0-9]+).*$" "\\1" ZLIB_VERSION_MAJOR "${ZLIB_H}")
|
|
||||||
string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_MINOR "${ZLIB_H}")
|
|
||||||
string(REGEX REPLACE "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ZLIB_VERSION_PATCH "${ZLIB_H}")
|
|
||||||
|
|
||||||
set(ZLIB_VERSION_STRING "${ZLIB_VERSION_MAJOR}.${ZLIB_VERSION_MINOR}.${ZLIB_VERSION_PATCH}")
|
|
||||||
|
|
||||||
# only append a TWEAK version if it exists:
|
|
||||||
set(ZLIB_VERSION_TWEAK "")
|
|
||||||
if ("${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$")
|
|
||||||
set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}")
|
|
||||||
set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}")
|
|
||||||
endif ("${ZLIB_H}" MATCHES "^.*ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$")
|
|
||||||
|
|
||||||
set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}")
|
|
||||||
set(ZLIB_MINOR_VERSION "${ZLIB_VERSION_MINOR}")
|
|
||||||
set(ZLIB_PATCH_VERSION "${ZLIB_VERSION_PATCH}")
|
|
||||||
endif (ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
|
|
||||||
|
|
||||||
find_library(ZLIB_LIBRARY
|
|
||||||
NAMES
|
|
||||||
z
|
|
||||||
zdll
|
|
||||||
zlib
|
|
||||||
zlib1
|
|
||||||
zlibd
|
|
||||||
PATHS
|
|
||||||
/usr/local/lib
|
|
||||||
/opt/local/lib
|
|
||||||
/sw/lib
|
|
||||||
/usr/sfw/lib/64
|
|
||||||
/usr/sfw/lib
|
|
||||||
${ZLIB_ROOT_DIR}/lib
|
|
||||||
)
|
|
||||||
mark_as_advanced(ZLIB_LIBRARY)
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(ZLIB DEFAULT_MSG ZLIB_INCLUDE_DIR ZLIB_LIBRARY)
|
|
||||||
#find_package_handle_standard_args(ZLIB REQUIRED_VARS ZLIB_INCLUDE_DIR ZLIB_LIBRARY
|
|
||||||
# VERSION_VAR ZLIB_VERSION_STRING)
|
|
||||||
|
|
||||||
if (ZLIB_FOUND)
|
|
||||||
set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
|
|
||||||
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
|
|
||||||
endif (ZLIB_FOUND)
|
|
||||||
endif (ZLIB_LIBRARIES AND ZLIB_INCLUDE_DIRS)
|
|
||||||
118
cmake/Modules/GenerateMap.cmake
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2018 Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
#.rst:
|
||||||
|
# GenerateMap
|
||||||
|
# -----------
|
||||||
|
#
|
||||||
|
# This is a helper script for FindABImap.cmake.
|
||||||
|
#
|
||||||
|
# Generates a symbols version script using the abimap tool.
|
||||||
|
# This script is run in build time to use the correct command depending on the
|
||||||
|
# existence of the file provided ``CURRENT_MAP``.
|
||||||
|
#
|
||||||
|
# If the file exists, the ``abimap update`` subcommand is used to update the
|
||||||
|
# existing map. Otherwise, the ``abimap new`` subcommand is used to create a new
|
||||||
|
# map file.
|
||||||
|
#
|
||||||
|
# If the file provided in ``CURRENT_MAP`` exists, it is copied to the
|
||||||
|
# ``OUTPUT_PATH`` before updating.
|
||||||
|
# This is required because ``abimap`` do not generate output if no symbols were
|
||||||
|
# changed when updating an existing file.
|
||||||
|
#
|
||||||
|
# Expected defined variables
|
||||||
|
# --------------------------
|
||||||
|
#
|
||||||
|
# ``SYMBOLS``:
|
||||||
|
# Required file containing the symbols to be used as input. Usually this is
|
||||||
|
# the ``OUTPUT`` generated by ``extract_symbols()`` function provided in
|
||||||
|
# FindABImap.cmake
|
||||||
|
#
|
||||||
|
# ``RELEASE_NAME_VERSION``:
|
||||||
|
# Required, expects the library name and version information to be added to
|
||||||
|
# the symbols in the format ``library_name_1_2_3``
|
||||||
|
#
|
||||||
|
# ``CURRENT_MAP``:
|
||||||
|
# Required, expects the path to the current map file (or the path were it
|
||||||
|
# should be)
|
||||||
|
#
|
||||||
|
# ``OUTPUT_PATH``:
|
||||||
|
# Required, expects the output file path.
|
||||||
|
#
|
||||||
|
# ``ABIMAP_EXECUTABLE``:
|
||||||
|
# Required, expects the path to the ``abimap`` tool.
|
||||||
|
#
|
||||||
|
# Optionally defined variables
|
||||||
|
# ----------------------------
|
||||||
|
#
|
||||||
|
# ``FINAL``:
|
||||||
|
# If defined, will mark the modified set of symbols in the symbol version
|
||||||
|
# script as final, preventing later changes using ``abimap``.
|
||||||
|
#
|
||||||
|
# ``BREAK_ABI``:
|
||||||
|
# If defined, the build will not fail if symbols were removed.
|
||||||
|
# If defined and a symbol is removed, a new release is created containing
|
||||||
|
# all symbols from all released versions. This makes an incompatible release.
|
||||||
|
#
|
||||||
|
|
||||||
|
if (NOT DEFINED RELEASE_NAME_VERSION)
|
||||||
|
message(SEND_ERROR "RELEASE_NAME_VERSION not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED SYMBOLS)
|
||||||
|
message(SEND_ERROR "SYMBOLS not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED CURRENT_MAP)
|
||||||
|
message(SEND_ERROR "CURRENT_MAP not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED OUTPUT_PATH)
|
||||||
|
message(SEND_ERROR "OUTPUT_PATH not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT ABIMAP_EXECUTABLE)
|
||||||
|
message(SEND_ERROR "ABIMAP_EXECUTABLE not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(ARGS_LIST)
|
||||||
|
|
||||||
|
if (FINAL)
|
||||||
|
list(APPEND ARGS_LIST "--final")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (EXISTS ${CURRENT_MAP})
|
||||||
|
if (BREAK_ABI)
|
||||||
|
list(APPEND ARGS_LIST "--allow-abi-break")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND
|
||||||
|
${CMAKE_COMMAND} -E copy_if_different ${CURRENT_MAP} ${OUTPUT_PATH}
|
||||||
|
COMMAND
|
||||||
|
${ABIMAP_EXECUTABLE} update ${ARGS_LIST}
|
||||||
|
-r ${RELEASE_NAME_VERSION}
|
||||||
|
-i ${SYMBOLS}
|
||||||
|
-o ${OUTPUT_PATH}
|
||||||
|
${CURRENT_MAP}
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
)
|
||||||
|
else ()
|
||||||
|
execute_process(
|
||||||
|
COMMAND
|
||||||
|
${ABIMAP_EXECUTABLE} new ${ARGS_LIST}
|
||||||
|
-r ${RELEASE_NAME_VERSION}
|
||||||
|
-i ${SYMBOLS}
|
||||||
|
-o ${OUTPUT_PATH}
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT "${result}" STREQUAL "0")
|
||||||
|
message(SEND_ERROR "Map generation failed")
|
||||||
|
endif()
|
||||||
59
cmake/Modules/GetFilesList.cmake
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
#
|
||||||
|
# Copyright (c) 2018 Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
|
||||||
|
#
|
||||||
|
# Redistribution and use is allowed according to the terms of the New
|
||||||
|
# BSD license.
|
||||||
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
|
#
|
||||||
|
|
||||||
|
#.rst:
|
||||||
|
# GetFilesList
|
||||||
|
# ------------
|
||||||
|
#
|
||||||
|
# This is a helper script for FindABImap.cmake.
|
||||||
|
#
|
||||||
|
# Search in the provided directories for files matching the provided pattern.
|
||||||
|
# The list of files is then written to the output file.
|
||||||
|
#
|
||||||
|
# Expected defined variables
|
||||||
|
# --------------------------
|
||||||
|
#
|
||||||
|
# ``DIRECTORIES``:
|
||||||
|
# Required, expects a list of directories paths.
|
||||||
|
#
|
||||||
|
# ``FILES_PATTERNS``:
|
||||||
|
# Required, expects a list of patterns to be used to search files
|
||||||
|
#
|
||||||
|
# ``OUTPUT_PATH``:
|
||||||
|
# Required, expects the output file path.
|
||||||
|
|
||||||
|
if (NOT DEFINED DIRECTORIES)
|
||||||
|
message(SEND_ERROR "DIRECTORIES not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED FILES_PATTERNS)
|
||||||
|
message(SEND_ERROR "FILES_PATTERNS not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (NOT DEFINED OUTPUT_PATH)
|
||||||
|
message(SEND_ERROR "OUTPUT_PATH not defined")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
string(REPLACE " " ";" DIRECTORIES_LIST "${DIRECTORIES}")
|
||||||
|
string(REPLACE " " ";" FILES_PATTERNS_LIST "${FILES_PATTERNS}")
|
||||||
|
|
||||||
|
# Create the list of expressions for the files
|
||||||
|
set(glob_expressions)
|
||||||
|
foreach(dir ${DIRECTORIES_LIST})
|
||||||
|
foreach(exp ${FILES_PATTERNS_LIST})
|
||||||
|
list(APPEND glob_expressions
|
||||||
|
"${dir}/${exp}"
|
||||||
|
)
|
||||||
|
endforeach()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
# Create the list of files
|
||||||
|
file(GLOB files ${glob_expressions})
|
||||||
|
|
||||||
|
# Write to the output
|
||||||
|
file(WRITE ${OUTPUT_PATH} "${files}")
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
# - MACRO_ADD_COMPILE_FLAGS(target_name flag1 ... flagN)
|
|
||||||
|
|
||||||
# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
|
|
||||||
# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
||||||
|
|
||||||
|
|
||||||
macro (MACRO_ADD_COMPILE_FLAGS _target)
|
|
||||||
|
|
||||||
get_target_property(_flags ${_target} COMPILE_FLAGS)
|
|
||||||
if (_flags)
|
|
||||||
set(_flags ${_flags} ${ARGN})
|
|
||||||
else (_flags)
|
|
||||||
set(_flags ${ARGN})
|
|
||||||
endif (_flags)
|
|
||||||
|
|
||||||
set_target_properties(${_target} PROPERTIES COMPILE_FLAGS ${_flags})
|
|
||||||
|
|
||||||
endmacro (MACRO_ADD_COMPILE_FLAGS)
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# - MACRO_ADD_LINK_FLAGS(target_name flag1 ... flagN)
|
|
||||||
|
|
||||||
# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
|
|
||||||
# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
||||||
|
|
||||||
macro (MACRO_ADD_LINK_FLAGS _target)
|
|
||||||
|
|
||||||
get_target_property(_flags ${_target} LINK_FLAGS)
|
|
||||||
if (_flags)
|
|
||||||
set(_flags "${_flags} ${ARGN}")
|
|
||||||
else (_flags)
|
|
||||||
set(_flags "${ARGN}")
|
|
||||||
endif (_flags)
|
|
||||||
|
|
||||||
set_target_properties(${_target} PROPERTIES LINK_FLAGS "${_flags}")
|
|
||||||
|
|
||||||
endmacro (MACRO_ADD_LINK_FLAGS)
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
# - MACRO_ADD_PLUGIN(name [WITH_PREFIX] file1 .. fileN)
|
|
||||||
#
|
|
||||||
# Create a plugin from the given source files.
|
|
||||||
# If WITH_PREFIX is given, the resulting plugin will have the
|
|
||||||
# prefix "lib", otherwise it won't.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
|
|
||||||
# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
|
|
||||||
# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
||||||
|
|
||||||
|
|
||||||
macro (MACRO_ADD_PLUGIN _target_NAME _with_PREFIX)
|
|
||||||
|
|
||||||
if (${_with_PREFIX} STREQUAL "WITH_PREFIX")
|
|
||||||
set(_first_SRC)
|
|
||||||
else (${_with_PREFIX} STREQUAL "WITH_PREFIX")
|
|
||||||
set(_first_SRC ${_with_PREFIX})
|
|
||||||
endif (${_with_PREFIX} STREQUAL "WITH_PREFIX")
|
|
||||||
|
|
||||||
add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN})
|
|
||||||
|
|
||||||
if (_first_SRC)
|
|
||||||
set_target_properties(${_target_NAME} PROPERTIES PREFIX "")
|
|
||||||
endif (_first_SRC)
|
|
||||||
|
|
||||||
endmacro (MACRO_ADD_PLUGIN _name _sources)
|
|
||||||
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
# - macro_copy_file(_src _dst)
|
|
||||||
# Copies a file to ${_dst} only if ${_src} is different (newer) than ${_dst}
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# macro_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/icon.png ${CMAKE_CURRENT_BINARY_DIR}/.)
|
|
||||||
# Copies file icon.png to ${CMAKE_CURRENT_BINARY_DIR} directory
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006-2007 Wengo
|
|
||||||
# Copyright (c) 2006-2008 Andreas Schneider <mail@cynapses.org>
|
|
||||||
#
|
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
|
||||||
# For details see the accompanying COPYING file.
|
|
||||||
|
|
||||||
|
|
||||||
macro (macro_copy_file _src _dst)
|
|
||||||
# Removes all path containing .svn or CVS or CMakeLists.txt during the copy
|
|
||||||
if (NOT ${_src} MATCHES ".*\\.svn|CVS|CMakeLists\\.txt.*")
|
|
||||||
|
|
||||||
if (CMAKE_VERBOSE_MAKEFILE)
|
|
||||||
message(STATUS "Copy file from ${_src} to ${_dst}")
|
|
||||||
endif (CMAKE_VERBOSE_MAKEFILE)
|
|
||||||
|
|
||||||
# Creates directory if necessary
|
|
||||||
get_filename_component(_path ${_dst} PATH)
|
|
||||||
file(MAKE_DIRECTORY ${_path})
|
|
||||||
|
|
||||||
execute_process(
|
|
||||||
COMMAND
|
|
||||||
${CMAKE_COMMAND} -E copy_if_different ${_src} ${_dst}
|
|
||||||
OUTPUT_QUIET
|
|
||||||
)
|
|
||||||
endif (NOT ${_src} MATCHES ".*\\.svn|CVS|CMakeLists\\.txt.*")
|
|
||||||
endmacro (macro_copy_file)
|
|
||||||
@@ -1,100 +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 dependency.
|
|
||||||
# i.e.: the API documentation is built with:
|
|
||||||
# make doc
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Variables you may define are:
|
|
||||||
# DOXYFILE_OUTPUT_DIR - Path where the Doxygen output is stored. Defaults to "doc".
|
|
||||||
#
|
|
||||||
# DOXYFILE_LATEX_DIR - Directory where the Doxygen LaTeX output is stored. Defaults to "latex".
|
|
||||||
#
|
|
||||||
# DOXYFILE_HTML_DIR - Directory where the Doxygen html output is stored. Defaults to "html".
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright (c) 2009-2010 Tobias Rautenkranz <tobias@rautenkranz.ch>
|
|
||||||
# Copyright (c) 2010 Andreas Schneider <mail@cynapses.org>
|
|
||||||
#
|
|
||||||
# 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)
|
|
||||||
if(NOT DEFINED "${name}")
|
|
||||||
set("${name}" "${value}")
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
find_package(Doxygen)
|
|
||||||
|
|
||||||
if(DOXYGEN_FOUND)
|
|
||||||
find_file(DOXYFILE_IN
|
|
||||||
NAMES
|
|
||||||
doxy.config.in
|
|
||||||
PATHS
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
${CMAKE_ROOT}/Modules/
|
|
||||||
NO_DEFAULT_PATH)
|
|
||||||
include(FindPackageHandleStandardArgs)
|
|
||||||
find_package_handle_standard_args(DOXYFILE_IN DEFAULT_MSG "DOXYFILE_IN")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(DOXYGEN_FOUND AND DOXYFILE_IN_FOUND)
|
|
||||||
add_custom_target(doxygen ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxy.config)
|
|
||||||
|
|
||||||
usedoxygen_set_default(DOXYFILE_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
|
||||||
usedoxygen_set_default(DOXYFILE_HTML_DIR "html")
|
|
||||||
|
|
||||||
set_property(DIRECTORY APPEND PROPERTY
|
|
||||||
ADDITIONAL_MAKE_CLEAN_FILES "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_HTML_DIR}")
|
|
||||||
|
|
||||||
set(DOXYFILE_LATEX FALSE)
|
|
||||||
set(DOXYFILE_PDFLATEX FALSE)
|
|
||||||
set(DOXYFILE_DOT FALSE)
|
|
||||||
|
|
||||||
#find_package(LATEX)
|
|
||||||
#if(LATEX_COMPILER AND MAKEINDEX_COMPILER)
|
|
||||||
# set(DOXYFILE_LATEX TRUE)
|
|
||||||
# usedoxygen_set_default(DOXYFILE_LATEX_DIR "latex")
|
|
||||||
#
|
|
||||||
# set_property(DIRECTORY APPEND PROPERTY
|
|
||||||
# ADDITIONAL_MAKE_CLEAN_FILES
|
|
||||||
# "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
|
|
||||||
#
|
|
||||||
# if(PDFLATEX_COMPILER)
|
|
||||||
# set(DOXYFILE_PDFLATEX TRUE)
|
|
||||||
# endif()
|
|
||||||
# if(DOXYGEN_DOT_EXECUTABLE)
|
|
||||||
# set(DOXYFILE_DOT TRUE)
|
|
||||||
# endif()
|
|
||||||
#
|
|
||||||
# add_custom_command(TARGET doxygen
|
|
||||||
# POST_BUILD
|
|
||||||
# COMMAND ${CMAKE_MAKE_PROGRAM}
|
|
||||||
# WORKING_DIRECTORY "${DOXYFILE_OUTPUT_DIR}/${DOXYFILE_LATEX_DIR}")
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
configure_file(${DOXYFILE_IN} ${CMAKE_CURRENT_BINARY_DIR}/doxy.config ESCAPE_QUOTES IMMEDIATE @ONLY)
|
|
||||||
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doxy.trac.in)
|
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doxy.trac.in ${CMAKE_CURRENT_BINARY_DIR}/doxy.trac ESCAPE_QUOTES IMMEDIATE @ONLY)
|
|
||||||
add_custom_target(doxygen-trac ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxy.trac)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
get_target_property(DOC_TARGET doc TYPE)
|
|
||||||
if(NOT DOC_TARGET)
|
|
||||||
add_custom_target(doc)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
add_dependencies(doc doxygen)
|
|
||||||
endif()
|
|
||||||
23
cmake/Toolchain-cross-m32.cmake
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
set(CMAKE_C_FLAGS "-m32" CACHE STRING "C compiler flags" FORCE)
|
||||||
|
set(CMAKE_CXX_FLAGS "-m32" CACHE STRING "C++ compiler flags" FORCE)
|
||||||
|
|
||||||
|
set(LIB32 /usr/lib) # Fedora
|
||||||
|
|
||||||
|
if(EXISTS /usr/lib32)
|
||||||
|
set(LIB32 /usr/lib32) # Arch, Solus
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_SYSTEM_LIBRARY_PATH ${LIB32} CACHE STRING "system library search path" FORCE)
|
||||||
|
set(CMAKE_LIBRARY_PATH ${LIB32} CACHE STRING "library search path" FORCE)
|
||||||
|
|
||||||
|
# this is probably unlikely to be needed, but just in case
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "executable linker flags" FORCE)
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "shared library linker flags" FORCE)
|
||||||
|
set(CMAKE_MODULE_LINKER_FLAGS "-m32 -L${LIB32}" CACHE STRING "module linker flags" FORCE)
|
||||||
|
|
||||||
|
# on Fedora and Arch and similar, point pkgconfig at 32 bit .pc files. We have
|
||||||
|
# to include the regular system .pc files as well (at the end), because some
|
||||||
|
# are not always present in the 32 bit directory
|
||||||
|
if(EXISTS ${LIB32}/pkgconfig)
|
||||||
|
set(ENV{PKG_CONFIG_LIBDIR} ${LIB32}/pkgconfig:/usr/share/pkgconfig:/usr/lib/pkgconfig:/usr/lib64/pkgconfig)
|
||||||
|
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}"
|
||||||
@@ -17,15 +17,42 @@
|
|||||||
/* Define to 1 if you have the <argp.h> header file. */
|
/* Define to 1 if you have the <argp.h> header file. */
|
||||||
#cmakedefine HAVE_ARGP_H 1
|
#cmakedefine HAVE_ARGP_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <aprpa/inet.h> header file. */
|
||||||
|
#cmakedefine HAVE_ARPA_INET_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <glob.h> header file. */
|
||||||
|
#cmakedefine HAVE_GLOB_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
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <utmp.h> header file. */
|
||||||
|
#cmakedefine HAVE_UTMP_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <util.h> header file. */
|
||||||
|
#cmakedefine HAVE_UTIL_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <libutil.h> header file. */
|
||||||
|
#cmakedefine HAVE_LIBUTIL_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_TIME_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <sys/utime.h> header file. */
|
||||||
|
#cmakedefine HAVE_SYS_UTIME_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <io.h> header file. */
|
||||||
|
#cmakedefine HAVE_IO_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <termios.h> header file. */
|
/* Define to 1 if you have the <termios.h> header file. */
|
||||||
#cmakedefine HAVE_TERMIOS_H 1
|
#cmakedefine HAVE_TERMIOS_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
/* Define to 1 if you have the <unistd.h> header file. */
|
||||||
#cmakedefine HAVE_UNISTD_H 1
|
#cmakedefine HAVE_UNISTD_H 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <stdint.h> header file. */
|
||||||
|
#cmakedefine HAVE_STDINT_H 1
|
||||||
|
|
||||||
/* Define to 1 if you have the <openssl/aes.h> header file. */
|
/* Define to 1 if you have the <openssl/aes.h> header file. */
|
||||||
#cmakedefine HAVE_OPENSSL_AES_H 1
|
#cmakedefine HAVE_OPENSSL_AES_H 1
|
||||||
|
|
||||||
@@ -59,8 +86,26 @@
|
|||||||
/* Define to 1 if you have eliptic curve cryptography */
|
/* Define to 1 if you have eliptic curve cryptography */
|
||||||
#cmakedefine HAVE_ECC 1
|
#cmakedefine HAVE_ECC 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have DSA */
|
||||||
|
#cmakedefine HAVE_DSA 1
|
||||||
|
|
||||||
/*************************** FUNCTIONS ***************************/
|
/*************************** FUNCTIONS ***************************/
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `EVP_aes128_ctr' function. */
|
||||||
|
#cmakedefine HAVE_OPENSSL_EVP_AES_CTR 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `EVP_aes128_cbc' function. */
|
||||||
|
#cmakedefine HAVE_OPENSSL_EVP_AES_CBC 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `CRYPTO_THREADID_set_callback' function. */
|
||||||
|
#cmakedefine HAVE_OPENSSL_CRYPTO_THREADID_SET_CALLBACK 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `CRYPTO_ctr128_encrypt' function. */
|
||||||
|
#cmakedefine HAVE_OPENSSL_CRYPTO_CTR128_ENCRYPT 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `EVP_CIPHER_CTX_new' function. */
|
||||||
|
#cmakedefine HAVE_OPENSSL_EVP_CIPHER_CTX_NEW 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
|
||||||
|
|
||||||
@@ -79,9 +124,15 @@
|
|||||||
/* Define to 1 if you have the `_vsnprintf_s' function. */
|
/* Define to 1 if you have the `_vsnprintf_s' function. */
|
||||||
#cmakedefine HAVE__VSNPRINTF_S 1
|
#cmakedefine HAVE__VSNPRINTF_S 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `isblank' function. */
|
||||||
|
#cmakedefine HAVE_ISBLANK 1
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
||||||
@@ -112,6 +163,18 @@
|
|||||||
/* Define to 1 if you have the `_strtoui64' function. */
|
/* Define to 1 if you have the `_strtoui64' function. */
|
||||||
#cmakedefine HAVE__STRTOUI64 1
|
#cmakedefine HAVE__STRTOUI64 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `glob' function. */
|
||||||
|
#cmakedefine HAVE_GLOB 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `explicit_bzero' function. */
|
||||||
|
#cmakedefine HAVE_EXPLICIT_BZERO 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `memset_s' function. */
|
||||||
|
#cmakedefine HAVE_MEMSET_S 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `SecureZeroMemory' function. */
|
||||||
|
#cmakedefine HAVE_SECURE_ZERO_MEMORY 1
|
||||||
|
|
||||||
/*************************** LIBRARIES ***************************/
|
/*************************** LIBRARIES ***************************/
|
||||||
|
|
||||||
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
/* Define to 1 if you have the `crypto' library (-lcrypto). */
|
||||||
@@ -120,16 +183,29 @@
|
|||||||
/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */
|
/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */
|
||||||
#cmakedefine HAVE_LIBGCRYPT 1
|
#cmakedefine HAVE_LIBGCRYPT 1
|
||||||
|
|
||||||
|
/* Define to 1 if you have the 'mbedTLS' library (-lmbedtls). */
|
||||||
|
#cmakedefine HAVE_LIBMBEDCRYPTO 1
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
||||||
|
|
||||||
/**************************** 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_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__FUNCTION__ 1
|
||||||
|
|
||||||
|
#cmakedefine HAVE_GCC_BOUNDED_ATTRIBUTE 1
|
||||||
|
|
||||||
/* Define to 1 if you want to enable GSSAPI */
|
/* Define to 1 if you want to enable GSSAPI */
|
||||||
#cmakedefine WITH_GSSAPI 1
|
#cmakedefine WITH_GSSAPI 1
|
||||||
@@ -140,21 +216,24 @@
|
|||||||
/* Define to 1 if you want to enable SFTP */
|
/* Define to 1 if you want to enable SFTP */
|
||||||
#cmakedefine WITH_SFTP 1
|
#cmakedefine WITH_SFTP 1
|
||||||
|
|
||||||
/* Define to 1 if you want to enable SSH1 */
|
|
||||||
#cmakedefine WITH_SSH1 1
|
|
||||||
|
|
||||||
/* 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 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
|
||||||
|
|
||||||
|
/* Define to 1 if you want to enable debug output for packet functions */
|
||||||
|
#cmakedefine DEBUG_PACKET 1
|
||||||
|
|
||||||
/* Define to 1 if you want to enable pcap output support (experimental) */
|
/* Define to 1 if you want to enable pcap output support (experimental) */
|
||||||
#cmakedefine WITH_PCAP 1
|
#cmakedefine WITH_PCAP 1
|
||||||
|
|
||||||
/* Define to 1 if you want to enable calltrace debug output */
|
/* Define to 1 if you want to enable calltrace debug output */
|
||||||
#cmakedefine DEBUG_CALLTRACE 1
|
#cmakedefine DEBUG_CALLTRACE 1
|
||||||
|
|
||||||
|
/* Define to 1 if you want to enable NaCl support */
|
||||||
|
#cmakedefine WITH_NACL 1
|
||||||
|
|
||||||
/*************************** ENDIAN *****************************/
|
/*************************** ENDIAN *****************************/
|
||||||
|
|
||||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ The ssh_userauth_publickey_auto() function also tries to authenticate using the
|
|||||||
SSH agent, if you have one running, or the "none" method otherwise.
|
SSH agent, if you have one running, or the "none" method otherwise.
|
||||||
|
|
||||||
If you wish to authenticate with public key by your own, follow these steps:
|
If you wish to authenticate with public key by your own, follow these steps:
|
||||||
- Retrieve the public key with ssh_import_pubkey_file().
|
- Retrieve the public key with ssh_pki_import_pubkey_file().
|
||||||
- Offer the public key to the SSH server using ssh_userauth_try_publickey().
|
- Offer the public key to the SSH server using ssh_userauth_try_publickey().
|
||||||
If the return value is SSH_AUTH_SUCCESS, the SSH server accepts to
|
If the return value is SSH_AUTH_SUCCESS, the SSH server accepts to
|
||||||
authenticate using the public key and you can go to the next step.
|
authenticate using the public key and you can go to the next step.
|
||||||
@@ -285,7 +285,7 @@ int authenticate_kbdint(ssh_session session)
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = ssh_userauth_none(session, NULL, NULL);
|
rc = ssh_userauth_none(session, NULL);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
@@ -304,8 +304,8 @@ int test_several_auth_methods(ssh_session session)
|
|||||||
{
|
{
|
||||||
int method, rc;
|
int method, rc;
|
||||||
|
|
||||||
rc = ssh_userauth_none(session, NULL, NULL);
|
rc = ssh_userauth_none(session, NULL);
|
||||||
if (rc != SSH_AUTH_SUCCESS) {
|
if (rc == SSH_AUTH_SUCCESS || rc == SSH_AUTH_ERROR) {
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ If an error has been encountered, it returns a negative value:
|
|||||||
|
|
||||||
@code
|
@code
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
unsigned int nbytes;
|
int nbytes;
|
||||||
|
|
||||||
nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0);
|
nbytes = ssh_channel_read(channel, buffer, sizeof(buffer), 0);
|
||||||
while (nbytes > 0)
|
while (nbytes > 0)
|
||||||
|
|||||||
119
doc/curve25519-sha256@libssh.org.txt
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
curve25519-sha256@libssh.org.txt Aris Adamantiadis <aris@badcode.be>
|
||||||
|
21/9/2013
|
||||||
|
|
||||||
|
1. Introduction
|
||||||
|
|
||||||
|
This document describes the key exchange methode curve25519-sha256@libssh.org
|
||||||
|
for SSH version 2 protocol. It is provided as an alternative to the existing
|
||||||
|
key exchange mechanisms based on either Diffie-Hellman or Elliptic Curve Diffie-
|
||||||
|
Hellman [RFC5656].
|
||||||
|
The reason is the following : During summer of 2013, revelations from ex-
|
||||||
|
consultant at NSA Edward Snowden gave proof that NSA willingly inserts backdoors
|
||||||
|
into softwares, hardware components and published standards. While it is still
|
||||||
|
believed that the mathematics behind ECC cryptography are still sound and solid,
|
||||||
|
some people (including Bruce Schneier [SCHNEIER]), showed their lack of confidence
|
||||||
|
in NIST-published curves such as nistp256, nistp384, nistp521, for which constant
|
||||||
|
parameters (including the generator point) are defined without explanation. It
|
||||||
|
is also believed that NSA had a word to say in their definition. These curves
|
||||||
|
are not the most secure or fastest possible for their key sizes [DJB], and
|
||||||
|
researchers think it is possible that NSA have ways of cracking NIST curves.
|
||||||
|
It is also interesting to note that SSH belongs to the list of protocols the NSA
|
||||||
|
claims to be able to eavesdrop. Having a secure replacement would make passive
|
||||||
|
attacks much harder if such a backdoor exists.
|
||||||
|
|
||||||
|
However an alternative exists in the form of Curve25519. This algorithm has been
|
||||||
|
proposed in 2006 by DJB [Curve25519]. Its main strengths are its speed, its
|
||||||
|
constant-time run time (and resistance against side-channel attacks), and its
|
||||||
|
lack of nebulous hard-coded constants.
|
||||||
|
|
||||||
|
The reference version being used in this document is the one described in
|
||||||
|
[Curve25519] as implemented in the library NaCl [NaCl].
|
||||||
|
This document does not attempt to provide alternatives to the ecdsa-sha1-*
|
||||||
|
authentication keys.
|
||||||
|
|
||||||
|
2. Key exchange
|
||||||
|
|
||||||
|
The key exchange procedure is very similar to the one described chapter 4 of
|
||||||
|
[RFC5656]. Public ephemeral keys are transmitted over SSH encapsulated into
|
||||||
|
standard SSH strings.
|
||||||
|
|
||||||
|
The following is an overview of the key exchange process:
|
||||||
|
|
||||||
|
Client Server
|
||||||
|
------ ------
|
||||||
|
Generate ephemeral key pair.
|
||||||
|
SSH_MSG_KEX_ECDH_INIT -------->
|
||||||
|
Verify that client public key
|
||||||
|
length is 32 bytes.
|
||||||
|
Generate ephemeral key pair.
|
||||||
|
Compute shared secret.
|
||||||
|
Generate and sign exchange hash.
|
||||||
|
<-------- SSH_MSG_KEX_ECDH_REPLY
|
||||||
|
Verify that server public key length is 32 bytes.
|
||||||
|
* Verify host keys belong to server.
|
||||||
|
Compute shared secret.
|
||||||
|
Generate exchange hash.
|
||||||
|
Verify server's signature.
|
||||||
|
|
||||||
|
* Optional but strongly recommanded as this protects against MITM attacks.
|
||||||
|
|
||||||
|
This is implemented using the same messages as described in RFC5656 chapter 4
|
||||||
|
|
||||||
|
3. Method Name
|
||||||
|
|
||||||
|
The name of this key exchange method is "curve25519-sha256@libssh.org".
|
||||||
|
|
||||||
|
4. Implementation considerations
|
||||||
|
|
||||||
|
The whole method is based on the curve25519 scalar multiplication. In this
|
||||||
|
method, a private key is a scalar of 256 bits, and a public key is a point
|
||||||
|
of 256 bits.
|
||||||
|
|
||||||
|
4.1. Private key generation
|
||||||
|
|
||||||
|
A 32 bytes private key should be generated for each new connection,
|
||||||
|
using a secure PRNG. The following actions must be done on the private key:
|
||||||
|
mysecret[0] &= 248;
|
||||||
|
mysecret[31] &= 127;
|
||||||
|
mysecret[31] |= 64;
|
||||||
|
In order to keep the key valid. However, many cryptographic libraries will do
|
||||||
|
this automatically.
|
||||||
|
It should be noted that, in opposition to NIST curves, no special validation
|
||||||
|
should be done to ensure the result is a valid and secure private key.
|
||||||
|
|
||||||
|
4.2 Public key generation
|
||||||
|
|
||||||
|
The 32 bytes public key of either a client or a server must be generated using
|
||||||
|
the 32 bytes private key and a common generator base. This base is defined as 9
|
||||||
|
followed by all zeroes:
|
||||||
|
const unsigned char basepoint[32] = {9};
|
||||||
|
|
||||||
|
The public key is calculated using the cryptographic scalar multiplication:
|
||||||
|
const unsigned char privkey[32];
|
||||||
|
unsigned char pubkey[32];
|
||||||
|
crypto_scalarmult (pubkey, privkey, basepoint);
|
||||||
|
However some cryptographic libraries may provide a combined function:
|
||||||
|
crypto_scalarmult_base (pubkey, privkey);
|
||||||
|
|
||||||
|
It should be noted that, in opposition to NIST curves, no special validation
|
||||||
|
should be done to ensure the received public keys are valid curves point. The
|
||||||
|
Curve25519 algorithm ensure that every possible public key maps to a valid
|
||||||
|
ECC Point.
|
||||||
|
|
||||||
|
4.3 Shared secret generation
|
||||||
|
|
||||||
|
The shared secret, k, is defined in SSH specifications to be a big integer.
|
||||||
|
This number is calculated using the following procedure:
|
||||||
|
|
||||||
|
X is the 32 bytes point obtained by the scalar multiplication of the other
|
||||||
|
side's public key and the local private key scalar.
|
||||||
|
|
||||||
|
The whole 32 bytes of the number X are then converted into a big integer k.
|
||||||
|
This conversion follows the network byte order. This step differs from
|
||||||
|
RFC5656.
|
||||||
|
|
||||||
|
[RFC5656] http://tools.ietf.org/html/rfc5656
|
||||||
|
[SCHNEIER] https://www.schneier.com/blog/archives/2013/09/the_nsa_is_brea.html#c1675929
|
||||||
|
[DJB] http://cr.yp.to/talks/2013.05.31/slides-dan+tanja-20130531-4x3.pdf
|
||||||
|
[Curve25519] "Curve25519: new Diffie-Hellman speed records."
|
||||||
|
http://cr.yp.to/ecdh/curve25519-20060209.pdf
|
||||||
1917
doc/doxy.config.in
1546
doc/doxy.trac.in
@@ -144,10 +144,10 @@ or whatever use you have for it.
|
|||||||
|
|
||||||
@subsection libssh_reverse Doing reverse port forwarding with libssh
|
@subsection libssh_reverse Doing reverse port forwarding with libssh
|
||||||
|
|
||||||
To do reverse port forwarding, call ssh_forward_listen(),
|
To do reverse port forwarding, call ssh_channel_listen_forward(),
|
||||||
then ssh_forward_accept().
|
then ssh_channel_accept_forward().
|
||||||
|
|
||||||
When you call ssh_forward_listen(), 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-priviledged port it should listen to. Otherwise, you can chose
|
||||||
your own priviledged or non-priviledged port. Beware that you should have
|
your own priviledged or non-priviledged port. Beware that you should have
|
||||||
administrative priviledges on the remote server to open a priviledged port
|
administrative priviledges on the remote server to open a priviledged port
|
||||||
@@ -164,6 +164,7 @@ int web_server(ssh_session session)
|
|||||||
ssh_channel channel;
|
ssh_channel channel;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
int nbytes, nwritten;
|
int nbytes, nwritten;
|
||||||
|
int port = 0;
|
||||||
char *helloworld = ""
|
char *helloworld = ""
|
||||||
"HTTP/1.1 200 OK\n"
|
"HTTP/1.1 200 OK\n"
|
||||||
"Content-Type: text/html\n"
|
"Content-Type: text/html\n"
|
||||||
@@ -178,7 +179,7 @@ int web_server(ssh_session session)
|
|||||||
" </body>\n"
|
" </body>\n"
|
||||||
"</html>\n";
|
"</html>\n";
|
||||||
|
|
||||||
rc = ssh_forward_listen(session, NULL, 8080, NULL);
|
rc = ssh_channel_listen_forward(session, NULL, 8080, NULL);
|
||||||
if (rc != SSH_OK)
|
if (rc != SSH_OK)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error opening remote port: %s\n",
|
fprintf(stderr, "Error opening remote port: %s\n",
|
||||||
@@ -186,7 +187,7 @@ int web_server(ssh_session session)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
channel = ssh_forward_accept(session, 60000);
|
channel = ssh_channel_accept_forward(session, 60000, &port);
|
||||||
if (channel == NULL)
|
if (channel == NULL)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error waiting for incoming connection: %s\n",
|
fprintf(stderr, "Error waiting for incoming connection: %s\n",
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ you just connected to is known and safe to use (remember, SSH is about security
|
|||||||
authentication).
|
authentication).
|
||||||
|
|
||||||
There are two ways of doing this:
|
There are two ways of doing this:
|
||||||
- The first way (recommended) is to use the ssh_is_server_known()
|
- The first way (recommended) is to use the ssh_session_is_known_server()
|
||||||
function. This function will look into the known host file
|
function. This function will look into the known host file
|
||||||
(~/.ssh/known_hosts on UNIX), look for the server hostname's pattern,
|
(~/.ssh/known_hosts on UNIX), look for the server hostname's pattern,
|
||||||
and determine whether this host is present or not in the list.
|
and determine whether this host is present or not in the list.
|
||||||
@@ -185,74 +185,89 @@ examples/ directory:
|
|||||||
|
|
||||||
int verify_knownhost(ssh_session session)
|
int verify_knownhost(ssh_session session)
|
||||||
{
|
{
|
||||||
int state, hlen;
|
enum ssh_known_hosts_e state;
|
||||||
unsigned char *hash = NULL;
|
unsigned char *hash = NULL;
|
||||||
char *hexa;
|
ssh_key srv_pubkey = NULL;
|
||||||
char buf[10];
|
size_t hlen;
|
||||||
|
char buf[10];
|
||||||
|
char *hexa;
|
||||||
|
char *p;
|
||||||
|
int cmp;
|
||||||
|
int rc;
|
||||||
|
|
||||||
state = ssh_is_server_known(session);
|
rc = ssh_get_server_publickey(session, &srv_pubkey);
|
||||||
|
if (rc < 0) {
|
||||||
hlen = ssh_get_pubkey_hash(session, &hash);
|
|
||||||
if (hlen < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
switch (state)
|
|
||||||
{
|
|
||||||
case SSH_SERVER_KNOWN_OK:
|
|
||||||
break; /* ok */
|
|
||||||
|
|
||||||
case SSH_SERVER_KNOWN_CHANGED:
|
|
||||||
fprintf(stderr, "Host key for server changed: it is now:\n");
|
|
||||||
ssh_print_hexa("Public key hash", hash, hlen);
|
|
||||||
fprintf(stderr, "For security reasons, connection will be stopped\n");
|
|
||||||
free(hash);
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
case SSH_SERVER_FOUND_OTHER:
|
|
||||||
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 into thinking the key does not exist\n");
|
|
||||||
free(hash);
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
case SSH_SERVER_FILE_NOT_FOUND:
|
|
||||||
fprintf(stderr, "Could not find known host file.\n");
|
|
||||||
fprintf(stderr, "If you accept the host key here, the file will be"
|
|
||||||
"automatically created.\n");
|
|
||||||
/* fallback to SSH_SERVER_NOT_KNOWN behavior */
|
|
||||||
|
|
||||||
case SSH_SERVER_NOT_KNOWN:
|
|
||||||
hexa = ssh_get_hexa(hash, hlen);
|
|
||||||
fprintf(stderr,"The server is unknown. Do you trust the host key?\n");
|
|
||||||
fprintf(stderr, "Public key hash: %s\n", hexa);
|
|
||||||
free(hexa);
|
|
||||||
if (fgets(buf, sizeof(buf), stdin) == NULL)
|
|
||||||
{
|
|
||||||
free(hash);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (strncasecmp(buf, "yes", 3) != 0)
|
|
||||||
{
|
|
||||||
free(hash);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (ssh_write_knownhost(session) < 0)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Error %s\n", strerror(errno));
|
|
||||||
free(hash);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSH_SERVER_ERROR:
|
rc = ssh_get_publickey_hash(srv_pubkey,
|
||||||
fprintf(stderr, "Error %s", ssh_get_error(session));
|
SSH_PUBLICKEY_HASH_SHA1,
|
||||||
free(hash);
|
&hash,
|
||||||
return -1;
|
&hlen);
|
||||||
}
|
ssh_key_free(srv_pubkey);
|
||||||
|
if (rc < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
free(hash);
|
state = ssh_session_is_known_server(session);
|
||||||
return 0;
|
switch (state) {
|
||||||
|
case SSH_KNOWN_HOSTS_OK:
|
||||||
|
/* OK */
|
||||||
|
|
||||||
|
break;
|
||||||
|
case SSH_KNOWN_HOSTS_CHANGED:
|
||||||
|
fprintf(stderr, "Host key for server changed: it is now:\n");
|
||||||
|
ssh_print_hexa("Public key hash", hash, hlen);
|
||||||
|
fprintf(stderr, "For security reasons, connection will be stopped\n");
|
||||||
|
ssh_clean_pubkey_hash(&hash);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
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, "An attacker might change the default server key to"
|
||||||
|
"confuse your client into thinking the key does not exist\n");
|
||||||
|
ssh_clean_pubkey_hash(&hash);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
case SSH_KNOWN_HOSTS_NOT_FOUND:
|
||||||
|
fprintf(stderr, "Could not find known host file.\n");
|
||||||
|
fprintf(stderr, "If you accept the host key here, the file will be"
|
||||||
|
"automatically created.\n");
|
||||||
|
|
||||||
|
/* FALL THROUGH to SSH_SERVER_NOT_KNOWN behavior */
|
||||||
|
|
||||||
|
case SSH_KNOWN_HOSTS_UNKNOWN:
|
||||||
|
hexa = ssh_get_hexa(hash, hlen);
|
||||||
|
fprintf(stderr,"The server is unknown. Do you trust the host key?\n");
|
||||||
|
fprintf(stderr, "Public key hash: %s\n", hexa);
|
||||||
|
ssh_string_free_char(hexa);
|
||||||
|
ssh_clean_pubkey_hash(&hash);
|
||||||
|
p = fgets(buf, sizeof(buf), stdin);
|
||||||
|
if (p == NULL) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
cmp = strncasecmp(buf, "yes", 3);
|
||||||
|
if (cmp != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = ssh_session_update_known_hosts(session);
|
||||||
|
if (rc < 0) {
|
||||||
|
fprintf(stderr, "Error %s\n", strerror(errno));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case SSH_KNOWN_HOSTS_ERROR:
|
||||||
|
fprintf(stderr, "Error %s", ssh_get_error(session));
|
||||||
|
ssh_clean_pubkey_hash(&hash);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_clean_pubkey_hash(&hash);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
@@ -260,9 +275,10 @@ int verify_knownhost(ssh_session session)
|
|||||||
@see ssh_disconnect
|
@see ssh_disconnect
|
||||||
@see ssh_get_error
|
@see ssh_get_error
|
||||||
@see ssh_get_error_code
|
@see ssh_get_error_code
|
||||||
@see ssh_get_pubkey_hash
|
@see ssh_get_server_publickey
|
||||||
@see ssh_is_server_known
|
@see ssh_get_publickey_hash
|
||||||
@see ssh_write_knownhost
|
@see ssh_session_is_known_server
|
||||||
|
@see ssh_session_update_known_hosts
|
||||||
|
|
||||||
|
|
||||||
@subsection auth Authenticating the user
|
@subsection auth Authenticating the user
|
||||||
@@ -367,7 +383,7 @@ int show_remote_processes(ssh_session session)
|
|||||||
ssh_channel channel;
|
ssh_channel channel;
|
||||||
int rc;
|
int rc;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
unsigned int nbytes;
|
int nbytes;
|
||||||
|
|
||||||
channel = ssh_channel_new(session);
|
channel = ssh_channel_new(session);
|
||||||
if (channel == NULL)
|
if (channel == NULL)
|
||||||
@@ -391,7 +407,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);
|
||||||
while (nbytes > 0)
|
while (nbytes > 0)
|
||||||
{
|
{
|
||||||
if (write(1, buffer, nbytes) != nbytes)
|
if (write(1, buffer, nbytes) != (unsigned int) nbytes)
|
||||||
{
|
{
|
||||||
ssh_channel_close(channel);
|
ssh_channel_close(channel);
|
||||||
ssh_channel_free(channel);
|
ssh_channel_free(channel);
|
||||||
@@ -443,11 +459,10 @@ 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.
|
(generaly 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.
|
||||||
|
|
||||||
ssh_get_error() and ssh_get_error_code() take a ssh_session as a parameter.
|
For thread safety, errors are bound to ssh_session objects.
|
||||||
That's for thread safety, error messages that can be attached to a session
|
As long as your ssh_session object is not NULL, you can retrieve the last error
|
||||||
aren't static anymore. Any error that happens during ssh_options_xxx()
|
message and error code from the ssh_session using ssh_get_error() and
|
||||||
or ssh_connect() (i.e., outside of any session) can be retrieved by
|
ssh_get_error_code() respectively.
|
||||||
giving NULL as argument.
|
|
||||||
|
|
||||||
The SFTP subsystem has its own error codes, in addition to libssh ones.
|
The SFTP subsystem has its own error codes, in addition to libssh ones.
|
||||||
|
|
||||||
|
|||||||
@@ -19,16 +19,16 @@ the interesting functions as you go.
|
|||||||
|
|
||||||
The libssh library provides:
|
The libssh library provides:
|
||||||
|
|
||||||
- <strong>Key Exchange Methods</strong>: <i>ecdh-sha2-nistp256</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>ecdsa-sha2-nistp256</i>, ssh-dss, ssh-rsa
|
- <strong>Hostkey Types</strong>: <i>ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521</i>, ssh-dss, ssh-rsa
|
||||||
- <strong>Ciphers</strong>: <i>aes256-ctr, aes192-ctr, aes128-ctr</i>, aes256-cbc (rijndael-cbc@lysator.liu.se), aes192-cbc, aes128-cbc, 3des-cbc, des-cbc-ssh1, 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, none
|
- <strong>MAC hashes</strong>: hmac-sha1, hmac-sha2-256, hmac-sha2-384, 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>
|
||||||
- <strong>Subsystems</strong>: sftp(version 3), publickey(version 2), <i>OpenSSH Extensions</i>
|
- <strong>Subsystems</strong>: sftp(version 3), <i>OpenSSH Extensions</i>
|
||||||
- <strong>SFTP</strong>: <i>statvfs@openssh.com, fstatvfs@openssh.com</i>
|
- <strong>SFTP</strong>: <i>statvfs@openssh.com, fstatvfs@openssh.com</i>
|
||||||
- <strong>Thread-safe</strong>: Just don't share sessions
|
- <strong>Thread-safe</strong>: Just don't share sessions
|
||||||
- <strong>Non-blocking</strong>: it can be used both blocking and non-blocking
|
- <strong>Non-blocking</strong>: it can be used both blocking and non-blocking
|
||||||
@@ -184,6 +184,8 @@ It was later modified and expanded by the following RFCs.
|
|||||||
Authentication and Key Exchange for the Secure Shell (SSH) Protocol
|
Authentication and Key Exchange for the Secure Shell (SSH) Protocol
|
||||||
- <a href="http://tools.ietf.org/html/rfc4716" target="_blank">RFC 4716</a>,
|
- <a href="http://tools.ietf.org/html/rfc4716" target="_blank">RFC 4716</a>,
|
||||||
The Secure Shell (SSH) Public Key File Format
|
The Secure Shell (SSH) Public Key File Format
|
||||||
|
- <a href="http://tools.ietf.org/html/rfc5647" target="_blank">RFC 5647</a>,
|
||||||
|
AES Galois Counter Mode for the Secure Shell Transport Layer Protocol
|
||||||
- <a href="http://tools.ietf.org/html/rfc5656" target="_blank">RFC 5656</a>,
|
- <a href="http://tools.ietf.org/html/rfc5656" target="_blank">RFC 5656</a>,
|
||||||
Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
|
Elliptic Curve Algorithm Integration in the Secure Shell Transport Layer
|
||||||
|
|
||||||
@@ -203,6 +205,12 @@ do the same in libssh.
|
|||||||
|
|
||||||
@subsection main-rfc-extensions Secure Shell Extensions
|
@subsection main-rfc-extensions Secure Shell Extensions
|
||||||
|
|
||||||
|
The libssh project has an extension to support Curve25519 which is also supported by
|
||||||
|
the OpenSSH project.
|
||||||
|
|
||||||
|
- <a href="http://git.libssh.org/projects/libssh.git/tree/doc/curve25519-sha256@libssh.org.txt" target="_blank">curve25519-sha256@libssh.org</a>,
|
||||||
|
Curve25519-SHA256 for ECDH KEX
|
||||||
|
|
||||||
The OpenSSH project has defined some extensions to the protocol. We support some of
|
The OpenSSH project has defined some extensions to the protocol. We support some of
|
||||||
them like the statvfs calls in SFTP or the ssh-agent.
|
them like the statvfs calls in SFTP or the ssh-agent.
|
||||||
|
|
||||||
|
|||||||
122
doc/sftp.dox
@@ -210,52 +210,63 @@ results to come.
|
|||||||
|
|
||||||
Synchronous read is done with sftp_read().
|
Synchronous read is done with sftp_read().
|
||||||
|
|
||||||
The following example prints the contents of remote file "/etc/profile". For
|
Files are normally transferred in chunks. A good chunk size is 16 KB. The following
|
||||||
each 1024 bytes of information read, it waits until the end of the read operation:
|
example transfers the remote file "/etc/profile" in 16 KB chunks. For each chunk we
|
||||||
|
request, sftp_read blocks till the data has been received:
|
||||||
|
|
||||||
@code
|
@code
|
||||||
|
// Good chunk size
|
||||||
|
#define MAX_XFER_BUF_SIZE 16384
|
||||||
|
|
||||||
int sftp_read_sync(ssh_session session, sftp_session sftp)
|
int sftp_read_sync(ssh_session session, sftp_session sftp)
|
||||||
{
|
{
|
||||||
int access_type;
|
int access_type;
|
||||||
sftp_file file;
|
sftp_file file;
|
||||||
char buffer[1024];
|
char buffer[MAX_XFER_BUF_SIZE];
|
||||||
int nbytes, rc;
|
int nbytes, nwritten, rc;
|
||||||
|
int fd;
|
||||||
|
|
||||||
access_type = O_RDONLY;
|
access_type = O_RDONLY;
|
||||||
file = sftp_open(sftp, "/etc/profile",
|
file = sftp_open(sftp, "/etc/profile",
|
||||||
access_type, 0);
|
access_type, 0);
|
||||||
if (file == NULL)
|
if (file == NULL) {
|
||||||
{
|
fprintf(stderr, "Can't open file for reading: %s\n",
|
||||||
fprintf(stderr, "Can't open file for reading: %s\n",
|
ssh_get_error(session));
|
||||||
ssh_get_error(session));
|
|
||||||
return SSH_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
nbytes = sftp_read(file, buffer, sizeof(buffer));
|
|
||||||
while (nbytes > 0)
|
|
||||||
{
|
|
||||||
if (write(1, buffer, nbytes) != nbytes)
|
|
||||||
{
|
|
||||||
sftp_close(file);
|
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
}
|
|
||||||
nbytes = sftp_read(file, buffer, sizeof(buffer));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbytes < 0)
|
fd = open("/path/to/profile", O_CREAT);
|
||||||
{
|
if (fd < 0) {
|
||||||
fprintf(stderr, "Error while reading file: %s\n",
|
fprintf(stderr, "Can't open file for writing: %s\n",
|
||||||
ssh_get_error(session));
|
strerror(errno));
|
||||||
sftp_close(file);
|
return SSH_ERROR;
|
||||||
return SSH_ERROR;
|
}
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
nbytes = sftp_read(file, buffer, sizeof(buffer));
|
||||||
|
if (nbytes == 0) {
|
||||||
|
break; // EOF
|
||||||
|
} else if (nbytes < 0) {
|
||||||
|
fprintf(stderr, "Error while reading file: %s\n",
|
||||||
|
ssh_get_error(session));
|
||||||
|
sftp_close(file);
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
nwritten = write(fd, buffer, nbytes);
|
||||||
|
if (nwritten != nbytes) {
|
||||||
|
fprintf(stderr, "Error writing: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
sftp_close(file);
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = sftp_close(file);
|
rc = sftp_close(file);
|
||||||
if (rc != SSH_OK)
|
if (rc != SSH_OK) {
|
||||||
{
|
fprintf(stderr, "Can't close the read file: %s\n",
|
||||||
fprintf(stderr, "Can't close the read file: %s\n",
|
ssh_get_error(session));
|
||||||
ssh_get_error(session));
|
return rc;
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return SSH_OK;
|
return SSH_OK;
|
||||||
@@ -271,14 +282,17 @@ sftp_async_read() waits for the data to come. To open a file in nonblocking mode
|
|||||||
call sftp_file_set_nonblocking() right after you opened it. Default is blocking mode.
|
call sftp_file_set_nonblocking() right after you opened it. Default is blocking mode.
|
||||||
|
|
||||||
The example below reads a very big file in asynchronous, nonblocking, mode. Each
|
The example below reads a very big file in asynchronous, nonblocking, mode. Each
|
||||||
time the data are not ready yet, a counter is incrementer.
|
time the data is not ready yet, a counter is incremented.
|
||||||
|
|
||||||
@code
|
@code
|
||||||
|
// Good chunk size
|
||||||
|
#define MAX_XFER_BUF_SIZE 16384
|
||||||
|
|
||||||
int sftp_read_async(ssh_session session, sftp_session sftp)
|
int sftp_read_async(ssh_session session, sftp_session sftp)
|
||||||
{
|
{
|
||||||
int access_type;
|
int access_type;
|
||||||
sftp_file file;
|
sftp_file file;
|
||||||
char buffer[1024];
|
char buffer[MAX_XFER_BUF_SIZE];
|
||||||
int async_request;
|
int async_request;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
long counter;
|
long counter;
|
||||||
@@ -287,8 +301,7 @@ int sftp_read_async(ssh_session session, sftp_session sftp)
|
|||||||
access_type = O_RDONLY;
|
access_type = O_RDONLY;
|
||||||
file = sftp_open(sftp, "some_very_big_file",
|
file = sftp_open(sftp, "some_very_big_file",
|
||||||
access_type, 0);
|
access_type, 0);
|
||||||
if (file == NULL)
|
if (file == NULL) {
|
||||||
{
|
|
||||||
fprintf(stderr, "Can't open file for reading: %s\n",
|
fprintf(stderr, "Can't open file for reading: %s\n",
|
||||||
ssh_get_error(session));
|
ssh_get_error(session));
|
||||||
return SSH_ERROR;
|
return SSH_ERROR;
|
||||||
@@ -298,27 +311,31 @@ int sftp_read_async(ssh_session session, sftp_session sftp)
|
|||||||
async_request = sftp_async_read_begin(file, sizeof(buffer));
|
async_request = sftp_async_read_begin(file, sizeof(buffer));
|
||||||
counter = 0L;
|
counter = 0L;
|
||||||
usleep(10000);
|
usleep(10000);
|
||||||
if (async_request >= 0)
|
if (async_request >= 0) {
|
||||||
nbytes = sftp_async_read(file, buffer, sizeof(buffer),
|
nbytes = sftp_async_read(file, buffer, sizeof(buffer),
|
||||||
async_request);
|
async_request);
|
||||||
else nbytes = -1;
|
} else {
|
||||||
while (nbytes > 0 || nbytes == SSH_AGAIN)
|
nbytes = -1;
|
||||||
{
|
|
||||||
if (nbytes > 0)
|
|
||||||
{
|
|
||||||
write(1, buffer, nbytes);
|
|
||||||
async_request = sftp_async_read_begin(file, sizeof(buffer));
|
|
||||||
}
|
|
||||||
else counter++;
|
|
||||||
usleep(10000);
|
|
||||||
if (async_request >= 0)
|
|
||||||
nbytes = sftp_async_read(file, buffer, sizeof(buffer),
|
|
||||||
async_request);
|
|
||||||
else nbytes = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nbytes < 0)
|
while (nbytes > 0 || nbytes == SSH_AGAIN) {
|
||||||
{
|
if (nbytes > 0) {
|
||||||
|
write(1, buffer, nbytes);
|
||||||
|
async_request = sftp_async_read_begin(file, sizeof(buffer));
|
||||||
|
} else {
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
usleep(10000);
|
||||||
|
|
||||||
|
if (async_request >= 0) {
|
||||||
|
nbytes = sftp_async_read(file, buffer, sizeof(buffer),
|
||||||
|
async_request);
|
||||||
|
} else {
|
||||||
|
nbytes = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nbytes < 0) {
|
||||||
fprintf(stderr, "Error while reading file: %s\n",
|
fprintf(stderr, "Error while reading file: %s\n",
|
||||||
ssh_get_error(session));
|
ssh_get_error(session));
|
||||||
sftp_close(file);
|
sftp_close(file);
|
||||||
@@ -328,8 +345,7 @@ int sftp_read_async(ssh_session session, sftp_session sftp)
|
|||||||
printf("The counter has reached value: %ld\n", counter);
|
printf("The counter has reached value: %ld\n", counter);
|
||||||
|
|
||||||
rc = sftp_close(file);
|
rc = sftp_close(file);
|
||||||
if (rc != SSH_OK)
|
if (rc != SSH_OK) {
|
||||||
{
|
|
||||||
fprintf(stderr, "Can't close the read file: %s\n",
|
fprintf(stderr, "Can't close the read file: %s\n",
|
||||||
ssh_get_error(session));
|
ssh_get_error(session));
|
||||||
return rc;
|
return rc;
|
||||||
|
|||||||
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);
|
||||||
69
doc/that_style/sass/_fragment_base.scss
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
Basic styling for fragments shared by all themes.
|
||||||
|
*/
|
||||||
|
|
||||||
|
div.fragment {
|
||||||
|
padding: 0;
|
||||||
|
margin: 4px 8px 4px 2px;
|
||||||
|
color: #bebebe;
|
||||||
|
background-color: #323232;
|
||||||
|
border: 3px solid #e8e8e8;
|
||||||
|
border-radius: 2px;
|
||||||
|
overflow-y: hidden;
|
||||||
|
overflow-x: auto;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
div.line {
|
||||||
|
font-family: monospace, fixed;
|
||||||
|
font-size: 13px;
|
||||||
|
min-height: 13px;
|
||||||
|
line-height: 1.0;
|
||||||
|
text-indent: -53px;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 1px 0 1px 53px;
|
||||||
|
white-space: pre;
|
||||||
|
|
||||||
|
@include transition-property(background-color);
|
||||||
|
@include transition-duration(0s);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
// insert linefeed
|
||||||
|
content:"\000A";
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span.lineno {
|
||||||
|
padding-right: 4px;
|
||||||
|
text-align: right;
|
||||||
|
color: black;
|
||||||
|
height: 100px;
|
||||||
|
white-space: pre;
|
||||||
|
border-right: 3px solid #1d7567;
|
||||||
|
background-color: #a0a0a0;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.lineno a, span.lineno a:visited {
|
||||||
|
background-color: inherit;
|
||||||
|
color: #1e595a;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.lineno a:hover {
|
||||||
|
background-color: #C8C8C8;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lineno {
|
||||||
|
-webkit-touch-callout: none;
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-khtml-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
80
doc/that_style/sass/_fragment_color.scss
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
// colours of code view
|
||||||
|
|
||||||
|
div.fragment {
|
||||||
|
color: #bebebe;
|
||||||
|
background-color: #323232;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.fragment::before {
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
border-right: 1px solid #3e3e3e;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.line:hover {
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.lineno {
|
||||||
|
color: #969696;
|
||||||
|
background-color: #1a1a1a;
|
||||||
|
border-right: 1px solid #3e3e3e;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.lineno a, span.lineno a:visited {
|
||||||
|
background-color: inherit;
|
||||||
|
color: #dcdcdc;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.lineno a:hover {
|
||||||
|
background-color: #323232;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// syntax highlighting
|
||||||
|
|
||||||
|
a.code, a.code:visited {
|
||||||
|
color: #6cc7eb;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.codeRef, a.codeRef:visited {
|
||||||
|
color: #3d95e6;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.keyword {
|
||||||
|
color: #98f77a;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.keywordtype {
|
||||||
|
color: #ffa0a0;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.keywordflow {
|
||||||
|
color: #98f77a;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.comment {
|
||||||
|
// color: #dadbb1;
|
||||||
|
color: #999;
|
||||||
|
font-style: oblique;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.preprocessor {
|
||||||
|
color: #cd5c57;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.stringliteral {
|
||||||
|
color: #64b041;
|
||||||
|
}
|
||||||
|
|
||||||
|
span.charliteral {
|
||||||
|
color: #64b041;
|
||||||
|
}
|
||||||
|
|
||||||
|
blockquote {
|
||||||
|
background-color: #F7F8FB;
|
||||||
|
border-left: 2px solid #9CAFD4;
|
||||||
|
margin: 0 24px 0 4px;
|
||||||
|
padding: 0 12px 0 16px;
|
||||||
|
}
|
||||||
70
doc/that_style/sass/_menu_bar.scss
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* The main menu at the top
|
||||||
|
*/
|
||||||
|
|
||||||
|
#main-menu {
|
||||||
|
background-image: none;
|
||||||
|
background: $background-color-dark;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sm-dox {
|
||||||
|
// :not(:last-child) -> do not style search box
|
||||||
|
&> li:not(:last-child) > a {
|
||||||
|
background-image: none;
|
||||||
|
text-shadow: none;
|
||||||
|
color: white;
|
||||||
|
font-weight: normal;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-size: 11pt;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
&> li:not(:last-child) > a:hover,
|
||||||
|
&> li:not(:last-child) > a.highlighted {
|
||||||
|
background-color: $primary-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
a span.sub-arrow {
|
||||||
|
// this sets the color of the arrow
|
||||||
|
border-color: white transparent transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
// sub menus
|
||||||
|
border: none;
|
||||||
|
@include border-radius(0 !important);
|
||||||
|
padding: 0;
|
||||||
|
background: $background-color-dark;
|
||||||
|
@include box-shadow(0 0 4px rgba(0,0,0,0.35), 0 0 8px rgba(0,0,0,0.2));
|
||||||
|
|
||||||
|
a {
|
||||||
|
background: inherit;
|
||||||
|
color: white;
|
||||||
|
font-weight: normal;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
background: $primary-color;
|
||||||
|
color: white;
|
||||||
|
font-weight: normal;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.highlighted {
|
||||||
|
background: $primary-color;
|
||||||
|
color: white;
|
||||||
|
font-weight: normal;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
a span.sub-arrow {
|
||||||
|
/* this sets the color of the arrow */
|
||||||
|
border-color: white transparent transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
33
doc/that_style/sass/_mixins.scss
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
@mixin box-shadow($args...) {
|
||||||
|
-moz-box-shadow: $args;
|
||||||
|
-webkit-box-shadow: $args;
|
||||||
|
-o-box-shadow: $args;
|
||||||
|
box-shadow: $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin border-radius($args...) {
|
||||||
|
-moz-border-radius: $args;
|
||||||
|
-webkit-border-radius: $args;
|
||||||
|
border-radius: $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin transition($args...) {
|
||||||
|
-webkit-transition: $args;
|
||||||
|
-moz-transition: $args;
|
||||||
|
-o-transition: $args;
|
||||||
|
transition: $args;
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin transition-property($arg) {
|
||||||
|
-webkit-transition: $arg;
|
||||||
|
-moz-transition: $arg;
|
||||||
|
-o-transition: $arg;
|
||||||
|
transition: $arg;
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin transition-duration($arg) {
|
||||||
|
-webkit-duration: $arg;
|
||||||
|
-moz-duration: $arg;
|
||||||
|
-o-duration: $arg;
|
||||||
|
duration: $arg;
|
||||||
|
}
|
||||||
72
doc/that_style/sass/_nav_tree.scss
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* The tree view on the left
|
||||||
|
*/
|
||||||
|
|
||||||
|
.arrow {
|
||||||
|
color:black;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 80%;
|
||||||
|
display: inline-block;
|
||||||
|
width: 16px;
|
||||||
|
height: 22px;
|
||||||
|
margin-left: 4px;
|
||||||
|
|
||||||
|
-webkit-user-select: none;
|
||||||
|
-khtml-user-select: none;
|
||||||
|
-moz-user-select: none;
|
||||||
|
-ms-user-select: none;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#selected .arrow {
|
||||||
|
color: white;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #d2d2d2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#nav-tree {
|
||||||
|
background-image: none;
|
||||||
|
background-color: white;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #d2d2d2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.selected {
|
||||||
|
background-image: none;
|
||||||
|
background-color: $primary-color;
|
||||||
|
color: white;
|
||||||
|
text-shadow: none;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-image: none;
|
||||||
|
background-color: $primary-color;
|
||||||
|
color: white;
|
||||||
|
text-shadow: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-resizable-e {
|
||||||
|
background: #808080 url("splitbar_handle.svg") no-repeat center;
|
||||||
|
border-right: solid 1px #c0c0c0;
|
||||||
|
border-left: solid 1px black;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: #606060;
|
||||||
|
}
|
||||||
|
}
|
||||||
121
doc/that_style/sass/_navpath.scss
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
/*
|
||||||
|
* The line at the bottom
|
||||||
|
*/
|
||||||
|
|
||||||
|
.navpath {
|
||||||
|
ul {
|
||||||
|
font-size: 11px;
|
||||||
|
background-image: none;
|
||||||
|
height: 30px;
|
||||||
|
line-height: 30px;
|
||||||
|
color: black;
|
||||||
|
border: none;
|
||||||
|
border-top: 1px solid #808080;
|
||||||
|
overflow: hidden;
|
||||||
|
margin: 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* intermediate navelems */
|
||||||
|
li:not(:first-child) {
|
||||||
|
list-style-type: none;
|
||||||
|
float: left;
|
||||||
|
padding-left: 18px;
|
||||||
|
padding-right: 10px;
|
||||||
|
color: black;
|
||||||
|
background-color: white;
|
||||||
|
background-image: url('nav_edge_inter.svg');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: left -1px;
|
||||||
|
background-size: auto 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* first navelem */
|
||||||
|
li:first-child {
|
||||||
|
list-style-type: none;
|
||||||
|
float: left;
|
||||||
|
padding-left: 15px;
|
||||||
|
padding-right: 10px;
|
||||||
|
color: black;
|
||||||
|
background-color: white;
|
||||||
|
background-image: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* last navelem */
|
||||||
|
li:nth-last-child(2) {
|
||||||
|
list-style-type: none;
|
||||||
|
float: left;
|
||||||
|
padding-left:10px;
|
||||||
|
padding-right:15px;
|
||||||
|
color: white;
|
||||||
|
background-color: $primary-color;
|
||||||
|
background-image: url('nav_edge_right.svg');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: right -1px;
|
||||||
|
background-size: auto 100%;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
li:nth-last-child(2):not(:first-child) {
|
||||||
|
list-style-type: none;
|
||||||
|
float: left;
|
||||||
|
padding-left:15px;
|
||||||
|
padding-right:15px;
|
||||||
|
color: white;
|
||||||
|
background-color: $primary-color;
|
||||||
|
background-image: url('nav_edge_left.svg'), url('nav_edge_right.svg');
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: -1px -1px, right -1px;
|
||||||
|
background-size: auto 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.navelem a, .navpath li.navelem b {
|
||||||
|
height:32px;
|
||||||
|
display:block;
|
||||||
|
text-decoration: none;
|
||||||
|
outline: none;
|
||||||
|
color: inherit;
|
||||||
|
font-family: Roboto,sans-serif;
|
||||||
|
text-shadow: none;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
li.navelem a:hover {
|
||||||
|
color: inherit;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
|
||||||
|
// the "doxygen" logo at the right
|
||||||
|
li.footer {
|
||||||
|
list-style-type: none;
|
||||||
|
float: right;
|
||||||
|
padding-left: 0;
|
||||||
|
padding-right: 10px;
|
||||||
|
background-color: #d5d5d5;
|
||||||
|
background-image: none;
|
||||||
|
color: black;
|
||||||
|
font-size: 8pt;
|
||||||
|
|
||||||
|
// show the edge image
|
||||||
|
&:before {
|
||||||
|
content: "";
|
||||||
|
width: 13px;
|
||||||
|
height: 30px;
|
||||||
|
display: inline-block;
|
||||||
|
float: left;
|
||||||
|
background-image: url("nav_edge_right.svg");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: right 0;
|
||||||
|
background-size: auto 100%;
|
||||||
|
|
||||||
|
/* flip the element horizontally */
|
||||||
|
-moz-transform: scaleX(-1);
|
||||||
|
-o-transform: scaleX(-1);
|
||||||
|
-webkit-transform: scaleX(-1);
|
||||||
|
transform: scaleX(-1);
|
||||||
|
filter: FlipH;
|
||||||
|
-ms-filter: "FlipH";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
89
doc/that_style/sass/_search.scss
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* The search box
|
||||||
|
*/
|
||||||
|
|
||||||
|
.sm-dox > li:last-child {
|
||||||
|
margin-right: 10pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
#MSearchBox {
|
||||||
|
border: 2px inset black;
|
||||||
|
display: table;
|
||||||
|
width: 350px;
|
||||||
|
height: 26px;
|
||||||
|
background: white;
|
||||||
|
margin-top: 5px;
|
||||||
|
|
||||||
|
.left {
|
||||||
|
background-image: none;
|
||||||
|
display: table-cell;
|
||||||
|
width: 100%;
|
||||||
|
height: inherit;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't need this element
|
||||||
|
.right {
|
||||||
|
background-image: none;
|
||||||
|
width: 0;
|
||||||
|
display: none;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// override for when there is no main menu
|
||||||
|
nav > #MSearchBox {
|
||||||
|
border: 2px solid #666666;
|
||||||
|
margin: 5px 10pt 0 0;
|
||||||
|
height: 22px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#MSearchSelect, .left #MSearchSelect {
|
||||||
|
left: 0;
|
||||||
|
background-image: url("mag_glass.svg");
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
padding: 22px 22px 0 0 ;
|
||||||
|
margin: 0 4px 0 4px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
#MSearchField {
|
||||||
|
background-image: none;
|
||||||
|
display: table-cell;
|
||||||
|
margin: 0;
|
||||||
|
// leave room for #MSearchSelect and a bit more for the border
|
||||||
|
margin-left: 30px;
|
||||||
|
width: calc(100% - 34px);
|
||||||
|
height: 22px;
|
||||||
|
font: 11pt sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
#MSearchSelectWindow {
|
||||||
|
background-color: $background-color-dark;
|
||||||
|
padding: 0;
|
||||||
|
border: solid 1px black;
|
||||||
|
@include border-radius(0);
|
||||||
|
@include box-shadow(0 0 4px rgba(0,0,0,0.35), 0 0 8px rgba(0,0,0,0.2));
|
||||||
|
}
|
||||||
|
|
||||||
|
a.SelectItem {
|
||||||
|
color: white;
|
||||||
|
padding: 3px 4px;
|
||||||
|
font: 10pt sans-serif;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: $primary-color;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus, &:active {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#MSearchResultsWindow {
|
||||||
|
background-color: white;
|
||||||
|
@include box-shadow(0 0 4px rgba(0,0,0,0.35), 0 0 8px rgba(0,0,0,0.2));
|
||||||
|
}
|
||||||
1240
doc/that_style/sass/that_style.scss
Normal file
1436
doc/that_style/that_style.css
Normal file
@@ -3,63 +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.
|
||||||
|
|
||||||
Good luck !
|
Good luck !
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,57 +11,63 @@ include_directories(
|
|||||||
${CMAKE_BINARY_DIR}
|
${CMAKE_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BSD OR SOLARIS)
|
if (ARGP_INCLUDE_DIR)
|
||||||
find_package(Argp)
|
include_directories(${ARGP_INCLUDE_DIR})
|
||||||
endif (BSD OR SOLARIS)
|
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_SERVER)
|
|
||||||
if (HAVE_LIBUTIL)
|
|
||||||
add_executable(samplesshd-tty samplesshd-tty.c)
|
|
||||||
target_link_libraries(samplesshd-tty ${LIBSSH_SHARED_LIBRARY} util)
|
|
||||||
endif (HAVE_LIBUTIL)
|
|
||||||
endif (WITH_SERVER)
|
|
||||||
|
|
||||||
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(samplessh sample.c ${examples_SRCS})
|
add_executable(ssh-client ssh_client.c ${examples_SRCS})
|
||||||
target_link_libraries(samplessh ${LIBSSH_SHARED_LIBRARY})
|
target_compile_options(ssh-client PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
|
target_link_libraries(ssh-client ${LIBSSH_SHARED_LIBRARY})
|
||||||
|
|
||||||
if (WITH_SERVER)
|
if (WITH_SERVER AND (ARGP_LIBRARY OR HAVE_ARGP_H))
|
||||||
add_executable(samplesshd samplesshd.c)
|
if (HAVE_LIBUTIL)
|
||||||
target_link_libraries(samplesshd ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARIES})
|
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)
|
||||||
|
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_link_libraries(samplesshd-cb ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARIES})
|
target_compile_options(samplesshd-cb PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
|
target_link_libraries(samplesshd-cb ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
|
||||||
|
|
||||||
add_executable(proxy proxy.c)
|
add_executable(proxy proxy.c)
|
||||||
target_link_libraries(proxy ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARIES})
|
target_compile_options(proxy PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
|
target_link_libraries(proxy ${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_link_libraries(samplesshd-kbdint ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARIES})
|
target_compile_options(samplesshd-kbdint PRIVATE ${DEFAULT_C_COMPILE_FLAGS})
|
||||||
|
target_link_libraries(samplesshd-kbdint ${LIBSSH_SHARED_LIBRARY} ${ARGP_LIBRARY})
|
||||||
|
|
||||||
endif (WITH_SERVER)
|
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(libsshpp libsshpp.cpp)
|
add_executable(libsshpp libsshpp.cpp)
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ int authenticate_console(ssh_session session){
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
method = ssh_auth_list(session);
|
method = ssh_userauth_list(session, NULL);
|
||||||
while (rc != SSH_AUTH_SUCCESS) {
|
while (rc != SSH_AUTH_SUCCESS) {
|
||||||
if (method & SSH_AUTH_METHOD_GSSAPI_MIC){
|
if (method & SSH_AUTH_METHOD_GSSAPI_MIC){
|
||||||
rc = ssh_userauth_gssapi(session);
|
rc = ssh_userauth_gssapi(session);
|
||||||
@@ -129,10 +129,10 @@ int authenticate_console(ssh_session session){
|
|||||||
}
|
}
|
||||||
// Try to authenticate with public key first
|
// Try to authenticate with public key first
|
||||||
if (method & SSH_AUTH_METHOD_PUBLICKEY) {
|
if (method & SSH_AUTH_METHOD_PUBLICKEY) {
|
||||||
rc = ssh_userauth_autopubkey(session, NULL);
|
rc = ssh_userauth_publickey_auto(session, NULL, NULL);
|
||||||
if (rc == SSH_AUTH_ERROR) {
|
if (rc == SSH_AUTH_ERROR) {
|
||||||
error(session);
|
error(session);
|
||||||
return rc;
|
return rc;
|
||||||
} else if (rc == SSH_AUTH_SUCCESS) {
|
} else if (rc == SSH_AUTH_SUCCESS) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,14 @@ 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.
|
clients must be made or how a client should react.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "libssh/priv.h"
|
||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include "examples_common.h"
|
#include "examples_common.h"
|
||||||
|
|
||||||
@@ -30,42 +33,54 @@ clients must be made or how a client should react.
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int verify_knownhost(ssh_session session){
|
int verify_knownhost(ssh_session session){
|
||||||
char *hexa;
|
enum ssh_known_hosts_e state;
|
||||||
int state;
|
|
||||||
char buf[10];
|
char buf[10];
|
||||||
unsigned char *hash = NULL;
|
unsigned char *hash = NULL;
|
||||||
int hlen;
|
size_t hlen;
|
||||||
|
ssh_key srv_pubkey;
|
||||||
|
int rc;
|
||||||
|
|
||||||
state=ssh_is_server_known(session);
|
rc = ssh_get_server_publickey(session, &srv_pubkey);
|
||||||
|
if (rc < 0) {
|
||||||
hlen = ssh_get_pubkey_hash(session, &hash);
|
return -1;
|
||||||
if (hlen < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc = ssh_get_publickey_hash(srv_pubkey,
|
||||||
|
SSH_PUBLICKEY_HASH_SHA256,
|
||||||
|
&hash,
|
||||||
|
&hlen);
|
||||||
|
ssh_key_free(srv_pubkey);
|
||||||
|
if (rc < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
state = ssh_session_is_known_server(session);
|
||||||
|
|
||||||
switch(state){
|
switch(state){
|
||||||
case SSH_SERVER_KNOWN_OK:
|
case SSH_KNOWN_HOSTS_OK:
|
||||||
break; /* ok */
|
break; /* ok */
|
||||||
case SSH_SERVER_KNOWN_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_SERVER_FOUND_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_SERVER_FILE_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;
|
||||||
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) {
|
if (fgets(buf, sizeof(buf), stdin) == NULL) {
|
||||||
ssh_clean_pubkey_hash(&hash);
|
ssh_clean_pubkey_hash(&hash);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -88,7 +103,7 @@ int verify_knownhost(ssh_session session){
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SSH_SERVER_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;
|
||||||
|
|||||||
@@ -229,6 +229,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive){
|
|||||||
fprintf(stderr,"error: %s\n",ssh_get_error(dest->session));
|
fprintf(stderr,"error: %s\n",ssh_get_error(dest->session));
|
||||||
ssh_string_free_char(filename);
|
ssh_string_free_char(filename);
|
||||||
ssh_scp_free(dest->scp);
|
ssh_scp_free(dest->scp);
|
||||||
|
dest->scp = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,514 +0,0 @@
|
|||||||
/* client.c */
|
|
||||||
/*
|
|
||||||
Copyright 2003-2009 Aris Adamantiadis
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include <sys/select.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_TERMIOS_H
|
|
||||||
#include <termios.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_UNISTD_H
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_PTY_H
|
|
||||||
#include <pty.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/ioctl.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
#include <libssh/callbacks.h>
|
|
||||||
#include <libssh/libssh.h>
|
|
||||||
#include <libssh/sftp.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include "examples_common.h"
|
|
||||||
#define MAXCMD 10
|
|
||||||
|
|
||||||
static char *host;
|
|
||||||
static char *user;
|
|
||||||
static char *cmds[MAXCMD];
|
|
||||||
static struct termios terminal;
|
|
||||||
|
|
||||||
static char *pcap_file=NULL;
|
|
||||||
|
|
||||||
static char *proxycommand;
|
|
||||||
|
|
||||||
static int auth_callback(const char *prompt, char *buf, size_t len,
|
|
||||||
int echo, int verify, void *userdata) {
|
|
||||||
(void) verify;
|
|
||||||
(void) userdata;
|
|
||||||
|
|
||||||
return ssh_getpass(prompt, buf, len, echo, verify);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ssh_callbacks_struct cb = {
|
|
||||||
.auth_function=auth_callback,
|
|
||||||
.userdata=NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static void add_cmd(char *cmd){
|
|
||||||
int n;
|
|
||||||
|
|
||||||
for (n = 0; (n < MAXCMD) && cmds[n] != NULL; n++);
|
|
||||||
|
|
||||||
if (n == MAXCMD) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cmds[n]=strdup(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void usage(){
|
|
||||||
fprintf(stderr,"Usage : ssh [options] [login@]hostname\n"
|
|
||||||
"sample client - libssh-%s\n"
|
|
||||||
"Options :\n"
|
|
||||||
" -l user : log in as user\n"
|
|
||||||
" -p port : connect to port\n"
|
|
||||||
" -d : use DSS to verify host public key\n"
|
|
||||||
" -r : use RSA to verify host public key\n"
|
|
||||||
#ifdef WITH_PCAP
|
|
||||||
" -P file : create a pcap debugging file\n"
|
|
||||||
#endif
|
|
||||||
#ifndef _WIN32
|
|
||||||
" -T proxycommand : command to execute as a socket proxy\n"
|
|
||||||
#endif
|
|
||||||
,
|
|
||||||
ssh_version(0));
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int opts(int argc, char **argv){
|
|
||||||
int i;
|
|
||||||
// for(i=0;i<argc;i++)
|
|
||||||
// printf("%d : %s\n",i,argv[i]);
|
|
||||||
/* insert your own arguments here */
|
|
||||||
while((i=getopt(argc,argv,"T:P:"))!=-1){
|
|
||||||
switch(i){
|
|
||||||
case 'P':
|
|
||||||
pcap_file=optarg;
|
|
||||||
break;
|
|
||||||
#ifndef _WIN32
|
|
||||||
case 'T':
|
|
||||||
proxycommand=optarg;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
fprintf(stderr,"unknown option %c\n",optopt);
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(optind < argc)
|
|
||||||
host=argv[optind++];
|
|
||||||
while(optind < argc)
|
|
||||||
add_cmd(argv[optind++]);
|
|
||||||
if(host==NULL)
|
|
||||||
usage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef HAVE_CFMAKERAW
|
|
||||||
static void cfmakeraw(struct termios *termios_p){
|
|
||||||
termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
|
|
||||||
termios_p->c_oflag &= ~OPOST;
|
|
||||||
termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
|
|
||||||
termios_p->c_cflag &= ~(CSIZE|PARENB);
|
|
||||||
termios_p->c_cflag |= CS8;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static void do_cleanup(int i) {
|
|
||||||
/* unused variable */
|
|
||||||
(void) i;
|
|
||||||
|
|
||||||
tcsetattr(0,TCSANOW,&terminal);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void do_exit(int i) {
|
|
||||||
/* unused variable */
|
|
||||||
(void) i;
|
|
||||||
|
|
||||||
do_cleanup(0);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ssh_channel chan;
|
|
||||||
int signal_delayed=0;
|
|
||||||
|
|
||||||
static void sigwindowchanged(int i){
|
|
||||||
(void) i;
|
|
||||||
signal_delayed=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void setsignal(void){
|
|
||||||
signal(SIGWINCH, sigwindowchanged);
|
|
||||||
signal_delayed=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sizechanged(void){
|
|
||||||
struct winsize win = { 0, 0, 0, 0 };
|
|
||||||
ioctl(1, TIOCGWINSZ, &win);
|
|
||||||
ssh_channel_change_pty_size(chan,win.ws_col, win.ws_row);
|
|
||||||
// printf("Changed pty size\n");
|
|
||||||
setsignal();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* There are two flavors of select loop: the one based on
|
|
||||||
* ssh_select and the one based on channel_select.
|
|
||||||
* The ssh_select one permits you to give your own file descriptors to
|
|
||||||
* follow. It is thus a complete select loop.
|
|
||||||
* The second one only selects on channels. It is simplier to use
|
|
||||||
* but doesn't permit you to fill in your own file descriptor. It is
|
|
||||||
* more adapted if you can't use ssh_select as a main loop (because
|
|
||||||
* you already have another main loop system).
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef USE_CHANNEL_SELECT
|
|
||||||
|
|
||||||
/* channel_select base main loop, with a standard select(2)
|
|
||||||
*/
|
|
||||||
static void select_loop(ssh_session session,ssh_channel channel){
|
|
||||||
fd_set fds;
|
|
||||||
struct timeval timeout;
|
|
||||||
char buffer[4096];
|
|
||||||
ssh_buffer readbuf=ssh_buffer_new();
|
|
||||||
ssh_channel channels[2];
|
|
||||||
int lus;
|
|
||||||
int eof=0;
|
|
||||||
int maxfd;
|
|
||||||
int ret;
|
|
||||||
while(channel){
|
|
||||||
/* when a signal is caught, ssh_select will return
|
|
||||||
* with SSH_EINTR, which means it should be started
|
|
||||||
* again. It lets you handle the signal the faster you
|
|
||||||
* can, like in this window changed example. Of course, if
|
|
||||||
* your signal handler doesn't call libssh at all, you're
|
|
||||||
* free to handle signals directly in sighandler.
|
|
||||||
*/
|
|
||||||
do{
|
|
||||||
FD_ZERO(&fds);
|
|
||||||
if(!eof)
|
|
||||||
FD_SET(0,&fds);
|
|
||||||
timeout.tv_sec=30;
|
|
||||||
timeout.tv_usec=0;
|
|
||||||
FD_SET(ssh_get_fd(session),&fds);
|
|
||||||
maxfd=ssh_get_fd(session)+1;
|
|
||||||
ret=select(maxfd,&fds,NULL,NULL,&timeout);
|
|
||||||
if(ret==EINTR)
|
|
||||||
continue;
|
|
||||||
if(FD_ISSET(0,&fds)){
|
|
||||||
lus=read(0,buffer,sizeof(buffer));
|
|
||||||
if(lus)
|
|
||||||
ssh_channel_write(channel,buffer,lus);
|
|
||||||
else {
|
|
||||||
eof=1;
|
|
||||||
ssh_channel_send_eof(channel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(FD_ISSET(ssh_get_fd(session),&fds)){
|
|
||||||
ssh_set_fd_toread(session);
|
|
||||||
}
|
|
||||||
channels[0]=channel; // set the first channel we want to read from
|
|
||||||
channels[1]=NULL;
|
|
||||||
ret=ssh_channel_select(channels,NULL,NULL,NULL); // no specific timeout - just poll
|
|
||||||
if(signal_delayed)
|
|
||||||
sizechanged();
|
|
||||||
} while (ret==EINTR || ret==SSH_EINTR);
|
|
||||||
|
|
||||||
// we already looked for input from stdin. Now, we are looking for input from the channel
|
|
||||||
|
|
||||||
if(channel && ssh_channel_is_closed(channel)){
|
|
||||||
ssh_channel_free(channel);
|
|
||||||
channel=NULL;
|
|
||||||
channels[0]=NULL;
|
|
||||||
}
|
|
||||||
if(channels[0]){
|
|
||||||
while(channel && ssh_channel_is_open(channel) && ssh_channel_poll(channel,0)>0){
|
|
||||||
lus=channel_read_buffer(channel,readbuf,0,0);
|
|
||||||
if(lus==-1){
|
|
||||||
fprintf(stderr, "Error reading channel: %s\n",
|
|
||||||
ssh_get_error(session));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(lus==0){
|
|
||||||
ssh_channel_free(channel);
|
|
||||||
channel=channels[0]=NULL;
|
|
||||||
} else
|
|
||||||
if (write(1,ssh_buffer_get_begin(readbuf),lus) < 0) {
|
|
||||||
fprintf(stderr, "Error writing to buffer\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while(channel && ssh_channel_is_open(channel) && ssh_channel_poll(channel,1)>0){ /* stderr */
|
|
||||||
lus=channel_read_buffer(channel,readbuf,0,1);
|
|
||||||
if(lus==-1){
|
|
||||||
fprintf(stderr, "Error reading channel: %s\n",
|
|
||||||
ssh_get_error(session));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(lus==0){
|
|
||||||
ssh_channel_free(channel);
|
|
||||||
channel=channels[0]=NULL;
|
|
||||||
} else
|
|
||||||
if (write(2,ssh_buffer_get_begin(readbuf),lus) < 0) {
|
|
||||||
fprintf(stderr, "Error writing to buffer\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(channel && ssh_channel_is_closed(channel)){
|
|
||||||
ssh_channel_free(channel);
|
|
||||||
channel=NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ssh_buffer_free(readbuf);
|
|
||||||
}
|
|
||||||
#else /* CHANNEL_SELECT */
|
|
||||||
|
|
||||||
static void select_loop(ssh_session session,ssh_channel channel){
|
|
||||||
fd_set fds;
|
|
||||||
struct timeval timeout;
|
|
||||||
char buffer[4096];
|
|
||||||
/* channels will be set to the channels to poll.
|
|
||||||
* outchannels will contain the result of the poll
|
|
||||||
*/
|
|
||||||
ssh_channel channels[2], outchannels[2];
|
|
||||||
int lus;
|
|
||||||
int eof=0;
|
|
||||||
int maxfd;
|
|
||||||
unsigned int r;
|
|
||||||
int ret;
|
|
||||||
while(channel){
|
|
||||||
do{
|
|
||||||
FD_ZERO(&fds);
|
|
||||||
if(!eof)
|
|
||||||
FD_SET(0,&fds);
|
|
||||||
timeout.tv_sec=30;
|
|
||||||
timeout.tv_usec=0;
|
|
||||||
FD_SET(ssh_get_fd(session),&fds);
|
|
||||||
maxfd=ssh_get_fd(session)+1;
|
|
||||||
channels[0]=channel; // set the first channel we want to read from
|
|
||||||
channels[1]=NULL;
|
|
||||||
ret=ssh_select(channels,outchannels,maxfd,&fds,&timeout);
|
|
||||||
if(signal_delayed)
|
|
||||||
sizechanged();
|
|
||||||
if(ret==EINTR)
|
|
||||||
continue;
|
|
||||||
if(FD_ISSET(0,&fds)){
|
|
||||||
lus=read(0,buffer,sizeof(buffer));
|
|
||||||
if(lus)
|
|
||||||
ssh_channel_write(channel,buffer,lus);
|
|
||||||
else {
|
|
||||||
eof=1;
|
|
||||||
ssh_channel_send_eof(channel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(channel && ssh_channel_is_closed(channel)){
|
|
||||||
ssh_channel_free(channel);
|
|
||||||
channel=NULL;
|
|
||||||
channels[0]=NULL;
|
|
||||||
}
|
|
||||||
if(outchannels[0]){
|
|
||||||
while(channel && ssh_channel_is_open(channel) && (r = ssh_channel_poll(channel,0))!=0){
|
|
||||||
lus=ssh_channel_read(channel,buffer,sizeof(buffer) > r ? r : sizeof(buffer),0);
|
|
||||||
if(lus==-1){
|
|
||||||
fprintf(stderr, "Error reading channel: %s\n",
|
|
||||||
ssh_get_error(session));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(lus==0){
|
|
||||||
ssh_channel_free(channel);
|
|
||||||
channel=channels[0]=NULL;
|
|
||||||
} else
|
|
||||||
if (write(1,buffer,lus) < 0) {
|
|
||||||
fprintf(stderr, "Error writing to buffer\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while(channel && ssh_channel_is_open(channel) && (r = ssh_channel_poll(channel,1))!=0){ /* stderr */
|
|
||||||
lus=ssh_channel_read(channel,buffer,sizeof(buffer) > r ? r : sizeof(buffer),1);
|
|
||||||
if(lus==-1){
|
|
||||||
fprintf(stderr, "Error reading channel: %s\n",
|
|
||||||
ssh_get_error(session));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(lus==0){
|
|
||||||
ssh_channel_free(channel);
|
|
||||||
channel=channels[0]=NULL;
|
|
||||||
} else
|
|
||||||
if (write(2,buffer,lus) < 0) {
|
|
||||||
fprintf(stderr, "Error writing to buffer\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(channel && ssh_channel_is_closed(channel)){
|
|
||||||
ssh_channel_free(channel);
|
|
||||||
channel=NULL;
|
|
||||||
}
|
|
||||||
} while (ret==EINTR || ret==SSH_EINTR);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void shell(ssh_session session){
|
|
||||||
ssh_channel channel;
|
|
||||||
struct termios terminal_local;
|
|
||||||
int interactive=isatty(0);
|
|
||||||
channel = ssh_channel_new(session);
|
|
||||||
if(interactive){
|
|
||||||
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));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
chan=channel;
|
|
||||||
if(interactive){
|
|
||||||
ssh_channel_request_pty(channel);
|
|
||||||
sizechanged();
|
|
||||||
}
|
|
||||||
if(ssh_channel_request_shell(channel)){
|
|
||||||
printf("Requesting shell : %s\n",ssh_get_error(session));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(interactive){
|
|
||||||
cfmakeraw(&terminal_local);
|
|
||||||
tcsetattr(0,TCSANOW,&terminal_local);
|
|
||||||
setsignal();
|
|
||||||
}
|
|
||||||
signal(SIGTERM,do_cleanup);
|
|
||||||
select_loop(session,channel);
|
|
||||||
if(interactive)
|
|
||||||
do_cleanup(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void batch_shell(ssh_session session){
|
|
||||||
ssh_channel channel;
|
|
||||||
char buffer[1024];
|
|
||||||
int i,s=0;
|
|
||||||
for(i=0;i<MAXCMD && cmds[i];++i) {
|
|
||||||
s+=snprintf(buffer+s,sizeof(buffer)-s,"%s ",cmds[i]);
|
|
||||||
free(cmds[i]);
|
|
||||||
cmds[i] = NULL;
|
|
||||||
}
|
|
||||||
channel=ssh_channel_new(session);
|
|
||||||
ssh_channel_open_session(channel);
|
|
||||||
if(ssh_channel_request_exec(channel,buffer)){
|
|
||||||
printf("error executing \"%s\" : %s\n",buffer,ssh_get_error(session));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
select_loop(session,channel);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int client(ssh_session session){
|
|
||||||
int auth=0;
|
|
||||||
char *banner;
|
|
||||||
int state;
|
|
||||||
if (user)
|
|
||||||
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)){
|
|
||||||
fprintf(stderr,"Connection failed : %s\n",ssh_get_error(session));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
state=verify_knownhost(session);
|
|
||||||
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])
|
|
||||||
shell(session);
|
|
||||||
else
|
|
||||||
batch_shell(session);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssh_pcap_file pcap;
|
|
||||||
void set_pcap(ssh_session session);
|
|
||||||
void set_pcap(ssh_session session){
|
|
||||||
if(!pcap_file)
|
|
||||||
return;
|
|
||||||
pcap=ssh_pcap_file_new();
|
|
||||||
if(!pcap)
|
|
||||||
return;
|
|
||||||
if(ssh_pcap_file_open(pcap,pcap_file) == SSH_ERROR){
|
|
||||||
printf("Error opening pcap file\n");
|
|
||||||
ssh_pcap_file_free(pcap);
|
|
||||||
pcap=NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ssh_set_pcap_file(session,pcap);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cleanup_pcap(void);
|
|
||||||
void cleanup_pcap(){
|
|
||||||
if(pcap)
|
|
||||||
ssh_pcap_file_free(pcap);
|
|
||||||
pcap=NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
|
||||||
ssh_session session;
|
|
||||||
|
|
||||||
session = ssh_new();
|
|
||||||
|
|
||||||
ssh_callbacks_init(&cb);
|
|
||||||
ssh_set_callbacks(session,&cb);
|
|
||||||
|
|
||||||
if(ssh_options_getopt(session, &argc, argv)) {
|
|
||||||
fprintf(stderr, "error parsing command line :%s\n",
|
|
||||||
ssh_get_error(session));
|
|
||||||
usage();
|
|
||||||
}
|
|
||||||
opts(argc,argv);
|
|
||||||
signal(SIGTERM, do_exit);
|
|
||||||
|
|
||||||
set_pcap(session);
|
|
||||||
client(session);
|
|
||||||
|
|
||||||
ssh_disconnect(session);
|
|
||||||
ssh_free(session);
|
|
||||||
cleanup_pcap();
|
|
||||||
|
|
||||||
ssh_finalize();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1,462 +0,0 @@
|
|||||||
/* This is a sample implementation of a libssh based SSH server */
|
|
||||||
/*
|
|
||||||
Copyright 2003-2011 Aris Adamantiadis
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <libssh/libssh.h>
|
|
||||||
#include <libssh/server.h>
|
|
||||||
#include <libssh/callbacks.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_ARGP_H
|
|
||||||
#include <argp.h>
|
|
||||||
#endif
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <pty.h>
|
|
||||||
|
|
||||||
#define SSHD_USER "libssh"
|
|
||||||
#define SSHD_PASSWORD "libssh"
|
|
||||||
|
|
||||||
#ifndef KEYS_FOLDER
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define KEYS_FOLDER
|
|
||||||
#else
|
|
||||||
#define KEYS_FOLDER "/etc/ssh/"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_PCAP
|
|
||||||
const char *pcap_file="debug.server.pcap";
|
|
||||||
ssh_pcap_file pcap;
|
|
||||||
|
|
||||||
static void set_pcap(ssh_session session){
|
|
||||||
if(!pcap_file)
|
|
||||||
return;
|
|
||||||
pcap=ssh_pcap_file_new();
|
|
||||||
if(ssh_pcap_file_open(pcap,pcap_file) == SSH_ERROR){
|
|
||||||
printf("Error opening pcap file\n");
|
|
||||||
ssh_pcap_file_free(pcap);
|
|
||||||
pcap=NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ssh_set_pcap_file(session,pcap);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cleanup_pcap(){
|
|
||||||
ssh_pcap_file_free(pcap);
|
|
||||||
pcap=NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static int auth_password(const char *user, const char *password){
|
|
||||||
if(strcmp(user, SSHD_USER))
|
|
||||||
return 0;
|
|
||||||
if(strcmp(password, SSHD_PASSWORD))
|
|
||||||
return 0;
|
|
||||||
return 1; // authenticated
|
|
||||||
}
|
|
||||||
#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";
|
|
||||||
|
|
||||||
static int port = 22;
|
|
||||||
|
|
||||||
/* 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, 0, 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);
|
|
||||||
port = atoi(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, "3");
|
|
||||||
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 */
|
|
||||||
|
|
||||||
static int authenticate(ssh_session session) {
|
|
||||||
ssh_message message;
|
|
||||||
|
|
||||||
do {
|
|
||||||
message=ssh_message_get(session);
|
|
||||||
if(!message)
|
|
||||||
break;
|
|
||||||
switch(ssh_message_type(message)){
|
|
||||||
case SSH_REQUEST_AUTH:
|
|
||||||
switch(ssh_message_subtype(message)){
|
|
||||||
case SSH_AUTH_METHOD_PASSWORD:
|
|
||||||
printf("User %s wants to auth with pass %s\n",
|
|
||||||
ssh_message_auth_user(message),
|
|
||||||
ssh_message_auth_password(message));
|
|
||||||
if(auth_password(ssh_message_auth_user(message),
|
|
||||||
ssh_message_auth_password(message))){
|
|
||||||
ssh_message_auth_reply_success(message,0);
|
|
||||||
ssh_message_free(message);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
ssh_message_auth_set_methods(message,
|
|
||||||
SSH_AUTH_METHOD_PASSWORD |
|
|
||||||
SSH_AUTH_METHOD_INTERACTIVE);
|
|
||||||
// not authenticated, send default message
|
|
||||||
ssh_message_reply_default(message);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SSH_AUTH_METHOD_NONE:
|
|
||||||
default:
|
|
||||||
printf("User %s wants to auth with unknown auth %d\n",
|
|
||||||
ssh_message_auth_user(message),
|
|
||||||
ssh_message_subtype(message));
|
|
||||||
ssh_message_auth_set_methods(message,
|
|
||||||
SSH_AUTH_METHOD_PASSWORD |
|
|
||||||
SSH_AUTH_METHOD_INTERACTIVE);
|
|
||||||
ssh_message_reply_default(message);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ssh_message_auth_set_methods(message,
|
|
||||||
SSH_AUTH_METHOD_PASSWORD |
|
|
||||||
SSH_AUTH_METHOD_INTERACTIVE);
|
|
||||||
ssh_message_reply_default(message);
|
|
||||||
}
|
|
||||||
ssh_message_free(message);
|
|
||||||
} while (1);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int copy_fd_to_chan(socket_t fd, int revents, void *userdata) {
|
|
||||||
ssh_channel chan = (ssh_channel)userdata;
|
|
||||||
char buf[2048];
|
|
||||||
int sz = 0;
|
|
||||||
|
|
||||||
if(!chan) {
|
|
||||||
close(fd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if(revents & POLLIN) {
|
|
||||||
sz = read(fd, buf, 2048);
|
|
||||||
if(sz > 0) {
|
|
||||||
ssh_channel_write(chan, buf, sz);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(revents & POLLHUP) {
|
|
||||||
ssh_channel_close(chan);
|
|
||||||
sz = -1;
|
|
||||||
}
|
|
||||||
return sz;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int copy_chan_to_fd(ssh_session session,
|
|
||||||
ssh_channel channel,
|
|
||||||
void *data,
|
|
||||||
uint32_t len,
|
|
||||||
int is_stderr,
|
|
||||||
void *userdata) {
|
|
||||||
int fd = *(int*)userdata;
|
|
||||||
int sz;
|
|
||||||
(void)session;
|
|
||||||
(void)channel;
|
|
||||||
(void)is_stderr;
|
|
||||||
|
|
||||||
sz = write(fd, data, len);
|
|
||||||
return sz;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void chan_close(ssh_session session, ssh_channel channel, void *userdata) {
|
|
||||||
int fd = *(int*)userdata;
|
|
||||||
(void)session;
|
|
||||||
(void)channel;
|
|
||||||
|
|
||||||
close(fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ssh_channel_callbacks_struct cb = {
|
|
||||||
.channel_data_function = copy_chan_to_fd,
|
|
||||||
.channel_eof_function = chan_close,
|
|
||||||
.channel_close_function = chan_close,
|
|
||||||
.userdata = NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static int main_loop(ssh_channel chan) {
|
|
||||||
ssh_session session = ssh_channel_get_session(chan);
|
|
||||||
socket_t fd;
|
|
||||||
struct termios *term = NULL;
|
|
||||||
struct winsize *win = NULL;
|
|
||||||
pid_t childpid;
|
|
||||||
ssh_event event;
|
|
||||||
short events;
|
|
||||||
int rc;
|
|
||||||
|
|
||||||
childpid = forkpty(&fd, NULL, term, win);
|
|
||||||
if(childpid == 0) {
|
|
||||||
execl("/bin/bash", "/bin/bash", (char *)NULL);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
|
|
||||||
cb.userdata = &fd;
|
|
||||||
ssh_callbacks_init(&cb);
|
|
||||||
ssh_set_channel_callbacks(chan, &cb);
|
|
||||||
|
|
||||||
events = POLLIN | POLLPRI | POLLERR | POLLHUP | POLLNVAL;
|
|
||||||
|
|
||||||
event = ssh_event_new();
|
|
||||||
if(event == NULL) {
|
|
||||||
printf("Couldn't get a event\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if(ssh_event_add_fd(event, fd, events, copy_fd_to_chan, chan) != SSH_OK) {
|
|
||||||
printf("Couldn't add an fd to the event\n");
|
|
||||||
ssh_event_free(event);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if(ssh_event_add_session(event, session) != SSH_OK) {
|
|
||||||
printf("Couldn't add the session to the event\n");
|
|
||||||
ssh_event_remove_fd(event, fd);
|
|
||||||
ssh_event_free(event);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
rc = ssh_event_dopoll(event, 1000);
|
|
||||||
if (rc == SSH_ERROR){
|
|
||||||
fprintf(stderr, "Error : %s\n", ssh_get_error(session));
|
|
||||||
ssh_event_free(event);
|
|
||||||
ssh_disconnect(session);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} while(!ssh_channel_is_closed(chan));
|
|
||||||
|
|
||||||
ssh_event_remove_fd(event, fd);
|
|
||||||
|
|
||||||
ssh_event_remove_session(event, session);
|
|
||||||
|
|
||||||
ssh_event_free(event);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char **argv){
|
|
||||||
ssh_session session;
|
|
||||||
ssh_bind sshbind;
|
|
||||||
ssh_message message;
|
|
||||||
ssh_channel chan=0;
|
|
||||||
int auth=0;
|
|
||||||
int shell=0;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
sshbind=ssh_bind_new();
|
|
||||||
session=ssh_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
|
|
||||||
#ifdef WITH_PCAP
|
|
||||||
set_pcap(session);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(ssh_bind_listen(sshbind)<0){
|
|
||||||
printf("Error listening to socket: %s\n", ssh_get_error(sshbind));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
printf("Started sample libssh sshd on port %d\n", port);
|
|
||||||
printf("You can login as the user %s with the password %s\n", SSHD_USER,
|
|
||||||
SSHD_PASSWORD);
|
|
||||||
r = ssh_bind_accept(sshbind, session);
|
|
||||||
if(r==SSH_ERROR){
|
|
||||||
printf("Error accepting a connection: %s\n", ssh_get_error(sshbind));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (ssh_handle_key_exchange(session)) {
|
|
||||||
printf("ssh_handle_key_exchange: %s\n", ssh_get_error(session));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* proceed to authentication */
|
|
||||||
auth = authenticate(session);
|
|
||||||
if(!auth){
|
|
||||||
printf("Authentication error: %s\n", ssh_get_error(session));
|
|
||||||
ssh_disconnect(session);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* wait for a channel session */
|
|
||||||
do {
|
|
||||||
message = ssh_message_get(session);
|
|
||||||
if(message){
|
|
||||||
if(ssh_message_type(message) == SSH_REQUEST_CHANNEL_OPEN &&
|
|
||||||
ssh_message_subtype(message) == SSH_CHANNEL_SESSION) {
|
|
||||||
chan = ssh_message_channel_request_open_reply_accept(message);
|
|
||||||
ssh_message_free(message);
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
ssh_message_reply_default(message);
|
|
||||||
ssh_message_free(message);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while(!chan);
|
|
||||||
|
|
||||||
if(!chan) {
|
|
||||||
printf("Error: cleint did not ask for a channel session (%s)\n",
|
|
||||||
ssh_get_error(session));
|
|
||||||
ssh_finalize();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* wait for a shell */
|
|
||||||
do {
|
|
||||||
message = ssh_message_get(session);
|
|
||||||
if(message != NULL) {
|
|
||||||
if(ssh_message_type(message) == SSH_REQUEST_CHANNEL) {
|
|
||||||
if(ssh_message_subtype(message) == SSH_CHANNEL_REQUEST_SHELL) {
|
|
||||||
shell = 1;
|
|
||||||
ssh_message_channel_request_reply_success(message);
|
|
||||||
ssh_message_free(message);
|
|
||||||
break;
|
|
||||||
} else if(ssh_message_subtype(message) == SSH_CHANNEL_REQUEST_PTY) {
|
|
||||||
ssh_message_channel_request_reply_success(message);
|
|
||||||
ssh_message_free(message);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ssh_message_reply_default(message);
|
|
||||||
ssh_message_free(message);
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} while(!shell);
|
|
||||||
|
|
||||||
if(!shell) {
|
|
||||||
printf("Error: No shell requested (%s)\n", ssh_get_error(session));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("it works !\n");
|
|
||||||
|
|
||||||
main_loop(chan);
|
|
||||||
|
|
||||||
ssh_disconnect(session);
|
|
||||||
ssh_bind_free(sshbind);
|
|
||||||
#ifdef WITH_PCAP
|
|
||||||
cleanup_pcap();
|
|
||||||
#endif
|
|
||||||
ssh_finalize();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,314 +0,0 @@
|
|||||||
/* This is a sample implementation of a libssh based SSH server */
|
|
||||||
/*
|
|
||||||
Copyright 2003-2009 Aris Adamantiadis
|
|
||||||
|
|
||||||
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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <libssh/libssh.h>
|
|
||||||
#include <libssh/server.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_ARGP_H
|
|
||||||
#include <argp.h>
|
|
||||||
#endif
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#ifndef KEYS_FOLDER
|
|
||||||
#ifdef _WIN32
|
|
||||||
#define KEYS_FOLDER
|
|
||||||
#else
|
|
||||||
#define KEYS_FOLDER "/etc/ssh/"
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WITH_PCAP
|
|
||||||
static const char *pcap_file="debug.server.pcap";
|
|
||||||
static ssh_pcap_file pcap;
|
|
||||||
|
|
||||||
static void set_pcap(ssh_session session) {
|
|
||||||
if(!pcap_file)
|
|
||||||
return;
|
|
||||||
pcap=ssh_pcap_file_new();
|
|
||||||
if(ssh_pcap_file_open(pcap,pcap_file) == SSH_ERROR){
|
|
||||||
printf("Error opening pcap file\n");
|
|
||||||
ssh_pcap_file_free(pcap);
|
|
||||||
pcap=NULL;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ssh_set_pcap_file(session,pcap);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cleanup_pcap(void) {
|
|
||||||
ssh_pcap_file_free(pcap);
|
|
||||||
pcap=NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
static int auth_password(const char *user, const char *password){
|
|
||||||
if(strcmp(user,"aris"))
|
|
||||||
return 0;
|
|
||||||
if(strcmp(password,"lala"))
|
|
||||||
return 0;
|
|
||||||
return 1; // authenticated
|
|
||||||
}
|
|
||||||
#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, "3");
|
|
||||||
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;
|
|
||||||
ssh_message message;
|
|
||||||
ssh_channel chan=0;
|
|
||||||
char buf[2048];
|
|
||||||
int auth=0;
|
|
||||||
int sftp=0;
|
|
||||||
int i;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
sshbind=ssh_bind_new();
|
|
||||||
session=ssh_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
|
|
||||||
#ifdef WITH_PCAP
|
|
||||||
set_pcap(session);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(ssh_bind_listen(sshbind)<0){
|
|
||||||
printf("Error listening to socket: %s\n",ssh_get_error(sshbind));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
r=ssh_bind_accept(sshbind,session);
|
|
||||||
if(r==SSH_ERROR){
|
|
||||||
printf("error accepting a connection : %s\n",ssh_get_error(sshbind));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (ssh_handle_key_exchange(session)) {
|
|
||||||
printf("ssh_handle_key_exchange: %s\n", ssh_get_error(session));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
message=ssh_message_get(session);
|
|
||||||
if(!message)
|
|
||||||
break;
|
|
||||||
switch(ssh_message_type(message)){
|
|
||||||
case SSH_REQUEST_AUTH:
|
|
||||||
switch(ssh_message_subtype(message)){
|
|
||||||
case SSH_AUTH_METHOD_PASSWORD:
|
|
||||||
printf("User %s wants to auth with pass %s\n",
|
|
||||||
ssh_message_auth_user(message),
|
|
||||||
ssh_message_auth_password(message));
|
|
||||||
if(auth_password(ssh_message_auth_user(message),
|
|
||||||
ssh_message_auth_password(message))){
|
|
||||||
auth=1;
|
|
||||||
ssh_message_auth_reply_success(message,0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// not authenticated, send default message
|
|
||||||
case SSH_AUTH_METHOD_NONE:
|
|
||||||
default:
|
|
||||||
ssh_message_auth_set_methods(message,SSH_AUTH_METHOD_PASSWORD);
|
|
||||||
ssh_message_reply_default(message);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ssh_message_reply_default(message);
|
|
||||||
}
|
|
||||||
ssh_message_free(message);
|
|
||||||
} while (!auth);
|
|
||||||
if(!auth){
|
|
||||||
printf("auth error: %s\n",ssh_get_error(session));
|
|
||||||
ssh_disconnect(session);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
message=ssh_message_get(session);
|
|
||||||
if(message){
|
|
||||||
switch(ssh_message_type(message)){
|
|
||||||
case SSH_REQUEST_CHANNEL_OPEN:
|
|
||||||
if(ssh_message_subtype(message)==SSH_CHANNEL_SESSION){
|
|
||||||
chan=ssh_message_channel_request_open_reply_accept(message);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
ssh_message_reply_default(message);
|
|
||||||
}
|
|
||||||
ssh_message_free(message);
|
|
||||||
}
|
|
||||||
} while(message && !chan);
|
|
||||||
if(!chan){
|
|
||||||
printf("error : %s\n",ssh_get_error(session));
|
|
||||||
ssh_finalize();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
do {
|
|
||||||
message=ssh_message_get(session);
|
|
||||||
if(message && ssh_message_type(message)==SSH_REQUEST_CHANNEL &&
|
|
||||||
(ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_SHELL ||
|
|
||||||
ssh_message_subtype(message)==SSH_CHANNEL_REQUEST_PTY)) {
|
|
||||||
// if(!strcmp(ssh_message_channel_request_subsystem(message),"sftp")){
|
|
||||||
sftp=1;
|
|
||||||
ssh_message_channel_request_reply_success(message);
|
|
||||||
break;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
if(!sftp){
|
|
||||||
ssh_message_reply_default(message);
|
|
||||||
}
|
|
||||||
ssh_message_free(message);
|
|
||||||
} while (message && !sftp);
|
|
||||||
if(!sftp){
|
|
||||||
printf("error : %s\n",ssh_get_error(session));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
printf("it works !\n");
|
|
||||||
do{
|
|
||||||
i=ssh_channel_read(chan,buf, 2048, 0);
|
|
||||||
if(i>0) {
|
|
||||||
ssh_channel_write(chan, buf, i);
|
|
||||||
if (write(1,buf,i) < 0) {
|
|
||||||
printf("error writing to buffer\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (buf[0] == '\x0d') {
|
|
||||||
if (write(1, "\n", 1) < 0) {
|
|
||||||
printf("error writing to buffer\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
ssh_channel_write(chan, "\n", 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (i>0);
|
|
||||||
ssh_disconnect(session);
|
|
||||||
ssh_bind_free(sshbind);
|
|
||||||
#ifdef WITH_PCAP
|
|
||||||
cleanup_pcap();
|
|
||||||
#endif
|
|
||||||
ssh_finalize();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -22,9 +22,12 @@ program.
|
|||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include "examples_common.h"
|
#include "examples_common.h"
|
||||||
|
|
||||||
int verbosity=0;
|
static int verbosity = 0;
|
||||||
const char *createcommand="rm -fr /tmp/libssh_tests && mkdir /tmp/libssh_tests && cd /tmp/libssh_tests && date > a && date > b && mkdir c && date > d";
|
static const char *createcommand =
|
||||||
char *host=NULL;
|
"rm -fr /tmp/libssh_tests && mkdir /tmp/libssh_tests && "
|
||||||
|
"cd /tmp/libssh_tests && date > a && date > b && mkdir c && date > d";
|
||||||
|
static char *host = NULL;
|
||||||
|
|
||||||
static void usage(const char *argv0){
|
static void usage(const char *argv0){
|
||||||
fprintf(stderr,"Usage : %s [options] host\n"
|
fprintf(stderr,"Usage : %s [options] host\n"
|
||||||
"sample tiny scp downloader client - libssh-%s\n"
|
"sample tiny scp downloader client - libssh-%s\n"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include <libssh/libssh.h>
|
#include <libssh/libssh.h>
|
||||||
#include "examples_common.h"
|
#include "examples_common.h"
|
||||||
|
|
||||||
#define LIMIT 0x100000000
|
#define LIMIT 0x100000000UL
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
ssh_session session;
|
ssh_session session;
|
||||||
|
|||||||
356
examples/ssh_client.c
Normal file
@@ -0,0 +1,356 @@
|
|||||||
|
/* client.c */
|
||||||
|
/*
|
||||||
|
Copyright 2003-2009 Aris Adamantiadis
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <sys/select.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_TERMIOS_H
|
||||||
|
#include <termios.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_PTY_H
|
||||||
|
#include <pty.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#include <libssh/callbacks.h>
|
||||||
|
#include <libssh/libssh.h>
|
||||||
|
#include <libssh/sftp.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "examples_common.h"
|
||||||
|
#define MAXCMD 10
|
||||||
|
|
||||||
|
static char *host;
|
||||||
|
static char *user;
|
||||||
|
static char *cmds[MAXCMD];
|
||||||
|
static struct termios terminal;
|
||||||
|
|
||||||
|
static char *pcap_file=NULL;
|
||||||
|
|
||||||
|
static char *proxycommand;
|
||||||
|
|
||||||
|
static int auth_callback(const char *prompt, char *buf, size_t len,
|
||||||
|
int echo, int verify, void *userdata) {
|
||||||
|
(void) verify;
|
||||||
|
(void) userdata;
|
||||||
|
|
||||||
|
return ssh_getpass(prompt, buf, len, echo, verify);
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ssh_callbacks_struct cb = {
|
||||||
|
.auth_function=auth_callback,
|
||||||
|
.userdata=NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static void add_cmd(char *cmd){
|
||||||
|
int n;
|
||||||
|
|
||||||
|
for (n = 0; (n < MAXCMD) && cmds[n] != NULL; n++);
|
||||||
|
|
||||||
|
if (n == MAXCMD) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
cmds[n]=strdup(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void usage(void)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"Usage : ssh [options] [login@]hostname\n"
|
||||||
|
"sample client - libssh-%s\n"
|
||||||
|
"Options :\n"
|
||||||
|
" -l user : log in as user\n"
|
||||||
|
" -p port : connect to port\n"
|
||||||
|
" -d : use DSS to verify host public key\n"
|
||||||
|
" -r : use RSA to verify host public key\n"
|
||||||
|
#ifdef WITH_PCAP
|
||||||
|
" -P file : create a pcap debugging file\n"
|
||||||
|
#endif
|
||||||
|
#ifndef _WIN32
|
||||||
|
" -T proxycommand : command to execute as a socket proxy\n"
|
||||||
|
#endif
|
||||||
|
"\n",
|
||||||
|
ssh_version(0));
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int opts(int argc, char **argv){
|
||||||
|
int i;
|
||||||
|
// for(i=0;i<argc;i++)
|
||||||
|
// printf("%d : %s\n",i,argv[i]);
|
||||||
|
/* insert your own arguments here */
|
||||||
|
while((i=getopt(argc,argv,"T:P:"))!=-1){
|
||||||
|
switch(i){
|
||||||
|
case 'P':
|
||||||
|
pcap_file=optarg;
|
||||||
|
break;
|
||||||
|
#ifndef _WIN32
|
||||||
|
case 'T':
|
||||||
|
proxycommand=optarg;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
fprintf(stderr,"unknown option %c\n",optopt);
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(optind < argc)
|
||||||
|
host=argv[optind++];
|
||||||
|
while(optind < argc)
|
||||||
|
add_cmd(argv[optind++]);
|
||||||
|
if(host==NULL)
|
||||||
|
usage();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_CFMAKERAW
|
||||||
|
static void cfmakeraw(struct termios *termios_p){
|
||||||
|
termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
|
||||||
|
termios_p->c_oflag &= ~OPOST;
|
||||||
|
termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
|
||||||
|
termios_p->c_cflag &= ~(CSIZE|PARENB);
|
||||||
|
termios_p->c_cflag |= CS8;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static void do_cleanup(int i) {
|
||||||
|
/* unused variable */
|
||||||
|
(void) i;
|
||||||
|
|
||||||
|
tcsetattr(0,TCSANOW,&terminal);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void do_exit(int i) {
|
||||||
|
/* unused variable */
|
||||||
|
(void) i;
|
||||||
|
|
||||||
|
do_cleanup(0);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_channel chan;
|
||||||
|
int signal_delayed=0;
|
||||||
|
|
||||||
|
static void sigwindowchanged(int i){
|
||||||
|
(void) i;
|
||||||
|
signal_delayed=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setsignal(void){
|
||||||
|
signal(SIGWINCH, sigwindowchanged);
|
||||||
|
signal_delayed=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void sizechanged(void){
|
||||||
|
struct winsize win = { 0, 0, 0, 0 };
|
||||||
|
ioctl(1, TIOCGWINSZ, &win);
|
||||||
|
ssh_channel_change_pty_size(chan,win.ws_col, win.ws_row);
|
||||||
|
// printf("Changed pty size\n");
|
||||||
|
setsignal();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void select_loop(ssh_session session,ssh_channel channel){
|
||||||
|
ssh_connector connector_in, connector_out, connector_err;
|
||||||
|
ssh_event event = ssh_event_new();
|
||||||
|
|
||||||
|
/* stdin */
|
||||||
|
connector_in = ssh_connector_new(session);
|
||||||
|
ssh_connector_set_out_channel(connector_in, channel, SSH_CONNECTOR_STDOUT);
|
||||||
|
ssh_connector_set_in_fd(connector_in, 0);
|
||||||
|
ssh_event_add_connector(event, connector_in);
|
||||||
|
|
||||||
|
/* stdout */
|
||||||
|
connector_out = ssh_connector_new(session);
|
||||||
|
ssh_connector_set_out_fd(connector_out, 1);
|
||||||
|
ssh_connector_set_in_channel(connector_out, channel, SSH_CONNECTOR_STDOUT);
|
||||||
|
ssh_event_add_connector(event, connector_out);
|
||||||
|
|
||||||
|
/* stderr */
|
||||||
|
connector_err = ssh_connector_new(session);
|
||||||
|
ssh_connector_set_out_fd(connector_err, 2);
|
||||||
|
ssh_connector_set_in_channel(connector_err, channel, SSH_CONNECTOR_STDERR);
|
||||||
|
ssh_event_add_connector(event, connector_err);
|
||||||
|
|
||||||
|
while(ssh_channel_is_open(channel)){
|
||||||
|
if(signal_delayed)
|
||||||
|
sizechanged();
|
||||||
|
ssh_event_dopoll(event, 60000);
|
||||||
|
}
|
||||||
|
ssh_event_remove_connector(event, connector_in);
|
||||||
|
ssh_event_remove_connector(event, connector_out);
|
||||||
|
ssh_event_remove_connector(event, connector_err);
|
||||||
|
|
||||||
|
ssh_connector_free(connector_in);
|
||||||
|
ssh_connector_free(connector_out);
|
||||||
|
ssh_connector_free(connector_err);
|
||||||
|
|
||||||
|
ssh_event_free(event);
|
||||||
|
ssh_channel_free(channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void shell(ssh_session session){
|
||||||
|
ssh_channel channel;
|
||||||
|
struct termios terminal_local;
|
||||||
|
int interactive=isatty(0);
|
||||||
|
channel = ssh_channel_new(session);
|
||||||
|
if(interactive){
|
||||||
|
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));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
chan=channel;
|
||||||
|
if(interactive){
|
||||||
|
ssh_channel_request_pty(channel);
|
||||||
|
sizechanged();
|
||||||
|
}
|
||||||
|
if(ssh_channel_request_shell(channel)){
|
||||||
|
printf("Requesting shell : %s\n",ssh_get_error(session));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(interactive){
|
||||||
|
cfmakeraw(&terminal_local);
|
||||||
|
tcsetattr(0,TCSANOW,&terminal_local);
|
||||||
|
setsignal();
|
||||||
|
}
|
||||||
|
signal(SIGTERM,do_cleanup);
|
||||||
|
select_loop(session,channel);
|
||||||
|
if(interactive)
|
||||||
|
do_cleanup(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void batch_shell(ssh_session session){
|
||||||
|
ssh_channel channel;
|
||||||
|
char buffer[1024];
|
||||||
|
int i,s=0;
|
||||||
|
for(i=0;i<MAXCMD && cmds[i];++i) {
|
||||||
|
s+=snprintf(buffer+s,sizeof(buffer)-s,"%s ",cmds[i]);
|
||||||
|
free(cmds[i]);
|
||||||
|
cmds[i] = NULL;
|
||||||
|
}
|
||||||
|
channel=ssh_channel_new(session);
|
||||||
|
ssh_channel_open_session(channel);
|
||||||
|
if(ssh_channel_request_exec(channel,buffer)){
|
||||||
|
printf("error executing \"%s\" : %s\n",buffer,ssh_get_error(session));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
select_loop(session,channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int client(ssh_session session){
|
||||||
|
int auth=0;
|
||||||
|
char *banner;
|
||||||
|
int state;
|
||||||
|
if (user)
|
||||||
|
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)){
|
||||||
|
fprintf(stderr,"Connection failed : %s\n",ssh_get_error(session));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
state=verify_knownhost(session);
|
||||||
|
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])
|
||||||
|
shell(session);
|
||||||
|
else
|
||||||
|
batch_shell(session);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_pcap_file pcap;
|
||||||
|
void set_pcap(ssh_session session);
|
||||||
|
void set_pcap(ssh_session session){
|
||||||
|
if(!pcap_file)
|
||||||
|
return;
|
||||||
|
pcap=ssh_pcap_file_new();
|
||||||
|
if(!pcap)
|
||||||
|
return;
|
||||||
|
if(ssh_pcap_file_open(pcap,pcap_file) == SSH_ERROR){
|
||||||
|
printf("Error opening pcap file\n");
|
||||||
|
ssh_pcap_file_free(pcap);
|
||||||
|
pcap=NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ssh_set_pcap_file(session,pcap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cleanup_pcap(void);
|
||||||
|
void cleanup_pcap(){
|
||||||
|
if(pcap)
|
||||||
|
ssh_pcap_file_free(pcap);
|
||||||
|
pcap=NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv){
|
||||||
|
ssh_session session;
|
||||||
|
|
||||||
|
session = ssh_new();
|
||||||
|
|
||||||
|
ssh_callbacks_init(&cb);
|
||||||
|
ssh_set_callbacks(session,&cb);
|
||||||
|
|
||||||
|
if(ssh_options_getopt(session, &argc, argv)) {
|
||||||
|
fprintf(stderr, "error parsing command line :%s\n",
|
||||||
|
ssh_get_error(session));
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
opts(argc,argv);
|
||||||
|
signal(SIGTERM, do_exit);
|
||||||
|
|
||||||
|
set_pcap(session);
|
||||||
|
client(session);
|
||||||
|
|
||||||
|
ssh_disconnect(session);
|
||||||
|
ssh_free(session);
|
||||||
|
cleanup_pcap();
|
||||||
|
|
||||||
|
ssh_finalize();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
707
examples/ssh_server_fork.c
Normal file
@@ -0,0 +1,707 @@
|
|||||||
|
/* This is a sample implementation of a libssh based SSH server */
|
||||||
|
/*
|
||||||
|
Copyright 2014 Audrius Butkevicius
|
||||||
|
|
||||||
|
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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <libssh/callbacks.h>
|
||||||
|
#include <libssh/server.h>
|
||||||
|
|
||||||
|
#include <poll.h>
|
||||||
|
#ifdef HAVE_ARGP_H
|
||||||
|
#include <argp.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
#ifdef HAVE_LIBUTIL_H
|
||||||
|
#include <libutil.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_PTY_H
|
||||||
|
#include <pty.h>
|
||||||
|
#endif
|
||||||
|
#include <signal.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#ifdef HAVE_UTMP_H
|
||||||
|
#include <utmp.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UTIL_H
|
||||||
|
#include <util.h>
|
||||||
|
#endif
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#ifndef KEYS_FOLDER
|
||||||
|
#ifdef _WIN32
|
||||||
|
#define KEYS_FOLDER
|
||||||
|
#else
|
||||||
|
#define KEYS_FOLDER "/etc/ssh/"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define USER "myuser"
|
||||||
|
#define PASS "mypassword"
|
||||||
|
#define BUF_SIZE 1048576
|
||||||
|
#define SESSION_END (SSH_CLOSED | SSH_CLOSED_ERROR)
|
||||||
|
#define SFTP_SERVER_PATH "/usr/lib/sftp-server"
|
||||||
|
|
||||||
|
static void set_default_keys(ssh_bind sshbind,
|
||||||
|
int rsa_already_set,
|
||||||
|
int dsa_already_set,
|
||||||
|
int ecdsa_already_set) {
|
||||||
|
if (!rsa_already_set) {
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY,
|
||||||
|
KEYS_FOLDER "ssh_host_rsa_key");
|
||||||
|
}
|
||||||
|
if (!dsa_already_set) {
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_DSAKEY,
|
||||||
|
KEYS_FOLDER "ssh_host_dsa_key");
|
||||||
|
}
|
||||||
|
if (!ecdsa_already_set) {
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_ECDSAKEY,
|
||||||
|
KEYS_FOLDER "ssh_host_ecdsa_key");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 a host key. Can be used multiple times. "
|
||||||
|
"Implies no default keys.",
|
||||||
|
.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 = "ecdsakey",
|
||||||
|
.key = 'e',
|
||||||
|
.arg = "FILE",
|
||||||
|
.flags = 0,
|
||||||
|
.doc = "Set the ecdsa key.",
|
||||||
|
.group = 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "no-default-keys",
|
||||||
|
.key = 'n',
|
||||||
|
.arg = NULL,
|
||||||
|
.flags = 0,
|
||||||
|
.doc = "Do not set default key locations.",
|
||||||
|
.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;
|
||||||
|
static int no_default_keys = 0;
|
||||||
|
static int rsa_already_set = 0, dsa_already_set = 0, ecdsa_already_set = 0;
|
||||||
|
|
||||||
|
switch (key) {
|
||||||
|
case 'n':
|
||||||
|
no_default_keys = 1;
|
||||||
|
break;
|
||||||
|
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);
|
||||||
|
dsa_already_set = 1;
|
||||||
|
break;
|
||||||
|
case 'k':
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_HOSTKEY, arg);
|
||||||
|
/* We can't track the types of keys being added with this
|
||||||
|
option, so let's ensure we keep the keys we're adding
|
||||||
|
by just not setting the default keys */
|
||||||
|
no_default_keys = 1;
|
||||||
|
break;
|
||||||
|
case 'r':
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_RSAKEY, arg);
|
||||||
|
rsa_already_set = 1;
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_ECDSAKEY, arg);
|
||||||
|
ecdsa_already_set = 1;
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
ssh_bind_options_set(sshbind, SSH_BIND_OPTIONS_LOG_VERBOSITY_STR,
|
||||||
|
"3");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!no_default_keys) {
|
||||||
|
set_default_keys(sshbind,
|
||||||
|
rsa_already_set,
|
||||||
|
dsa_already_set,
|
||||||
|
ecdsa_already_set);
|
||||||
|
}
|
||||||
|
|
||||||
|
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 */
|
||||||
|
|
||||||
|
/* A userdata struct for channel. */
|
||||||
|
struct channel_data_struct {
|
||||||
|
/* pid of the child process the channel will spawn. */
|
||||||
|
pid_t pid;
|
||||||
|
/* For PTY allocation */
|
||||||
|
socket_t pty_master;
|
||||||
|
socket_t pty_slave;
|
||||||
|
/* For communication with the child process. */
|
||||||
|
socket_t child_stdin;
|
||||||
|
socket_t child_stdout;
|
||||||
|
/* Only used for subsystem and exec requests. */
|
||||||
|
socket_t child_stderr;
|
||||||
|
/* Event which is used to poll the above descriptors. */
|
||||||
|
ssh_event event;
|
||||||
|
/* Terminal size struct. */
|
||||||
|
struct winsize *winsize;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* A userdata struct for session. */
|
||||||
|
struct session_data_struct {
|
||||||
|
/* Pointer to the channel the session will allocate. */
|
||||||
|
ssh_channel channel;
|
||||||
|
int auth_attempts;
|
||||||
|
int authenticated;
|
||||||
|
};
|
||||||
|
|
||||||
|
static int data_function(ssh_session session, ssh_channel channel, void *data,
|
||||||
|
uint32_t len, int is_stderr, void *userdata) {
|
||||||
|
struct channel_data_struct *cdata = (struct channel_data_struct *) userdata;
|
||||||
|
|
||||||
|
(void) session;
|
||||||
|
(void) channel;
|
||||||
|
(void) is_stderr;
|
||||||
|
|
||||||
|
if (len == 0 || cdata->pid < 1 || kill(cdata->pid, 0) < 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return write(cdata->child_stdin, (char *) data, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int pty_request(ssh_session session, ssh_channel channel,
|
||||||
|
const char *term, int cols, int rows, int py, int px,
|
||||||
|
void *userdata) {
|
||||||
|
struct channel_data_struct *cdata = (struct channel_data_struct *)userdata;
|
||||||
|
|
||||||
|
(void) session;
|
||||||
|
(void) channel;
|
||||||
|
(void) term;
|
||||||
|
|
||||||
|
cdata->winsize->ws_row = rows;
|
||||||
|
cdata->winsize->ws_col = cols;
|
||||||
|
cdata->winsize->ws_xpixel = px;
|
||||||
|
cdata->winsize->ws_ypixel = py;
|
||||||
|
|
||||||
|
if (openpty(&cdata->pty_master, &cdata->pty_slave, NULL, NULL,
|
||||||
|
cdata->winsize) != 0) {
|
||||||
|
fprintf(stderr, "Failed to open pty\n");
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
return SSH_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int pty_resize(ssh_session session, ssh_channel channel, int cols,
|
||||||
|
int rows, int py, int px, void *userdata) {
|
||||||
|
struct channel_data_struct *cdata = (struct channel_data_struct *)userdata;
|
||||||
|
|
||||||
|
(void) session;
|
||||||
|
(void) channel;
|
||||||
|
|
||||||
|
cdata->winsize->ws_row = rows;
|
||||||
|
cdata->winsize->ws_col = cols;
|
||||||
|
cdata->winsize->ws_xpixel = px;
|
||||||
|
cdata->winsize->ws_ypixel = py;
|
||||||
|
|
||||||
|
if (cdata->pty_master != -1) {
|
||||||
|
return ioctl(cdata->pty_master, TIOCSWINSZ, cdata->winsize);
|
||||||
|
}
|
||||||
|
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int exec_pty(const char *mode, const char *command,
|
||||||
|
struct channel_data_struct *cdata) {
|
||||||
|
switch(cdata->pid = fork()) {
|
||||||
|
case -1:
|
||||||
|
close(cdata->pty_master);
|
||||||
|
close(cdata->pty_slave);
|
||||||
|
fprintf(stderr, "Failed to fork\n");
|
||||||
|
return SSH_ERROR;
|
||||||
|
case 0:
|
||||||
|
close(cdata->pty_master);
|
||||||
|
if (login_tty(cdata->pty_slave) != 0) {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
execl("/bin/sh", "sh", mode, command, NULL);
|
||||||
|
exit(0);
|
||||||
|
default:
|
||||||
|
close(cdata->pty_slave);
|
||||||
|
/* pty fd is bi-directional */
|
||||||
|
cdata->child_stdout = cdata->child_stdin = cdata->pty_master;
|
||||||
|
}
|
||||||
|
return SSH_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int exec_nopty(const char *command, struct channel_data_struct *cdata) {
|
||||||
|
int in[2], out[2], err[2];
|
||||||
|
|
||||||
|
/* Do the plumbing to be able to talk with the child process. */
|
||||||
|
if (pipe(in) != 0) {
|
||||||
|
goto stdin_failed;
|
||||||
|
}
|
||||||
|
if (pipe(out) != 0) {
|
||||||
|
goto stdout_failed;
|
||||||
|
}
|
||||||
|
if (pipe(err) != 0) {
|
||||||
|
goto stderr_failed;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(cdata->pid = fork()) {
|
||||||
|
case -1:
|
||||||
|
goto fork_failed;
|
||||||
|
case 0:
|
||||||
|
/* Finish the plumbing in the child process. */
|
||||||
|
close(in[1]);
|
||||||
|
close(out[0]);
|
||||||
|
close(err[0]);
|
||||||
|
dup2(in[0], STDIN_FILENO);
|
||||||
|
dup2(out[1], STDOUT_FILENO);
|
||||||
|
dup2(err[1], STDERR_FILENO);
|
||||||
|
close(in[0]);
|
||||||
|
close(out[1]);
|
||||||
|
close(err[1]);
|
||||||
|
/* exec the requested command. */
|
||||||
|
execl("/bin/sh", "sh", "-c", command, NULL);
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
close(in[0]);
|
||||||
|
close(out[1]);
|
||||||
|
close(err[1]);
|
||||||
|
|
||||||
|
cdata->child_stdin = in[1];
|
||||||
|
cdata->child_stdout = out[0];
|
||||||
|
cdata->child_stderr = err[0];
|
||||||
|
|
||||||
|
return SSH_OK;
|
||||||
|
|
||||||
|
fork_failed:
|
||||||
|
close(err[0]);
|
||||||
|
close(err[1]);
|
||||||
|
stderr_failed:
|
||||||
|
close(out[0]);
|
||||||
|
close(out[1]);
|
||||||
|
stdout_failed:
|
||||||
|
close(in[0]);
|
||||||
|
close(in[1]);
|
||||||
|
stdin_failed:
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int exec_request(ssh_session session, ssh_channel channel,
|
||||||
|
const char *command, void *userdata) {
|
||||||
|
struct channel_data_struct *cdata = (struct channel_data_struct *) userdata;
|
||||||
|
|
||||||
|
|
||||||
|
(void) session;
|
||||||
|
(void) channel;
|
||||||
|
|
||||||
|
if(cdata->pid > 0) {
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cdata->pty_master != -1 && cdata->pty_slave != -1) {
|
||||||
|
return exec_pty("-c", command, cdata);
|
||||||
|
}
|
||||||
|
return exec_nopty(command, cdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int shell_request(ssh_session session, ssh_channel channel,
|
||||||
|
void *userdata) {
|
||||||
|
struct channel_data_struct *cdata = (struct channel_data_struct *) userdata;
|
||||||
|
|
||||||
|
(void) session;
|
||||||
|
(void) channel;
|
||||||
|
|
||||||
|
if(cdata->pid > 0) {
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cdata->pty_master != -1 && cdata->pty_slave != -1) {
|
||||||
|
return exec_pty("-l", NULL, cdata);
|
||||||
|
}
|
||||||
|
/* Client requested a shell without a pty, let's pretend we allow that */
|
||||||
|
return SSH_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int subsystem_request(ssh_session session, ssh_channel channel,
|
||||||
|
const char *subsystem, void *userdata) {
|
||||||
|
/* subsystem requests behave simillarly to exec requests. */
|
||||||
|
if (strcmp(subsystem, "sftp") == 0) {
|
||||||
|
return exec_request(session, channel, SFTP_SERVER_PATH, userdata);
|
||||||
|
}
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int auth_password(ssh_session session, const char *user,
|
||||||
|
const char *pass, void *userdata) {
|
||||||
|
struct session_data_struct *sdata = (struct session_data_struct *) userdata;
|
||||||
|
|
||||||
|
(void) session;
|
||||||
|
|
||||||
|
if (strcmp(user, USER) == 0 && strcmp(pass, PASS) == 0) {
|
||||||
|
sdata->authenticated = 1;
|
||||||
|
return SSH_AUTH_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
sdata->auth_attempts++;
|
||||||
|
return SSH_AUTH_DENIED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ssh_channel channel_open(ssh_session session, void *userdata) {
|
||||||
|
struct session_data_struct *sdata = (struct session_data_struct *) userdata;
|
||||||
|
|
||||||
|
sdata->channel = ssh_channel_new(session);
|
||||||
|
return sdata->channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int process_stdout(socket_t fd, int revents, void *userdata) {
|
||||||
|
char buf[BUF_SIZE];
|
||||||
|
int n = -1;
|
||||||
|
ssh_channel channel = (ssh_channel) userdata;
|
||||||
|
|
||||||
|
if (channel != NULL && (revents & POLLIN) != 0) {
|
||||||
|
n = read(fd, buf, BUF_SIZE);
|
||||||
|
if (n > 0) {
|
||||||
|
ssh_channel_write(channel, buf, n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int process_stderr(socket_t fd, int revents, void *userdata) {
|
||||||
|
char buf[BUF_SIZE];
|
||||||
|
int n = -1;
|
||||||
|
ssh_channel channel = (ssh_channel) userdata;
|
||||||
|
|
||||||
|
if (channel != NULL && (revents & POLLIN) != 0) {
|
||||||
|
n = read(fd, buf, BUF_SIZE);
|
||||||
|
if (n > 0) {
|
||||||
|
ssh_channel_write_stderr(channel, buf, n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_session(ssh_event event, ssh_session session) {
|
||||||
|
int n, rc;
|
||||||
|
|
||||||
|
/* Structure for storing the pty size. */
|
||||||
|
struct winsize wsize = {
|
||||||
|
.ws_row = 0,
|
||||||
|
.ws_col = 0,
|
||||||
|
.ws_xpixel = 0,
|
||||||
|
.ws_ypixel = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Our struct holding information about the channel. */
|
||||||
|
struct channel_data_struct cdata = {
|
||||||
|
.pid = 0,
|
||||||
|
.pty_master = -1,
|
||||||
|
.pty_slave = -1,
|
||||||
|
.child_stdin = -1,
|
||||||
|
.child_stdout = -1,
|
||||||
|
.child_stderr = -1,
|
||||||
|
.event = NULL,
|
||||||
|
.winsize = &wsize
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Our struct holding information about the session. */
|
||||||
|
struct session_data_struct sdata = {
|
||||||
|
.channel = NULL,
|
||||||
|
.auth_attempts = 0,
|
||||||
|
.authenticated = 0
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ssh_channel_callbacks_struct channel_cb = {
|
||||||
|
.userdata = &cdata,
|
||||||
|
.channel_pty_request_function = pty_request,
|
||||||
|
.channel_pty_window_change_function = pty_resize,
|
||||||
|
.channel_shell_request_function = shell_request,
|
||||||
|
.channel_exec_request_function = exec_request,
|
||||||
|
.channel_data_function = data_function,
|
||||||
|
.channel_subsystem_request_function = subsystem_request
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ssh_server_callbacks_struct server_cb = {
|
||||||
|
.userdata = &sdata,
|
||||||
|
.auth_password_function = auth_password,
|
||||||
|
.channel_open_request_session_function = channel_open,
|
||||||
|
};
|
||||||
|
|
||||||
|
ssh_callbacks_init(&server_cb);
|
||||||
|
ssh_callbacks_init(&channel_cb);
|
||||||
|
|
||||||
|
ssh_set_server_callbacks(session, &server_cb);
|
||||||
|
|
||||||
|
if (ssh_handle_key_exchange(session) != SSH_OK) {
|
||||||
|
fprintf(stderr, "%s\n", ssh_get_error(session));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_set_auth_methods(session, SSH_AUTH_METHOD_PASSWORD);
|
||||||
|
ssh_event_add_session(event, session);
|
||||||
|
|
||||||
|
n = 0;
|
||||||
|
while (sdata.authenticated == 0 || sdata.channel == NULL) {
|
||||||
|
/* If the user has used up all attempts, or if he hasn't been able to
|
||||||
|
* authenticate in 10 seconds (n * 100ms), disconnect. */
|
||||||
|
if (sdata.auth_attempts >= 3 || n >= 100) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ssh_event_dopoll(event, 100) == SSH_ERROR) {
|
||||||
|
fprintf(stderr, "%s\n", ssh_get_error(session));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_set_channel_callbacks(sdata.channel, &channel_cb);
|
||||||
|
|
||||||
|
do {
|
||||||
|
/* Poll the main event which takes care of the session, the channel and
|
||||||
|
* even our child process's stdout/stderr (once it's started). */
|
||||||
|
if (ssh_event_dopoll(event, -1) == SSH_ERROR) {
|
||||||
|
ssh_channel_close(sdata.channel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If child process's stdout/stderr has been registered with the event,
|
||||||
|
* or the child process hasn't started yet, continue. */
|
||||||
|
if (cdata.event != NULL || cdata.pid == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
/* Executed only once, once the child process starts. */
|
||||||
|
cdata.event = event;
|
||||||
|
/* If stdout valid, add stdout to be monitored by the poll event. */
|
||||||
|
if (cdata.child_stdout != -1) {
|
||||||
|
if (ssh_event_add_fd(event, cdata.child_stdout, POLLIN, process_stdout,
|
||||||
|
sdata.channel) != SSH_OK) {
|
||||||
|
fprintf(stderr, "Failed to register stdout to poll context\n");
|
||||||
|
ssh_channel_close(sdata.channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If stderr valid, add stderr to be monitored by the poll event. */
|
||||||
|
if (cdata.child_stderr != -1){
|
||||||
|
if (ssh_event_add_fd(event, cdata.child_stderr, POLLIN, process_stderr,
|
||||||
|
sdata.channel) != SSH_OK) {
|
||||||
|
fprintf(stderr, "Failed to register stderr to poll context\n");
|
||||||
|
ssh_channel_close(sdata.channel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while(ssh_channel_is_open(sdata.channel) &&
|
||||||
|
(cdata.pid == 0 || waitpid(cdata.pid, &rc, WNOHANG) == 0));
|
||||||
|
|
||||||
|
close(cdata.pty_master);
|
||||||
|
close(cdata.child_stdin);
|
||||||
|
close(cdata.child_stdout);
|
||||||
|
close(cdata.child_stderr);
|
||||||
|
|
||||||
|
/* Remove the descriptors from the polling context, since they are now
|
||||||
|
* closed, they will always trigger during the poll calls. */
|
||||||
|
ssh_event_remove_fd(event, cdata.child_stdout);
|
||||||
|
ssh_event_remove_fd(event, cdata.child_stderr);
|
||||||
|
|
||||||
|
/* If the child process exited. */
|
||||||
|
if (kill(cdata.pid, 0) < 0 && WIFEXITED(rc)) {
|
||||||
|
rc = WEXITSTATUS(rc);
|
||||||
|
ssh_channel_request_send_exit_status(sdata.channel, rc);
|
||||||
|
/* If client terminated the channel or the process did not exit nicely,
|
||||||
|
* but only if something has been forked. */
|
||||||
|
} else if (cdata.pid > 0) {
|
||||||
|
kill(cdata.pid, SIGKILL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_channel_send_eof(sdata.channel);
|
||||||
|
ssh_channel_close(sdata.channel);
|
||||||
|
|
||||||
|
/* Wait up to 5 seconds for the client to terminate the session. */
|
||||||
|
for (n = 0; n < 50 && (ssh_get_status(session) & SESSION_END) == 0; n++) {
|
||||||
|
ssh_event_dopoll(event, 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SIGCHLD handler for cleaning up dead children. */
|
||||||
|
static void sigchld_handler(int signo) {
|
||||||
|
(void) signo;
|
||||||
|
while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv) {
|
||||||
|
ssh_bind sshbind;
|
||||||
|
ssh_session session;
|
||||||
|
ssh_event event;
|
||||||
|
struct sigaction sa;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
/* Set up SIGCHLD handler. */
|
||||||
|
sa.sa_handler = sigchld_handler;
|
||||||
|
sigemptyset(&sa.sa_mask);
|
||||||
|
sa.sa_flags = SA_RESTART | SA_NOCLDSTOP;
|
||||||
|
if (sigaction(SIGCHLD, &sa, NULL) != 0) {
|
||||||
|
fprintf(stderr, "Failed to register SIGCHLD handler\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = ssh_init();
|
||||||
|
if (rc < 0) {
|
||||||
|
fprintf(stderr, "ssh_init failed\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sshbind = ssh_bind_new();
|
||||||
|
if (sshbind == NULL) {
|
||||||
|
fprintf(stderr, "ssh_bind_new failed\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ARGP_H
|
||||||
|
argp_parse(&argp, argc, argv, 0, 0, sshbind);
|
||||||
|
#else
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
|
|
||||||
|
set_default_keys(sshbind, 0, 0, 0);
|
||||||
|
#endif /* HAVE_ARGP_H */
|
||||||
|
|
||||||
|
if(ssh_bind_listen(sshbind) < 0) {
|
||||||
|
fprintf(stderr, "%s\n", ssh_get_error(sshbind));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
session = ssh_new();
|
||||||
|
if (session == NULL) {
|
||||||
|
fprintf(stderr, "Failed to allocate session\n");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Blocks until there is a new incoming connection. */
|
||||||
|
if(ssh_bind_accept(sshbind, session) != SSH_ERROR) {
|
||||||
|
switch(fork()) {
|
||||||
|
case 0:
|
||||||
|
/* Remove the SIGCHLD handler inherited from parent. */
|
||||||
|
sa.sa_handler = SIG_DFL;
|
||||||
|
sigaction(SIGCHLD, &sa, NULL);
|
||||||
|
/* Remove socket binding, which allows us to restart the
|
||||||
|
* parent process, without terminating existing sessions. */
|
||||||
|
ssh_bind_free(sshbind);
|
||||||
|
|
||||||
|
event = ssh_event_new();
|
||||||
|
if (event != NULL) {
|
||||||
|
/* Blocks until the SSH session ends by either
|
||||||
|
* child process exiting, or client disconnecting. */
|
||||||
|
handle_session(event, session);
|
||||||
|
ssh_event_free(event);
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "Could not create polling context\n");
|
||||||
|
}
|
||||||
|
ssh_disconnect(session);
|
||||||
|
ssh_free(session);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
case -1:
|
||||||
|
fprintf(stderr, "Failed to fork\n");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fprintf(stderr, "%s\n", ssh_get_error(sshbind));
|
||||||
|
}
|
||||||
|
/* Since the session has been passed to a child fork, do some cleaning
|
||||||
|
* up at the parent process. */
|
||||||
|
ssh_disconnect(session);
|
||||||
|
ssh_free(session);
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_bind_free(sshbind);
|
||||||
|
ssh_finalize();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
}
|
}
|
||||||
@@ -87,13 +88,23 @@ static void select_loop(ssh_session session,ssh_channel channel){
|
|||||||
int ret;
|
int ret;
|
||||||
while(channel){
|
while(channel){
|
||||||
do{
|
do{
|
||||||
|
int fd;
|
||||||
|
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
if(!eof)
|
if(!eof)
|
||||||
FD_SET(0,&fds);
|
FD_SET(0,&fds);
|
||||||
timeout.tv_sec=30;
|
timeout.tv_sec=30;
|
||||||
timeout.tv_usec=0;
|
timeout.tv_usec=0;
|
||||||
FD_SET(ssh_get_fd(session),&fds);
|
|
||||||
maxfd=ssh_get_fd(session)+1;
|
fd = ssh_get_fd(session);
|
||||||
|
if (fd == -1) {
|
||||||
|
fprintf(stderr, "Error getting the session file descriptor: %s\n",
|
||||||
|
ssh_get_error(session));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FD_SET(fd, &fds);
|
||||||
|
maxfd = fd + 1;
|
||||||
|
|
||||||
channels[0]=channel; // set the first channel we want to read from
|
channels[0]=channel; // set the first channel we want to read from
|
||||||
channels[1]=NULL;
|
channels[1]=NULL;
|
||||||
ret=ssh_select(channels,outchannels,maxfd,&fds,&timeout);
|
ret=ssh_select(channels,outchannels,maxfd,&fds,&timeout);
|
||||||
@@ -102,27 +113,27 @@ static void select_loop(ssh_session session,ssh_channel channel){
|
|||||||
if(FD_ISSET(0,&fds)){
|
if(FD_ISSET(0,&fds)){
|
||||||
lus=read(0,buffer,sizeof(buffer));
|
lus=read(0,buffer,sizeof(buffer));
|
||||||
if(lus)
|
if(lus)
|
||||||
channel_write(channel,buffer,lus);
|
ssh_channel_write(channel,buffer,lus);
|
||||||
else {
|
else {
|
||||||
eof=1;
|
eof=1;
|
||||||
channel_send_eof(channel);
|
ssh_channel_send_eof(channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(channel && channel_is_closed(channel)){
|
if(channel && ssh_channel_is_closed(channel)){
|
||||||
channel_free(channel);
|
ssh_channel_free(channel);
|
||||||
channel=NULL;
|
channel=NULL;
|
||||||
channels[0]=NULL;
|
channels[0]=NULL;
|
||||||
}
|
}
|
||||||
if(outchannels[0]){
|
if(outchannels[0]){
|
||||||
while(channel && channel_is_open(channel) && channel_poll(channel,0)){
|
while(channel && ssh_channel_is_open(channel) && ssh_channel_poll(channel,0)){
|
||||||
lus=channel_read(channel,buffer,sizeof(buffer),0);
|
lus = ssh_channel_read(channel,buffer,sizeof(buffer),0);
|
||||||
if(lus==-1){
|
if(lus==-1){
|
||||||
fprintf(stderr, "Error reading channel: %s\n",
|
fprintf(stderr, "Error reading channel: %s\n",
|
||||||
ssh_get_error(session));
|
ssh_get_error(session));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(lus==0){
|
if(lus==0){
|
||||||
channel_free(channel);
|
ssh_channel_free(channel);
|
||||||
channel=channels[0]=NULL;
|
channel=channels[0]=NULL;
|
||||||
} else {
|
} else {
|
||||||
ret = write(1, buffer, lus);
|
ret = write(1, buffer, lus);
|
||||||
@@ -133,27 +144,28 @@ static void select_loop(ssh_session session,ssh_channel channel){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while(channel && channel_is_open(channel) && channel_poll(channel,1)){ /* stderr */
|
while(channel && ssh_channel_is_open(channel) && ssh_channel_poll(channel,1)){ /* stderr */
|
||||||
lus=channel_read(channel,buffer,sizeof(buffer),1);
|
lus = ssh_channel_read(channel, buffer, sizeof(buffer), 1);
|
||||||
if(lus==-1){
|
if(lus==-1){
|
||||||
fprintf(stderr, "Error reading channel: %s\n",
|
fprintf(stderr, "Error reading channel: %s\n",
|
||||||
ssh_get_error(session));
|
ssh_get_error(session));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(lus==0){
|
if(lus==0){
|
||||||
channel_free(channel);
|
ssh_channel_free(channel);
|
||||||
channel=channels[0]=NULL;
|
channel=channels[0]=NULL;
|
||||||
} else
|
} else {
|
||||||
ret = write(2, buffer, lus);
|
ret = write(2, buffer, lus);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
fprintf(stderr, "Error writing to stderr: %s",
|
fprintf(stderr, "Error writing to stderr: %s",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(channel && channel_is_closed(channel)){
|
if(channel && ssh_channel_is_closed(channel)){
|
||||||
channel_free(channel);
|
ssh_channel_free(channel);
|
||||||
channel=NULL;
|
channel=NULL;
|
||||||
}
|
}
|
||||||
} while (ret==EINTR || ret==SSH_EINTR);
|
} while (ret==EINTR || ret==SSH_EINTR);
|
||||||
@@ -164,8 +176,8 @@ static void select_loop(ssh_session session,ssh_channel channel){
|
|||||||
static void forwarding(ssh_session session){
|
static void forwarding(ssh_session session){
|
||||||
ssh_channel channel;
|
ssh_channel channel;
|
||||||
int r;
|
int r;
|
||||||
channel=channel_new(session);
|
channel = ssh_channel_new(session);
|
||||||
r=channel_open_forward(channel,desthost,atoi(port),"localhost",22);
|
r = ssh_channel_open_forward(channel, desthost, atoi(port), "localhost", 22);
|
||||||
if(r<0) {
|
if(r<0) {
|
||||||
printf("error forwarding port : %s\n",ssh_get_error(session));
|
printf("error forwarding port : %s\n",ssh_get_error(session));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
project(headers C)
|
project(libssh-headers-x C)
|
||||||
|
|
||||||
add_subdirectory(libssh)
|
add_subdirectory(libssh)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ set(libssh_HDRS
|
|||||||
libssh.h
|
libssh.h
|
||||||
ssh2.h
|
ssh2.h
|
||||||
legacy.h
|
legacy.h
|
||||||
|
libsshpp.hpp
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WITH_SFTP)
|
if (WITH_SFTP)
|
||||||
@@ -14,13 +15,6 @@ if (WITH_SFTP)
|
|||||||
)
|
)
|
||||||
endif (WITH_SFTP)
|
endif (WITH_SFTP)
|
||||||
|
|
||||||
if (WITH_SSH1)
|
|
||||||
set(libssh_HDRS
|
|
||||||
${libssh_HDRS}
|
|
||||||
ssh1.h
|
|
||||||
)
|
|
||||||
endif (WITH_SSH1)
|
|
||||||
|
|
||||||
if (WITH_SERVER)
|
if (WITH_SERVER)
|
||||||
set(libssh_HDRS
|
set(libssh_HDRS
|
||||||
${libssh_HDRS}
|
${libssh_HDRS}
|
||||||
|
|||||||
@@ -81,16 +81,16 @@ struct ssh_agent_struct {
|
|||||||
*
|
*
|
||||||
* @return An allocated ssh agent structure or NULL on error.
|
* @return An allocated ssh agent structure or NULL on error.
|
||||||
*/
|
*/
|
||||||
struct ssh_agent_struct *agent_new(struct ssh_session_struct *session);
|
struct ssh_agent_struct *ssh_agent_new(struct ssh_session_struct *session);
|
||||||
|
|
||||||
void agent_close(struct ssh_agent_struct *agent);
|
void ssh_agent_close(struct ssh_agent_struct *agent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Free an allocated ssh agent structure.
|
* @brief Free an allocated ssh agent structure.
|
||||||
*
|
*
|
||||||
* @param agent The ssh agent structure to free.
|
* @param agent The ssh agent structure to free.
|
||||||
*/
|
*/
|
||||||
void agent_free(struct ssh_agent_struct *agent);
|
void ssh_agent_free(struct ssh_agent_struct *agent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Check if the ssh agent is running.
|
* @brief Check if the ssh agent is running.
|
||||||
@@ -99,7 +99,7 @@ void agent_free(struct ssh_agent_struct *agent);
|
|||||||
*
|
*
|
||||||
* @return 1 if it is running, 0 if not.
|
* @return 1 if it is running, 0 if not.
|
||||||
*/
|
*/
|
||||||
int agent_is_running(struct ssh_session_struct *session);
|
int ssh_agent_is_running(struct ssh_session_struct *session);
|
||||||
|
|
||||||
int ssh_agent_get_ident_count(struct ssh_session_struct *session);
|
int ssh_agent_get_ident_count(struct ssh_session_struct *session);
|
||||||
|
|
||||||
@@ -115,4 +115,3 @@ ssh_string ssh_agent_sign_data(ssh_session session,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __AGENT_H */
|
#endif /* __AGENT_H */
|
||||||
/* vim: set ts=2 sw=2 et cindent: */
|
|
||||||
|
|||||||
@@ -49,20 +49,6 @@ ssh_kbdint ssh_kbdint_new(void);
|
|||||||
void ssh_kbdint_clean(ssh_kbdint kbd);
|
void ssh_kbdint_clean(ssh_kbdint kbd);
|
||||||
void ssh_kbdint_free(ssh_kbdint kbd);
|
void ssh_kbdint_free(ssh_kbdint kbd);
|
||||||
|
|
||||||
|
|
||||||
#ifdef WITH_SSH1
|
|
||||||
void ssh_auth1_handler(ssh_session session, uint8_t type);
|
|
||||||
|
|
||||||
/* auth1.c */
|
|
||||||
int ssh_userauth1_none(ssh_session session, const char *username);
|
|
||||||
int ssh_userauth1_offer_pubkey(ssh_session session, const char *username,
|
|
||||||
int type, ssh_string pubkey);
|
|
||||||
int ssh_userauth1_password(ssh_session session, const char *username,
|
|
||||||
const char *password);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** @internal
|
/** @internal
|
||||||
* States of authentication in the client-side. They describe
|
* States of authentication in the client-side. They describe
|
||||||
* what was the last response from the server
|
* what was the last response from the server
|
||||||
@@ -104,8 +90,6 @@ enum ssh_auth_service_state_e {
|
|||||||
SSH_AUTH_SERVICE_ACCEPTED,
|
SSH_AUTH_SERVICE_ACCEPTED,
|
||||||
/** Access to service denied (fatal) */
|
/** Access to service denied (fatal) */
|
||||||
SSH_AUTH_SERVICE_DENIED,
|
SSH_AUTH_SERVICE_DENIED,
|
||||||
/** Specific to SSH1 */
|
|
||||||
SSH_AUTH_SERVICE_USER_SENT
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* AUTH_H_ */
|
#endif /* AUTH_H_ */
|
||||||
|
|||||||
34
include/libssh/bignum.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the SSH Library
|
||||||
|
*
|
||||||
|
* Copyright (c) 2014 by Aris Adamantiadis <aris@badcode.be>
|
||||||
|
*
|
||||||
|
* 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 BIGNUM_H_
|
||||||
|
#define BIGNUM_H_
|
||||||
|
|
||||||
|
#include "libssh/libcrypto.h"
|
||||||
|
#include "libssh/libgcrypt.h"
|
||||||
|
#include "libssh/libmbedcrypto.h"
|
||||||
|
|
||||||
|
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);
|
||||||
|
void ssh_print_bignum(const char *which, const bignum num);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* BIGNUM_H_ */
|
||||||
@@ -36,9 +36,11 @@ struct ssh_bind_struct {
|
|||||||
char *ecdsakey;
|
char *ecdsakey;
|
||||||
char *dsakey;
|
char *dsakey;
|
||||||
char *rsakey;
|
char *rsakey;
|
||||||
|
char *ed25519key;
|
||||||
ssh_key ecdsa;
|
ssh_key ecdsa;
|
||||||
ssh_key dsa;
|
ssh_key dsa;
|
||||||
ssh_key rsa;
|
ssh_key rsa;
|
||||||
|
ssh_key ed25519;
|
||||||
char *bindaddr;
|
char *bindaddr;
|
||||||
socket_t bindfd;
|
socket_t bindfd;
|
||||||
unsigned int bindport;
|
unsigned int bindport;
|
||||||
|
|||||||
87
include/libssh/blf.h
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/* $OpenBSD: blf.h,v 1.7 2007/03/14 17:59:41 grunk Exp $ */
|
||||||
|
/*
|
||||||
|
* Blowfish - a fast block cipher designed by Bruce Schneier
|
||||||
|
*
|
||||||
|
* Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
|
* must display the following acknowledgement:
|
||||||
|
* This product includes software developed by Niels Provos.
|
||||||
|
* 4. The name of the author may not be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||||
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _BLF_H_
|
||||||
|
#define _BLF_H_
|
||||||
|
|
||||||
|
//#include "includes.h"
|
||||||
|
|
||||||
|
#if !defined(HAVE_BCRYPT_PBKDF) && !defined(HAVE_BLH_H)
|
||||||
|
|
||||||
|
/* Schneier specifies a maximum key length of 56 bytes.
|
||||||
|
* This ensures that every key bit affects every cipher
|
||||||
|
* bit. However, the subkeys can hold up to 72 bytes.
|
||||||
|
* Warning: For normal blowfish encryption only 56 bytes
|
||||||
|
* of the key affect all cipherbits.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define BLF_N 16 /* Number of Subkeys */
|
||||||
|
#define BLF_MAXKEYLEN ((BLF_N-2)*4) /* 448 bits */
|
||||||
|
#define BLF_MAXUTILIZED ((BLF_N+2)*4) /* 576 bits */
|
||||||
|
|
||||||
|
/* Blowfish context */
|
||||||
|
typedef struct BlowfishContext {
|
||||||
|
uint32_t S[4][256]; /* S-Boxes */
|
||||||
|
uint32_t P[BLF_N + 2]; /* Subkeys */
|
||||||
|
} ssh_blf_ctx;
|
||||||
|
|
||||||
|
/* Raw access to customized Blowfish
|
||||||
|
* blf_key is just:
|
||||||
|
* Blowfish_initstate( state )
|
||||||
|
* Blowfish_expand0state( state, key, keylen )
|
||||||
|
*/
|
||||||
|
|
||||||
|
void Blowfish_encipher(ssh_blf_ctx *, uint32_t *, uint32_t *);
|
||||||
|
void Blowfish_decipher(ssh_blf_ctx *, uint32_t *, uint32_t *);
|
||||||
|
void Blowfish_initstate(ssh_blf_ctx *);
|
||||||
|
void Blowfish_expand0state(ssh_blf_ctx *, const uint8_t *, uint16_t);
|
||||||
|
void Blowfish_expandstate
|
||||||
|
(ssh_blf_ctx *, const uint8_t *, uint16_t, const uint8_t *, uint16_t);
|
||||||
|
|
||||||
|
/* Standard Blowfish */
|
||||||
|
|
||||||
|
void ssh_blf_key(ssh_blf_ctx *, const uint8_t *, uint16_t);
|
||||||
|
void ssh_blf_enc(ssh_blf_ctx *, uint32_t *, uint16_t);
|
||||||
|
void ssh_blf_dec(ssh_blf_ctx *, uint32_t *, uint16_t);
|
||||||
|
|
||||||
|
void ssh_blf_ecb_encrypt(ssh_blf_ctx *, uint8_t *, uint32_t);
|
||||||
|
void ssh_blf_ecb_decrypt(ssh_blf_ctx *, uint8_t *, uint32_t);
|
||||||
|
|
||||||
|
void ssh_blf_cbc_encrypt(ssh_blf_ctx *, uint8_t *, uint8_t *, uint32_t);
|
||||||
|
void ssh_blf_cbc_decrypt(ssh_blf_ctx *, uint8_t *, uint8_t *, uint32_t);
|
||||||
|
|
||||||
|
/* Converts uint8_t to uint32_t */
|
||||||
|
uint32_t Blowfish_stream2word(const uint8_t *, uint16_t , uint16_t *);
|
||||||
|
|
||||||
|
#endif /* !defined(HAVE_BCRYPT_PBKDF) && !defined(HAVE_BLH_H) */
|
||||||
|
#endif /* _BLF_H */
|
||||||
@@ -21,6 +21,8 @@
|
|||||||
#ifndef BUFFER_H_
|
#ifndef BUFFER_H_
|
||||||
#define BUFFER_H_
|
#define BUFFER_H_
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "libssh/libssh.h"
|
#include "libssh/libssh.h"
|
||||||
/*
|
/*
|
||||||
* Describes a buffer state
|
* Describes a buffer state
|
||||||
@@ -34,39 +36,56 @@ struct ssh_buffer_struct {
|
|||||||
uint32_t used;
|
uint32_t used;
|
||||||
uint32_t allocated;
|
uint32_t allocated;
|
||||||
uint32_t pos;
|
uint32_t pos;
|
||||||
|
int secure;
|
||||||
};
|
};
|
||||||
|
|
||||||
LIBSSH_API void ssh_buffer_free(ssh_buffer buffer);
|
#define SSH_BUFFER_PACK_END ((uint32_t) 0x4f65feb3)
|
||||||
LIBSSH_API void *ssh_buffer_get_begin(ssh_buffer buffer);
|
|
||||||
LIBSSH_API uint32_t ssh_buffer_get_len(ssh_buffer buffer);
|
|
||||||
LIBSSH_API ssh_buffer ssh_buffer_new(void);
|
|
||||||
int buffer_add_ssh_string(ssh_buffer buffer, ssh_string string);
|
|
||||||
int buffer_add_u8(ssh_buffer buffer, uint8_t data);
|
|
||||||
int buffer_add_u16(ssh_buffer buffer, uint16_t data);
|
|
||||||
int buffer_add_u32(ssh_buffer buffer, uint32_t data);
|
|
||||||
int buffer_add_u64(ssh_buffer buffer, uint64_t data);
|
|
||||||
int buffer_add_data(ssh_buffer buffer, const void *data, uint32_t len);
|
|
||||||
int buffer_prepend_data(ssh_buffer buffer, const void *data, uint32_t len);
|
|
||||||
int buffer_add_buffer(ssh_buffer buffer, ssh_buffer source);
|
|
||||||
int buffer_reinit(ssh_buffer buffer);
|
|
||||||
|
|
||||||
/* buffer_get_rest returns a pointer to the current position into the buffer */
|
void ssh_buffer_set_secure(ssh_buffer buffer);
|
||||||
void *buffer_get_rest(ssh_buffer buffer);
|
int ssh_buffer_add_ssh_string(ssh_buffer buffer, ssh_string string);
|
||||||
/* buffer_get_rest_len returns the number of bytes which can be read */
|
int ssh_buffer_add_u8(ssh_buffer buffer, uint8_t data);
|
||||||
uint32_t buffer_get_rest_len(ssh_buffer buffer);
|
int ssh_buffer_add_u16(ssh_buffer buffer, uint16_t data);
|
||||||
|
int ssh_buffer_add_u32(ssh_buffer buffer, uint32_t data);
|
||||||
|
int ssh_buffer_add_u64(ssh_buffer buffer, uint64_t data);
|
||||||
|
|
||||||
|
int ssh_buffer_validate_length(struct ssh_buffer_struct *buffer, size_t len);
|
||||||
|
|
||||||
|
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_pack_va(struct ssh_buffer_struct *buffer,
|
||||||
|
const char *format,
|
||||||
|
int argc,
|
||||||
|
va_list ap);
|
||||||
|
int _ssh_buffer_pack(struct ssh_buffer_struct *buffer,
|
||||||
|
const char *format,
|
||||||
|
int argc,
|
||||||
|
...);
|
||||||
|
#define ssh_buffer_pack(buffer, format, ...) \
|
||||||
|
_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,
|
||||||
|
const char *format, int argc,
|
||||||
|
va_list ap);
|
||||||
|
int _ssh_buffer_unpack(struct ssh_buffer_struct *buffer,
|
||||||
|
const char *format,
|
||||||
|
int argc,
|
||||||
|
...);
|
||||||
|
#define ssh_buffer_unpack(buffer, format, ...) \
|
||||||
|
_ssh_buffer_unpack((buffer), (format), __VA_NARG__(__VA_ARGS__), __VA_ARGS__, SSH_BUFFER_PACK_END)
|
||||||
|
|
||||||
|
int ssh_buffer_prepend_data(ssh_buffer buffer, const void *data, uint32_t len);
|
||||||
|
int ssh_buffer_add_buffer(ssh_buffer buffer, ssh_buffer source);
|
||||||
|
|
||||||
/* buffer_read_*() returns the number of bytes read, except for ssh strings */
|
/* buffer_read_*() returns the number of bytes read, except for ssh strings */
|
||||||
int buffer_get_u8(ssh_buffer buffer, uint8_t *data);
|
int ssh_buffer_get_u8(ssh_buffer buffer, uint8_t *data);
|
||||||
int buffer_get_u32(ssh_buffer buffer, uint32_t *data);
|
int ssh_buffer_get_u32(ssh_buffer buffer, uint32_t *data);
|
||||||
int buffer_get_u64(ssh_buffer buffer, uint64_t *data);
|
int ssh_buffer_get_u64(ssh_buffer buffer, uint64_t *data);
|
||||||
|
|
||||||
uint32_t buffer_get_data(ssh_buffer buffer, void *data, uint32_t requestedlen);
|
/* ssh_buffer_get_ssh_string() is an exception. if the String read is too large or invalid, it will answer NULL. */
|
||||||
/* buffer_get_ssh_string() is an exception. if the String read is too large or invalid, it will answer NULL. */
|
ssh_string ssh_buffer_get_ssh_string(ssh_buffer buffer);
|
||||||
ssh_string buffer_get_ssh_string(ssh_buffer buffer);
|
|
||||||
/* gets a string out of a SSH-1 mpint */
|
/* ssh_buffer_pass_bytes acts as if len bytes have been read (used for padding) */
|
||||||
ssh_string buffer_get_mpint(ssh_buffer buffer);
|
uint32_t ssh_buffer_pass_bytes_end(ssh_buffer buffer, uint32_t len);
|
||||||
/* buffer_pass_bytes acts as if len bytes have been read (used for padding) */
|
uint32_t ssh_buffer_pass_bytes(ssh_buffer buffer, uint32_t len);
|
||||||
uint32_t buffer_pass_bytes_end(ssh_buffer buffer, uint32_t len);
|
|
||||||
uint32_t buffer_pass_bytes(ssh_buffer buffer, uint32_t len);
|
|
||||||
|
|
||||||
#endif /* BUFFER_H_ */
|
#endif /* BUFFER_H_ */
|
||||||
|
|||||||
@@ -124,6 +124,18 @@ typedef void (*ssh_global_request_callback) (ssh_session session,
|
|||||||
typedef ssh_channel (*ssh_channel_open_request_x11_callback) (ssh_session session,
|
typedef ssh_channel (*ssh_channel_open_request_x11_callback) (ssh_session session,
|
||||||
const char * originator_address, int originator_port, void *userdata);
|
const char * originator_address, int originator_port, void *userdata);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Handles an SSH new channel open "auth-agent" request. This happens when the server
|
||||||
|
* sends back an "auth-agent" connection attempt. This is a client-side API
|
||||||
|
* @param session current session handler
|
||||||
|
* @param userdata Userdata to be passed to the callback function.
|
||||||
|
* @returns a valid ssh_channel handle if the request is to be allowed
|
||||||
|
* @returns NULL if the request should not be allowed
|
||||||
|
* @warning The channel pointer returned by this callback must be closed by the application.
|
||||||
|
*/
|
||||||
|
typedef ssh_channel (*ssh_channel_open_request_auth_agent_callback) (ssh_session session,
|
||||||
|
void *userdata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The structure to replace libssh functions with appropriate callbacks.
|
* The structure to replace libssh functions with appropriate callbacks.
|
||||||
*/
|
*/
|
||||||
@@ -154,6 +166,9 @@ struct ssh_callbacks_struct {
|
|||||||
/** This function will be called when an incoming X11 request is received.
|
/** This function will be called when an incoming X11 request is received.
|
||||||
*/
|
*/
|
||||||
ssh_channel_open_request_x11_callback channel_open_request_x11_function;
|
ssh_channel_open_request_x11_callback channel_open_request_x11_function;
|
||||||
|
/** This function will be called when an incoming "auth-agent" request is received.
|
||||||
|
*/
|
||||||
|
ssh_channel_open_request_auth_agent_callback channel_open_request_auth_agent_function;
|
||||||
};
|
};
|
||||||
typedef struct ssh_callbacks_struct *ssh_callbacks;
|
typedef struct ssh_callbacks_struct *ssh_callbacks;
|
||||||
|
|
||||||
@@ -166,7 +181,7 @@ typedef struct ssh_callbacks_struct *ssh_callbacks;
|
|||||||
* @param user User that wants to authenticate
|
* @param user User that wants to authenticate
|
||||||
* @param password Password used for authentication
|
* @param password Password used for authentication
|
||||||
* @param userdata Userdata to be passed to the callback function.
|
* @param userdata Userdata to be passed to the callback function.
|
||||||
* @returns SSH_AUTH_OK Authentication is accepted.
|
* @returns SSH_AUTH_SUCCESS Authentication is accepted.
|
||||||
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
|
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
|
||||||
* @returns SSH_AUTH_DENIED Authentication failed.
|
* @returns SSH_AUTH_DENIED Authentication failed.
|
||||||
*/
|
*/
|
||||||
@@ -179,7 +194,7 @@ typedef int (*ssh_auth_password_callback) (ssh_session session, const char *user
|
|||||||
* @param session Current session handler
|
* @param session Current session handler
|
||||||
* @param user User that wants to authenticate
|
* @param user User that wants to authenticate
|
||||||
* @param userdata Userdata to be passed to the callback function.
|
* @param userdata Userdata to be passed to the callback function.
|
||||||
* @returns SSH_AUTH_OK Authentication is accepted.
|
* @returns SSH_AUTH_SUCCESS Authentication is accepted.
|
||||||
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
|
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
|
||||||
* @returns SSH_AUTH_DENIED Authentication failed.
|
* @returns SSH_AUTH_DENIED Authentication failed.
|
||||||
*/
|
*/
|
||||||
@@ -191,7 +206,7 @@ typedef int (*ssh_auth_none_callback) (ssh_session session, const char *user, vo
|
|||||||
* @param user Username of the user (can be spoofed)
|
* @param user Username of the user (can be spoofed)
|
||||||
* @param principal Authenticated principal of the user, including realm.
|
* @param principal Authenticated principal of the user, including realm.
|
||||||
* @param userdata Userdata to be passed to the callback function.
|
* @param userdata Userdata to be passed to the callback function.
|
||||||
* @returns SSH_AUTH_OK Authentication is accepted.
|
* @returns SSH_AUTH_SUCCESS Authentication is accepted.
|
||||||
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
|
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
|
||||||
* @returns SSH_AUTH_DENIED Authentication failed.
|
* @returns SSH_AUTH_DENIED Authentication failed.
|
||||||
* @warning Implementations should verify that parameter user matches in some way the principal.
|
* @warning Implementations should verify that parameter user matches in some way the principal.
|
||||||
@@ -209,7 +224,7 @@ typedef int (*ssh_auth_gssapi_mic_callback) (ssh_session session, const char *us
|
|||||||
* SSH_PUBLICKEY_STATE_VALID if the signature is valid. Others values should be
|
* SSH_PUBLICKEY_STATE_VALID if the signature is valid. Others values should be
|
||||||
* replied with a SSH_AUTH_DENIED.
|
* replied with a SSH_AUTH_DENIED.
|
||||||
* @param userdata Userdata to be passed to the callback function.
|
* @param userdata Userdata to be passed to the callback function.
|
||||||
* @returns SSH_AUTH_OK Authentication is accepted.
|
* @returns SSH_AUTH_SUCCESS Authentication is accepted.
|
||||||
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
|
* @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
|
||||||
* @returns SSH_AUTH_DENIED Authentication failed.
|
* @returns SSH_AUTH_DENIED Authentication failed.
|
||||||
*/
|
*/
|
||||||
@@ -420,6 +435,69 @@ typedef struct ssh_socket_callbacks_struct *ssh_socket_callbacks;
|
|||||||
((p)-> c != NULL) \
|
((p)-> c != NULL) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @brief Iterate through a list of callback structures
|
||||||
|
*
|
||||||
|
* This tests for their validity and executes them. The userdata argument is
|
||||||
|
* automatically passed through.
|
||||||
|
*
|
||||||
|
* @param list list of callbacks
|
||||||
|
*
|
||||||
|
* @param cbtype type of the callback
|
||||||
|
*
|
||||||
|
* @param c callback name
|
||||||
|
*
|
||||||
|
* @param va_args parameters to be passed
|
||||||
|
*/
|
||||||
|
#define ssh_callbacks_execute_list(list, cbtype, c, ...) \
|
||||||
|
do { \
|
||||||
|
struct ssh_iterator *i = ssh_list_get_iterator(list); \
|
||||||
|
cbtype cb; \
|
||||||
|
while (i != NULL){ \
|
||||||
|
cb = ssh_iterator_value(cbtype, i); \
|
||||||
|
if (ssh_callbacks_exists(cb, c)) \
|
||||||
|
cb-> c (__VA_ARGS__, cb->userdata); \
|
||||||
|
i = i->next; \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* @brief iterate through a list of callback structures.
|
||||||
|
*
|
||||||
|
* This tests for their validity and give control back to the calling code to
|
||||||
|
* execute them. Caller can decide to break the loop or continue executing the
|
||||||
|
* callbacks with different parameters
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* ssh_callbacks_iterate(channel->callbacks, ssh_channel_callbacks,
|
||||||
|
* channel_eof_function){
|
||||||
|
* rc = ssh_callbacks_iterate_exec(session, channel);
|
||||||
|
* if (rc != SSH_OK){
|
||||||
|
* break;
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ssh_callbacks_iterate_end();
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
#define ssh_callbacks_iterate(_cb_list, _cb_type, _cb_name) \
|
||||||
|
do { \
|
||||||
|
struct ssh_iterator *_cb_i = ssh_list_get_iterator(_cb_list); \
|
||||||
|
_cb_type _cb; \
|
||||||
|
for (; _cb_i != NULL; _cb_i = _cb_i->next) { \
|
||||||
|
_cb = ssh_iterator_value(_cb_type, _cb_i); \
|
||||||
|
if (ssh_callbacks_exists(_cb, _cb_name))
|
||||||
|
|
||||||
|
#define ssh_callbacks_iterate_exec(_cb_name, ...) \
|
||||||
|
_cb->_cb_name(__VA_ARGS__, _cb->userdata)
|
||||||
|
|
||||||
|
#define ssh_callbacks_iterate_end() \
|
||||||
|
} \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
/** @brief Prototype for a packet callback, to be called when a new packet arrives
|
/** @brief Prototype for a packet callback, to be called when a new packet arrives
|
||||||
* @param session The current session of the packet
|
* @param session The current session of the packet
|
||||||
* @param type packet type (see ssh2.h)
|
* @param type packet type (see ssh2.h)
|
||||||
@@ -495,6 +573,8 @@ LIBSSH_API int ssh_set_callbacks(ssh_session session, ssh_callbacks cb);
|
|||||||
* @param len the length of the data
|
* @param len the length of the data
|
||||||
* @param is_stderr is 0 for stdout or 1 for stderr
|
* @param is_stderr is 0 for stdout or 1 for stderr
|
||||||
* @param userdata Userdata to be passed to the callback function.
|
* @param userdata Userdata to be passed to the callback function.
|
||||||
|
* @returns number of bytes processed by the callee. The remaining bytes will
|
||||||
|
* be sent in the next callback message, when more data is available.
|
||||||
*/
|
*/
|
||||||
typedef int (*ssh_channel_data_callback) (ssh_session session,
|
typedef int (*ssh_channel_data_callback) (ssh_session session,
|
||||||
ssh_channel channel,
|
ssh_channel channel,
|
||||||
@@ -677,6 +757,22 @@ typedef int (*ssh_channel_subsystem_request_callback) (ssh_session session,
|
|||||||
const char *subsystem,
|
const char *subsystem,
|
||||||
void *userdata);
|
void *userdata);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SSH channel write will not block (flow control).
|
||||||
|
*
|
||||||
|
* @param channel the channel
|
||||||
|
*
|
||||||
|
* @param[in] bytes size of the remote window in bytes. Writing as much data
|
||||||
|
* will not block.
|
||||||
|
*
|
||||||
|
* @param[in] userdata Userdata to be passed to the callback function.
|
||||||
|
*
|
||||||
|
* @returns 0 default return value (other return codes may be added in future).
|
||||||
|
*/
|
||||||
|
typedef int (*ssh_channel_write_wontblock_callback) (ssh_session session,
|
||||||
|
ssh_channel channel,
|
||||||
|
size_t bytes,
|
||||||
|
void *userdata);
|
||||||
|
|
||||||
struct ssh_channel_callbacks_struct {
|
struct ssh_channel_callbacks_struct {
|
||||||
/** DON'T SET THIS use ssh_callbacks_init() instead. */
|
/** DON'T SET THIS use ssh_callbacks_init() instead. */
|
||||||
@@ -741,6 +837,10 @@ struct ssh_channel_callbacks_struct {
|
|||||||
* (like sftp).
|
* (like sftp).
|
||||||
*/
|
*/
|
||||||
ssh_channel_subsystem_request_callback channel_subsystem_request_function;
|
ssh_channel_subsystem_request_callback channel_subsystem_request_function;
|
||||||
|
/** This function will be called when the channel write is guaranteed
|
||||||
|
* not to block.
|
||||||
|
*/
|
||||||
|
ssh_channel_write_wontblock_callback channel_write_wontblock_function;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
|
typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
|
||||||
@@ -765,10 +865,46 @@ typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
|
|||||||
* @param cb The callback structure itself.
|
* @param cb The callback structure itself.
|
||||||
*
|
*
|
||||||
* @return SSH_OK on success, SSH_ERROR on error.
|
* @return SSH_OK on success, SSH_ERROR on error.
|
||||||
|
* @warning this function will not replace existing callbacks but set the
|
||||||
|
* new one atop of them.
|
||||||
*/
|
*/
|
||||||
LIBSSH_API int ssh_set_channel_callbacks(ssh_channel channel,
|
LIBSSH_API int ssh_set_channel_callbacks(ssh_channel channel,
|
||||||
ssh_channel_callbacks cb);
|
ssh_channel_callbacks cb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add channel callback functions
|
||||||
|
*
|
||||||
|
* This function will add channel callback functions to the channel callback
|
||||||
|
* list.
|
||||||
|
* Callbacks missing from a callback structure will be probed in the next
|
||||||
|
* on the list.
|
||||||
|
*
|
||||||
|
* @param channel The channel to set the callback structure.
|
||||||
|
*
|
||||||
|
* @param cb The callback structure itself.
|
||||||
|
*
|
||||||
|
* @return SSH_OK on success, SSH_ERROR on error.
|
||||||
|
*
|
||||||
|
* @see ssh_set_channel_callbacks
|
||||||
|
*/
|
||||||
|
LIBSSH_API int ssh_add_channel_callbacks(ssh_channel channel,
|
||||||
|
ssh_channel_callbacks cb);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Remove a channel callback.
|
||||||
|
*
|
||||||
|
* The channel has been added with ssh_add_channel_callbacks or
|
||||||
|
* ssh_set_channel_callbacks in this case.
|
||||||
|
*
|
||||||
|
* @param channel The channel to remove the callback structure from.
|
||||||
|
*
|
||||||
|
* @param cb The callback structure to remove
|
||||||
|
*
|
||||||
|
* @returns SSH_OK on success, SSH_ERROR on error.
|
||||||
|
*/
|
||||||
|
LIBSSH_API int ssh_remove_channel_callbacks(ssh_channel channel,
|
||||||
|
ssh_channel_callbacks cb);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
/** @group libssh_threads
|
/** @group libssh_threads
|
||||||
@@ -788,14 +924,21 @@ struct ssh_threads_callbacks_struct {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief sets the thread callbacks necessary if your program is using
|
* @brief Set the thread callbacks structure.
|
||||||
* libssh in a multithreaded fashion. This function must be called first,
|
*
|
||||||
* outside of any threading context (in your main() for instance), before
|
* This is necessary if your program is using libssh in a multithreaded fashion.
|
||||||
* ssh_init().
|
* This function must be called first, outside of any threading context (in your
|
||||||
* @param cb pointer to a ssh_threads_callbacks_struct structure, which contains
|
* main() function for instance), before you call ssh_init().
|
||||||
* the different callbacks to be set.
|
*
|
||||||
|
* @param[in] cb A pointer to a ssh_threads_callbacks_struct structure, which
|
||||||
|
* contains the different callbacks to be set.
|
||||||
|
*
|
||||||
|
* @returns Always returns SSH_OK.
|
||||||
|
*
|
||||||
* @see ssh_threads_callbacks_struct
|
* @see ssh_threads_callbacks_struct
|
||||||
* @see SSH_THREADS_PTHREAD
|
* @see SSH_THREADS_PTHREAD
|
||||||
|
* @bug libgcrypt 1.6 and bigger backend does not support custom callback.
|
||||||
|
* Using anything else than pthreads here will fail.
|
||||||
*/
|
*/
|
||||||
LIBSSH_API int ssh_threads_set_callbacks(struct ssh_threads_callbacks_struct
|
LIBSSH_API int ssh_threads_set_callbacks(struct ssh_threads_callbacks_struct
|
||||||
*cb);
|
*cb);
|
||||||
@@ -809,9 +952,13 @@ LIBSSH_API int ssh_threads_set_callbacks(struct ssh_threads_callbacks_struct
|
|||||||
LIBSSH_API struct ssh_threads_callbacks_struct *ssh_threads_get_pthread(void);
|
LIBSSH_API struct ssh_threads_callbacks_struct *ssh_threads_get_pthread(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief returns a pointer on the noop threads callbacks, to be used with
|
* @brief Get the noop threads callbacks structure
|
||||||
* ssh_threads_set_callbacks. These callbacks do nothing and are being used by
|
*
|
||||||
* default.
|
* This can be used with ssh_threads_set_callbacks. These callbacks do nothing
|
||||||
|
* and are being used by default.
|
||||||
|
*
|
||||||
|
* @return Always returns a valid pointer to the noop callbacks structure.
|
||||||
|
*
|
||||||
* @see ssh_threads_set_callbacks
|
* @see ssh_threads_set_callbacks
|
||||||
*/
|
*/
|
||||||
LIBSSH_API struct ssh_threads_callbacks_struct *ssh_threads_get_noop(void);
|
LIBSSH_API struct ssh_threads_callbacks_struct *ssh_threads_get_noop(void);
|
||||||
|
|||||||
41
include/libssh/chacha.h
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
/* $OpenBSD: chacha.h,v 1.3 2014/05/02 03:27:54 djm Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
chacha-merged.c version 20080118
|
||||||
|
D. J. Bernstein
|
||||||
|
Public domain.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CHACHA_H
|
||||||
|
#define CHACHA_H
|
||||||
|
|
||||||
|
struct chacha_ctx {
|
||||||
|
uint32_t input[16];
|
||||||
|
};
|
||||||
|
|
||||||
|
#define CHACHA_MINKEYLEN 16
|
||||||
|
#define CHACHA_NONCELEN 8
|
||||||
|
#define CHACHA_CTRLEN 8
|
||||||
|
#define CHACHA_STATELEN (CHACHA_NONCELEN+CHACHA_CTRLEN)
|
||||||
|
#define CHACHA_BLOCKLEN 64
|
||||||
|
|
||||||
|
void chacha_keysetup(struct chacha_ctx *x, const uint8_t *k, uint32_t kbits)
|
||||||
|
#ifdef HAVE_GCC_BOUNDED_ATTRIBUTE
|
||||||
|
__attribute__((__bounded__(__minbytes__, 2, CHACHA_MINKEYLEN)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
void chacha_ivsetup(struct chacha_ctx *x, const uint8_t *iv, const uint8_t *ctr)
|
||||||
|
#ifdef HAVE_GCC_BOUNDED_ATTRIBUTE
|
||||||
|
__attribute__((__bounded__(__minbytes__, 2, CHACHA_NONCELEN)))
|
||||||
|
__attribute__((__bounded__(__minbytes__, 3, CHACHA_CTRLEN)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
void chacha_encrypt_bytes(struct chacha_ctx *x, const uint8_t *m,
|
||||||
|
uint8_t *c, uint32_t bytes)
|
||||||
|
#ifdef HAVE_GCC_BOUNDED_ATTRIBUTE
|
||||||
|
__attribute__((__bounded__(__buffer__, 2, 4)))
|
||||||
|
__attribute__((__bounded__(__buffer__, 3, 4)))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
#endif /* CHACHA_H */
|
||||||