~ubuntu-branches/ubuntu/utopic/coreutils/utopic-proposed

« back to all changes in this revision

Viewing changes to src/chown-core.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-11-28 03:03:42 UTC
  • mfrom: (8.3.4 sid)
  • Revision ID: package-import@ubuntu.com-20121128030342-21zanj8354gas5gr
Tags: 8.20-3ubuntu1
* Resynchronise with Debian.  Remaining changes:
  - Make 'uname -i -p' return the real processor/hardware, instead of
    unknown.
  - Build-depend on gettext:any instead of on gettext, so that apt-get can
    properly resolve build-dependencies on the tool when cross-building.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* chown-core.c -- core functions for changing ownership.
2
 
   Copyright (C) 2000, 2002-2011 Free Software Foundation, Inc.
 
2
   Copyright (C) 2000-2012 Free Software Foundation, Inc.
3
3
 
4
4
   This program is free software: you can redistribute it and/or modify
5
5
   it under the terms of the GNU General Public License as published by
193
193
 
194
194
/* Change the owner and/or group of the FILE to UID and/or GID (safely)
195
195
   only if REQUIRED_UID and REQUIRED_GID match the owner and group IDs
196
 
   of FILE.  ORIG_ST must be the result of `stat'ing FILE.
 
196
   of FILE.  ORIG_ST must be the result of 'stat'ing FILE.
197
197
 
198
 
   The `safely' part above means that we can't simply use chown(2),
 
198
   The 'safely' part above means that we can't simply use chown(2),
199
199
   since FILE might be replaced with some other file between the time
200
200
   of the preceding stat/lstat and this chown call.  So here we open
201
201
   FILE and do everything else via the resulting file descriptor.
456
456
        }
457
457
 
458
458
      /* On some systems (e.g., GNU/Linux 2.4.x),
459
 
         the chown function resets the `special' permission bits.
 
459
         the chown function resets the 'special' permission bits.
460
460
         Do *not* restore those bits;  doing so would open a window in
461
461
         which a malicious user, M, could subvert a chown command run
462
462
         by some other user and operating on files in a directory