Hello Robin

That's interesting. I added the logging to attachments.inc to see if the same happens on my systems (RC 0.7.2, PHP 5.2.17).
But the "randomness" seems to work:

RC 0.7.2 with PHP 5.2.17 (PHP 5.2)
[09-Oct-2012 09:58:51 +0200]: Uploaded attachtment for user1@localhost in /tmp/php5PHusb.                                                                     
[09-Oct-2012 10:00:00 +0200]: Uploaded attachtment for user2@localhost in /tmp/phprn11nz.                                                                   
[09-Oct-2012 10:00:20 +0200]: Uploaded attachtment for user2@localhost in /tmp/phpacekPS.                                                                   
[09-Oct-2012 10:00:31 +0200]: Uploaded attachtment for user1@localhost in /tmp/phpduCBlP.                                                                     
[09-Oct-2012 10:02:22 +0200]: Uploaded attachtment for user1@localhost in /tmp/phpD9cUNm.                                                                     
[09-Oct-2012 10:02:30 +0200]: Uploaded attachtment for user1@localhost in /tmp/phpn1uWXX.


RC 0.7.2 with PHP 5.3.17 (PHP 5.3)
[09-Oct-2012 10:07:06 +0200]: Uploaded attachtment for user1@localhost in /tmp/phpEbshLs.                                                                    
[09-Oct-2012 10:07:13 +0200]: Uploaded attachtment for user1@localhost in /tmp/phpNm3FL8.                                                                    
[09-Oct-2012 10:07:22 +0200]: Uploaded attachtment for user1@localhost in /tmp/phpShflmK.                                                                    
[09-Oct-2012 10:08:06 +0200]: Uploaded attachtment for user2@localhost in /tmp/phpkDOEdw.                                                                    
[09-Oct-2012 10:08:11 +0200]: Uploaded attachtment for user2@localhost in /tmp/phppVz1wg.


RC 0.8.1 with PHP 5.2.17 (PHP 5.2)
[09-Oct-2012 10:11:36 +0200]: Uploaded attachtment for user1@localhost in /tmp/phpQ38fu2.                                                                     
[09-Oct-2012 10:11:44 +0200]: Uploaded attachtment for user1@localhost in /tmp/phplQnw2j.                                                                     
[09-Oct-2012 10:11:53 +0200]: Uploaded attachtment for user1@localhost in /tmp/phpyl7Tm6.                                                                     
[09-Oct-2012 10:12:24 +0200]: Uploaded attachtment for user2@localhost in /tmp/phpCvIMQM.                                                                   
[09-Oct-2012 10:12:30 +0200]: Uploaded attachtment for user2@localhost in /tmp/phpi2NmWj.                                                                   
[09-Oct-2012 10:12:36 +0200]: Uploaded attachtment for user2@localhost in /tmp/phpUmScAb.                                                                   
[09-Oct-2012 10:12:48 +0200]: Uploaded attachtment for user1@localhost in /tmp/phpJVEDJi.

Seems to be an issue in your PHP environment only?



On Tue, Oct 9, 2012 at 9:51 AM, Robin Elfrink <robin@15augustus.nl> wrote:
Hi all,



I got reports from RC users claiming their recipients got the wrong
attachments, attachments belonging to other RC users.


So I added some logging to
plugins/filesystem_attachments/filesystem_attachments.php:

<>
        if (!$args['path']) {
            $rcmail = rcmail::get_instance();
            $temp_dir = $rcmail->config->get('temp_dir');
            $tmp_path = tempnam($temp_dir, 'rcmAttmnt');
            write_log('sendmail', sprintf('Saving attachtment for %s to
%s.',
                                          $RCMAIL->user->get_username(),
                                          $tmp_path));
...
<>


Here are some (anonymized) lines from logs/sendmail (notice the typo,
which accidentally makes for easier grep'ing):


<>
[09-Oct-2012 09:11:29 +0200]: Saving attachtment for <user1> to
<path>/temp/rcmAttmntP007sn.
[09-Oct-2012 09:18:10 +0200]: Saving attachtment for <user2> to
<path>/temp/rcmAttmntP007sn.
[09-Oct-2012 09:26:33 +0200]: Saving attachtment for <user3> to
<path>/temp/rcmAttmntP007sn.
<>


With an average of 30 attachments total for all users on this server,
those filenames don't look very random to me.


So I added some more logging to program/steps/mail/attachments.inc:

<>
    if (!$err) {
      $attachment = array(
        'path' => $filepath,
        'size' => $_FILES['_attachments']['size'][$i],
        'name' => $_FILES['_attachments']['name'][$i],
        'mimetype' => rc_mime_content_type($filepath,
$_FILES['_attachments']['name'][$i], $_FILES['_attachments']['type'][$i]),
        'group' => $COMPOSE_ID,
      );
      write_log('sendmail', sprintf('Uploaded attachtment for %s in %s.',
                                    $RCMAIL->user->get_username(),
                                    $filepath));
...
<>


Which gives me duplicate filenames as well:


<>
[09-Oct-2012 09:16:59 +0200]: Uploaded attachtment for <user1> in
<path>/tmp/phpH007sn.
[09-Oct-2012 09:23:52 +0200]: Uploaded attachtment for <user2> in
<path>/tmp/phpH007sn.
<>



So this is obviously not an RC bug, but a PHP bug.

My question is: Has anyone seen this before? I cannot find a related bug
on https://bugs.php.net/


Robin
_______________________________________________
Roundcube Development discussion mailing list
dev@lists.roundcube.net
http://lists.roundcube.net/mailman/listinfo/dev