Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
1 deleted
3 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source4/torture/winbind/struct_based.c

    r414 r745  
    2121#include "includes.h"
    2222#include "torture/torture.h"
    23 #include "torture/winbind/proto.h"
    2423#include "nsswitch/winbind_client.h"
    2524#include "libcli/security/security.h"
    2625#include "librpc/gen_ndr/netlogon.h"
    2726#include "param/param.h"
    28 #include "auth/ntlm/pam_errors.h"
     27#include "../libcli/auth/pam_errors.h"
    2928
    3029#define DO_STRUCT_REQ_REP_EXT(op,req,rep,expected,strict,warnaction,cmt) do { \
     
    124123
    125124        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
    128128        torture_assert_int_equal(torture,
    129129                                 rep.data.info.winbind_separator,
     
    168168
    169169        expected = torture_setting_string(torture,
    170                                           "winbindd netbios name",
    171                                           lp_netbios_name(torture->lp_ctx));
     170                                          "winbindd_netbios_name",
     171                                          lpcfg_netbios_name(torture->lp_ctx));
    172172        expected = strupper_talloc(torture, expected);
    173        
     173
    174174        torture_assert_str_equal(torture,
    175175                                 rep.data.netbios_name, expected,
     
    201201
    202202        expected = torture_setting_string(torture,
    203                                           "winbindd netbios domain",
    204                                           lp_workgroup(torture->lp_ctx));
     203                                          "winbindd_netbios_domain",
     204                                          lpcfg_workgroup(torture->lp_ctx));
    205205
    206206        get_winbind_domain(torture, &domain);
     
    475475        bool ok;
    476476        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));
    477480        struct torture_trust_domain *listd = NULL;
    478481        uint32_t i, count = 0;
     
    486489                struct winbindd_request req;
    487490                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                }
    488498
    489499                ZERO_STRUCT(req);
     
    618628
    619629        ok = get_user_list(torture, &users);
    620         torture_assert(torture, ok, "failed to get group list");
     630        torture_assert(torture, ok, "failed to get user list");
    621631
    622632        for (count = 0; users[count]; count++) { }
     
    627637}
    628638
    629 static bool get_group_list(struct torture_context *torture, char ***groups)
     639static bool get_group_list(struct torture_context *torture,
     640                           unsigned int *num_entries,
     641                           char ***groups)
    630642{
    631643        struct winbindd_request req;
     
    640652
    641653        DO_STRUCT_REQ_REP(WINBINDD_LIST_GROUPS, &req, &rep);
    642 
    643654        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
    644665        torture_assert(torture, extra_data, "NULL extra data");
    645666
     
    655676        SAFE_FREE(rep.extra_data.data);
    656677
     678        torture_assert_int_equal(torture, *num_entries, count,
     679                                 "Wrong number of group entries reported.");
     680
    657681        *groups = g;
    658682        return true;
     
    667691        torture_comment(torture, "Running WINBINDD_LIST_GROUPS (struct based)\n");
    668692
    669         ok = get_group_list(torture, &groups);
     693        ok = get_group_list(torture, &count, &groups);
    670694        torture_assert(torture, ok, "failed to get group list");
    671 
    672         for (count = 0; groups[count]; count++) { }
    673695
    674696        torture_comment(torture, "got %d groups\n", count);
     
    761783
    762784                torture_assert(torture, s[i].netbios_name,
    763                                "more domains recieved in second run");
     785                               "more domains received in second run");
    764786                torture_assert_str_equal(torture, domlist[i].netbios_name,
    765787                                         s[i].netbios_name,
     
    829851        ZERO_STRUCT(rep);
    830852        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        }
    832861        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        }
    837870
    838871        return true;
     
    895928                char *sid;
    896929                char *name;
     930                const char *domain_name = torture_setting_string(torture,
     931                                                "winbindd_netbios_domain",
     932                                                lpcfg_workgroup(torture->lp_ctx));
    897933
    898934                ZERO_STRUCT(req);
     
    913949                DO_STRUCT_REQ_REP(WINBINDD_LOOKUPSID, &req, &rep);
    914950
    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                }
    919960
    920961                torture_assert_casestr_equal(torture, list[count], name,
     
    937978        uint32_t count;
    938979
    939         for (count = 0; list[count]; count++) {
     980        for (count = 0; list && list[count]; count++) {
    940981                if (strequal(name, list[count])) {
    941982                        return true;
     
    956997        char **users;
    957998        char **groups;
    958         uint32_t count;
     999        uint32_t count, num_groups;
    9591000        bool ok;
    9601001
     
    9651006        lookup_name_sid_list(torture, users);
    9661007
    967         ok = get_group_list(torture, &groups);
     1008        ok = get_group_list(torture, &num_groups, &groups);
    9681009        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        }
    9701013
    9711014        ZERO_STRUCT(req);
     
    10201063struct torture_suite *torture_winbind_struct_init(void)
    10211064{
    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);
    10421085
    10431086        suite->description = talloc_strdup(suite, "WINBIND - struct based protocol tests");
  • trunk/server/source4/torture/winbind/winbind.c

    r414 r745  
    2424NTSTATUS torture_winbind_init(void)
    2525{
    26         struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "WINBIND");
     26        struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "winbind");
    2727
    2828        torture_suite_add_suite(suite, torture_winbind_struct_init());
Note: See TracChangeset for help on using the changeset viewer.