Ensure we don't try and set the acct_flags if they are 0 (meaning
authorAndrew Bartlett <abartlet@samba.org>
Wed, 27 Feb 2008 23:43:57 +0000 (10:43 +1100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 27 Feb 2008 23:43:57 +0000 (10:43 +1100)
unchanged in this interface).

We seem to have two very similar interfaces here, and this is the
poorer interface, for this reason.

Andrew Bartlett
(This used to be commit 582073eff1f21f81abb3e5f1ce2eca4ebef56a00)

source4/libnet/libnet_user.c
source4/libnet/libnet_user.h

index d5ccf34a57ac67b8dd8560dec4d4874351acaf7f..678c7a226e601ce96f1c21913bcceb500b18156f 100644 (file)
@@ -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;
 }
index ece06f08fc0b6261b68655fdc413f6a31745771d..94aa38464f649eaf982599d7fe97132ce9381e19 100644 (file)
@@ -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 {