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 "nbt_server/nbt_server.h"
#include "nbt_server/wins/winsdb.h"
#include "lib/ldb/include/ldb.h"
#include "lib/ldb/include/ldb_private.h"
#include "system/network.h"
#include "lib/socket/netif.h"
+#include "param/param.h"
static int wins_ldb_verify(struct ldb_module *module, struct ldb_request *req)
{
{
struct winsdb_handle *h;
const char *owner;
+ struct loadparm_context *lp_ctx = ldb_get_opaque(ctx->ldb, "loadparm");
ctx->private_data = NULL;
- owner = lp_parm_string(-1, "winsdb", "local_owner");
+ owner = lp_parm_string(lp_ctx, NULL, "winsdb", "local_owner");
if (!owner) {
- owner = iface_n_ip(0);
+ struct interface *ifaces;
+ load_interfaces(ctx, lp_interfaces(lp_ctx), &ifaces);
+ owner = iface_n_ip(ifaces, 0);
if (!owner) {
owner = "0.0.0.0";
}
}
- h = talloc(ctx, struct winsdb_handle);
+ h = talloc_zero(ctx, struct winsdb_handle);
if (!h) goto failed;
h->ldb = ctx->ldb;
h->caller = WINSDB_HANDLE_CALLER_ADMIN;
return LDB_ERR_OTHER;
}
-static const struct ldb_module_ops wins_ldb_ops = {
+_PUBLIC_ const struct ldb_module_ops ldb_wins_ldb_module_ops = {
.name = "wins_ldb",
.add = wins_ldb_verify,
.modify = wins_ldb_verify,
.init_context = wins_ldb_init
};
-
-
-/* the init function */
-int wins_ldb_module_init(void)
-{
- return ldb_register_module(&wins_ldb_ops);
-}