r26295: Remove use of global_loadparm for net and wb_pam_auth.
[vlendec/samba-autobuild/.git] / source4 / utils / net / net_vampire.c
index 75ad175c6641ac832fe99b3e9e35595781769ed5..4e0f1501d94b63f55ae3350c191e5a498886ab93 100644 (file)
@@ -7,7 +7,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,
    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 "utils/net/net.h"
 #include "libnet/libnet.h"
-#include "librpc/gen_ndr/ndr_samr.h"
+#include "librpc/gen_ndr/samr.h"
+#include "auth/auth.h"
+#include "param/param.h"
 
 static int net_samdump_keytab_usage(struct net_context *ctx, int argc, const char **argv)
 {
@@ -48,7 +49,7 @@ static int net_samdump_keytab(struct net_context *ctx, int argc, const char **ar
                return net_samdump_keytab_usage(ctx, argc, argv);
                break;
        case 1:
-               r.keytab_name = argv[0];
+               r.in.keytab_name = argv[0];
                break;
        }
 
@@ -58,14 +59,15 @@ static int net_samdump_keytab(struct net_context *ctx, int argc, const char **ar
        }
        libnetctx->cred = ctx->credentials;
 
-       r.level        = LIBNET_SAMDUMP_GENERIC;
-       r.error_string = NULL;
+       r.out.error_string = NULL;
+       r.in.machine_account = NULL;
+       r.in.binding_string = NULL;
 
        status = libnet_SamDump_keytab(libnetctx, ctx->mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("libnet_SamDump returned %s: %s\n",
                         nt_errstr(status),
-                        r.error_string));
+                        r.out.error_string));
                return -1;
        }
 
@@ -103,14 +105,15 @@ int net_samdump(struct net_context *ctx, int argc, const char **argv)
        }
        libnetctx->cred = ctx->credentials;
 
-       r.level        = LIBNET_SAMDUMP_GENERIC;
-       r.error_string = NULL;
+       r.out.error_string = NULL;
+       r.in.machine_account = NULL;
+       r.in.binding_string = NULL;
 
        status = libnet_SamDump(libnetctx, ctx->mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("libnet_SamDump returned %s: %s\n",
                         nt_errstr(status),
-                        r.error_string));
+                        r.out.error_string));
                return -1;
        }
 
@@ -144,14 +147,18 @@ int net_samsync_ldb(struct net_context *ctx, int argc, const char **argv)
        }
        libnetctx->cred = ctx->credentials;
 
-       r.level        = LIBNET_SAMSYNC_LDB_GENERIC;
-       r.error_string = NULL;
+       r.out.error_string = NULL;
+       r.in.machine_account = NULL;
+       r.in.binding_string = NULL;
 
-       status = libnet_samsync_ldb(libnetctx, ctx->mem_ctx, &r);
+       /* Needed to override the ACLs on ldb */
+       r.in.session_info = system_session(libnetctx, ctx->lp_ctx);
+
+       status = libnet_samsync_ldb(libnetctx, libnetctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("libnet_samsync_ldb returned %s: %s\n",
                         nt_errstr(status),
-                        r.error_string));
+                        r.out.error_string));
                return -1;
        }
 
@@ -168,6 +175,6 @@ int net_samsync_ldb_usage(struct net_context *ctx, int argc, const char **argv)
 
 int net_samsync_ldb_help(struct net_context *ctx, int argc, const char **argv)
 {
-       d_printf("Syncrosnise into the local ldb the SAM of a domain.\n");
+       d_printf("Synchronise into the local ldb the SAM of a domain.\n");
        return 0;       
 }