r24942: Patch from Matthias Wallnöfer <mwallnoefer@yahoo.de> and a testsuite
authorAndrew Bartlett <abartlet@samba.org>
Tue, 4 Sep 2007 02:22:04 +0000 (02:22 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 20:03:41 +0000 (15:03 -0500)
to prove it is correct.

This should fix bug #4824: User Manager for Domains - Account Expires.

Thanks!

Andrew Bartlett
(This used to be commit e5f0744d627ccfcc2e301fc38d139742f0ea5934)

source4/rpc_server/samr/dcesrv_samr.c
source4/torture/rpc/samr.c

index da1054efce4b4bdc39c2b15b4d0d1465011fd54c..fcc52afc0314970c78121bd62ba56c9c837d3aa6 100644 (file)
@@ -3363,7 +3363,9 @@ static NTSTATUS dcesrv_samr_SetUserInfo(struct dcesrv_call_state *dce_call, TALL
                break;
 
        case 21:
-#define IFSET(bit) if (bit & r->in.info->info21.fields_present)
+#define IFSET(bit) if (bit & r->in.info->info21.fields_present)        
+               IFSET(SAMR_FIELD_ACCT_EXPIRY)
+                       SET_UINT64(msg, info21.acct_expiry,    "accountExpires");       
                IFSET(SAMR_FIELD_ACCOUNT_NAME)         
                        SET_STRING(msg, info21.account_name,   "samAccountName");
                IFSET(SAMR_FIELD_FULL_NAME) 
@@ -3391,15 +3393,14 @@ static NTSTATUS dcesrv_samr_SetUserInfo(struct dcesrv_call_state *dce_call, TALL
                IFSET(SAMR_FIELD_COUNTRY_CODE)
                        SET_UINT  (msg, info21.country_code,   "countryCode");
                IFSET(SAMR_FIELD_CODE_PAGE)
-                       SET_UINT  (msg, info21.code_page,      "codePage");
-
-
-               /* Any reason the rest of these can't be set? */
+                       SET_UINT  (msg, info21.code_page,      "codePage");     
 #undef IFSET
                break;
 
        case 23:
 #define IFSET(bit) if (bit & r->in.info->info23.info.fields_present)
+               IFSET(SAMR_FIELD_ACCT_EXPIRY)
+                       SET_UINT64(msg, info23.info.acct_expiry,  "accountExpires");    
                IFSET(SAMR_FIELD_ACCOUNT_NAME)         
                        SET_STRING(msg, info23.info.account_name, "samAccountName");
                IFSET(SAMR_FIELD_FULL_NAME)         
@@ -3454,6 +3455,8 @@ static NTSTATUS dcesrv_samr_SetUserInfo(struct dcesrv_call_state *dce_call, TALL
 
        case 25:
 #define IFSET(bit) if (bit & r->in.info->info25.info.fields_present)
+               IFSET(SAMR_FIELD_ACCT_EXPIRY)
+                       SET_UINT64(msg, info25.info.acct_expiry,  "accountExpires");    
                IFSET(SAMR_FIELD_ACCOUNT_NAME)         
                        SET_STRING(msg, info25.info.account_name, "samAccountName");
                IFSET(SAMR_FIELD_FULL_NAME)         
index a07a39e07863b15b63a991f4f3f180abcc77a40d..8d3164967a1f1a71e2e8d0d52bd418ae6087384c 100644 (file)
@@ -386,6 +386,11 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        TEST_USERINFO_INT(21, code_page, 21, code_page, __LINE__, 
                          SAMR_FIELD_CODE_PAGE);
 
+       TEST_USERINFO_INT(17, acct_expiry, 21, acct_expiry, __LINE__, 0);
+       TEST_USERINFO_INT(17, acct_expiry, 5, acct_expiry, __LINE__, 0);
+       TEST_USERINFO_INT(21, acct_expiry, 21, acct_expiry, __LINE__, 
+                         SAMR_FIELD_ACCT_EXPIRY);
+
        TEST_USERINFO_INT(4, logon_hours.bits[3],  3, logon_hours.bits[3], 1, 0);
        TEST_USERINFO_INT(4, logon_hours.bits[3],  5, logon_hours.bits[3], 2, 0);
        TEST_USERINFO_INT(4, logon_hours.bits[3], 21, logon_hours.bits[3], 3, 0);