From d965c00a22feafbb505a78d1414baa5e2ea39bb8 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 11 Oct 2001 21:57:20 +0000 Subject: Same. 2001-10-11 Jeffrey Stedfast * 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 --- camel/camel-tcp-stream-ssl.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'camel/camel-tcp-stream-ssl.c') 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 -- cgit v1.2.3