2011/6/14 Jesus Sanchez <[email protected]>

>
>
> 2011/6/14 Jesus Sanchez <[email protected]>
>
>>
>>
>> 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:
>>
>> ------------------------------------------------------------
>>
>> --- 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)
>
>
> typo: it should be 'to_stat.st_mode'
>
>
>
>> & RETAINBITS & ~myumask)) {
>>
>
>
>
> also not sure about the use of ~myumask here, as
> it can change an existing file and maybe we loose
>

* lose


> bits on a 0777 file. Again this 'retainbits' stuff only
> applies if and only if the source file shares UID (owner)
> and GID with the target file and also with the calling process.
>
>
>
>
>> +        /*
>> +         * 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