Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Core
Tor
Commits
aea9cf10
Commit
aea9cf10
authored
Sep 01, 2009
by
Sebastian Hahn
Browse files
Fix compile warnings on Snow Leopard
Big thanks to nickm and arma for helping me with this!
parent
075c0040
Changes
18
Hide whitespace changes
Inline
Side-by-side
src/common/address.c
View file @
aea9cf10
...
...
@@ -373,10 +373,10 @@ tor_addr_parse_reverse_lookup_name(tor_addr_t *result, const char *address,
return
-
1
;
/* malformed. */
/* reverse the bytes */
inaddr
.
s_addr
=
(((
inaddr
.
s_addr
&
0x000000fful
)
<<
24
)
|
((
inaddr
.
s_addr
&
0x0000ff00ul
)
<<
8
)
|
((
inaddr
.
s_addr
&
0x00ff0000ul
)
>>
8
)
|
((
inaddr
.
s_addr
&
0xff000000ul
)
>>
24
));
inaddr
.
s_addr
=
(((
inaddr
.
s_addr
&
(
uint32_t
)
0x000000fful
)
<<
24
)
|
((
inaddr
.
s_addr
&
(
uint32_t
)
0x0000ff00ul
)
<<
8
)
|
((
inaddr
.
s_addr
&
(
uint32_t
)
0x00ff0000ul
)
>>
8
)
|
((
inaddr
.
s_addr
&
(
uint32_t
)
0xff000000ul
)
>>
24
));
if
(
result
)
{
tor_addr_from_in
(
result
,
&
inaddr
);
...
...
src/common/log.c
View file @
aea9cf10
...
...
@@ -149,8 +149,8 @@ _log_prefix(char *buf, size_t buf_len, int severity)
t
=
(
time_t
)
now
.
tv_sec
;
n
=
strftime
(
buf
,
buf_len
,
"%b %d %H:%M:%S"
,
tor_localtime_r
(
&
t
,
&
tm
));
r
=
tor_snprintf
(
buf
+
n
,
buf_len
-
n
,
".%.3
ld
[%s] "
,
(
long
)
now
.
tv_usec
/
1000
,
sev_to_string
(
severity
));
r
=
tor_snprintf
(
buf
+
n
,
buf_len
-
n
,
".%.3
i
[%s] "
,
(
int
)
now
.
tv_usec
/
1000
,
sev_to_string
(
severity
));
if
(
r
<
0
)
return
buf_len
-
1
;
else
...
...
src/common/tortls.c
View file @
aea9cf10
...
...
@@ -1443,8 +1443,8 @@ tor_tls_used_v1_handshake(tor_tls_t *tls)
* buffer and *<b>wbuf_bytes</b> to the amount actually used. */
void
tor_tls_get_buffer_sizes
(
tor_tls_t
*
tls
,
in
t
*
rbuf_capacity
,
in
t
*
rbuf_bytes
,
in
t
*
wbuf_capacity
,
in
t
*
wbuf_bytes
)
size_
t
*
rbuf_capacity
,
size_
t
*
rbuf_bytes
,
size_
t
*
wbuf_capacity
,
size_
t
*
wbuf_bytes
)
{
if
(
tls
->
ssl
->
s3
->
rbuf
.
buf
)
*
rbuf_capacity
=
tls
->
ssl
->
s3
->
rbuf
.
len
;
...
...
src/common/tortls.h
View file @
aea9cf10
...
...
@@ -73,8 +73,8 @@ void tor_tls_get_n_raw_bytes(tor_tls_t *tls,
size_t
*
n_read
,
size_t
*
n_written
);
void
tor_tls_get_buffer_sizes
(
tor_tls_t
*
tls
,
in
t
*
rbuf_capacity
,
in
t
*
rbuf_bytes
,
in
t
*
wbuf_capacity
,
in
t
*
wbuf_bytes
);
size_
t
*
rbuf_capacity
,
size_
t
*
rbuf_bytes
,
size_
t
*
wbuf_capacity
,
size_
t
*
wbuf_bytes
);
int
tor_tls_used_v1_handshake
(
tor_tls_t
*
tls
);
...
...
src/common/util.c
View file @
aea9cf10
...
...
@@ -1816,7 +1816,8 @@ write_chunks_to_file_impl(const char *fname, const smartlist_t *chunks,
int
open_flags
)
{
open_file_t
*
file
=
NULL
;
int
fd
,
result
;
int
fd
;
ssize_t
result
;
fd
=
start_writing_to_file
(
fname
,
open_flags
,
0600
,
&
file
);
if
(
fd
<
0
)
return
-
1
;
...
...
@@ -1901,7 +1902,7 @@ read_file_to_str(const char *filename, int flags, struct stat *stat_out)
int
fd
;
/* router file */
struct
stat
statbuf
;
char
*
string
;
in
t
r
;
ssize_
t
r
;
int
bin
=
flags
&
RFTS_BIN
;
tor_assert
(
filename
);
...
...
@@ -1960,7 +1961,7 @@ read_file_to_str(const char *filename, int flags, struct stat *stat_out)
* match for size. */
int
save_errno
=
errno
;
log_warn
(
LD_FS
,
"Could read only %d of %ld bytes of file
\"
%s
\"
."
,
r
,
(
long
)
statbuf
.
st_size
,
filename
);
(
int
)
r
,
(
long
)
statbuf
.
st_size
,
filename
);
tor_free
(
string
);
close
(
fd
);
errno
=
save_errno
;
...
...
src/or/command.c
View file @
aea9cf10
...
...
@@ -575,7 +575,7 @@ command_process_netinfo_cell(cell_t *cell, or_connection_t *conn)
/* Consider all the other addresses; if any matches, this connection is
* "canonical." */
tor_addr_t
addr
;
const
char
*
next
=
decode_address_from_payload
(
&
addr
,
cp
,
end
-
cp
);
const
char
*
next
=
decode_address_from_payload
(
&
addr
,
cp
,
(
int
)(
end
-
cp
)
)
;
if
(
next
==
NULL
)
{
log_fn
(
LOG_PROTOCOL_WARN
,
LD_OR
,
"Bad address in netinfo cell; closing connection."
);
...
...
src/or/config.c
View file @
aea9cf10
...
...
@@ -2504,7 +2504,8 @@ is_local_addr(const tor_addr_t *addr)
* the same /24 as last_resolved_addr will be the same as checking whether
* it was on net 0, which is already done by is_internal_IP.
*/
if
((
last_resolved_addr
&
0xffffff00ul
)
==
(
ip
&
0xffffff00ul
))
if
((
last_resolved_addr
&
(
uint32_t
)
0xffffff00ul
)
==
(
ip
&
(
uint32_t
)
0xffffff00ul
))
return
1
;
}
return
0
;
...
...
@@ -4187,7 +4188,7 @@ options_init_from_string(const char *cf,
err:
config_free
(
&
options_format
,
newoptions
);
if
(
*
msg
)
{
int
len
=
strlen
(
*
msg
)
+
256
;
int
len
=
(
int
)
strlen
(
*
msg
)
+
256
;
char
*
newmsg
=
tor_malloc
(
len
);
tor_snprintf
(
newmsg
,
len
,
"Failed to parse/validate config: %s"
,
*
msg
);
...
...
src/or/control.c
View file @
aea9cf10
...
...
@@ -2601,7 +2601,7 @@ handle_control_resolve(control_connection_t *conn, uint32_t len,
int
is_reverse
=
0
;
(
void
)
len
;
/* body is nul-terminated; it's safe to ignore the length */
if
(
!
(
conn
->
event_mask
&
(
1L
<<
EVENT_ADDRMAP
)))
{
if
(
!
(
conn
->
event_mask
&
(
(
uint32_t
)
1L
<<
EVENT_ADDRMAP
)))
{
log_warn
(
LD_CONTROL
,
"Controller asked us to resolve an address, but "
"isn't listening for ADDRMAP events. It probably won't see "
"the answer."
);
...
...
src/or/directory.c
View file @
aea9cf10
...
...
@@ -872,7 +872,7 @@ static char *
directory_get_consensus_url
(
int
supports_conditional_consensus
)
{
char
*
url
;
in
t
len
;
size_
t
len
;
if
(
supports_conditional_consensus
)
{
char
*
authority_id_list
;
...
...
@@ -2342,7 +2342,7 @@ client_likes_consensus(networkstatus_t *v, const char *want_url)
need_at_least
=
smartlist_len
(
want_authorities
)
/
2
+
1
;
SMARTLIST_FOREACH
(
want_authorities
,
const
char
*
,
d
,
{
char
want_digest
[
DIGEST_LEN
];
in
t
want_len
=
strlen
(
d
)
/
2
;
size_
t
want_len
=
strlen
(
d
)
/
2
;
if
(
want_len
>
DIGEST_LEN
)
want_len
=
DIGEST_LEN
;
...
...
src/or/eventdns.c
View file @
aea9cf10
...
...
@@ -2385,7 +2385,7 @@ out1:
/* exported function */
int
evdns_nameserver_add
(
u
nsigned
long
in
t
address
)
{
evdns_nameserver_add
(
u
int32_
t
address
)
{
struct
sockaddr_in
sin
;
memset
(
&
sin
,
0
,
sizeof
(
sin
));
sin
.
sin_family
=
AF_INET
;
...
...
@@ -2416,13 +2416,13 @@ evdns_nameserver_ip_add(const char *ip_as_string) {
cp
=
strchr
(
ip_as_string
,
':'
);
if
(
*
ip_as_string
==
'['
)
{
in
t
len
;
size_
t
len
;
if
(
!
(
cp
=
strchr
(
ip_as_string
,
']'
)))
{
log
(
EVDNS_LOG_DEBUG
,
"Nameserver missing closing ]"
);
return
4
;
}
len
=
cp
-
(
ip_as_string
+
1
);
if
(
len
>
(
int
)
sizeof
(
buf
)
-
1
)
{
if
(
len
>
sizeof
(
buf
)
-
1
)
{
log
(
EVDNS_LOG_DEBUG
,
"[Nameserver] does not fit in buffer."
);
return
4
;
}
...
...
src/or/eventdns.h
View file @
aea9cf10
...
...
@@ -112,7 +112,7 @@
*
* API reference:
*
* int evdns_nameserver_add(u
nsigned long in
t address)
* int evdns_nameserver_add(u
int32_
t address)
* Add a nameserver. The address should be an IP address in
* network byte order. The type of address is chosen so that
* it matches in_addr.s_addr.
...
...
@@ -258,7 +258,7 @@ typedef void (*evdns_callback_type) (int result, char type, int count, int ttl,
int
evdns_init
(
void
);
void
evdns_shutdown
(
int
fail_requests
);
const
char
*
evdns_err_to_string
(
int
err
);
int
evdns_nameserver_add
(
u
nsigned
long
in
t
address
);
int
evdns_nameserver_add
(
u
int32_
t
address
);
int
evdns_count_nameservers
(
void
);
int
evdns_clear_nameservers_and_suspend
(
void
);
int
evdns_resume
(
void
);
...
...
src/or/main.c
View file @
aea9cf10
...
...
@@ -1608,7 +1608,7 @@ dumpstats(int severity)
{
time_t
now
=
time
(
NULL
);
time_t
elapsed
;
in
t
rbuf_cap
,
wbuf_cap
,
rbuf_len
,
wbuf_len
;
size_
t
rbuf_cap
,
wbuf_cap
,
rbuf_len
,
wbuf_len
;
log
(
severity
,
LD_GENERAL
,
"Dumping stats:"
);
...
...
@@ -1644,7 +1644,7 @@ dumpstats(int severity)
log
(
severity
,
LD_GENERAL
,
"Conn %d: %d/%d bytes used on OpenSSL read buffer; "
"%d/%d bytes used on write buffer."
,
i
,
rbuf_len
,
rbuf_cap
,
wbuf_len
,
wbuf_cap
);
i
,
(
int
)
rbuf_len
,
(
int
)
rbuf_cap
,
(
int
)
wbuf_len
,
(
int
)
wbuf_cap
);
}
}
}
...
...
src/or/rendclient.c
View file @
aea9cf10
...
...
@@ -146,7 +146,7 @@ rend_client_send_introduction(origin_circuit_t *introcirc,
REND_DESC_COOKIE_LEN
);
v3_shift
+=
2
+
REND_DESC_COOKIE_LEN
;
}
set_uint32
(
tmp
+
v3_shift
+
1
,
htonl
(
time
(
NULL
)));
set_uint32
(
tmp
+
v3_shift
+
1
,
htonl
(
(
uint32_t
)
time
(
NULL
)));
v3_shift
+=
4
;
}
/* if version 2 only write version number */
else
if
(
entry
->
parsed
->
protocols
&
(
1
<<
2
))
{
...
...
src/or/rendservice.c
View file @
aea9cf10
...
...
@@ -1013,7 +1013,7 @@ rend_service_introduce(origin_circuit_t *circuit, const char *request,
/* Check timestamp. */
memcpy
((
char
*
)
&
ts
,
buf
+
1
+
v3_shift
,
sizeof
(
uint32_t
));
v3_shift
+=
4
;
ts
=
ntohl
(
ts
);
ts
=
ntohl
(
(
uint32_t
)
ts
);
if
((
now
-
ts
)
<
-
1
*
REND_REPLAY_TIME_INTERVAL
/
2
||
(
now
-
ts
)
>
REND_REPLAY_TIME_INTERVAL
/
2
)
{
log_warn
(
LD_REND
,
"INTRODUCE2 cell is too %s. Discarding."
,
...
...
src/or/routerparse.c
View file @
aea9cf10
...
...
@@ -1917,8 +1917,9 @@ routerstatus_parse_entry_from_string(memarea_t *area,
for
(
i
=
0
;
i
<
tok
->
n_args
;
++
i
)
{
if
(
!
strcmpstart
(
tok
->
args
[
i
],
"Bandwidth="
))
{
int
ok
;
rs
->
bandwidth
=
tor_parse_ulong
(
strchr
(
tok
->
args
[
i
],
'='
)
+
1
,
10
,
0
,
UINT32_MAX
,
&
ok
,
NULL
);
rs
->
bandwidth
=
(
uint32_t
)
tor_parse_ulong
(
strchr
(
tok
->
args
[
i
],
'='
)
+
1
,
10
,
0
,
UINT32_MAX
,
&
ok
,
NULL
);
if
(
!
ok
)
{
log_warn
(
LD_DIR
,
"Invalid Bandwidth %s"
,
escaped
(
tok
->
args
[
i
]));
goto
err
;
...
...
src/or/test.c
View file @
aea9cf10
...
...
@@ -410,7 +410,7 @@ test_crypto_dh(void)
char
p2
[
DH_BYTES
];
char
s1
[
DH_BYTES
];
char
s2
[
DH_BYTES
];
in
t
s1len
,
s2len
;
ssize_
t
s1len
,
s2len
;
test_eq
(
crypto_dh_get_bytes
(
dh1
),
DH_BYTES
);
test_eq
(
crypto_dh_get_bytes
(
dh2
),
DH_BYTES
);
...
...
src/tools/tor-gencert.c
View file @
aea9cf10
...
...
@@ -70,7 +70,7 @@ show_help(void)
static
void
crypto_log_errors
(
int
severity
,
const
char
*
doing
)
{
unsigned
int
err
;
unsigned
long
err
;
const
char
*
msg
,
*
lib
,
*
func
;
while
((
err
=
ERR_get_error
())
!=
0
)
{
msg
=
(
const
char
*
)
ERR_reason_error_string
(
err
);
...
...
@@ -94,7 +94,7 @@ load_passphrase(void)
{
char
*
cp
;
char
buf
[
1024
];
/* "Ought to be enough for anybody." */
in
t
n
=
read_all
(
passphrase_fd
,
buf
,
sizeof
(
buf
),
0
);
ssize_
t
n
=
read_all
(
passphrase_fd
,
buf
,
sizeof
(
buf
),
0
);
if
(
n
<
0
)
{
log_err
(
LD_GENERAL
,
"Couldn't read from passphrase fd: %s"
,
strerror
(
errno
));
...
...
src/tools/tor-resolve.c
View file @
aea9cf10
...
...
@@ -51,7 +51,7 @@ static void usage(void) ATTR_NORETURN;
/** Set *<b>out</b> to a newly allocated SOCKS4a resolve request with
* <b>username</b> and <b>hostname</b> as provided. Return the number
* of bytes in the request. */
static
in
t
static
ssize_
t
build_socks_resolve_request
(
char
**
out
,
const
char
*
username
,
const
char
*
hostname
,
...
...
@@ -184,7 +184,7 @@ do_resolve(const char *hostname, uint32_t sockshost, uint16_t socksport,
int
s
;
struct
sockaddr_in
socksaddr
;
char
*
req
=
NULL
;
in
t
len
=
0
;
ssize_
t
len
=
0
;
tor_assert
(
hostname
);
tor_assert
(
result_addr
);
...
...
Write
Preview
Supports
Markdown
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