aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/camel-tcp-stream-openssl.c13
-rw-r--r--camel/camel-tcp-stream-ssl.c13
3 files changed, 23 insertions, 10 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index b1623c80d5..85dc5005a5 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,10 @@
+2001-10-11 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-tcp-stream-ssl.c (ssl_cert_is_saved): Same.
+
+ * camel-tcp-stream-openssl.c (ssl_cert_is_saved): Instead of
+ opening the file, stat it and make sure that it belongs to us.
+
2001-10-10 Jeffrey Stedfast <fejj@ximian.com>
* camel-tcp-stream-openssl.c (ssl_verify): Same hack as below.
diff --git a/camel/camel-tcp-stream-openssl.c b/camel/camel-tcp-stream-openssl.c
index f83b309de7..6dedeadab7 100644
--- a/camel/camel-tcp-stream-openssl.c
+++ b/camel/camel-tcp-stream-openssl.c
@@ -499,16 +499,19 @@ static gboolean
ssl_cert_is_saved (const char *certid)
{
char *filename;
- int fd;
+ struct stat st;
+ int ret;
filename = g_strdup_printf ("%s/.camel_certs/%s", getenv ("HOME"), certid);
- fd = open (filename, O_RDONLY);
+ if (stat (filename, &st) == -1) {
+ g_free (filename);
+ return FALSE;
+ }
+
g_free (filename);
- if (fd != -1)
- close (fd);
- return fd != -1;
+ return st.st_uid == getuid ();
}
static int
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index fa0da4041a..bab01e4d4c 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -366,16 +366,19 @@ static gboolean
ssl_cert_is_saved (const char *certid)
{
char *filename;
- int fd;
+ struct stat st;
+ int ret;
filename = g_strdup_printf ("%s/.camel_certs/%s", getenv ("HOME"), certid);
- fd = open (filename, O_RDONLY);
+ if (stat (filename, &st) == -1) {
+ g_free (filename);
+ return FALSE;
+ }
+
g_free (filename);
- if (fd != -1)
- close (fd);
- return fd != -1;
+ return st.st_uid == getuid ();
}
static SECStatus