aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-tcp-stream-openssl.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-10-12 05:57:20 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-10-12 05:57:20 +0800
commitd965c00a22feafbb505a78d1414baa5e2ea39bb8 (patch)
tree3da3a2efd68e9c615764f14ff37e36ba8d8ecfb7 /camel/camel-tcp-stream-openssl.c
parentdf87ab49497be51b02a8457a26bf3e16b89d127d (diff)
downloadgsoc2013-evolution-d965c00a22feafbb505a78d1414baa5e2ea39bb8.tar.gz
gsoc2013-evolution-d965c00a22feafbb505a78d1414baa5e2ea39bb8.tar.zst
gsoc2013-evolution-d965c00a22feafbb505a78d1414baa5e2ea39bb8.zip
Same.
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. svn path=/trunk/; revision=13600
Diffstat (limited to 'camel/camel-tcp-stream-openssl.c')
-rw-r--r--camel/camel-tcp-stream-openssl.c13
1 files changed, 8 insertions, 5 deletions
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