Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix some man page problems Scott Kostyshak pointed out.
[rsync/rsync.git]
/
uidlist.c
diff --git
a/uidlist.c
b/uidlist.c
index
7162dfa
..
5d3d1f3
100644
(file)
--- a/
uidlist.c
+++ b/
uidlist.c
@@
-33,6
+33,7
@@
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_acls;
extern int numeric_ids;
extern int preserve_gid;
extern int preserve_acls;
extern int numeric_ids;
+extern gid_t our_gid;
extern char *usermap;
extern char *groupmap;
extern char *usermap;
extern char *groupmap;
@@
-101,7
+102,6
@@
static int is_in_group(gid_t gid)
if (gid == last_in)
return last_out;
if (ngroups < -1) {
if (gid == last_in)
return last_out;
if (ngroups < -1) {
- gid_t mygid = MY_GID();
if ((ngroups = getgroups(0, NULL)) < 0)
ngroups = 0;
gidset = new_array(GETGROUPS_T, ngroups+1);
if ((ngroups = getgroups(0, NULL)) < 0)
ngroups = 0;
gidset = new_array(GETGROUPS_T, ngroups+1);
@@
-111,11
+111,11
@@
static int is_in_group(gid_t gid)
ngroups = getgroups(ngroups, gidset);
/* The default gid might not be in the list on some systems. */
for (n = 0; n < ngroups; n++) {
ngroups = getgroups(ngroups, gidset);
/* The default gid might not be in the list on some systems. */
for (n = 0; n < ngroups; n++) {
- if (gidset[n] ==
my
gid)
+ if (gidset[n] ==
our_
gid)
break;
}
if (n == ngroups)
break;
}
if (n == ngroups)
- gidset[ngroups++] =
my
gid;
+ gidset[ngroups++] =
our_
gid;
if (DEBUG_GTE(OWN, 2)) {
int pos;
char *gidbuf = new_array(char, ngroups*21+32);
if (DEBUG_GTE(OWN, 2)) {
int pos;
char *gidbuf = new_array(char, ngroups*21+32);
@@
-139,13
+139,7
@@
static int is_in_group(gid_t gid)
return last_out = 0;
#else
return last_out = 0;
#else
- static gid_t mygid = GID_NONE;
- if (mygid == GID_NONE) {
- mygid = MY_GID();
- if (DEBUG_GTE(OWN, 2))
- rprintf(FINFO, "process has gid %u\n", (unsigned)mygid);
- }
- return gid == mygid;
+ return gid == our_gid;
#endif
}
#endif
}
@@
-179,22
+173,22
@@
static struct idlist *recv_add_id(struct idlist **idlist_ptr, struct idlist *idm
if (node)
id2 = node->id2;
else if (*name && id) {
if (node)
id2 = node->id2;
else if (*name && id) {
- if (id
map == uidmap
) {
+ if (id
list_ptr == &uidlist
) {
uid_t uid;
uid_t uid;
- id2 =
name_to_uid(name, &uid
) ? uid : id;
+ id2 =
user_to_uid(name, &uid, False
) ? uid : id;
} else {
gid_t gid;
} else {
gid_t gid;
- id2 =
name_to_gid(name, &gid
) ? gid : id;
+ id2 =
group_to_gid(name, &gid, False
) ? gid : id;
}
} else
id2 = id;
}
} else
id2 = id;
- flag = id
map == gidmap
&& !am_root && !is_in_group(id2) ? FLAG_SKIP_GROUP : 0;
+ flag = id
list_ptr == &gidlist
&& !am_root && !is_in_group(id2) ? FLAG_SKIP_GROUP : 0;
node = add_to_list(idlist_ptr, id, *name ? name : NULL, id2, flag);
if (DEBUG_GTE(OWN, 2)) {
rprintf(FINFO, "%sid %u(%s) maps to %u\n",
node = add_to_list(idlist_ptr, id, *name ? name : NULL, id2, flag);
if (DEBUG_GTE(OWN, 2)) {
rprintf(FINFO, "%sid %u(%s) maps to %u\n",
- id
map == uidmap
? "u" : "g",
+ id
list_ptr == &uidlist
? "u" : "g",
(unsigned)id, name, (unsigned)id2);
}
(unsigned)id, name, (unsigned)id2);
}
@@
-415,7
+409,6
@@
void parse_name_map(char *map, BOOL usernames)
char *dash = strchr(cp, '-');
if (strspn(cp, "0123456789-") != (size_t)(colon - cp)
|| (dash && (!dash[1] || strchr(dash+1, '-')))) {
char *dash = strchr(cp, '-');
if (strspn(cp, "0123456789-") != (size_t)(colon - cp)
|| (dash && (!dash[1] || strchr(dash+1, '-')))) {
- bad_number:
rprintf(FERROR, "Invalid number in --%smap: %s\n",
usernames ? "user" : "group", cp);
exit_cleanup(RERR_SYNTAX);
rprintf(FERROR, "Invalid number in --%smap: %s\n",
usernames ? "user" : "group", cp);
exit_cleanup(RERR_SYNTAX);
@@
-436,15
+429,9
@@
void parse_name_map(char *map, BOOL usernames)
id1 = 0;
}
id1 = 0;
}
- if (isDigit(colon+1)) {
- if (strspn(colon+1, "0123456789") != (size_t)(end - colon - 1)) {
- cp = colon+1;
- goto bad_number;
- }
- add_to_list(idmap_ptr, id1, name, atol(colon+1), flags);
- } else if (usernames) {
+ if (usernames) {
uid_t uid;
uid_t uid;
- if (
name_to_uid(colon+1, &uid
))
+ if (
user_to_uid(colon+1, &uid, True
))
add_to_list(idmap_ptr, id1, name, uid, flags);
else {
rprintf(FERROR,
add_to_list(idmap_ptr, id1, name, uid, flags);
else {
rprintf(FERROR,
@@
-453,7
+440,7
@@
void parse_name_map(char *map, BOOL usernames)
}
} else {
gid_t gid;
}
} else {
gid_t gid;
- if (
name_to_gid(colon+1, &gid
))
+ if (
group_to_gid(colon+1, &gid, True
))
add_to_list(idmap_ptr, id1, name, gid, flags);
else {
rprintf(FERROR,
add_to_list(idmap_ptr, id1, name, gid, flags);
else {
rprintf(FERROR,