r25035: Fix some more warnings, use service pointer rather than service number in...
[samba.git] / source4 / torture / rpc / samr.c
index a5b171a773d6860f5d432dfe30bece9ee277ed5c..2a70a5b71f150e7fd78c40274cf9e6a5c787c834 100644 (file)
@@ -28,6 +28,7 @@
 #include "libcli/auth/libcli_auth.h"
 #include "libcli/security/security.h"
 #include "torture/rpc/rpc.h"
+#include "param/param.h"
 
 #define TEST_ACCOUNT_NAME "samrtorturetest"
 #define TEST_ALIASNAME "samrtorturetestalias"
@@ -83,7 +84,7 @@ static BOOL test_Shutdown(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        NTSTATUS status;
        struct samr_Shutdown r;
 
-       if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
+       if (!lp_parm_bool(NULL, "torture", "dangerous", false)) {
                printf("samr_Shutdown disabled - enable dangerous tests to use\n");
                return True;
        }
@@ -109,7 +110,7 @@ static BOOL test_SetDsrmPassword(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        struct lsa_String string;
        struct samr_Password hash;
 
-       if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
+       if (!lp_parm_bool(NULL, "torture", "dangerous", false)) {
                printf("samr_SetDsrmPassword disabled - enable dangerous tests to use\n");
                return True;
        }
@@ -158,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, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping SetSecurity test against Samba4\n");
                return True;
        }
@@ -227,8 +228,8 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
 
 #define INT_EQUAL(i1, i2, field) \
                if (i1 != i2) { \
-                       printf("Failed to set %s to 0x%x - got 0x%x (%s)\n", \
-                              #field, i2, i1, __location__); \
+                       printf("Failed to set %s to 0x%llx - got 0x%llx (%s)\n", \
+                              #field, (unsigned long long)i2, (unsigned long long)i1, __location__); \
                        ret = False; \
                        break; \
                }
@@ -373,18 +374,31 @@ static BOOL test_SetUserInfo(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
        TEST_USERINFO_STRING(14, workstations, 21, workstations, "14workstation21", 0);
        TEST_USERINFO_STRING(21, workstations, 21, workstations, "21workstation21", 
                           SAMR_FIELD_WORKSTATIONS);
+       TEST_USERINFO_STRING(21, workstations, 3, workstations, "21workstation3", 
+                          SAMR_FIELD_WORKSTATIONS);
+       TEST_USERINFO_STRING(21, workstations, 5, workstations, "21workstation5", 
+                          SAMR_FIELD_WORKSTATIONS);
+       TEST_USERINFO_STRING(21, workstations, 14, workstations, "21workstation14", 
+                          SAMR_FIELD_WORKSTATIONS);
 
        TEST_USERINFO_STRING(20, parameters, 21, parameters, "xx20-21 parameters", 0);
        TEST_USERINFO_STRING(21, parameters, 21, parameters, "xx21-21 parameters", 
                           SAMR_FIELD_PARAMETERS);
+       TEST_USERINFO_STRING(21, parameters, 20, parameters, "xx21-20 parameters", 
+                          SAMR_FIELD_PARAMETERS);
 
+       TEST_USERINFO_INT(2, country_code, 2, country_code, __LINE__, 0);
        TEST_USERINFO_INT(2, country_code, 21, country_code, __LINE__, 0);
        TEST_USERINFO_INT(21, country_code, 21, country_code, __LINE__, 
                          SAMR_FIELD_COUNTRY_CODE);
+       TEST_USERINFO_INT(21, country_code, 2, country_code, __LINE__, 
+                         SAMR_FIELD_COUNTRY_CODE);
 
        TEST_USERINFO_INT(2, code_page, 21, code_page, __LINE__, 0);
        TEST_USERINFO_INT(21, code_page, 21, code_page, __LINE__, 
                          SAMR_FIELD_CODE_PAGE);
+       TEST_USERINFO_INT(21, code_page, 2, 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);
@@ -401,7 +415,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, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping Set Account Flag tests against Samba4\n");
                return ret;
        }
@@ -2107,7 +2121,7 @@ static BOOL test_alias_ops(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                ret = False;
        }
 
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping MultipleMembers Alias tests against Samba4\n");
                return ret;
        }
@@ -3166,7 +3180,7 @@ static BOOL test_EnumDomainUsers_async(struct dcerpc_pipe *p, TALLOC_CTX *mem_ct
 #define ASYNC_COUNT 100
        struct rpc_request *req[ASYNC_COUNT];
 
-       if (!lp_parm_bool(-1, "torture", "dangerous", False)) {
+       if (!lp_parm_bool(NULL, "torture", "dangerous", false)) {
                printf("samr async test disabled - enable dangerous tests to use\n");
                return True;
        }
@@ -3357,8 +3371,8 @@ static BOOL test_GetDisplayEnumerationIndex2(struct dcerpc_pipe *p, TALLOC_CTX *
        }
 #define INT_EQUAL_QUERY(s1, s2, user)          \
                if (s1 != s2) { \
-                       printf("%s mismatch for %s: 0x%x != 0x%x (%s)\n", \
-                              #s1, user.string, (unsigned int)s1, (unsigned int)s2, __location__); \
+                       printf("%s mismatch for %s: 0x%llx != 0x%llx (%s)\n", \
+                              #s1, user.string, (unsigned long long)s1, (unsigned long long)s2, __location__); \
                        ret = False; \
                }
 
@@ -4053,7 +4067,7 @@ static BOOL test_AddGroupMember(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx,
                return False;
        }
 
-       if (lp_parm_bool(-1, "torture", "samba4", False)) {
+       if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                printf("skipping SetMemberAttributesOfGroup test against Samba4\n");
        } else {
                /* this one is quite strange. I am using random inputs in the
@@ -4242,7 +4256,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, "torture", "samba4", False)) {
+               if (lp_parm_bool(NULL, "torture", "samba4", false)) {
                        printf("skipping GetDisplayEnumerationIndex test against Samba4\n");
                } else {
                        ret &= test_GetDisplayEnumerationIndex(p, mem_ctx, &domain_handle);