Bug 1155 - fchown() used unconditionaly
Summary: fchown() used unconditionaly
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Build environment (show other bugs)
Version: 3.0.2a
Hardware: Other other
: P3 normal
Target Milestone: none
Assignee: Tim Potter
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-05 07:48 UTC by Joachim Schmitz (mail address dead)
Modified: 2005-08-24 10:16 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Schmitz (mail address dead) 2004-03-05 07:48:07 UTC
In .../smbd/vfs-wrap.c fchown() is used without checking whether HAVE_FCHOWN is 
#define'd

Patch:

diff -u ./source/smbd/vfs-wrap.c.orig ./source/smbd/vfs-wrap.c
--- ./source/smbd/vfs-wrap.c.orig       2004-01-06 22:08:41.000000000 +0100
+++ ./source/smbd/vfs-wrap.c    2004-02-29 16:10:46.000000000 +0100
@@ -359,7 +359,11 @@
         * But root probably wants to know, e.g. if NFS disallows it.
         */

+#if defined(HAVE_FCHOWN)
        if ((fchown(ofd, source_stats.st_uid, source_stats.st_gid) == -1) && (er
rno != EPERM))
+#else
+       if ((chown(dest, source_stats.st_uid, source_stats.st_gid) == -1) && (er
rno != EPERM))
+#endif
                goto err;

        /*
Comment 1 Tim Potter 2004-03-06 16:35:44 UTC
Fixed.  For next time, when submitting patches can you add them to the bug as an
attachment rather than inline?  It makes it much easier to apply.   Thanks!
Comment 2 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:16:21 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.