summaryrefslogtreecommitdiff
path: root/standalone/android/haskell-patches/x509-system-support-Android-cert-store.patch
blob: b3aa407dfc1fec27daa283a07c7532b7ed933a41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 2c736615e38ee4f582af9d98d7169cf07b84d875 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kitenet.net>
Date: Mon, 10 Feb 2014 23:27:32 +0000
Subject: [PATCH] support Android cert store

Android puts it in a different place and has only hashed files.
See https://github.com/vincenthz/hs-certificate/issues/19
---
 System/X509/Unix.hs |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/System/X509/Unix.hs b/System/X509/Unix.hs
index cbf9bbe..cab4f4a 100644
--- a/System/X509/Unix.hs
+++ b/System/X509/Unix.hs
@@ -34,7 +34,7 @@ import qualified Control.Exception as E
 import Data.Char
 
 defaultSystemPath :: FilePath
-defaultSystemPath = "/etc/ssl/certs/"
+defaultSystemPath = "/system/etc/security/cacerts/"
 
 envPathOverride :: String
 envPathOverride = "SYSTEM_CERTIFICATE_PATH"
@@ -46,7 +46,7 @@ listDirectoryCerts path = (map (path </>) . filter isCert <$> getDirectoryConten
                         && isDigit (s !! 9)
                         && (s !! 8) == '.'
                         && all isHexDigit (take 8 s)
-          isCert x = (not $ isPrefixOf "." x) && (not $ isHashedFile x)
+          isCert x = (not $ isPrefixOf "." x) 
 
 getSystemCertificateStore :: IO CertificateStore
 getSystemCertificateStore = makeCertificateStore . concat <$> (getSystemPath >>= listDirectoryCerts >>= mapM readCertificates)
-- 
1.7.10.4