Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
f31514ad
Commit
f31514ad
authored
Apr 20, 2007
by
Wayne Davison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the *_abbbrevint() functions to *_varint().
parent
2fcc265c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
48 deletions
+48
-48
acls.c
acls.c
+6
-6
flist.c
flist.c
+14
-14
io.c
io.c
+2
-2
io.h
io.h
+4
-4
uidlist.c
uidlist.c
+6
-6
xattrs.c
xattrs.c
+16
-16
No files found.
acls.c
View file @
f31514ad
...
...
@@ -559,11 +559,11 @@ static void send_ida_entries(const ida_entries *idal, int user_names, int f)
id_access
*
ida
;
size_t
count
=
idal
->
count
;
write_
abbrev
int
(
f
,
idal
->
count
);
write_
var
int
(
f
,
idal
->
count
);
for
(
ida
=
idal
->
idas
;
count
--
;
ida
++
)
{
char
*
name
=
user_names
?
add_uid
(
ida
->
id
)
:
add_gid
(
ida
->
id
);
write_
abbrev
int
(
f
,
ida
->
id
);
write_
var
int
(
f
,
ida
->
id
);
if
(
inc_recurse
&&
name
)
{
int
len
=
strlen
(
name
);
write_byte
(
f
,
ida
->
access
|
(
uchar
)
0x80
);
...
...
@@ -580,7 +580,7 @@ static void send_rsync_acl(rsync_acl *racl, SMB_ACL_TYPE_T type,
int
ndx
=
find_matching_rsync_acl
(
racl
,
type
,
racl_list
);
/* Send 0 (-1 + 1) to indicate that literal ACL data follows. */
write_
abbrev
int
(
f
,
ndx
+
1
);
write_
var
int
(
f
,
ndx
+
1
);
if
(
ndx
<
0
)
{
rsync_acl
*
new_racl
=
EXPAND_ITEM_LIST
(
racl_list
,
rsync_acl
,
1000
);
...
...
@@ -672,7 +672,7 @@ static uchar recv_acl_access(uchar *name_follows_val, int f)
static
uchar
recv_ida_entries
(
ida_entries
*
ent
,
int
user_names
,
int
f
)
{
uchar
computed_mask_bits
=
0
;
int
i
,
count
=
read_
abbrev
int
(
f
);
int
i
,
count
=
read_
var
int
(
f
);
if
(
count
)
{
if
(
!
(
ent
->
idas
=
new_array
(
id_access
,
ent
->
count
)))
...
...
@@ -684,7 +684,7 @@ static uchar recv_ida_entries(ida_entries *ent, int user_names, int f)
for
(
i
=
0
;
i
<
count
;
i
++
)
{
uchar
has_name
;
id_t
id
=
read_
abbrev
int
(
f
);
id_t
id
=
read_
var
int
(
f
);
int
access
=
recv_acl_access
(
&
has_name
,
f
);
if
(
has_name
)
{
...
...
@@ -713,7 +713,7 @@ static int recv_rsync_acl(item_list *racl_list, SMB_ACL_TYPE_T type, int f)
uchar
computed_mask_bits
=
0
;
acl_duo
*
duo_item
;
uchar
flags
;
int
ndx
=
read_
abbrev
int
(
f
);
int
ndx
=
read_
var
int
(
f
);
if
(
ndx
<
0
||
(
size_t
)
ndx
>
racl_list
->
count
)
{
rprintf
(
FERROR
,
"recv_acl_index: %s ACL index %d > %d
\n
"
,
...
...
flist.c
View file @
f31514ad
...
...
@@ -471,13 +471,13 @@ static void send_file_entry(int f, struct file_struct *file, int ndx)
if
(
flags
&
XMIT_SAME_NAME
)
write_byte
(
f
,
l1
);
if
(
flags
&
XMIT_LONG_NAME
)
write_
abbrev
int30
(
f
,
l2
);
write_
var
int30
(
f
,
l2
);
else
write_byte
(
f
,
l2
);
write_buf
(
f
,
fname
+
l1
,
l2
);
if
(
first_hlink_ndx
>=
0
)
{
write_
abbrev
int30
(
f
,
first_hlink_ndx
);
write_
var
int30
(
f
,
first_hlink_ndx
);
goto
the_end
;
}
...
...
@@ -490,7 +490,7 @@ static void send_file_entry(int f, struct file_struct *file, int ndx)
if
(
protocol_version
<
30
)
write_int
(
f
,
uid
);
else
{
write_
abbrev
int
(
f
,
uid
);
write_
var
int
(
f
,
uid
);
if
(
flags
&
XMIT_USER_NAME_FOLLOWS
)
{
int
len
=
strlen
(
user_name
);
write_byte
(
f
,
len
);
...
...
@@ -502,7 +502,7 @@ static void send_file_entry(int f, struct file_struct *file, int ndx)
if
(
protocol_version
<
30
)
write_int
(
f
,
gid
);
else
{
write_
abbrev
int
(
f
,
gid
);
write_
var
int
(
f
,
gid
);
if
(
flags
&
XMIT_GROUP_NAME_FOLLOWS
)
{
int
len
=
strlen
(
group_name
);
write_byte
(
f
,
len
);
...
...
@@ -517,9 +517,9 @@ static void send_file_entry(int f, struct file_struct *file, int ndx)
write_int
(
f
,
(
int
)
rdev
);
}
else
{
if
(
!
(
flags
&
XMIT_SAME_RDEV_MAJOR
))
write_
abbrev
int30
(
f
,
major
(
rdev
));
write_
var
int30
(
f
,
major
(
rdev
));
if
(
protocol_version
>=
30
)
write_
abbrev
int
(
f
,
minor
(
rdev
));
write_
var
int
(
f
,
minor
(
rdev
));
else
if
(
flags
&
XMIT_RDEV_MINOR_8_pre30
)
write_byte
(
f
,
minor
(
rdev
));
else
...
...
@@ -531,7 +531,7 @@ static void send_file_entry(int f, struct file_struct *file, int ndx)
if
(
preserve_links
&&
S_ISLNK
(
mode
))
{
const
char
*
sl
=
F_SYMLINK
(
file
);
int
len
=
strlen
(
sl
);
write_
abbrev
int30
(
f
,
len
);
write_
var
int30
(
f
,
len
);
write_buf
(
f
,
sl
,
len
);
}
#endif
...
...
@@ -597,7 +597,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
l1
=
read_byte
(
f
);
if
(
flags
&
XMIT_LONG_NAME
)
l2
=
read_
abbrev
int30
(
f
);
l2
=
read_
var
int30
(
f
);
else
l2
=
read_byte
(
f
);
...
...
@@ -636,7 +636,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
if
(
protocol_version
>=
30
&&
BITS_SETnUNSET
(
flags
,
XMIT_HLINKED
,
XMIT_HLINK_FIRST
))
{
struct
file_struct
*
first
;
first_hlink_ndx
=
read_
abbrev
int30
(
f
);
first_hlink_ndx
=
read_
var
int30
(
f
);
if
(
first_hlink_ndx
<
0
||
first_hlink_ndx
>=
flist
->
count
)
{
rprintf
(
FERROR
,
"hard-link reference out of range: %d (%d)
\n
"
,
...
...
@@ -678,7 +678,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
if
(
protocol_version
<
30
)
uid
=
(
uid_t
)
read_int
(
f
);
else
{
uid
=
(
uid_t
)
read_
abbrev
int
(
f
);
uid
=
(
uid_t
)
read_
var
int
(
f
);
if
(
flags
&
XMIT_USER_NAME_FOLLOWS
)
uid
=
recv_user_name
(
f
,
uid
);
else
if
(
inc_recurse
&&
am_root
&&
!
numeric_ids
)
...
...
@@ -689,7 +689,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
if
(
protocol_version
<
30
)
gid
=
(
gid_t
)
read_int
(
f
);
else
{
gid
=
(
gid_t
)
read_
abbrev
int
(
f
);
gid
=
(
gid_t
)
read_
var
int
(
f
);
if
(
flags
&
XMIT_GROUP_NAME_FOLLOWS
)
gid
=
recv_group_name
(
f
,
gid
);
else
if
(
inc_recurse
&&
(
!
am_root
||
!
numeric_ids
))
...
...
@@ -705,9 +705,9 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
}
else
{
uint32
rdev_minor
;
if
(
!
(
flags
&
XMIT_SAME_RDEV_MAJOR
))
rdev_major
=
read_
abbrev
int30
(
f
);
rdev_major
=
read_
var
int30
(
f
);
if
(
protocol_version
>=
30
)
rdev_minor
=
read_
abbrev
int
(
f
);
rdev_minor
=
read_
var
int
(
f
);
else
if
(
flags
&
XMIT_RDEV_MINOR_8_pre30
)
rdev_minor
=
read_byte
(
f
);
else
...
...
@@ -721,7 +721,7 @@ static struct file_struct *recv_file_entry(struct file_list *flist,
#ifdef SUPPORT_LINKS
if
(
preserve_links
&&
S_ISLNK
(
mode
))
{
linkname_len
=
read_
abbrev
int30
(
f
)
+
1
;
/* count the '\0' */
linkname_len
=
read_
var
int30
(
f
)
+
1
;
/* count the '\0' */
if
(
linkname_len
<=
0
||
linkname_len
>
MAXPATHLEN
)
{
rprintf
(
FERROR
,
"overflow: linkname_len=%d
\n
"
,
linkname_len
-
1
);
...
...
io.c
View file @
f31514ad
...
...
@@ -998,7 +998,7 @@ unsigned short read_shortint(int f)
return
(
UVAL
(
b
,
1
)
<<
8
)
+
UVAL
(
b
,
0
);
}
int32
read_
abbrev
int
(
int
f
)
int32
read_
var
int
(
int
f
)
{
int32
num
;
char
b
[
5
];
...
...
@@ -1404,7 +1404,7 @@ void write_shortint(int f, unsigned short x)
writefd
(
f
,
b
,
2
);
}
void
write_
abbrev
int
(
int
f
,
int32
x
)
void
write_
var
int
(
int
f
,
int32
x
)
{
char
b
[
5
];
if
((
uint32
)
x
<
((
uint32
)
1
<<
(
1
*
8
-
1
)))
{
...
...
io.h
View file @
f31514ad
...
...
@@ -18,18 +18,18 @@
extern
int
protocol_version
;
static
inline
int32
read_
abbrev
int30
(
int
f
)
read_
var
int30
(
int
f
)
{
if
(
protocol_version
<
30
)
return
read_int
(
f
);
return
read_
abbrev
int
(
f
);
return
read_
var
int
(
f
);
}
static
inline
void
write_
abbrev
int30
(
int
f
,
int32
x
)
write_
var
int30
(
int
f
,
int32
x
)
{
if
(
protocol_version
<
30
)
write_int
(
f
,
x
);
else
write_
abbrev
int
(
f
,
x
);
write_
var
int
(
f
,
x
);
}
uidlist.c
View file @
f31514ad
...
...
@@ -280,14 +280,14 @@ void send_uid_list(int f)
if
(
!
list
->
name
)
continue
;
len
=
strlen
(
list
->
name
);
write_
abbrev
int30
(
f
,
list
->
id
);
write_
var
int30
(
f
,
list
->
id
);
write_byte
(
f
,
len
);
write_buf
(
f
,
list
->
name
,
len
);
}
/* terminate the uid list with a 0 uid. We explicitly exclude
* 0 from the list */
write_
abbrev
int30
(
f
,
0
);
write_
var
int30
(
f
,
0
);
}
if
(
preserve_gid
||
preserve_acls
)
{
...
...
@@ -296,11 +296,11 @@ void send_uid_list(int f)
if
(
!
list
->
name
)
continue
;
len
=
strlen
(
list
->
name
);
write_
abbrev
int30
(
f
,
list
->
id
);
write_
var
int30
(
f
,
list
->
id
);
write_byte
(
f
,
len
);
write_buf
(
f
,
list
->
name
,
len
);
}
write_
abbrev
int30
(
f
,
0
);
write_
var
int30
(
f
,
0
);
}
}
...
...
@@ -332,13 +332,13 @@ void recv_uid_list(int f, struct file_list *flist)
if
((
preserve_uid
||
preserve_acls
)
&&
!
numeric_ids
)
{
/* read the uid list */
while
((
id
=
read_
abbrev
int30
(
f
))
!=
0
)
while
((
id
=
read_
var
int30
(
f
))
!=
0
)
recv_user_name
(
f
,
(
uid_t
)
id
);
}
if
((
preserve_gid
||
preserve_acls
)
&&
!
numeric_ids
)
{
/* read the gid list */
while
((
id
=
read_
abbrev
int30
(
f
))
!=
0
)
while
((
id
=
read_
var
int30
(
f
))
!=
0
)
recv_group_name
(
f
,
(
gid_t
)
id
);
}
...
...
xattrs.c
View file @
f31514ad
...
...
@@ -316,28 +316,28 @@ int send_xattr(statx *sxp, int f)
int
ndx
=
find_matching_xattr
(
sxp
->
xattr
);
/* Send 0 (-1 + 1) to indicate that literal xattr data follows. */
write_
abbrev
int
(
f
,
ndx
+
1
);
write_
var
int
(
f
,
ndx
+
1
);
if
(
ndx
<
0
)
{
rsync_xa
*
rxa
;
int
count
=
sxp
->
xattr
->
count
;
write_
abbrev
int
(
f
,
count
);
write_
var
int
(
f
,
count
);
for
(
rxa
=
sxp
->
xattr
->
items
;
count
--
;
rxa
++
)
{
#ifdef HAVE_LINUX_XATTRS
write_
abbrev
int
(
f
,
rxa
->
name_len
);
write_
abbrev
int
(
f
,
rxa
->
datum_len
);
write_
var
int
(
f
,
rxa
->
name_len
);
write_
var
int
(
f
,
rxa
->
datum_len
);
write_buf
(
f
,
rxa
->
name
,
rxa
->
name_len
);
#else
/* We strip the rsync prefix from disguised namespaces
* and put everything else in the user namespace. */
if
(
HAS_PREFIX
(
rxa
->
name
,
RSYNC_PREFIX
)
&&
rxa
->
name
[
RPRE_LEN
]
!=
'%'
)
{
write_
abbrev
int
(
f
,
rxa
->
name_len
-
RPRE_LEN
);
write_
abbrev
int
(
f
,
rxa
->
datum_len
);
write_
var
int
(
f
,
rxa
->
name_len
-
RPRE_LEN
);
write_
var
int
(
f
,
rxa
->
datum_len
);
write_buf
(
f
,
rxa
->
name
+
RPRE_LEN
,
rxa
->
name_len
-
RPRE_LEN
);
}
else
{
write_
abbrev
int
(
f
,
rxa
->
name_len
+
UPRE_LEN
);
write_
abbrev
int
(
f
,
rxa
->
datum_len
);
write_
var
int
(
f
,
rxa
->
name_len
+
UPRE_LEN
);
write_
var
int
(
f
,
rxa
->
datum_len
);
write_buf
(
f
,
USER_PREFIX
,
UPRE_LEN
);
write_buf
(
f
,
rxa
->
name
,
rxa
->
name_len
);
}
...
...
@@ -454,7 +454,7 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
/* Flag that we handled this abbreviated item. */
rxa
->
datum
[
0
]
=
XSTATE_DONE
;
write_
abbrev
int
(
f_out
,
j
-
prior_req
);
write_
var
int
(
f_out
,
j
-
prior_req
);
prior_req
=
j
;
if
(
fname
)
{
...
...
@@ -465,7 +465,7 @@ void send_xattr_request(const char *fname, struct file_struct *file, int f_out)
if
(
!
(
ptr
=
get_xattr_data
(
fname
,
rxa
->
name
,
&
len
,
0
)))
continue
;
write_
abbrev
int
(
f_out
,
len
);
/* length might have changed! */
write_
var
int
(
f_out
,
len
);
/* length might have changed! */
write_buf
(
f_out
,
ptr
,
len
);
free
(
ptr
);
}
...
...
@@ -515,7 +515,7 @@ void recv_xattr_request(struct file_struct *file, int f_in)
cnt
=
lst
->
count
;
rxa
=
lst
->
items
;
rxa
-=
1
;
while
((
rel_pos
=
read_
abbrev
int
(
f_in
))
!=
0
)
{
while
((
rel_pos
=
read_
var
int
(
f_in
))
!=
0
)
{
rxa
+=
rel_pos
;
cnt
-=
rel_pos
;
if
(
cnt
<
0
||
rxa
->
datum_len
<=
MAX_FULL_DATUM
...
...
@@ -530,7 +530,7 @@ void recv_xattr_request(struct file_struct *file, int f_in)
}
old_datum
=
rxa
->
datum
;
rxa
->
datum_len
=
read_
abbrev
int
(
f_in
);
rxa
->
datum_len
=
read_
var
int
(
f_in
);
if
(
rxa
->
name_len
+
rxa
->
datum_len
<
rxa
->
name_len
)
out_of_memory
(
"recv_xattr_request"
);
/* overflow */
...
...
@@ -552,7 +552,7 @@ void receive_xattr(struct file_struct *file, int f)
{
static
item_list
temp_xattr
=
EMPTY_ITEM_LIST
;
int
count
;
int
ndx
=
read_
abbrev
int
(
f
);
int
ndx
=
read_
var
int
(
f
);
if
(
ndx
<
0
||
(
size_t
)
ndx
>
rsync_xal_l
.
count
)
{
rprintf
(
FERROR
,
"receive_xattr: xa index %d out of"
...
...
@@ -565,7 +565,7 @@ void receive_xattr(struct file_struct *file, int f)
return
;
}
if
((
count
=
read_
abbrev
int
(
f
))
!=
0
)
{
if
((
count
=
read_
var
int
(
f
))
!=
0
)
{
(
void
)
EXPAND_ITEM_LIST
(
&
temp_xattr
,
rsync_xa
,
count
);
temp_xattr
.
count
=
0
;
}
...
...
@@ -573,8 +573,8 @@ void receive_xattr(struct file_struct *file, int f)
while
(
count
--
)
{
char
*
ptr
,
*
name
;
rsync_xa
*
rxa
;
size_t
name_len
=
read_
abbrev
int
(
f
);
size_t
datum_len
=
read_
abbrev
int
(
f
);
size_t
name_len
=
read_
var
int
(
f
);
size_t
datum_len
=
read_
var
int
(
f
);
size_t
dget_len
=
datum_len
>
MAX_FULL_DATUM
?
1
+
MAX_DIGEST_LEN
:
datum_len
;
#ifdef HAVE_LINUX_XATTRS
size_t
extra_len
=
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment