Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Nov 1998 11:35:33 +0600 (NS)
From:      nnd@nnd.itfs.nsk.su
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/8756: 'pw' command additional feature request
Message-ID:  <199811190535.LAA17771@nnd.itfs.nsk.su>

next in thread | raw e-mail | index | archive | help

>Number:         8756
>Category:       bin
>Synopsis:       'pw' command additional feature request
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 18 21:40:01 PST 1998
>Last-Modified:
>Originator:     Nickolay N. Dudorov
>Organization:
STE Infoteka
>Release:        FreeBSD 3.0-BETA i386
>Environment:

	Any FreeBSD system with 'pw' command

>Description:

	When I as an ISP add new users with 'pw' command
I initialize their home-dir through some skeleton directory
containing f.e. Maildir and dot.qmail for their mailbox.
It is very useful to set 'sunlnk' flag for Maildir components
(new, cur, tmp) and 'schg' flag for .qmail file.
But this flags are not sets when 'pw' copies skeleton to user
home directory.

>How-To-Repeat:

	Create some skeleton and set some flags for it's files
and after that do 'pw user add' with this skeleton specified.
All flags will be lost in new user home directory.

>Fix:
	
	The next patch change the 'pw' in such a way that it
preserve all the flags for files and directories inside 
skeleton directory while copiing them to user home directory.

	I also change one call to 'chown' to 'fchown' call,
which can be some kind of optimization :-)

===================================================================

diff -rubN pw/cpdir.c pw.new/cpdir.c
--- pw/cpdir.c	Fri Oct 10 13:23:30 1997
+++ pw.new/cpdir.c	Thu Nov 19 11:10:10 1998
@@ -98,8 +98,9 @@
 								while ((b = read(infd, copybuf, 4096)) > 0)
 									write(outfd, copybuf, b);
 								close(infd);
+								fchown(outfd, uid, gid);
+								fchflags(outfd, st.st_flags);
 								close(outfd);
-								chown(dst, uid, gid);
 							}
 						}
 					}

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811190535.LAA17771>