[Pkg-shadow-commits] r1595 - in upstream/trunk: . lib libmisc src
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Tue Jan 1 14:31:00 UTC 2008
Author: nekral-guest
Date: 2008-01-01 14:31:00 +0000 (Tue, 01 Jan 2008)
New Revision: 1595
Modified:
upstream/trunk/ChangeLog
upstream/trunk/lib/prototypes.h
upstream/trunk/libmisc/copydir.c
upstream/trunk/src/usermod.c
Log:
* libmisc/copydir.c, src/usermod.c, lib/prototypes.h: The uid and
gid parameters can be set to -1 to indicate that the original
owners must be kept. Change the types from uid_t/gid_t to a
long int (signed).
* libmisc/copydir.c: Change the copy_entry(), copy_dir(),
copy_symlink(), copy_special(), and copy_file() prototypes
accordingly.
* lib/prototypes.h: Add the parameters' name for the
libmisc/copydir.c functions.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2008-01-01 14:20:36 UTC (rev 1594)
+++ upstream/trunk/ChangeLog 2008-01-01 14:31:00 UTC (rev 1595)
@@ -1,5 +1,17 @@
2008-01-01 Nicolas François <nicolas.francois at centraliens.net>
+ * libmisc/copydir.c, src/usermod.c, lib/prototypes.h: The uid and
+ gid parameters can be set to -1 to indicate that the original
+ owners must be kept. Change the types from uid_t/gid_t to a
+ long int (signed).
+ * libmisc/copydir.c: Change the copy_entry(), copy_dir(),
+ copy_symlink(), copy_special(), and copy_file() prototypes
+ accordingly.
+ * lib/prototypes.h: Add the parameters' name for the
+ libmisc/copydir.c functions.
+
+2008-01-01 Nicolas François <nicolas.francois at centraliens.net>
+
* libmisc/limits.c, libmisc/obscure.c, src/login_nopam.c,
lib/pwauth.c: Avoid empty file when USE_PAM is set.
* libmisc/audit_help.c: Avoid empty file when WITH_AUDIT is not set.
Modified: upstream/trunk/lib/prototypes.h
===================================================================
--- upstream/trunk/lib/prototypes.h 2008-01-01 14:20:36 UTC (rev 1594)
+++ upstream/trunk/lib/prototypes.h 2008-01-01 14:31:00 UTC (rev 1595)
@@ -51,8 +51,9 @@
extern int is_listed (const char *, const char *, int);
/* copydir.c */
-extern int copy_tree (const char *, const char *, uid_t, gid_t);
-extern int remove_tree (const char *);
+extern int copy_tree (const char *src_root, const char *dst_root,
+ long int uid, long int gid);
+extern int remove_tree (const char *root);
/* encrypt.c */
extern char *pw_encrypt (const char *, const char *);
Modified: upstream/trunk/libmisc/copydir.c
===================================================================
--- upstream/trunk/libmisc/copydir.c 2008-01-01 14:20:36 UTC (rev 1594)
+++ upstream/trunk/libmisc/copydir.c 2008-01-01 14:31:00 UTC (rev 1595)
@@ -55,23 +55,23 @@
static struct link_name *links;
static int copy_entry (const char *src, const char *dst,
- uid_t uid, gid_t gid);
+ long int uid, long int gid);
static int copy_dir (const char *src, const char *dst,
const struct stat *statp, const struct timeval mt[2],
- uid_t uid, gid_t gid);
+ long int uid, long int gid);
#ifdef S_IFLNK
static int copy_symlink (const char *src, const char *dst,
const struct stat *statp, const struct timeval mt[2],
- uid_t uid, gid_t gid);
+ long int uid, long int gid);
#endif
static int copy_hardlink (const char *src, const char *dst,
struct link_name *lp);
static int copy_special (const char *src, const char *dst,
const struct stat *statp, const struct timeval mt[2],
- uid_t uid, gid_t gid);
+ long int uid, long int gid);
static int copy_file (const char *src, const char *dst,
const struct stat *statp, const struct timeval mt[2],
- uid_t uid, gid_t gid);
+ long int uid, long int gid);
#ifdef WITH_SELINUX
/*
@@ -180,7 +180,8 @@
* copy_tree() walks a directory tree and copies ordinary files
* as it goes.
*/
-int copy_tree (const char *src_root, const char *dst_root, uid_t uid, gid_t gid)
+int copy_tree (const char *src_root, const char *dst_root,
+ long int uid, long int gid)
{
char src_name[1024];
char dst_name[1024];
@@ -271,7 +272,7 @@
* not be modified.
*/
static int copy_entry (const char *src, const char *dst,
- uid_t uid, gid_t gid)
+ long int uid, long int gid)
{
int err = 0;
struct stat sb;
@@ -350,7 +351,7 @@
*/
static int copy_dir (const char *src, const char *dst,
const struct stat *statp, const struct timeval mt[2],
- uid_t uid, gid_t gid)
+ long int uid, long int gid)
{
int err = 0;
@@ -364,8 +365,8 @@
#endif
if ( (mkdir (dst, statp->st_mode) != 0)
|| (chown (dst,
- (uid == (uid_t) - 1) ? statp->st_uid : uid,
- (gid == (gid_t) - 1) ? statp->st_gid : gid) != 0)
+ (uid == - 1) ? statp->st_uid : (uid_t) uid,
+ (gid == - 1) ? statp->st_gid : (gid_t) gid) != 0)
|| (chmod (dst, statp->st_mode) != 0)
|| (copy_tree (src, dst, uid, gid) != 0)
|| (utimes (dst, mt) != 0)) {
@@ -388,7 +389,7 @@
*/
static int copy_symlink (const char *src, const char *dst,
const struct stat *statp, const struct timeval mt[2],
- uid_t uid, gid_t gid)
+ long int uid, long int gid)
{
char oldlink[1024];
char dummy[1024];
@@ -419,8 +420,8 @@
#endif
if ( (symlink (oldlink, dst) != 0)
|| (lchown (dst,
- (uid == (uid_t) - 1) ? statp->st_uid : uid,
- (gid == (gid_t) - 1) ? statp->st_gid : gid) != 0)) {
+ (uid == -1) ? statp->st_uid : (uid_t) uid,
+ (gid == -1) ? statp->st_gid : (gid_t) gid) != 0)) {
return -1;
}
@@ -476,7 +477,7 @@
*/
static int copy_special (const char *src, const char *dst,
const struct stat *statp, const struct timeval mt[2],
- uid_t uid, gid_t gid)
+ long int uid, long int gid)
{
int err = 0;
@@ -486,8 +487,8 @@
if ( (mknod (dst, statp->st_mode & ~07777, statp->st_rdev) != 0)
|| (chown (dst,
- (uid == (uid_t) - 1) ? statp->st_uid : uid,
- (gid == (gid_t) - 1) ? statp->st_gid : gid) != 0)
+ (uid == -1) ? statp->st_uid : (uid_t) uid,
+ (gid == -1) ? statp->st_gid : (gid_t) gid) != 0)
|| (chmod (dst, statp->st_mode & 07777) != 0)
|| (utimes (dst, mt) != 0)) {
err = -1;
@@ -508,7 +509,7 @@
*/
static int copy_file (const char *src, const char *dst,
const struct stat *statp, const struct timeval mt[2],
- uid_t uid, gid_t gid)
+ long int uid, long int gid)
{
int err = 0;
int ifd;
@@ -526,8 +527,8 @@
ofd = open (dst, O_WRONLY | O_CREAT | O_TRUNC, 0);
if ( (ofd < 0)
|| (chown (dst,
- (uid == (uid_t) - 1) ? statp->st_uid : uid,
- (gid == (gid_t) - 1) ? statp->st_gid : gid) != 0)
+ (uid == -1) ? statp->st_uid : (uid_t) uid,
+ (gid == -1) ? statp->st_gid : (gid_t) gid) != 0)
|| (chmod (dst, statp->st_mode & 07777) != 0)) {
close (ifd);
return -1;
Modified: upstream/trunk/src/usermod.c
===================================================================
--- upstream/trunk/src/usermod.c 2008-01-01 14:20:36 UTC (rev 1594)
+++ upstream/trunk/src/usermod.c 2008-01-01 14:31:00 UTC (rev 1595)
@@ -1328,8 +1328,8 @@
fail_exit (E_HOMEDIR);
}
if (copy_tree (user_home, user_newhome,
- uflg ? user_newid : -1,
- gflg ? user_newgid : -1) == 0) {
+ uflg ? (long int)user_newid : -1,
+ gflg ? (long int)user_newgid : -1) == 0) {
if (remove_tree (user_home) != 0 ||
rmdir (user_home) != 0)
fprintf (stderr,
More information about the Pkg-shadow-commits
mailing list