diff options
Diffstat (limited to 'source4/utils/net')
-rw-r--r-- | source4/utils/net/net.c | 1 | ||||
-rw-r--r-- | source4/utils/net/net_vampire.c | 40 |
2 files changed, 41 insertions, 0 deletions
diff --git a/source4/utils/net/net.c b/source4/utils/net/net.c index 51b860234d..787f71705b 100644 --- a/source4/utils/net/net.c +++ b/source4/utils/net/net.c @@ -106,6 +106,7 @@ static const struct net_functable net_functable[] = { {"time", "get remote server's time\n", net_time, net_time_usage}, {"join", "join a domain\n", net_join, net_join_usage}, {"samdump", "dump the sam of a domain\n", net_samdump, net_samdump_usage}, + {"samsync", "syncrosnise into the local ldb the sam of a domain\n", net_samsync_ldb, net_samsync_ldb_usage}, {"user", "manage user accounts\n", net_user, net_user_usage}, {NULL, NULL, NULL, NULL} }; diff --git a/source4/utils/net/net_vampire.c b/source4/utils/net/net_vampire.c index 72f791db66..e898352cfc 100644 --- a/source4/utils/net/net_vampire.c +++ b/source4/utils/net/net_vampire.c @@ -64,3 +64,43 @@ int net_samdump_help(struct net_context *ctx, int argc, const char **argv) d_printf("Dumps the sam of the domain we are joined to.\n"); return 0; } + +int net_samsync_ldb(struct net_context *ctx, int argc, const char **argv) +{ + NTSTATUS status; + struct libnet_context *libnetctx; + struct libnet_samsync_ldb r; + + libnetctx = libnet_context_init(NULL); + if (!libnetctx) { + return -1; + } + libnetctx->cred = ctx->credentials; + + r.level = LIBNET_SAMSYNC_LDB_GENERIC; + r.error_string = NULL; + + status = libnet_samsync_ldb(libnetctx, ctx->mem_ctx, &r); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("libnet_samsync_ldb returned %s: %s\n", + nt_errstr(status), + r.error_string)); + return -1; + } + + talloc_free(libnetctx); + + return 0; +} + +int net_samsync_ldb_usage(struct net_context *ctx, int argc, const char **argv) +{ + d_printf("net samsync_ldb\n"); + return 0; +} + +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"); + return 0; +} |