mirror of
https://github.com/samba-team/samba.git
synced 2025-02-08 05:57:51 +03:00
net_vampire: use bool for last_query information in samsync.
Guenther (This used to be commit fa1976e23a33bd3fab17c3f6ab5573ee1fdf9e31)
This commit is contained in:
parent
8b52e2bc63
commit
92df9ae393
@ -336,7 +336,8 @@ NTSTATUS libnet_samsync(enum netr_SamDatabaseID database_id,
|
|||||||
|
|
||||||
/* Process results */
|
/* Process results */
|
||||||
callback_status = ctx->delta_fn(mem_ctx, database_id,
|
callback_status = ctx->delta_fn(mem_ctx, database_id,
|
||||||
delta_enum_array, result, ctx);
|
delta_enum_array,
|
||||||
|
NT_STATUS_IS_OK(result), ctx);
|
||||||
if (!NT_STATUS_IS_OK(callback_status)) {
|
if (!NT_STATUS_IS_OK(callback_status)) {
|
||||||
result = callback_status;
|
result = callback_status;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -30,7 +30,7 @@ struct samsync_context;
|
|||||||
typedef NTSTATUS (*samsync_delta_fn_t)(TALLOC_CTX *,
|
typedef NTSTATUS (*samsync_delta_fn_t)(TALLOC_CTX *,
|
||||||
enum netr_SamDatabaseID,
|
enum netr_SamDatabaseID,
|
||||||
struct netr_DELTA_ENUM_ARRAY *,
|
struct netr_DELTA_ENUM_ARRAY *,
|
||||||
NTSTATUS,
|
bool,
|
||||||
struct samsync_context *);
|
struct samsync_context *);
|
||||||
|
|
||||||
struct samsync_context {
|
struct samsync_context {
|
||||||
@ -54,20 +54,20 @@ struct samsync_context {
|
|||||||
NTSTATUS fetch_sam_entries_ldif(TALLOC_CTX *mem_ctx,
|
NTSTATUS fetch_sam_entries_ldif(TALLOC_CTX *mem_ctx,
|
||||||
enum netr_SamDatabaseID database_id,
|
enum netr_SamDatabaseID database_id,
|
||||||
struct netr_DELTA_ENUM_ARRAY *r,
|
struct netr_DELTA_ENUM_ARRAY *r,
|
||||||
NTSTATUS result,
|
bool last_query,
|
||||||
struct samsync_context *ctx);
|
struct samsync_context *ctx);
|
||||||
NTSTATUS fetch_sam_entries(TALLOC_CTX *mem_ctx,
|
NTSTATUS fetch_sam_entries(TALLOC_CTX *mem_ctx,
|
||||||
enum netr_SamDatabaseID database_id,
|
enum netr_SamDatabaseID database_id,
|
||||||
struct netr_DELTA_ENUM_ARRAY *r,
|
struct netr_DELTA_ENUM_ARRAY *r,
|
||||||
NTSTATUS status,
|
bool last_query,
|
||||||
struct samsync_context *ctx);
|
struct samsync_context *ctx);
|
||||||
NTSTATUS display_sam_entries(TALLOC_CTX *mem_ctx,
|
NTSTATUS display_sam_entries(TALLOC_CTX *mem_ctx,
|
||||||
enum netr_SamDatabaseID database_id,
|
enum netr_SamDatabaseID database_id,
|
||||||
struct netr_DELTA_ENUM_ARRAY *r,
|
struct netr_DELTA_ENUM_ARRAY *r,
|
||||||
NTSTATUS status,
|
bool last_query,
|
||||||
struct samsync_context *ctx);
|
struct samsync_context *ctx);
|
||||||
NTSTATUS fetch_sam_entries_keytab(TALLOC_CTX *mem_ctx,
|
NTSTATUS fetch_sam_entries_keytab(TALLOC_CTX *mem_ctx,
|
||||||
enum netr_SamDatabaseID database_id,
|
enum netr_SamDatabaseID database_id,
|
||||||
struct netr_DELTA_ENUM_ARRAY *r,
|
struct netr_DELTA_ENUM_ARRAY *r,
|
||||||
NTSTATUS status,
|
bool last_query,
|
||||||
struct samsync_context *ctx);
|
struct samsync_context *ctx);
|
||||||
|
@ -164,7 +164,7 @@ static void display_rename_alias(uint32_t rid, struct netr_DELTA_RENAME *r)
|
|||||||
static NTSTATUS display_sam_entry(TALLOC_CTX *mem_ctx,
|
static NTSTATUS display_sam_entry(TALLOC_CTX *mem_ctx,
|
||||||
enum netr_SamDatabaseID database_id,
|
enum netr_SamDatabaseID database_id,
|
||||||
struct netr_DELTA_ENUM *r,
|
struct netr_DELTA_ENUM *r,
|
||||||
NTSTATUS status,
|
bool last_query,
|
||||||
struct samsync_context *ctx)
|
struct samsync_context *ctx)
|
||||||
{
|
{
|
||||||
union netr_DELTA_UNION u = r->delta_union;
|
union netr_DELTA_UNION u = r->delta_union;
|
||||||
@ -289,13 +289,14 @@ static NTSTATUS display_sam_entry(TALLOC_CTX *mem_ctx,
|
|||||||
NTSTATUS display_sam_entries(TALLOC_CTX *mem_ctx,
|
NTSTATUS display_sam_entries(TALLOC_CTX *mem_ctx,
|
||||||
enum netr_SamDatabaseID database_id,
|
enum netr_SamDatabaseID database_id,
|
||||||
struct netr_DELTA_ENUM_ARRAY *r,
|
struct netr_DELTA_ENUM_ARRAY *r,
|
||||||
NTSTATUS status,
|
bool last_query,
|
||||||
struct samsync_context *ctx)
|
struct samsync_context *ctx)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < r->num_deltas; i++) {
|
for (i = 0; i < r->num_deltas; i++) {
|
||||||
display_sam_entry(mem_ctx, database_id, &r->delta_enum[i], status, ctx);
|
display_sam_entry(mem_ctx, database_id, &r->delta_enum[i],
|
||||||
|
last_query, ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NT_STATUS_OK;
|
return NT_STATUS_OK;
|
||||||
|
@ -75,7 +75,7 @@ static NTSTATUS fetch_sam_entry_keytab(TALLOC_CTX *mem_ctx,
|
|||||||
enum netr_SamDatabaseID database_id,
|
enum netr_SamDatabaseID database_id,
|
||||||
uint32_t rid,
|
uint32_t rid,
|
||||||
struct netr_DELTA_USER *r,
|
struct netr_DELTA_USER *r,
|
||||||
NTSTATUS status,
|
bool last_query,
|
||||||
struct libnet_keytab_context *ctx)
|
struct libnet_keytab_context *ctx)
|
||||||
{
|
{
|
||||||
uchar nt_passwd[16];
|
uchar nt_passwd[16];
|
||||||
@ -111,7 +111,7 @@ static NTSTATUS fetch_sam_entry_keytab(TALLOC_CTX *mem_ctx,
|
|||||||
NTSTATUS fetch_sam_entries_keytab(TALLOC_CTX *mem_ctx,
|
NTSTATUS fetch_sam_entries_keytab(TALLOC_CTX *mem_ctx,
|
||||||
enum netr_SamDatabaseID database_id,
|
enum netr_SamDatabaseID database_id,
|
||||||
struct netr_DELTA_ENUM_ARRAY *r,
|
struct netr_DELTA_ENUM_ARRAY *r,
|
||||||
NTSTATUS result,
|
bool last_query,
|
||||||
struct samsync_context *ctx)
|
struct samsync_context *ctx)
|
||||||
{
|
{
|
||||||
NTSTATUS status = NT_STATUS_OK;
|
NTSTATUS status = NT_STATUS_OK;
|
||||||
@ -143,7 +143,7 @@ NTSTATUS fetch_sam_entries_keytab(TALLOC_CTX *mem_ctx,
|
|||||||
status = fetch_sam_entry_keytab(mem_ctx, database_id,
|
status = fetch_sam_entry_keytab(mem_ctx, database_id,
|
||||||
r->delta_enum[i].delta_id_union.rid,
|
r->delta_enum[i].delta_id_union.rid,
|
||||||
r->delta_enum[i].delta_union.user,
|
r->delta_enum[i].delta_union.user,
|
||||||
result,
|
last_query,
|
||||||
keytab_ctx);
|
keytab_ctx);
|
||||||
if (!NT_STATUS_IS_OK(status)) {
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
goto out;
|
goto out;
|
||||||
@ -159,10 +159,15 @@ NTSTATUS fetch_sam_entries_keytab(TALLOC_CTX *mem_ctx,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->result_message = talloc_asprintf(mem_ctx,
|
if (last_query) {
|
||||||
"vampired %d accounts to keytab %s",
|
ctx->result_message = talloc_asprintf(mem_ctx,
|
||||||
keytab_ctx->count,
|
"Vampired %d accounts to keytab %s",
|
||||||
keytab_ctx->keytab_name);
|
keytab_ctx->count,
|
||||||
|
keytab_ctx->keytab_name);
|
||||||
|
TALLOC_FREE(keytab_ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
return NT_STATUS_OK;
|
||||||
out:
|
out:
|
||||||
TALLOC_FREE(keytab_ctx);
|
TALLOC_FREE(keytab_ctx);
|
||||||
|
|
||||||
|
@ -1158,7 +1158,7 @@ static NTSTATUS ldif_realloc_maps(TALLOC_CTX *mem_ctx,
|
|||||||
NTSTATUS fetch_sam_entries_ldif(TALLOC_CTX *mem_ctx,
|
NTSTATUS fetch_sam_entries_ldif(TALLOC_CTX *mem_ctx,
|
||||||
enum netr_SamDatabaseID database_id,
|
enum netr_SamDatabaseID database_id,
|
||||||
struct netr_DELTA_ENUM_ARRAY *r,
|
struct netr_DELTA_ENUM_ARRAY *r,
|
||||||
NTSTATUS result,
|
bool last_query,
|
||||||
struct samsync_context *ctx)
|
struct samsync_context *ctx)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
@ -1193,7 +1193,7 @@ NTSTATUS fetch_sam_entries_ldif(TALLOC_CTX *mem_ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* This was the last query */
|
/* This was the last query */
|
||||||
if (NT_STATUS_IS_OK(result)) {
|
if (last_query) {
|
||||||
ldif_write_output(database_id, ldif_ctx);
|
ldif_write_output(database_id, ldif_ctx);
|
||||||
if (ldif_ctx->ldif_file != stdout) {
|
if (ldif_ctx->ldif_file != stdout) {
|
||||||
ctx->result_message = talloc_asprintf(mem_ctx,
|
ctx->result_message = talloc_asprintf(mem_ctx,
|
||||||
|
@ -776,7 +776,7 @@ static NTSTATUS fetch_sam_entry(TALLOC_CTX *mem_ctx,
|
|||||||
NTSTATUS fetch_sam_entries(TALLOC_CTX *mem_ctx,
|
NTSTATUS fetch_sam_entries(TALLOC_CTX *mem_ctx,
|
||||||
enum netr_SamDatabaseID database_id,
|
enum netr_SamDatabaseID database_id,
|
||||||
struct netr_DELTA_ENUM_ARRAY *r,
|
struct netr_DELTA_ENUM_ARRAY *r,
|
||||||
NTSTATUS status,
|
bool last_query,
|
||||||
struct samsync_context *ctx)
|
struct samsync_context *ctx)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user