On Jun 13, 2011, at 9:22 PM, Jesus Sanchez <[email protected]> wrote:

> 2011/6/13 Otto Moerbeek <[email protected]>
> 
>> Your diff got lost, please include it inline.
>> 
>>       -Otto
>> 
> 
> true, I hope gmail webclient doesn't fuck with the format:

It will. Guaranteed. You have to use another client. alpine works for me. 

> 
> ------------------------------------------------------------
> 
> --- utils.c.orig  Tue Jun 14 03:18:56 2011
> +++ utils.c Tue Jun 14 03:18:51 2011
> @@ -170,20 +170,26 @@
>      return (1);
>   }
> 
> -  if (pflag && setfile(fs, to_fd))
> -     rval = 1;
> +  if (pflag){  /* In case of pflag we don't try to retain S_ISUID or
> S_ISGID bits and ignore the umask values */
> +     if( setfile(fs, to_fd))
> +        rval = 1;
> +#define RETAINBITS \
> +     (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
> +  }
>   /*
>    * If the source was setuid or setgid, lose the bits unless the
>    * copy is owned by the same user and group.
>    */
> -#define RETAINBITS \
> -  (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO)
>   else if (fs->st_mode & (S_ISUID | S_ISGID) && fs->st_uid == myuid) {
>      if (fstat(to_fd, &to_stat)) {
>         warn("%s", to.p_path);
>         rval = 1;
>      } else if (fs->st_gid == to_stat.st_gid &&
> -         fchmod(to_fd, fs->st_mode & RETAINBITS & ~myumask)) {
> +         fchmod(to_fd, (((S_ISUID | S_ISGID) & fs->st_mode ) |
> to_stat->st_mode) & RETAINBITS & ~myumask)) {
> +        /*
> +         * We preserve the target file mode and add only the
> +         * S_ISUID and S_ISGID bits from the source file mode
> +         */
>         warn("%s", to.p_path);
>         rval = 1;
>      }

Reply via email to