Commit 73974636 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

nsiproxy: Add intermediate variables for sscanf on ULONG.

parent ff514935
...@@ -534,6 +534,7 @@ static NTSTATUS tcp_conns_enumerate_all( UINT filter, struct nsi_tcp_conn_key *k ...@@ -534,6 +534,7 @@ static NTSTATUS tcp_conns_enumerate_all( UINT filter, struct nsi_tcp_conn_key *k
FILE *fp; FILE *fp;
char buf[512], *ptr; char buf[512], *ptr;
int inode; int inode;
UINT laddr, raddr;
if (!(fp = fopen( "/proc/net/tcp", "r" ))) return ERROR_NOT_SUPPORTED; if (!(fp = fopen( "/proc/net/tcp", "r" ))) return ERROR_NOT_SUPPORTED;
...@@ -547,15 +548,17 @@ static NTSTATUS tcp_conns_enumerate_all( UINT filter, struct nsi_tcp_conn_key *k ...@@ -547,15 +548,17 @@ static NTSTATUS tcp_conns_enumerate_all( UINT filter, struct nsi_tcp_conn_key *k
while ((ptr = fgets( buf, sizeof(buf), fp ))) while ((ptr = fgets( buf, sizeof(buf), fp )))
{ {
if (sscanf( ptr, "%*x: %x:%hx %x:%hx %x %*s %*s %*s %*s %*s %d", if (sscanf( ptr, "%*x: %x:%hx %x:%hx %x %*s %*s %*s %*s %*s %d",
&key.local.Ipv4.sin_addr.WS_s_addr, &key.local.Ipv4.sin_port, &laddr, &key.local.Ipv4.sin_port,
&key.remote.Ipv4.sin_addr.WS_s_addr, &key.remote.Ipv4.sin_port, &raddr, &key.remote.Ipv4.sin_port,
&dyn.state, &inode ) != 6) &dyn.state, &inode ) != 6)
continue; continue;
dyn.state = tcp_state_to_mib_state( dyn.state ); dyn.state = tcp_state_to_mib_state( dyn.state );
if (filter && filter != dyn.state ) continue; if (filter && filter != dyn.state ) continue;
key.local.Ipv4.sin_family = key.remote.Ipv4.sin_family = WS_AF_INET; key.local.Ipv4.sin_family = key.remote.Ipv4.sin_family = WS_AF_INET;
key.local.Ipv4.sin_addr.WS_s_addr = laddr;
key.local.Ipv4.sin_port = htons( key.local.Ipv4.sin_port ); key.local.Ipv4.sin_port = htons( key.local.Ipv4.sin_port );
key.remote.Ipv4.sin_addr.WS_s_addr = raddr;
key.remote.Ipv4.sin_port = htons( key.remote.Ipv4.sin_port ); key.remote.Ipv4.sin_port = htons( key.remote.Ipv4.sin_port );
if (num < *count) if (num < *count)
......
...@@ -223,6 +223,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void ...@@ -223,6 +223,7 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void
FILE *fp; FILE *fp;
char buf[512], *ptr; char buf[512], *ptr;
int inode; int inode;
UINT addr;
if (!(fp = fopen( "/proc/net/udp", "r" ))) return ERROR_NOT_SUPPORTED; if (!(fp = fopen( "/proc/net/udp", "r" ))) return ERROR_NOT_SUPPORTED;
...@@ -235,10 +236,11 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void ...@@ -235,10 +236,11 @@ static NTSTATUS udp_endpoint_enumerate_all( void *key_data, UINT key_size, void
while ((ptr = fgets( buf, sizeof(buf), fp ))) while ((ptr = fgets( buf, sizeof(buf), fp )))
{ {
if (sscanf( ptr, "%*u: %x:%hx %*s %*s %*s %*s %*s %*s %*s %d", if (sscanf( ptr, "%*u: %x:%hx %*s %*s %*s %*s %*s %*s %*s %d",
&key.local.Ipv4.sin_addr.WS_s_addr, &key.local.Ipv4.sin_port, &inode ) != 3) &addr, &key.local.Ipv4.sin_port, &inode ) != 3)
continue; continue;
key.local.Ipv4.sin_family = WS_AF_INET; key.local.Ipv4.sin_family = WS_AF_INET;
key.local.Ipv4.sin_addr.WS_s_addr = addr;
key.local.Ipv4.sin_port = htons( key.local.Ipv4.sin_port ); key.local.Ipv4.sin_port = htons( key.local.Ipv4.sin_port );
stat.pid = find_owning_pid( pid_map, pid_map_size, inode ); stat.pid = find_owning_pid( pid_map, pid_map_size, inode );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment