1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

r5145: define struct ipv4_addr in misc.idl,

so we can use it in nbt.idl and
get a nicer debug output

metze
(This used to be commit abacbc9192646f6f3c720758ab65889b82b9ae7b)
This commit is contained in:
Stefan Metzmacher 2005-01-31 17:16:45 +00:00 committed by Gerald (Jerry) Carter
parent 3b6fb59314
commit ca3f70256a
11 changed files with 30 additions and 17 deletions

View File

@ -91,14 +91,6 @@
typedef int BOOL;
/*
we use struct ipv4_addr to avoid having to include all the
system networking headers everywhere
*/
struct ipv4_addr {
uint32_t addr;
};
#ifndef HAVE_STRERROR
extern char *sys_errlist[];
#define strerror(i) sys_errlist[i]
@ -126,7 +118,6 @@ extern int errno;
#include "pstring.h"
#include "smb_macros.h"
#include "smb.h"
#include "ads.h"
#include "lib/socket/socket.h"
#include "libcli/ldap/ldap.h"
#include "byteorder.h"
@ -142,6 +133,7 @@ extern int errno;
#include "ntvfs/ntvfs.h"
#include "cli_context.h"
#include "nsswitch/winbind_client.h"
#include "ads.h"
#define malloc_p(type) (type *)malloc(sizeof(type))
#define malloc_array_p(type, count) (type *)realloc_array(NULL, sizeof(type), count)

View File

@ -102,7 +102,7 @@ NTSTATUS nbt_name_query_recv(struct nbt_name_request *req,
}
for (i=0;i<io->out.num_addrs;i++) {
in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[i].ipaddr);
in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[i].ipaddr.addr);
addr = inet_ntoa(in);
if (addr == NULL) {
talloc_free(req);

View File

@ -64,7 +64,7 @@ struct nbt_name_request *nbt_name_refresh_send(struct nbt_name_socket *nbtsock,
struct nbt_rdata_address, 1);
if (packet->additional[0].rdata.netbios.addresses == NULL) goto failed;
packet->additional[0].rdata.netbios.addresses[0].nb_flags = io->in.nb_flags;
packet->additional[0].rdata.netbios.addresses[0].ipaddr = htonl(inet_addr(io->in.address));
packet->additional[0].rdata.netbios.addresses[0].ipaddr.addr = htonl(inet_addr(io->in.address));
req = nbt_name_request_send(nbtsock, io->in.dest_addr, lp_nbt_port(), packet,
timeval_current_ofs(io->in.timeout, 0), False);
@ -112,7 +112,7 @@ NTSTATUS nbt_name_refresh_recv(struct nbt_name_request *req,
talloc_free(req);
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[0].ipaddr);
in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[0].ipaddr.addr);
addr = inet_ntoa(in);
if (addr == NULL) {
talloc_free(req);

View File

@ -67,7 +67,7 @@ struct nbt_name_request *nbt_name_register_send(struct nbt_name_socket *nbtsock,
struct nbt_rdata_address, 1);
if (packet->additional[0].rdata.netbios.addresses == NULL) goto failed;
packet->additional[0].rdata.netbios.addresses[0].nb_flags = io->in.nb_flags;
packet->additional[0].rdata.netbios.addresses[0].ipaddr = htonl(inet_addr(io->in.address));
packet->additional[0].rdata.netbios.addresses[0].ipaddr.addr = htonl(inet_addr(io->in.address));
req = nbt_name_request_send(nbtsock, io->in.dest_addr, lp_nbt_port(), packet,
timeval_current_ofs(io->in.timeout, 0), False);
@ -115,7 +115,7 @@ NTSTATUS nbt_name_register_recv(struct nbt_name_request *req,
talloc_free(req);
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[0].ipaddr);
in.s_addr = htonl(packet->answers[0].rdata.netbios.addresses[0].ipaddr.addr);
addr = inet_ntoa(in);
if (addr == NULL) {
talloc_free(req);

View File

@ -390,6 +390,10 @@ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
talloc_set_destructor(req, nbt_name_request_destructor);
if (DEBUGLVL(10)) {
NDR_PRINT_DEBUG(nbt_name_packet, request);
}
status = ndr_push_struct_blob(&req->encoded, req, request,
(ndr_push_flags_fn_t)ndr_push_nbt_name_packet);
if (!NT_STATUS_IS_OK(status)) {

View File

@ -291,7 +291,7 @@ REQUIRED_SUBSYSTEMS = LIBNDR
INIT_OBJ_FILES = librpc/gen_ndr/ndr_nbt.o
INIT_FUNCTION = dcerpc_nbt_init
NOPROTO = YES
REQUIRED_SUBSYSTEMS = LIBNDR
REQUIRED_SUBSYSTEMS = LIBNDR NDR_MISC
[SUBSYSTEM::NDR_ALL]

View File

@ -6,6 +6,10 @@
interface misc
{
typedef [public,noprint] struct {
uint32 addr;
} ipv4_addr;
typedef [public,noprint,gensize] struct {
uint32 time_low;
uint16 time_mid;

View File

@ -102,7 +102,7 @@ interface nbt
typedef struct {
nb_flags nb_flags;
uint32 ipaddr;
ipv4_addr ipaddr;
} nbt_rdata_address;
typedef struct {

View File

@ -24,6 +24,16 @@
*/
#include "includes.h"
#include "system/network.h"
void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct ipv4_addr *_ip)
{
struct ipv4_addr ip;
ip.addr = htonl(_ip->addr);
ndr->print(ndr, "%-25s: %s", name, sys_inet_ntoa(ip));
}
/*
build a GUID from a string

View File

@ -60,7 +60,7 @@ static void nbt_name_query_reply(struct nbt_name_socket *nbtsock,
struct nbt_rdata_address, 1);
if (packet->answers[0].rdata.netbios.addresses == NULL) goto failed;
packet->answers[0].rdata.netbios.addresses[0].nb_flags = nb_flags;
packet->answers[0].rdata.netbios.addresses[0].ipaddr = htonl(inet_addr(address));
packet->answers[0].rdata.netbios.addresses[0].ipaddr.addr = htonl(inet_addr(address));
DEBUG(7,("Sending name query reply for %s<%02x> at %s to %s:%d\n",
name->name, name->type, src_address, address, src_port));

View File

@ -32,4 +32,7 @@ void nbt_query_wins(struct nbt_name_socket *nbtsock,
const char *src_address, int src_port)
{
DEBUG(0,("WINS query from %s\n", src_address));
if (DEBUGLVL(10)) {
NDR_PRINT_DEBUG(nbt_name_packet, packet);
}
}