diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-07-25 06:33:51 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:30:02 -0500 |
commit | 6d26a7114f233418b17b76c3e8dc73086a901ed7 (patch) | |
tree | 6cc79622e1c3ffcda8d69b271d2ba6cf7ad1d1c4 /source4/utils | |
parent | dc4af82432c43920eeafbcdbbe2a6576a6d8d80e (diff) | |
download | samba-6d26a7114f233418b17b76c3e8dc73086a901ed7.tar.gz samba-6d26a7114f233418b17b76c3e8dc73086a901ed7.tar.bz2 samba-6d26a7114f233418b17b76c3e8dc73086a901ed7.zip |
r8752: With all the infrustructure done, details like a SamSync migration
into LDB are actually quite easy.
This brings us the users, and sets basic domain information.
You are expected to have provisioned with the settings for the target
domain, and have joined the domain as a BDC. Then simply 'net
samsync'.
Now we just need to flesh out the delta types.
Andrew Bartlett
(This used to be commit 1e0f7792bb29b17c23197a5e42ee8cabb0cf17d0)
Diffstat (limited to 'source4/utils')
-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; +} |