diff --git a/source/libnet/libnet_user.c b/source/libnet/libnet_user.c index d5ccf34a57a..678c7a226e6 100644 --- a/source/libnet/libnet_user.c +++ b/source/libnet/libnet_user.c @@ -534,7 +534,7 @@ static NTSTATUS set_user_changes(TALLOC_CTX *mem_ctx, struct usermod_change *mod SET_FIELD_NTTIME(r->in, user, mod, acct_expiry, USERMOD_FIELD_ACCT_EXPIRY); /* account flags change */ - SET_FIELD_UINT32(r->in, user, mod, acct_flags, USERMOD_FIELD_ACCT_FLAGS); + SET_FIELD_ACCT_FLAGS(r->in, user, mod, acct_flags, USERMOD_FIELD_ACCT_FLAGS); return NT_STATUS_OK; } diff --git a/source/libnet/libnet_user.h b/source/libnet/libnet_user.h index ece06f08fc0..94aa38464f6 100644 --- a/source/libnet/libnet_user.h +++ b/source/libnet/libnet_user.h @@ -91,6 +91,14 @@ struct libnet_ModifyUser { mod->fields |= flag; \ } +#define SET_FIELD_ACCT_FLAGS(new, current, mod, field, flag) \ + if (new.field) { \ + if (current->field != new.field) { \ + mod->field = new.field; \ + mod->fields |= flag; \ + } \ + } + struct libnet_UserInfo { struct {