r26401: Don't cache interfaces context in libnetif.
[samba.git] / source4 / nbt_server / wins / wins_ldb.c
index 5bd1783c690a551addc050e0e8cbdd5513f44337..6fef2180560788acf96ea80896840c910f2b58a8 100644 (file)
@@ -5,7 +5,7 @@
 
    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,
@@ -14,8 +14,7 @@
    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/>.
 */
 
 /*
@@ -35,7 +34,8 @@
 #include "lib/ldb/include/ldb_errors.h"
 #include "lib/ldb/include/ldb_private.h"
 #include "system/network.h"
-#include "netif/netif.h"
+#include "lib/socket/netif.h"
+#include "param/param.h"
 
 static int wins_ldb_verify(struct ldb_module *module, struct ldb_request *req)
 {
@@ -84,12 +84,15 @@ static int wins_ldb_init(struct ldb_module *ctx)
 {
        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(lp_interfaces(lp_ctx), &ifaces);
+               owner = iface_n_ip(ifaces, 0);
                if (!owner) {
                        owner = "0.0.0.0";
                }