Changeset 745 for trunk/server/source4/torture/winbind
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 1 deleted
- 3 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source4/torture/winbind/struct_based.c
r414 r745 21 21 #include "includes.h" 22 22 #include "torture/torture.h" 23 #include "torture/winbind/proto.h"24 23 #include "nsswitch/winbind_client.h" 25 24 #include "libcli/security/security.h" 26 25 #include "librpc/gen_ndr/netlogon.h" 27 26 #include "param/param.h" 28 #include " auth/ntlm/pam_errors.h"27 #include "../libcli/auth/pam_errors.h" 29 28 30 29 #define DO_STRUCT_REQ_REP_EXT(op,req,rep,expected,strict,warnaction,cmt) do { \ … … 124 123 125 124 separator = torture_setting_string(torture, 126 "winbindd separator", 127 lp_winbind_separator(torture->lp_ctx)); 125 "winbindd_separator", 126 lpcfg_winbind_separator(torture->lp_ctx)); 127 128 128 torture_assert_int_equal(torture, 129 129 rep.data.info.winbind_separator, … … 168 168 169 169 expected = torture_setting_string(torture, 170 "winbindd netbiosname",171 lp _netbios_name(torture->lp_ctx));170 "winbindd_netbios_name", 171 lpcfg_netbios_name(torture->lp_ctx)); 172 172 expected = strupper_talloc(torture, expected); 173 173 174 174 torture_assert_str_equal(torture, 175 175 rep.data.netbios_name, expected, … … 201 201 202 202 expected = torture_setting_string(torture, 203 "winbindd netbiosdomain",204 lp _workgroup(torture->lp_ctx));203 "winbindd_netbios_domain", 204 lpcfg_workgroup(torture->lp_ctx)); 205 205 206 206 get_winbind_domain(torture, &domain); … … 475 475 bool ok; 476 476 bool strict = torture_setting_bool(torture, "strict mode", false); 477 const char *domain_name = torture_setting_string(torture, 478 "winbindd_netbios_domain", 479 lpcfg_workgroup(torture->lp_ctx)); 477 480 struct torture_trust_domain *listd = NULL; 478 481 uint32_t i, count = 0; … … 486 489 struct winbindd_request req; 487 490 struct winbindd_response rep; 491 492 /* getdcname is not expected to work on "BUILTIN" or our own 493 * domain */ 494 if (strequal(listd[i].netbios_name, "BUILTIN") || 495 strequal(listd[i].netbios_name, domain_name)) { 496 continue; 497 } 488 498 489 499 ZERO_STRUCT(req); … … 618 628 619 629 ok = get_user_list(torture, &users); 620 torture_assert(torture, ok, "failed to get grouplist");630 torture_assert(torture, ok, "failed to get user list"); 621 631 622 632 for (count = 0; users[count]; count++) { } … … 627 637 } 628 638 629 static bool get_group_list(struct torture_context *torture, char ***groups) 639 static bool get_group_list(struct torture_context *torture, 640 unsigned int *num_entries, 641 char ***groups) 630 642 { 631 643 struct winbindd_request req; … … 640 652 641 653 DO_STRUCT_REQ_REP(WINBINDD_LIST_GROUPS, &req, &rep); 642 643 654 extra_data = (char *)rep.extra_data.data; 655 656 *num_entries = rep.data.num_entries; 657 658 if (*num_entries == 0) { 659 torture_assert(torture, extra_data == NULL, 660 "extra data is null for >0 reported entries\n"); 661 *groups = NULL; 662 return true; 663 } 664 644 665 torture_assert(torture, extra_data, "NULL extra data"); 645 666 … … 655 676 SAFE_FREE(rep.extra_data.data); 656 677 678 torture_assert_int_equal(torture, *num_entries, count, 679 "Wrong number of group entries reported."); 680 657 681 *groups = g; 658 682 return true; … … 667 691 torture_comment(torture, "Running WINBINDD_LIST_GROUPS (struct based)\n"); 668 692 669 ok = get_group_list(torture, & groups);693 ok = get_group_list(torture, &count, &groups); 670 694 torture_assert(torture, ok, "failed to get group list"); 671 672 for (count = 0; groups[count]; count++) { }673 695 674 696 torture_comment(torture, "got %d groups\n", count); … … 761 783 762 784 torture_assert(torture, s[i].netbios_name, 763 "more domains rec ieved in second run");785 "more domains received in second run"); 764 786 torture_assert_str_equal(torture, domlist[i].netbios_name, 765 787 s[i].netbios_name, … … 829 851 ZERO_STRUCT(rep); 830 852 req.data.num_entries = 1; 831 DO_STRUCT_REQ_REP(WINBINDD_GETPWENT, &req, &rep); 853 if (torture_setting_bool(torture, "samba3", false)) { 854 bool __noop = false; 855 DO_STRUCT_REQ_REP_EXT(WINBINDD_GETPWENT, &req, &rep, 856 NSS_STATUS_SUCCESS, false, __noop=true, 857 NULL); 858 } else { 859 DO_STRUCT_REQ_REP(WINBINDD_GETPWENT, &req, &rep); 860 } 832 861 pwent = (struct winbindd_pw *)rep.extra_data.data; 833 torture_assert(torture, (pwent != NULL), "NULL pwent"); 834 torture_comment(torture, "name: %s, uid: %d, gid: %d, shell: %s\n", 835 pwent->pw_name, pwent->pw_uid, pwent->pw_gid, 836 pwent->pw_shell); 862 if (!torture_setting_bool(torture, "samba3", false)) { 863 torture_assert(torture, (pwent != NULL), "NULL pwent"); 864 } 865 if (pwent) { 866 torture_comment(torture, "name: %s, uid: %d, gid: %d, shell: %s\n", 867 pwent->pw_name, pwent->pw_uid, pwent->pw_gid, 868 pwent->pw_shell); 869 } 837 870 838 871 return true; … … 895 928 char *sid; 896 929 char *name; 930 const char *domain_name = torture_setting_string(torture, 931 "winbindd_netbios_domain", 932 lpcfg_workgroup(torture->lp_ctx)); 897 933 898 934 ZERO_STRUCT(req); … … 913 949 DO_STRUCT_REQ_REP(WINBINDD_LOOKUPSID, &req, &rep); 914 950 915 name = talloc_asprintf(torture, "%s%c%s", 916 rep.data.name.dom_name, 917 winbind_separator(torture), 918 rep.data.name.name); 951 if (strequal(rep.data.name.dom_name, domain_name)) { 952 name = talloc_asprintf(torture, "%s", 953 rep.data.name.name); 954 } else { 955 name = talloc_asprintf(torture, "%s%c%s", 956 rep.data.name.dom_name, 957 winbind_separator(torture), 958 rep.data.name.name); 959 } 919 960 920 961 torture_assert_casestr_equal(torture, list[count], name, … … 937 978 uint32_t count; 938 979 939 for (count = 0; list [count]; count++) {980 for (count = 0; list && list[count]; count++) { 940 981 if (strequal(name, list[count])) { 941 982 return true; … … 956 997 char **users; 957 998 char **groups; 958 uint32_t count ;999 uint32_t count, num_groups; 959 1000 bool ok; 960 1001 … … 965 1006 lookup_name_sid_list(torture, users); 966 1007 967 ok = get_group_list(torture, & groups);1008 ok = get_group_list(torture, &num_groups, &groups); 968 1009 torture_assert(torture, ok, "failed to retrieve list of groups"); 969 lookup_name_sid_list(torture, groups); 1010 if (num_groups > 0) { 1011 lookup_name_sid_list(torture, groups); 1012 } 970 1013 971 1014 ZERO_STRUCT(req); … … 1020 1063 struct torture_suite *torture_winbind_struct_init(void) 1021 1064 { 1022 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), " STRUCT");1023 1024 torture_suite_add_simple_test(suite, " INTERFACE_VERSION", torture_winbind_struct_interface_version);1025 torture_suite_add_simple_test(suite, " PING", torture_winbind_struct_ping);1026 torture_suite_add_simple_test(suite, " INFO", torture_winbind_struct_info);1027 torture_suite_add_simple_test(suite, " PRIV_PIPE_DIR", torture_winbind_struct_priv_pipe_dir);1028 torture_suite_add_simple_test(suite, " NETBIOS_NAME", torture_winbind_struct_netbios_name);1029 torture_suite_add_simple_test(suite, " DOMAIN_NAME", torture_winbind_struct_domain_name);1030 torture_suite_add_simple_test(suite, " CHECK_MACHACC", torture_winbind_struct_check_machacc);1031 torture_suite_add_simple_test(suite, " LIST_TRUSTDOM", torture_winbind_struct_list_trustdom);1032 torture_suite_add_simple_test(suite, " DOMAIN_INFO", torture_winbind_struct_domain_info);1033 torture_suite_add_simple_test(suite, " GETDCNAME", torture_winbind_struct_getdcname);1034 torture_suite_add_simple_test(suite, " DSGETDCNAME", torture_winbind_struct_dsgetdcname);1035 torture_suite_add_simple_test(suite, " LIST_USERS", torture_winbind_struct_list_users);1036 torture_suite_add_simple_test(suite, " LIST_GROUPS", torture_winbind_struct_list_groups);1037 torture_suite_add_simple_test(suite, " SHOW_SEQUENCE", torture_winbind_struct_show_sequence);1038 torture_suite_add_simple_test(suite, " SETPWENT", torture_winbind_struct_setpwent);1039 torture_suite_add_simple_test(suite, " GETPWENT", torture_winbind_struct_getpwent);1040 torture_suite_add_simple_test(suite, " ENDPWENT", torture_winbind_struct_endpwent);1041 torture_suite_add_simple_test(suite, " LOOKUP_NAME_SID", torture_winbind_struct_lookup_name_sid);1065 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "struct"); 1066 1067 torture_suite_add_simple_test(suite, "interface_version", torture_winbind_struct_interface_version); 1068 torture_suite_add_simple_test(suite, "ping", torture_winbind_struct_ping); 1069 torture_suite_add_simple_test(suite, "info", torture_winbind_struct_info); 1070 torture_suite_add_simple_test(suite, "priv_pipe_dir", torture_winbind_struct_priv_pipe_dir); 1071 torture_suite_add_simple_test(suite, "netbios_name", torture_winbind_struct_netbios_name); 1072 torture_suite_add_simple_test(suite, "domain_name", torture_winbind_struct_domain_name); 1073 torture_suite_add_simple_test(suite, "check_machacc", torture_winbind_struct_check_machacc); 1074 torture_suite_add_simple_test(suite, "list_trustdom", torture_winbind_struct_list_trustdom); 1075 torture_suite_add_simple_test(suite, "domain_info", torture_winbind_struct_domain_info); 1076 torture_suite_add_simple_test(suite, "getdcname", torture_winbind_struct_getdcname); 1077 torture_suite_add_simple_test(suite, "dsgetdcname", torture_winbind_struct_dsgetdcname); 1078 torture_suite_add_simple_test(suite, "list_users", torture_winbind_struct_list_users); 1079 torture_suite_add_simple_test(suite, "list_groups", torture_winbind_struct_list_groups); 1080 torture_suite_add_simple_test(suite, "show_sequence", torture_winbind_struct_show_sequence); 1081 torture_suite_add_simple_test(suite, "setpwent", torture_winbind_struct_setpwent); 1082 torture_suite_add_simple_test(suite, "getpwent", torture_winbind_struct_getpwent); 1083 torture_suite_add_simple_test(suite, "endpwent", torture_winbind_struct_endpwent); 1084 torture_suite_add_simple_test(suite, "lookup_name_sid", torture_winbind_struct_lookup_name_sid); 1042 1085 1043 1086 suite->description = talloc_strdup(suite, "WINBIND - struct based protocol tests"); -
trunk/server/source4/torture/winbind/winbind.c
r414 r745 24 24 NTSTATUS torture_winbind_init(void) 25 25 { 26 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), " WINBIND");26 struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "winbind"); 27 27 28 28 torture_suite_add_suite(suite, torture_winbind_struct_init());
Note:
See TracChangeset
for help on using the changeset viewer.