Browse Source

Support for retrieval of SSL certificates

dvh-chacham15-master
Hoa V. DINH 8 years ago
parent
commit
cff50f6529
12 changed files with 202 additions and 41 deletions
  1. +64
    -32
      build-mac/libetpan Tests.xcodeproj/project.pbxproj
  2. +4
    -0
      build-mac/libetpan.xcodeproj/project.pbxproj
  3. +19
    -0
      src/data-types/mailstream.c
  4. +4
    -0
      src/data-types/mailstream.h
  5. +36
    -0
      src/data-types/mailstream_cfstream.c
  6. +2
    -0
      src/data-types/mailstream_cfstream.h
  7. +15
    -9
      src/data-types/mailstream_compress.c
  8. +11
    -0
      src/data-types/mailstream_low.c
  9. +3
    -0
      src/data-types/mailstream_low.h
  10. +1
    -0
      src/data-types/mailstream_socket.c
  11. +40
    -0
      src/data-types/mailstream_ssl.c
  12. +3
    -0
      src/data-types/mailstream_types.h

+ 64
- 32
build-mac/libetpan Tests.xcodeproj/project.pbxproj View File

@ -40,36 +40,29 @@
3678612116AB411F002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678612316AB4131002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678612516AB4142002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
3678612716AB4169002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678612C16AB4314002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678612D16AB4314002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678612E16AB4314002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678612F16AB4314002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678613016AB4314002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
3678613E16AB4411002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678613F16AB4411002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678614016AB4411002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678614116AB4411002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678614216AB4411002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
3678614A16AB4426002F2B96 /* mime-parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 367860E916AB36DF002F2B96 /* mime-parse.c */; };
3678614B16AB442A002F2B96 /* mime-create.c in Sources */ = {isa = PBXBuildFile; fileRef = 367860E816AB36DF002F2B96 /* mime-create.c */; };
3678615016AB44A6002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678615116AB44A6002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678615216AB44A6002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678615316AB44A6002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678615416AB44A6002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
3678616116AB4547002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678616216AB4547002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678616316AB4547002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678616416AB4547002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678616516AB4547002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
3678617116AB4551002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678617216AB4551002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678617316AB4551002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678617416AB4551002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678617516AB4551002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
3678618116AB4559002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678618216AB4559002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678618316AB4559002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678618416AB4559002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678618516AB4559002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
@ -86,7 +79,6 @@
3678619816AB4685002F2B96 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
3678619916AB4689002F2B96 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
3678619E16AB470B002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678619F16AB470B002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
367861A016AB470B002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
367861A116AB470B002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
367861A216AB470B002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
@ -95,12 +87,10 @@
367861AC16AB47CA002F2B96 /* readmsg-common.c in Sources */ = {isa = PBXBuildFile; fileRef = 367860EF16AB36DF002F2B96 /* readmsg-common.c */; };
367861AD16AB47DC002F2B96 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
367861B316AB48E1002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
367861B416AB48E1002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
367861B516AB48E1002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
367861B616AB48E1002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
367861B716AB48E1002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
367861C316AB48E4002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
367861C416AB48E4002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
367861C516AB48E4002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
367861C616AB48E4002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
367861C716AB48E4002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
@ -111,32 +101,27 @@
367861D316AB4BDA002F2B96 /* libiconv.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678619616AB4671002F2B96 /* libiconv.2.dylib */; };
367861D416AB4BE9002F2B96 /* readmsg-common.c in Sources */ = {isa = PBXBuildFile; fileRef = 367860EF16AB36DF002F2B96 /* readmsg-common.c */; };
367861F116AB4D4F002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
367861F216AB4D4F002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
367861F316AB4D4F002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
367861F416AB4D4F002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
367861F516AB4D4F002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
367861FF16AB4D81002F2B96 /* decrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 367860DD16AB36DF002F2B96 /* decrypt.c */; };
3678620016AB4D96002F2B96 /* compose-msg.c in Sources */ = {isa = PBXBuildFile; fileRef = 367860DC16AB36DF002F2B96 /* compose-msg.c */; };
3678620516AB4DFE002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678620616AB4DFE002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678620716AB4DFE002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678620816AB4DFE002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678620916AB4DFE002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
3678621116AB4E16002F2B96 /* pgp.c in Sources */ = {isa = PBXBuildFile; fileRef = 367860EC16AB36DF002F2B96 /* pgp.c */; };
3678621816AB4E63002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678621916AB4E63002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678621A16AB4E63002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678621B16AB4E63002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678621C16AB4E63002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
3678622616AB4E97002F2B96 /* pop-sample.c in Sources */ = {isa = PBXBuildFile; fileRef = 367860ED16AB36DF002F2B96 /* pop-sample.c */; };
3678622B16AB4EE6002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678622C16AB4EE6002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678622D16AB4EE6002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678622E16AB4EE6002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678622F16AB4EE6002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
3678623716AB4EF6002F2B96 /* smime.c in Sources */ = {isa = PBXBuildFile; fileRef = 367860F416AB36DF002F2B96 /* smime.c */; };
3678623E16AB4F32002F2B96 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678611E16AB410C002F2B96 /* CoreFoundation.framework */; };
3678623F16AB4F32002F2B96 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612616AB4169002F2B96 /* CFNetwork.framework */; };
3678624016AB4F32002F2B96 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612016AB411F002F2B96 /* libssl.dylib */; };
3678624116AB4F32002F2B96 /* libsasl2.2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612216AB4131002F2B96 /* libsasl2.2.dylib */; };
3678624216AB4F32002F2B96 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678612416AB4142002F2B96 /* libcrypto.dylib */; };
@ -156,6 +141,36 @@
367863A616AB61F6002F2B96 /* libetpan.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678639816AB61BA002F2B96 /* libetpan.a */; };
367863A816AB61F9002F2B96 /* libetpan.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678639816AB61BA002F2B96 /* libetpan.a */; };
367863A916AB61FA002F2B96 /* libetpan.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3678639816AB61BA002F2B96 /* libetpan.a */; };
C6ED6CF917A1862C00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6CFA17A1863E00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6CFB17A1865600A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6CFC17A1865700A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6CFD17A1865700A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6CFE17A1865800A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6CFF17A1865900A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6D0017A1865900A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6D0117A1865B00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6D0217A1865C00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6D0317A1865C00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6D0417A1865D00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6D0517A1865E00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6D0617A1865E00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6D0717A1865F00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF817A1862C00A4A14C /* Security.framework */; };
C6ED6D0917A1883000A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D0A17A1884200A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D0B17A1884200A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D0D17A1884400A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D0E17A1884800A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D0F17A1884800A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D1017A1884900A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D1117A1884A00A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D1217A1884A00A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D1317A1884B00A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D1417A1884C00A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D1517A1884D00A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D1617A1884E00A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D1717A1884E00A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
C6ED6D1817A1884F00A4A14C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6D0817A1883000A4A14C /* CoreServices.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -432,7 +447,6 @@
3678612016AB411F002F2B96 /* libssl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libssl.dylib; path = usr/lib/libssl.dylib; sourceTree = SDKROOT; };
3678612216AB4131002F2B96 /* libsasl2.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsasl2.2.dylib; path = usr/lib/libsasl2.2.dylib; sourceTree = SDKROOT; };
3678612416AB4142002F2B96 /* libcrypto.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcrypto.dylib; path = usr/lib/libcrypto.dylib; sourceTree = SDKROOT; };
3678612616AB4169002F2B96 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
3678613616AB4314002F2B96 /* mime-parse */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "mime-parse"; sourceTree = BUILT_PRODUCTS_DIR; };
3678614816AB4411002F2B96 /* mime-create */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "mime-create"; sourceTree = BUILT_PRODUCTS_DIR; };
3678615A16AB44A7002F2B96 /* compose-msg */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "compose-msg"; sourceTree = BUILT_PRODUCTS_DIR; };
@ -449,6 +463,8 @@
3678623516AB4EE6002F2B96 /* smime */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = smime; sourceTree = BUILT_PRODUCTS_DIR; };
3678624816AB4F32002F2B96 /* smtpsend */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = smtpsend; sourceTree = BUILT_PRODUCTS_DIR; };
3678639816AB61BA002F2B96 /* libetpan.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libetpan.a; path = "../../../Library/Developer/Xcode/DerivedData/libetpan-dazyuihjymonnybirhcistixjbll/Build/Products/Debug/libetpan.a"; sourceTree = "<group>"; };
C6ED6CF817A1862C00A4A14C /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
C6ED6D0817A1883000A4A14C /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -456,8 +472,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C6ED6D0917A1883000A4A14C /* CoreServices.framework in Frameworks */,
3678611F16AB410C002F2B96 /* CoreFoundation.framework in Frameworks */,
3678612716AB4169002F2B96 /* CFNetwork.framework in Frameworks */,
C6ED6CF917A1862C00A4A14C /* Security.framework in Frameworks */,
3678612116AB411F002F2B96 /* libssl.dylib in Frameworks */,
3678612316AB4131002F2B96 /* libsasl2.2.dylib in Frameworks */,
3678612516AB4142002F2B96 /* libcrypto.dylib in Frameworks */,
@ -470,10 +487,11 @@
buildActionMask = 2147483647;
files = (
3678612C16AB4314002F2B96 /* CoreFoundation.framework in Frameworks */,
3678612D16AB4314002F2B96 /* CFNetwork.framework in Frameworks */,
C6ED6CFA17A1863E00A4A14C /* Security.framework in Frameworks */,
3678612E16AB4314002F2B96 /* libssl.dylib in Frameworks */,
3678612F16AB4314002F2B96 /* libsasl2.2.dylib in Frameworks */,
3678613016AB4314002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D0A17A1884200A4A14C /* CoreServices.framework in Frameworks */,
3678639B16AB61D3002F2B96 /* libetpan.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -483,10 +501,11 @@
buildActionMask = 2147483647;
files = (
3678613E16AB4411002F2B96 /* CoreFoundation.framework in Frameworks */,
3678613F16AB4411002F2B96 /* CFNetwork.framework in Frameworks */,
3678614016AB4411002F2B96 /* libssl.dylib in Frameworks */,
3678614116AB4411002F2B96 /* libsasl2.2.dylib in Frameworks */,
C6ED6CFB17A1865600A4A14C /* Security.framework in Frameworks */,
3678614216AB4411002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D0B17A1884200A4A14C /* CoreServices.framework in Frameworks */,
3678639C16AB61D7002F2B96 /* libetpan.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -496,10 +515,11 @@
buildActionMask = 2147483647;
files = (
3678615016AB44A6002F2B96 /* CoreFoundation.framework in Frameworks */,
3678615116AB44A6002F2B96 /* CFNetwork.framework in Frameworks */,
3678615216AB44A6002F2B96 /* libssl.dylib in Frameworks */,
3678615316AB44A6002F2B96 /* libsasl2.2.dylib in Frameworks */,
C6ED6CFC17A1865700A4A14C /* Security.framework in Frameworks */,
3678615416AB44A6002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D0D17A1884400A4A14C /* CoreServices.framework in Frameworks */,
3678639D16AB61DB002F2B96 /* libetpan.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -509,12 +529,13 @@
buildActionMask = 2147483647;
files = (
3678616116AB4547002F2B96 /* CoreFoundation.framework in Frameworks */,
3678616216AB4547002F2B96 /* CFNetwork.framework in Frameworks */,
3678616316AB4547002F2B96 /* libssl.dylib in Frameworks */,
3678616416AB4547002F2B96 /* libsasl2.2.dylib in Frameworks */,
3678616516AB4547002F2B96 /* libcrypto.dylib in Frameworks */,
3678619716AB4671002F2B96 /* libiconv.2.dylib in Frameworks */,
C6ED6CFD17A1865700A4A14C /* Security.framework in Frameworks */,
3678639E16AB61DE002F2B96 /* libetpan.a in Frameworks */,
C6ED6D0E17A1884800A4A14C /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -523,12 +544,13 @@
buildActionMask = 2147483647;
files = (
3678617116AB4551002F2B96 /* CoreFoundation.framework in Frameworks */,
3678617216AB4551002F2B96 /* CFNetwork.framework in Frameworks */,
3678617316AB4551002F2B96 /* libssl.dylib in Frameworks */,
3678617416AB4551002F2B96 /* libsasl2.2.dylib in Frameworks */,
3678617516AB4551002F2B96 /* libcrypto.dylib in Frameworks */,
3678619816AB4685002F2B96 /* libiconv.2.dylib in Frameworks */,
C6ED6CFE17A1865800A4A14C /* Security.framework in Frameworks */,
3678639F16AB61E1002F2B96 /* libetpan.a in Frameworks */,
C6ED6D0F17A1884800A4A14C /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -537,12 +559,13 @@
buildActionMask = 2147483647;
files = (
3678618116AB4559002F2B96 /* CoreFoundation.framework in Frameworks */,
3678618216AB4559002F2B96 /* CFNetwork.framework in Frameworks */,
3678618316AB4559002F2B96 /* libssl.dylib in Frameworks */,
3678618416AB4559002F2B96 /* libsasl2.2.dylib in Frameworks */,
3678618516AB4559002F2B96 /* libcrypto.dylib in Frameworks */,
3678619916AB4689002F2B96 /* libiconv.2.dylib in Frameworks */,
C6ED6CFF17A1865900A4A14C /* Security.framework in Frameworks */,
367863A016AB61E5002F2B96 /* libetpan.a in Frameworks */,
C6ED6D1017A1884900A4A14C /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -551,12 +574,13 @@
buildActionMask = 2147483647;
files = (
3678619E16AB470B002F2B96 /* CoreFoundation.framework in Frameworks */,
3678619F16AB470B002F2B96 /* CFNetwork.framework in Frameworks */,
367861A016AB470B002F2B96 /* libssl.dylib in Frameworks */,
367861A116AB470B002F2B96 /* libsasl2.2.dylib in Frameworks */,
367861A216AB470B002F2B96 /* libcrypto.dylib in Frameworks */,
367861AD16AB47DC002F2B96 /* libiconv.2.dylib in Frameworks */,
C6ED6D0017A1865900A4A14C /* Security.framework in Frameworks */,
367863A116AB61E9002F2B96 /* libetpan.a in Frameworks */,
C6ED6D1117A1884A00A4A14C /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -565,10 +589,11 @@
buildActionMask = 2147483647;
files = (
367861B316AB48E1002F2B96 /* CoreFoundation.framework in Frameworks */,
367861B416AB48E1002F2B96 /* CFNetwork.framework in Frameworks */,
367861B516AB48E1002F2B96 /* libssl.dylib in Frameworks */,
367861B616AB48E1002F2B96 /* libsasl2.2.dylib in Frameworks */,
C6ED6D0117A1865B00A4A14C /* Security.framework in Frameworks */,
367861B716AB48E1002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D1217A1884A00A4A14C /* CoreServices.framework in Frameworks */,
367863A216AB61EE002F2B96 /* libetpan.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -578,12 +603,13 @@
buildActionMask = 2147483647;
files = (
367861C316AB48E4002F2B96 /* CoreFoundation.framework in Frameworks */,
367861C416AB48E4002F2B96 /* CFNetwork.framework in Frameworks */,
367861C516AB48E4002F2B96 /* libssl.dylib in Frameworks */,
367861C616AB48E4002F2B96 /* libsasl2.2.dylib in Frameworks */,
367861C716AB48E4002F2B96 /* libcrypto.dylib in Frameworks */,
367861D316AB4BDA002F2B96 /* libiconv.2.dylib in Frameworks */,
C6ED6D0217A1865C00A4A14C /* Security.framework in Frameworks */,
367863A316AB61F5002F2B96 /* libetpan.a in Frameworks */,
C6ED6D1317A1884B00A4A14C /* CoreServices.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -592,10 +618,11 @@
buildActionMask = 2147483647;
files = (
367861F116AB4D4F002F2B96 /* CoreFoundation.framework in Frameworks */,
367861F216AB4D4F002F2B96 /* CFNetwork.framework in Frameworks */,
367861F316AB4D4F002F2B96 /* libssl.dylib in Frameworks */,
367861F416AB4D4F002F2B96 /* libsasl2.2.dylib in Frameworks */,
C6ED6D0317A1865C00A4A14C /* Security.framework in Frameworks */,
367861F516AB4D4F002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D1517A1884D00A4A14C /* CoreServices.framework in Frameworks */,
367863A416AB61F5002F2B96 /* libetpan.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -605,10 +632,11 @@
buildActionMask = 2147483647;
files = (
3678620516AB4DFE002F2B96 /* CoreFoundation.framework in Frameworks */,
3678620616AB4DFE002F2B96 /* CFNetwork.framework in Frameworks */,
3678620716AB4DFE002F2B96 /* libssl.dylib in Frameworks */,
3678620816AB4DFE002F2B96 /* libsasl2.2.dylib in Frameworks */,
C6ED6D0517A1865E00A4A14C /* Security.framework in Frameworks */,
3678620916AB4DFE002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D1417A1884C00A4A14C /* CoreServices.framework in Frameworks */,
367863A516AB61F6002F2B96 /* libetpan.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -618,10 +646,11 @@
buildActionMask = 2147483647;
files = (
3678621816AB4E63002F2B96 /* CoreFoundation.framework in Frameworks */,
3678621916AB4E63002F2B96 /* CFNetwork.framework in Frameworks */,
3678621A16AB4E63002F2B96 /* libssl.dylib in Frameworks */,
3678621B16AB4E63002F2B96 /* libsasl2.2.dylib in Frameworks */,
C6ED6D0417A1865D00A4A14C /* Security.framework in Frameworks */,
3678621C16AB4E63002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D1617A1884E00A4A14C /* CoreServices.framework in Frameworks */,
367863A616AB61F6002F2B96 /* libetpan.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -631,10 +660,11 @@
buildActionMask = 2147483647;
files = (
3678622B16AB4EE6002F2B96 /* CoreFoundation.framework in Frameworks */,
3678622C16AB4EE6002F2B96 /* CFNetwork.framework in Frameworks */,
3678622D16AB4EE6002F2B96 /* libssl.dylib in Frameworks */,
3678622E16AB4EE6002F2B96 /* libsasl2.2.dylib in Frameworks */,
C6ED6D0717A1865F00A4A14C /* Security.framework in Frameworks */,
3678622F16AB4EE6002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D1717A1884E00A4A14C /* CoreServices.framework in Frameworks */,
367863A816AB61F9002F2B96 /* libetpan.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -644,10 +674,11 @@
buildActionMask = 2147483647;
files = (
3678623E16AB4F32002F2B96 /* CoreFoundation.framework in Frameworks */,
3678623F16AB4F32002F2B96 /* CFNetwork.framework in Frameworks */,
3678624016AB4F32002F2B96 /* libssl.dylib in Frameworks */,
3678624116AB4F32002F2B96 /* libsasl2.2.dylib in Frameworks */,
C6ED6D0617A1865E00A4A14C /* Security.framework in Frameworks */,
3678624216AB4F32002F2B96 /* libcrypto.dylib in Frameworks */,
C6ED6D1817A1884F00A4A14C /* CoreServices.framework in Frameworks */,
367863A916AB61FA002F2B96 /* libetpan.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -731,7 +762,8 @@
isa = PBXGroup;
children = (
3678611E16AB410C002F2B96 /* CoreFoundation.framework */,
3678612616AB4169002F2B96 /* CFNetwork.framework */,
C6ED6D0817A1883000A4A14C /* CoreServices.framework */,
C6ED6CF817A1862C00A4A14C /* Security.framework */,
3678612416AB4142002F2B96 /* libcrypto.dylib */,
3678612216AB4131002F2B96 /* libsasl2.2.dylib */,
3678612016AB411F002F2B96 /* libssl.dylib */,


+ 4
- 0
build-mac/libetpan.xcodeproj/project.pbxproj View File

@ -384,6 +384,7 @@
C6E572101103770400897274 /* quota_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = C6E571FA110376F200897274 /* quota_parser.c */; };
C6E572121103770400897274 /* quota_sender.c in Sources */ = {isa = PBXBuildFile; fileRef = C6E571FC110376F200897274 /* quota_sender.c */; };
C6E572141103770400897274 /* quota_types.c in Sources */ = {isa = PBXBuildFile; fileRef = C6E571FE110376F200897274 /* quota_types.c */; };
C6ED6CF717A185FD00A4A14C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6ED6CF617A185FD00A4A14C /* Security.framework */; };
C6EFB8781433F1F300F805C0 /* mailstream_cfstream.c in Sources */ = {isa = PBXBuildFile; fileRef = C6EFB8761433F1F300F805C0 /* mailstream_cfstream.c */; };
C6EFB87A1433F1F300F805C0 /* mailstream_cfstream.c in Sources */ = {isa = PBXBuildFile; fileRef = C6EFB8761433F1F300F805C0 /* mailstream_cfstream.c */; };
C6EFB8AE1433F58500F805C0 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C6EFB8AD1433F58500F805C0 /* CoreFoundation.framework */; };
@ -632,6 +633,7 @@
C6E571FF110376F200897274 /* quota_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quota_types.h; sourceTree = "<group>"; };
C6E57200110376F200897274 /* quota.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = quota.c; sourceTree = "<group>"; };
C6E57201110376F200897274 /* quota.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quota.h; sourceTree = "<group>"; };
C6ED6CF617A185FD00A4A14C /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
C6EFB8761433F1F300F805C0 /* mailstream_cfstream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mailstream_cfstream.c; sourceTree = "<group>"; };
C6EFB8771433F1F300F805C0 /* mailstream_cfstream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mailstream_cfstream.h; sourceTree = "<group>"; };
C6EFB8AD1433F58500F805C0 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
@ -987,6 +989,7 @@
C6F9EDBE105339EA0059C3BA /* libcrypto.dylib in Frameworks */,
C6EFB8AE1433F58500F805C0 /* CoreFoundation.framework in Frameworks */,
C6EFB8B41433F5A400F805C0 /* CoreServices.framework in Frameworks */,
C6ED6CF717A185FD00A4A14C /* Security.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1037,6 +1040,7 @@
C6F9ED9A105338F60059C3BA /* Libraries */,
C6EFB8AD1433F58500F805C0 /* CoreFoundation.framework */,
C6EFB8B31433F5A400F805C0 /* CoreServices.framework */,
C6ED6CF617A185FD00A4A14C /* Security.framework */,
);
name = "External Frameworks and Libraries";
sourceTree = "<group>";


+ 19
- 0
src/data-types/mailstream.c View File

@ -471,3 +471,22 @@ void mailstream_set_logger(mailstream * s, void (* logger)(mailstream * s, int l
s->logger = logger;
s->logger_context = logger_context;
}
carray * mailstream_get_certificate_chain(mailstream * s)
{
return mailstream_low_get_certificate_chain(s->low);
}
void mailstream_certificate_chain_free(carray * certificate_chain)
{
unsigned int i;
if (certificate_chain == NULL)
return;
for(i = 0 ; i < carray_count(certificate_chain) ; i ++) {
free(carray_get(certificate_chain, i));
}
carray_free(certificate_chain);
}

+ 4
- 0
src/data-types/mailstream.h View File

@ -97,6 +97,10 @@ int mailstream_setup_idle(mailstream * s);
void mailstream_unsetup_idle(mailstream * s);
void mailstream_interrupt_idle(mailstream * s);
/* Get certificate chain. Returns an array of MMAPString containing DER data or NULL if it's not a SSL connection */
carray * mailstream_get_certificate_chain(mailstream * s);
void mailstream_certificate_chain_free(carray * certificate_chain);
#define LIBETPAN_MAILSTREAM_NETWORK_DELAY
LIBETPAN_EXPORT
extern struct timeval mailstream_network_delay;


+ 36
- 0
src/data-types/mailstream_cfstream.c View File

@ -36,6 +36,7 @@
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR
#include <CFNetwork/CFNetwork.h>
#include <Security/Security.h>
#else
#include <CoreServices/CoreServices.h>
#endif
@ -129,6 +130,7 @@ static ssize_t mailstream_low_cfstream_write(mailstream_low * s,
static void mailstream_low_cfstream_free(mailstream_low * s);
static int mailstream_low_cfstream_get_fd(mailstream_low * s);
static void mailstream_low_cfstream_cancel(mailstream_low * s);
static carray * mailstream_low_cfstream_get_certificate_chain(mailstream_low * s);
static mailstream_low_driver local_mailstream_cfstream_driver = {
/* mailstream_read */ mailstream_low_cfstream_read,
@ -138,6 +140,7 @@ static mailstream_low_driver local_mailstream_cfstream_driver = {
/* mailstream_free */ mailstream_low_cfstream_free,
/* mailstream_cancel */ mailstream_low_cfstream_cancel,
/* mailstream_get_cancel_fd */ NULL,
/* mailstream_get_certificate_chain */ mailstream_low_cfstream_get_certificate_chain,
};
mailstream_low_driver * mailstream_cfstream_driver =
@ -1110,3 +1113,36 @@ void mailstream_cfstream_interrupt_idle(mailstream * s)
pthread_mutex_unlock(&cfstream_data->runloop_lock);
#endif
}
static carray * mailstream_low_cfstream_get_certificate_chain(mailstream_low * s)
{
#if HAVE_CFNETWORK
struct mailstream_cfstream_data * cfstream_data;
CFArrayRef certs;
unsigned int i;
carray * result;
cfstream_data = (struct mailstream_cfstream_data *) s->data;
certs = CFReadStreamCopyProperty(cfstream_data->readStream, kCFStreamPropertySSLPeerCertificates);
if (certs == NULL)
return NULL;
result = carray_new(4);
for(i = 0 ; i < CFArrayGetCount(certs) ; i ++) {
SecCertificateRef cert = (SecCertificateRef) CFArrayGetValueAtIndex(certs, i);
CFDataRef data = SecCertificateCopyData(cert);
CFIndex length = CFDataGetLength(data);
const UInt8 * bytes = CFDataGetBytePtr(data);
MMAPString * str = mmap_string_sized_new(length);
mmap_string_append_len(str, (char*) bytes, length);
carray_add(result, str, NULL);
CFRelease(data);
}
CFRelease(certs);
return result;
#else
return NULL;
#endif
}

+ 2
- 0
src/data-types/mailstream_cfstream.h View File

@ -99,6 +99,8 @@ extern "C" {
void mailstream_cfstream_interrupt_idle(mailstream * s);
void mailstream_cfstream_unsetup_idle(mailstream * s);
/* SSL certificate */
#ifdef __cplusplus
}
#endif


+ 15
- 9
src/data-types/mailstream_compress.c View File

@ -60,6 +60,7 @@ static int mailstream_low_compress_get_fd(mailstream_low * s);
static struct mailstream_cancel * mailstream_low_compress_get_cancel(mailstream_low * s);
static void mailstream_low_compress_free(mailstream_low * s);
static void mailstream_low_compress_cancel(mailstream_low * s);
static carray * mailstream_low_compress_get_certificate_chain(mailstream_low * s);
typedef struct mailstream_compress_data
{
@ -78,11 +79,12 @@ static mailstream_low_driver local_mailstream_compress_driver = {
/* mailstream_free */ mailstream_low_compress_free,
/* mailstream_cancel */ mailstream_low_compress_cancel,
/* mailstream_get_cancel */ mailstream_low_compress_get_cancel,
/* mailstream_get_certificate_chain */ mailstream_low_compress_get_certificate_chain,
};
mailstream_low_driver * mailstream_compress_driver = &local_mailstream_compress_driver;
mailstream_low * mailstream_low_compress_open(mailstream_low * ms)
static mailstream_low * mailstream_low_compress_open(mailstream_low * ms)
{
mailstream_low * s;
@ -139,7 +141,7 @@ mailstream_low * mailstream_low_compress_open(mailstream_low * ms)
return NULL;
}
ssize_t mailstream_low_compress_read(mailstream_low * s, void * buf, size_t count) {
static ssize_t mailstream_low_compress_read(mailstream_low * s, void * buf, size_t count) {
compress_data *data = s->data;
data->ms->timeout = s->timeout;
z_stream *strm = data->decompress_stream;
@ -232,8 +234,7 @@ static int wait_write_compress(mailstream_low * s)
return 1;
}
ssize_t mailstream_low_compress_write(mailstream_low * s,
const void * buf, size_t count) {
static ssize_t mailstream_low_compress_write(mailstream_low * s, const void * buf, size_t count) {
int zr, wr;
compress_data *data = s->data;
@ -278,22 +279,22 @@ const void * buf, size_t count) {
return compress_len - strm->avail_in;
}
int mailstream_low_compress_close(mailstream_low * s) {
static int mailstream_low_compress_close(mailstream_low * s) {
compress_data *data = s->data;
return data->ms->driver->mailstream_close(data->ms);
}
int mailstream_low_compress_get_fd(mailstream_low * s) {
static int mailstream_low_compress_get_fd(mailstream_low * s) {
compress_data *data = s->data;
return data->ms->driver->mailstream_get_fd(data->ms);
}
struct mailstream_cancel * mailstream_low_compress_get_cancel(mailstream_low * s) {
static struct mailstream_cancel * mailstream_low_compress_get_cancel(mailstream_low * s) {
compress_data *data = s->data;
return data->ms->driver->mailstream_get_cancel(data->ms);
}
void mailstream_low_compress_free(mailstream_low * s) {
static void mailstream_low_compress_free(mailstream_low * s) {
compress_data *data = s->data;
data->ms->driver->mailstream_free(data->ms);
if (data->compress_stream) {
@ -308,9 +309,14 @@ void mailstream_low_compress_free(mailstream_low * s) {
free(s);
}
void mailstream_low_compress_cancel(mailstream_low * s) {
static void mailstream_low_compress_cancel(mailstream_low * s) {
compress_data *data = s->data;
data->ms->driver->mailstream_cancel(data->ms);
}
static carray * mailstream_low_compress_get_certificate_chain(mailstream_low * s) {
compress_data *data = s->data;
data->ms->driver->mailstream_get_certificate_chain(data->ms);
}
#endif

+ 11
- 0
src/data-types/mailstream_low.c View File

@ -401,3 +401,14 @@ static inline void mailstream_logger_internal(mailstream_low * s, int is_stream_
s->logger(s, log_type, buffer, size, s->logger_context);
}
carray * mailstream_low_get_certificate_chain(mailstream_low * s)
{
if (s == NULL)
return NULL;
if (s->driver->mailstream_get_certificate_chain == NULL)
return NULL;
return s->driver->mailstream_get_certificate_chain(s);
}

+ 3
- 0
src/data-types/mailstream_low.h View File

@ -92,6 +92,9 @@ time_t mailstream_low_get_timeout(mailstream_low * s);
void mailstream_low_set_logger(mailstream_low * s, void (* logger)(mailstream_low * s, int log_type,
const char * str, size_t size, void * context), void * logger_context);
/* Get certificate chain. Returns an array of MMAPString containing DER data or NULL if it's not a SSL connection */
carray * mailstream_low_get_certificate_chain(mailstream_low * s);
#ifdef __cplusplus
}
#endif


+ 1
- 0
src/data-types/mailstream_socket.c View File

@ -95,6 +95,7 @@ static mailstream_low_driver local_mailstream_socket_driver = {
/* mailstream_free */ mailstream_low_socket_free,
/* mailstream_cancel */ mailstream_low_socket_cancel,
/* mailstream_get_cancel */ mailstream_low_socket_get_cancel,
/* mailstream_get_certificate_chain */ NULL,
};
mailstream_low_driver * mailstream_socket_driver =


+ 40
- 0
src/data-types/mailstream_ssl.c View File

@ -93,6 +93,7 @@
# endif
#endif
#include "mmapstring.h"
#include "mailstream_cancel.h"
struct mailstream_ssl_context
@ -341,6 +342,7 @@ static void mailstream_low_ssl_free(mailstream_low * s);
static int mailstream_low_ssl_get_fd(mailstream_low * s);
static void mailstream_low_ssl_cancel(mailstream_low * s);
static struct mailstream_cancel * mailstream_low_ssl_get_cancel(mailstream_low * s);
static carray * mailstream_low_ssl_get_certificate_chain(mailstream_low * s);
static mailstream_low_driver local_mailstream_ssl_driver = {
/* mailstream_read */ mailstream_low_ssl_read,
@ -350,6 +352,7 @@ static mailstream_low_driver local_mailstream_ssl_driver = {
/* mailstream_free */ mailstream_low_ssl_free,
/* mailstream_cancel */ mailstream_low_ssl_cancel,
/* mailstream_get_cancel */ mailstream_low_ssl_get_cancel,
/* mailstream_get_certificate_chain */ mailstream_low_ssl_get_certificate_chain,
};
mailstream_low_driver * mailstream_ssl_driver = &local_mailstream_ssl_driver;
@ -1332,3 +1335,40 @@ static struct mailstream_cancel * mailstream_low_ssl_get_cancel(mailstream_low *
return NULL;
#endif
}
carray * mailstream_low_ssl_get_certificate_chain(mailstream_low * s)
{
#ifdef USE_SSL
#ifndef USE_GNUTLS
STACK_OF(X509) * skx;
struct mailstream_ssl_data * ssl_data;
carray * result;
int skpos;
ssl_data = (struct mailstream_ssl_data *) s->data;
if (!(skx = SSL_get_peer_cert_chain(ssl_data->ssl_conn))) {
return NULL;
}
result = carray_new(4);
for(skpos = 0 ; skpos < sk_num(skx) ; skpos ++) {
X509 * x = (X509 *) sk_value(skx, skpos);
unsigned char * p;
MMAPString * str;
int length = i2d_X509(x, NULL);
str = mmap_string_sized_new(length);
p = (unsigned char *) str->str;
str->len = length;
i2d_X509(x, &p);
carray_add(result, str, NULL);
}
return result;
#else
/* TODO: GnuTLS implementation */
return NULL;
#endif
#else
return NULL;
#endif
}

+ 3
- 0
src/data-types/mailstream_types.h View File

@ -45,6 +45,7 @@ extern "C" {
#ifndef LIBETPAN_CONFIG_H
# include <libetpan/libetpan-config.h>
#endif
#include <libetpan/carray.h>
struct _mailstream;
@ -96,6 +97,8 @@ struct mailstream_low_driver {
void (* mailstream_free)(mailstream_low *);
void (* mailstream_cancel)(mailstream_low *);
struct mailstream_cancel * (* mailstream_get_cancel)(mailstream_low *);
/* Returns an array of MMAPString containing DER data or NULL if it's not a SSL connection */
carray * (* mailstream_get_certificate_chain)(mailstream_low *);
};
typedef struct mailstream_low_driver mailstream_low_driver;


Loading…
Cancel
Save