#include "includes.h"
#include "dlinklist.h"
#include "nbt_server/nbt_server.h"
+#include "libcli/raw/libcliraw.h"
+#include "libcli/composite/composite.h"
/*
start a timer to refresh this name
/*
a name registration has completed
*/
-static void nbt_register_handler(struct nbt_name_request *req)
+static void nbt_register_handler(struct smbcli_composite *req)
{
struct nbt_iface_name *iname = talloc_get_type(req->async.private, struct nbt_iface_name);
NTSTATUS status;
- struct nbt_name_register io;
- status = nbt_name_register_recv(req, iname, &io);
- if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+ status = nbt_name_register_bcast_recv(req);
+ if (NT_STATUS_IS_OK(status)) {
/* good - nobody complained about our registration */
iname->nb_flags |= NBT_NM_ACTIVE;
DEBUG(3,("Registered %s<%02x> on interface %s\n",
return;
}
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1,("Error registering %s<%02x> on interface %s - %s\n",
- iname->name.name, iname->name.type, iname->iface->bcast_address,
- nt_errstr(status)));
- return;
- }
-
/* someone must have replied with an objection! */
iname->nb_flags |= NBT_NM_CONFLICT;
-
- DEBUG(1,("Name conflict registering %s<%02x> on interface %s - rcode %d from %s for %s\n",
+
+ DEBUG(1,("Error registering %s<%02x> on interface %s - %s\n",
iname->name.name, iname->name.type, iname->iface->bcast_address,
- io.out.rcode, io.out.reply_from, io.out.reply_addr));
+ nt_errstr(status)));
}
{
struct nbt_iface_name *iname;
const char *scope = lp_netbios_scope();
- struct nbt_name_register io;
- struct nbt_name_request *req;
+ struct nbt_name_register_bcast io;
+ struct smbcli_composite *req;
iname = talloc(iface, struct nbt_iface_name);
if (!iname) return;
iname->ttl = lp_parm_int(-1, "nbtd", "bcast_ttl", 300000);
iname->registration_time = timeval_zero();
- DLIST_ADD(iface->names, iname);
+ DLIST_ADD_END(iface->names, iname, struct nbt_iface_name *);
if (nb_flags & NBT_NM_PERMANENT) {
/* permanent names are not announced and are immediately active */
io.in.dest_addr = iface->bcast_address;
io.in.address = iface->ip_address;
io.in.nb_flags = nb_flags;
- io.in.register_demand = False;
- io.in.broadcast = True;
io.in.ttl = iname->ttl;
- io.in.timeout = 1;
- req = nbt_name_register_send(iface->nbtsock, &io);
+ req = nbt_name_register_bcast_send(iface->nbtsock, &io);
if (req == NULL) return;
req->async.fn = nbt_register_handler;
nbt_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_CLIENT, nb_flags);
nbt_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_USER, nb_flags);
nbt_register_name(nbtsrv, lp_netbios_name(), NBT_NAME_SERVER, nb_flags);
- nbt_register_name(nbtsrv, lp_workgroup(), NBT_NAME_CLIENT, nb_flags | NBT_NM_GROUP);
- nbt_register_name(nbtsrv, lp_workgroup(), NBT_NAME_SERVER, nb_flags | NBT_NM_GROUP);
- nbt_register_name(nbtsrv, "__SAMBA__", NBT_NAME_CLIENT, nb_flags | NBT_NM_PERMANENT);
- nbt_register_name(nbtsrv, "__SAMBA__", NBT_NAME_SERVER, nb_flags | NBT_NM_PERMANENT);
+
+ nb_flags |= NBT_NM_GROUP;
+ nbt_register_name(nbtsrv, lp_workgroup(), NBT_NAME_CLIENT, nb_flags);
+
+ nb_flags |= NBT_NM_PERMANENT;
+ nbt_register_name(nbtsrv, "__SAMBA__", NBT_NAME_CLIENT, nb_flags);
+ nbt_register_name(nbtsrv, "__SAMBA__", NBT_NAME_SERVER, nb_flags);
+ nbt_register_name(nbtsrv, "*", NBT_NAME_CLIENT, nb_flags);
}