This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "lib/events/events.h"
-#include "dlinklist.h"
+#include "lib/util/dlinklist.h"
#include "nbt_server/nbt_server.h"
#include "smbd/service_task.h"
#include "libcli/composite/composite.h"
#include "librpc/gen_ndr/ndr_samr.h"
#include "nbt_server/wins/winsserver.h"
#include "librpc/gen_ndr/ndr_nbt.h"
-
+#include "dsdb/samdb/samdb.h"
+#include "param/param.h"
static void nbtd_start_refresh_timer(struct nbtd_iface_name *iname);
static void nbtd_start_refresh_timer(struct nbtd_iface_name *iname)
{
uint32_t refresh_time;
- uint32_t max_refresh_time = lp_parm_int(-1, "nbtd", "max_refresh_time", 7200);
+ uint32_t max_refresh_time = lp_parm_int(NULL, "nbtd", "max_refresh_time", 7200);
refresh_time = MIN(max_refresh_time, iname->ttl/2);
iname->name.scope = NULL;
}
iname->nb_flags = nb_flags;
- iname->ttl = lp_parm_int(-1, "nbtd", "bcast_ttl", 300000);
+ iname->ttl = lp_parm_int(NULL, "nbtd", "bcast_ttl", 300000);
iname->registration_time = timeval_zero();
iname->wins_server = NULL;
/*
register one name on all our interfaces
*/
-static void nbtd_register_name(struct nbtd_server *nbtsrv,
- const char *name, enum nbt_name_type type,
- uint16_t nb_flags)
+void nbtd_register_name(struct nbtd_server *nbtsrv,
+ const char *name, enum nbt_name_type type,
+ uint16_t nb_flags)
{
struct nbtd_interface *iface;
aliases++;
}
- switch (lp_server_role()) {
- case ROLE_DOMAIN_PDC:
- nbtd_register_name(nbtsrv, lp_workgroup(), NBT_NAME_PDC, nb_flags);
- nbtd_register_name(nbtsrv, lp_workgroup(), NBT_NAME_LOGON, nb_flags | NBT_NM_GROUP);
- break;
- case ROLE_DOMAIN_BDC:
- nbtd_register_name(nbtsrv, lp_workgroup(), NBT_NAME_LOGON, nb_flags | NBT_NM_GROUP);
- default:
- break;
+ if (lp_server_role() == ROLE_DOMAIN_CONTROLLER) {
+ BOOL is_pdc = samdb_is_pdc(nbtsrv->sam_ctx);
+ if (is_pdc) {
+ nbtd_register_name(nbtsrv, lp_workgroup(),
+ NBT_NAME_PDC, nb_flags);
+ }
+ nbtd_register_name(nbtsrv, lp_workgroup(),
+ NBT_NAME_LOGON, nb_flags | NBT_NM_GROUP);
}
nb_flags |= NBT_NM_GROUP;