From 957d9ab384696738fedf4bab9bd49978d3af75e7 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 29 Aug 2002 10:36:05 +0000 Subject: There's more work to be done on samsync. Intermediate commit, now I get all the groups at least. Volker (This used to be commit 23a4f6991e93797afad0043689737a1b20c67f60) --- source3/rpc_parse/parse_net.c | 2 +- source3/utils/net_rpc_samsync.c | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index f380862ea7..149d5a02d9 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -1674,7 +1674,7 @@ BOOL init_net_q_sam_sync(NET_Q_SAM_SYNC * q_s, const char *srv_name, memset(&q_s->ret_creds, 0, sizeof(q_s->ret_creds)); q_s->database_id = database_id; - q_s->restart_state = 4; + q_s->restart_state = 0; q_s->sync_context = next_rid; q_s->max_size = 0xffff; diff --git a/source3/utils/net_rpc_samsync.c b/source3/utils/net_rpc_samsync.c index f9afb76875..a41eae40d1 100644 --- a/source3/utils/net_rpc_samsync.c +++ b/source3/utils/net_rpc_samsync.c @@ -67,6 +67,17 @@ static void display_account_info(uint32 rid, SAM_ACCOUNT_INFO *a) smbpasswd_encode_acb_info(a->acb_info)); } +static void display_domain_info(SAM_DOMAIN_INFO *a) +{ + d_printf("Domain name: %s\n", unistr2_static(&a->uni_dom_name)); +} + +static void display_group_info(uint32 rid, SAM_GROUP_INFO *a) +{ + d_printf("Group '%s' ", unistr2_static(&a->uni_grp_name)); + d_printf("desc='%s', rid=%u\n", unistr2_static(&a->uni_grp_desc), rid); +} + static void display_sam_entry(SAM_DELTA_HDR *hdr_delta, SAM_DELTA_CTR *delta) { switch (hdr_delta->type) { @@ -82,6 +93,12 @@ static void display_sam_entry(SAM_DELTA_HDR *hdr_delta, SAM_DELTA_CTR *delta) case SAM_DELTA_ALIAS_MEM: display_alias_mem(hdr_delta->target_rid, &delta->als_mem_info); break; + case SAM_DELTA_DOMAIN_INFO: + display_domain_info(&delta->domain_info); + break; + case SAM_DELTA_GROUP_INFO: + display_group_info(hdr_delta->target_rid, &delta->group_info); + break; default: d_printf("Unknown delta record type %d\n", hdr_delta->type); break; @@ -91,7 +108,7 @@ static void display_sam_entry(SAM_DELTA_HDR *hdr_delta, SAM_DELTA_CTR *delta) static void dump_database(struct cli_state *cli, unsigned db_type, DOM_CRED *ret_creds) { - unsigned last_rid = 0; + unsigned last_rid = -1; NTSTATUS result; int i; TALLOC_CTX *mem_ctx; @@ -113,9 +130,6 @@ static void dump_database(struct cli_state *cli, unsigned db_type, DOM_CRED *ret for (i = 0; i < num_deltas; i++) { display_sam_entry(&hdr_deltas[i], &deltas[i]); last_rid = hdr_deltas[i].target_rid; - if (last_rid == 0) { - break; - } } } while (last_rid && NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)); @@ -155,7 +169,9 @@ int rpc_samdump(int argc, const char **argv) dump_database(cli, SAM_DATABASE_DOMAIN, &ret_creds); dump_database(cli, SAM_DATABASE_BUILTIN, &ret_creds); - dump_database(cli, SAM_DATABASE_PRIVS, &ret_creds); + + /* Currently we crash on PRIVS somewhere in unmarshalling */ + /* Dump_database(cli, SAM_DATABASE_PRIVS, &ret_creds); */ cli_nt_session_close(cli); -- cgit