mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
s3:winbindd: make use of samba_sockaddr in set_remote_addresses() to avoid warnings
../../source3/winbindd/winbindd_dual_ndr.c: In function ‘set_remote_addresses’: ../../source3/winbindd/winbindd_dual_ndr.c:467:51: warning: dereferencing type-punned pointer might break strict-aliasing rules [-Wstrict-aliasing] 467 | struct sockaddr *sar = (struct sockaddr *)&st; Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
parent
0de93c34db
commit
fa04464316
@ -463,23 +463,24 @@ fail:
|
|||||||
static NTSTATUS set_remote_addresses(struct dcesrv_connection *conn,
|
static NTSTATUS set_remote_addresses(struct dcesrv_connection *conn,
|
||||||
int sock)
|
int sock)
|
||||||
{
|
{
|
||||||
struct sockaddr_storage st = { 0 };
|
struct samba_sockaddr ssa;
|
||||||
struct sockaddr *sar = (struct sockaddr *)&st;
|
|
||||||
struct tsocket_address *remote = NULL;
|
struct tsocket_address *remote = NULL;
|
||||||
struct tsocket_address *local = NULL;
|
struct tsocket_address *local = NULL;
|
||||||
socklen_t sa_len = sizeof(st);
|
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ZERO_STRUCT(st);
|
ssa = (struct samba_sockaddr) { .sa_socklen = sizeof(ssa.u.ss), };
|
||||||
ret = getpeername(sock, sar, &sa_len);
|
ret = getpeername(sock, &ssa.u.sa, &ssa.sa_socklen);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
status = map_nt_error_from_unix(ret);
|
status = map_nt_error_from_unix(ret);
|
||||||
DBG_ERR("getpeername failed: %s\n", nt_errstr(status));
|
DBG_ERR("getpeername failed: %s\n", nt_errstr(status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = tsocket_address_bsd_from_sockaddr(conn, sar, sa_len, &remote);
|
ret = tsocket_address_bsd_from_sockaddr(conn,
|
||||||
|
&ssa.u.sa,
|
||||||
|
ssa.sa_socklen,
|
||||||
|
&remote);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
status = map_nt_error_from_unix(ret);
|
status = map_nt_error_from_unix(ret);
|
||||||
DBG_ERR("tsocket_address_bsd_from_sockaddr failed: %s\n",
|
DBG_ERR("tsocket_address_bsd_from_sockaddr failed: %s\n",
|
||||||
@ -487,15 +488,18 @@ static NTSTATUS set_remote_addresses(struct dcesrv_connection *conn,
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZERO_STRUCT(st);
|
ssa = (struct samba_sockaddr) { .sa_socklen = sizeof(ssa.u.ss), };
|
||||||
ret = getsockname(sock, sar, &sa_len);
|
ret = getsockname(sock, &ssa.u.sa, &ssa.sa_socklen);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
status = map_nt_error_from_unix(ret);
|
status = map_nt_error_from_unix(ret);
|
||||||
DBG_ERR("getsockname failed: %s\n", nt_errstr(status));
|
DBG_ERR("getsockname failed: %s\n", nt_errstr(status));
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = tsocket_address_bsd_from_sockaddr(conn, sar, sa_len, &local);
|
ret = tsocket_address_bsd_from_sockaddr(conn,
|
||||||
|
&ssa.u.sa,
|
||||||
|
ssa.sa_socklen,
|
||||||
|
&local);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
status = map_nt_error_from_unix(ret);
|
status = map_nt_error_from_unix(ret);
|
||||||
DBG_ERR("tsocket_address_bsd_from_sockaddr failed: %s\n",
|
DBG_ERR("tsocket_address_bsd_from_sockaddr failed: %s\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user