//------------------------------------------------------------------------------ // Copyright (c) 2004, Perforce Software, Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //------------------------------------------------------------------------------ #ifndef ADMINCLIENT_H # define ADMINCLIENT_H //------------------------------------------------------------------------------ // A class to trap chmod()'s to our files and alter the umask just before // the chmod so that we get the right permissions for each file. The umask // is taken from the umask attribute of the revision being accessed. //------------------------------------------------------------------------------ class AdminUser; class FileList; class AdminClient : public ClientApi { public: AdminClient() : simulate( 0 ) {} void SetArgv( int argc, char *const *argv ); void Run( const char *func ); private: void StatFiles( ClientUser *ui, FileList *list ); void SetPerms( AdminUser *ui ); void ChmodFile( const StrPtr *file, const StrPtr *mode, Error *e ); private: int simulate; }; #endif
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 4662 | Tony Smith |
Add the first release of my Perforce command line client for Unix sysadmins. On a Unix box, some of the files you really want under version control need to be protected. P4 uses the user's umask to control the permissions on the files it manages but when you're managing a unix box these permissions can vary on a per-file basis and that makes it tricky to manage unix boxes properly with Perforce. Enter P4U. It uses the 2004.2 server's ability to store per-revision attributes to store a permission-mask for each file that requires custom handling. The bits in the mask are removed from the permissions of the relevant files when normal Perforce commands are executed using 'p4u' instead of 'p4'. i.e. p4u add /etc/shadow p4u attribute -n unixMask -v 077 /etc/shadow p4u submit This will cause /etc/shadow to have the mode you would hope for (0400). The mode will be restricted whenever you: p4u submit p4u edit p4u revert p4u sync Currently that's it. |