[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sylpheed
Subject:    [sylpheed:24063] Bug with sylpheed gtk2 1.0.0 & Home directories in smbfs
From:       "tonin" <tonin () uco ! es>
Date:       2005-02-11 19:21:18
Message-ID: 005a01c5106e$dd4e2460$c964a8c0 () tonin
[Download RAW message or body]

Hello.

We use sylpheed gtk2 1.0.0 in an environment where user home directories are mounted using smbmount \
(smbfs) from a Samba server. Using smb is more secure than nfs because the local "root" problem.

When sylpheed write temp files in ~/.sylpheed/tmp, there is a problem because "mkstemp" function in \
utils.c (line 2671) create the file with O_EXCL flag and smbfs doesn't support the latter writes on it.

I don't understand why to put tmp files in user home directory (is more slow if it's nfs or smbfs). I \
solve this problem changing this function in utils.c:

const gchar *get_tmp_dir(void)
{
        static gchar *tmp_dir = NULL;

        if (!tmp_dir)
                tmp_dir = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S,
                                     TMP_DIR, NULL);
        return tmp_dir;
}

for this one:

const gchar *get_tmp_dir(void)
{
        static gchar *tmp_dir = NULL;

        if (!tmp_dir)
                tmp_dir = g_strconcat(g_get_tmp_dir(), G_DIR_SEPARATOR_S, ".sylpheed", G_DIR_SEPARATOR_S \
, g_get_user_name(),  NULL);
        return tmp_dir;
}

So, sylpheed create files using TMP, TMPDIR or TEMP environment variables, almost always the tmp files \
went to "/tmp/.sylpheed/username".

It works with all home dirs file systems, is faster and i cann't see any security risk or race condition \
because tmp dir is unique and mkstemp function is secure itself. 

Can this patch be considered?

Thanks in advance.


[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2523" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>
<DIV><FONT face=Arial size=2>Hello.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>We use sylpheed gtk2 1.0.0 in an environment where 
user home directories are mounted using smbmount (smbfs) from a Samba server. 
Using smb is more secure than nfs because the local "root" problem.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>When sylpheed&nbsp;write temp files in 
~/.sylpheed/tmp, there is a problem because "mkstemp" function in utils.c (line 
2671) create the file with O_EXCL flag and smbfs doesn't support the latter 
writes on it.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I don't understand why to put tmp files in user 
home directory (is more slow if it's nfs or smbfs). I solve this problem 
changing this function in utils.c:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><EM>const gchar 
*get_tmp_dir(void)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; static 
gchar *tmp_dir = NULL;</EM></FONT></DIV>
<DIV><FONT face=Arial size=2><EM></EM></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><EM>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
(!tmp_dir)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
tmp_dir = g_strconcat(get_rc_dir(), 
G_DIR_SEPARATOR_S,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 TMP_DIR, NULL);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
tmp_dir;<BR>}<BR></EM></FONT></DIV>
<DIV><FONT face=Arial size=2>for this one:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><EM>const gchar 
*get_tmp_dir(void)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; static 
gchar *tmp_dir = NULL;</EM></FONT></DIV>
<DIV><EM></EM>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><EM>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if 
(!tmp_dir)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
tmp_dir = g_strconcat(g_get_tmp_dir(), G_DIR_SEPARATOR_S, ".sylpheed", 
G_DIR_SEPARATOR_S , 
g_get_user_name(),<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
 NULL);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return 
tmp_dir;<BR>}<BR></EM></FONT></DIV>
<DIV><FONT face=Arial size=2>So, sylpheed create files using TMP, TMPDIR or TEMP 
environment variables, almost always the tmp files went to 
"/tmp/.sylpheed/username".</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>It works with all home dirs file systems, is faster 
and i cann't see any security risk or race condition because tmp dir is unique 
and mkstemp function is secure itself. </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Can this patch be considered?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Thanks in advance.</DIV></FONT>
<DIV><FONT face=Arial size=2>&nbsp;</DIV></FONT></FONT></DIV></BODY></HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic