r20149: Remove the smb.conf distinction between PDC and BDC. Now the correct
[jra/samba/.git] / source4 / torture / rpc / samr.c
index 657898c4a2e20679ec6ae1c04d8d9b5c13fb8020..28dd03e803c4d4cb0c1c0902b830f4a3143a0b25 100644 (file)
@@ -159,7 +159,7 @@ static BOOL test_QuerySecurity(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        s.in.sec_info = 7;
        s.in.sdbuf = r.out.sdbuf;
 
-       if (lp_parm_bool(-1, "target", "samba4", False)) {
+       if (lp_parm_bool(-1, "torture", "samba4", False)) {
                printf("skipping SetSecurity test against Samba4\n");
                return True;
        }
@@ -337,6 +337,22 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        TEST_USERINFO_STRING(21, profile_path, 21, profile_path, "xx21-21 profile_path", 
                           SAMR_FIELD_PROFILE_PATH);
 
+       TEST_USERINFO_STRING(10, home_directory, 3, home_directory, "xx10-3 home_directory", 0);
+       TEST_USERINFO_STRING(10, home_directory, 5, home_directory, "xx10-5 home_directory", 0);
+       TEST_USERINFO_STRING(10, home_directory, 21, home_directory, "xx10-21 home_directory", 0);
+       TEST_USERINFO_STRING(21, home_directory, 21, home_directory, "xx21-21 home_directory",
+                            SAMR_FIELD_HOME_DIRECTORY);
+       TEST_USERINFO_STRING(21, home_directory, 10, home_directory, "xx21-10 home_directory",
+                            SAMR_FIELD_HOME_DIRECTORY);
+
+       TEST_USERINFO_STRING(10, home_drive, 3, home_drive, "xx10-3 home_drive", 0);
+       TEST_USERINFO_STRING(10, home_drive, 5, home_drive, "xx10-5 home_drive", 0);
+       TEST_USERINFO_STRING(10, home_drive, 21, home_drive, "xx10-21 home_drive", 0);
+       TEST_USERINFO_STRING(21, home_drive, 21, home_drive, "xx21-21 home_drive",
+                            SAMR_FIELD_HOME_DRIVE);
+       TEST_USERINFO_STRING(21, home_drive, 10, home_drive, "xx21-10 home_drive",
+                            SAMR_FIELD_HOME_DRIVE);
+       
        TEST_USERINFO_STRING(13, description,  1, description, "xx13-1 description", 0);
        TEST_USERINFO_STRING(13, description,  5, description, "xx13-5 description", 0);
        TEST_USERINFO_STRING(13, description, 21, description, "xx13-21 description", 0);
@@ -367,7 +383,7 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        TEST_USERINFO_INT(21, logon_hours.bits[3], 21, logon_hours.bits[3], 4, 
                          SAMR_FIELD_LOGON_HOURS);
 
-       if (lp_parm_bool(-1, "target", "samba4", False)) {
+       if (lp_parm_bool(-1, "torture", "samba4", False)) {
                printf("skipping Set Account Flag tests against Samba4\n");
                return ret;
        }
@@ -1646,7 +1662,7 @@ static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                ret = False;
        }
 
-       if (lp_parm_bool(-1, "target", "samba4", False)) {
+       if (lp_parm_bool(-1, "torture", "samba4", False)) {
                printf("skipping MultipleMembers Alias tests against Samba4\n");
                return ret;
        }
@@ -1882,9 +1898,17 @@ static BOOL test_ChangePassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                ret = False;
        }
 
-       /* test what happens when picking a simple password (FIXME) */
-       if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, "simple", 0, True)) {
-               ret = False;
+       {
+               char simple_pass[9];
+               char *v = generate_random_str(mem_ctx, 1);
+
+               ZERO_STRUCT(simple_pass);
+               memset(simple_pass, *v, sizeof(simple_pass) - 1);
+
+               /* test what happens when picking a simple password */
+               if (!test_ChangePasswordUser3(p, mem_ctx, acct_name, 0, password, simple_pass, 0, True)) {
+                       ret = False;
+               }
        }
 
        /* set samr_SetDomainInfo level 1 with min_length 5 */
@@ -2963,6 +2987,16 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                                       levels[i], r.out.info->info2.comment.string, domain_comment);
                                ret = False;
                        }
+                       if (!r.out.info->info2.primary.string) {
+                               printf("QueryDomainInfo level %u returned no PDC name\n",
+                                      levels[i]);
+                               ret = False;
+                       } else if (r.out.info->info2.role == SAMR_ROLE_DOMAIN_PDC) {
+                               if (dcerpc_server_name(p) && strcasecmp_m(dcerpc_server_name(p), r.out.info->info2.primary.string) != 0) {
+                                       printf("QueryDomainInfo level %u returned different PDC name (%s) compared to server name (%s), despite claiming to be the PDC\n",
+                                              levels[i], r.out.info->info2.primary.string, dcerpc_server_name(p));
+                               }
+                       }
                        break;
                case 4:
                        if (strcmp(r.out.info->info4.comment.string, domain_comment) != 0) {
@@ -2971,6 +3005,13 @@ static BOOL test_QueryDomainInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                                ret = False;
                        }
                        break;
+               case 6:
+                       if (!r.out.info->info6.primary.string) {
+                               printf("QueryDomainInfo level %u returned no PDC name\n",
+                                      levels[i]);
+                               ret = False;
+                       }
+                       break;
                case 11:
                        if (strcmp(r.out.info->info11.info2.comment.string, domain_comment) != 0) {
                                printf("QueryDomainInfo level %u returned different comment (%s, expected %s)\n",
@@ -3290,7 +3331,7 @@ static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                return False;
        }
 
-       if (lp_parm_bool(-1, "target", "samba4", False)) {
+       if (lp_parm_bool(-1, "torture", "samba4", False)) {
                printf("skipping SetMemberAttributesOfGroup test against Samba4\n");
        } else {
                /* this one is quite strange. I am using random inputs in the
@@ -3478,7 +3519,7 @@ static BOOL test_OpenDomain(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                ret &= test_QueryDisplayInfo3(p, mem_ctx, &domain_handle);
                ret &= test_QueryDisplayInfo_continue(p, mem_ctx, &domain_handle);
                
-               if (lp_parm_bool(-1, "target", "samba4", False)) {
+               if (lp_parm_bool(-1, "torture", "samba4", False)) {
                        printf("skipping GetDisplayEnumerationIndex test against Samba4\n");
                } else {
                        ret &= test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle);