Changeset 746 for vendor/current/source4


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

Samba Server: updated vendor to 3.6.9

Location:
vendor/current/source4
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/auth/credentials/credentials_ntlm.c

    r740 r746  
    111111                *flags &= ~CLI_CRED_LANMAN_AUTH;
    112112        } else if (*flags & CLI_CRED_NTLM2) {
    113                 struct MD5Context md5_session_nonce_ctx;
     113                MD5_CTX md5_session_nonce_ctx;
    114114                uint8_t session_nonce[16];
    115115                uint8_t session_nonce_hash[16];
  • vendor/current/source4/dsdb/samdb/ldb_modules/password_hash.c

    r740 r746  
    13521352
    13531353        for (i=0; i < ARRAY_SIZE(wdigest); i++) {
    1354                 struct MD5Context md5;
     1354                MD5_CTX md5;
    13551355                MD5Init(&md5);
    13561356                if (wdigest[i].nt4dom) {
  • vendor/current/source4/lib/ldb/common/ldb_parse.c

    r740 r746  
    112112}
    113113
     114static bool need_encode(unsigned char cval)
     115{
     116        if (cval < 0x20 || cval > 0x7E || strchr(" *()\\&|!\"", cval)) {
     117                return true;
     118        }
     119        return false;
     120}
    114121
    115122/*
     
    125132
    126133        for (i=0;i<val.length;i++) {
    127                 if (!isprint(buf[i]) || strchr(" *()\\&|!\"", buf[i])) {
     134                if (need_encode(buf[i])) {
    128135                        len += 2;
    129136                }
     
    134141        len = 0;
    135142        for (i=0;i<val.length;i++) {
    136                 if (!isprint(buf[i]) || strchr(" *()\\&|!\"", buf[i])) {
     143                if (need_encode(buf[i])) {
    137144                        snprintf(ret+len, 4, "\\%02X", buf[i]);
    138145                        len += 3;
  • vendor/current/source4/libcli/raw/smb_signing.c

    r740 r746  
    104104{
    105105        uint8_t calc_md5_mac[16];
    106         struct MD5Context md5_ctx;
     106        MD5_CTX md5_ctx;
    107107
    108108        /*
     
    139139        uint8_t *server_sent_mac;
    140140        uint8_t sequence_buf[8];
    141         struct MD5Context md5_ctx;
     141        MD5_CTX md5_ctx;
    142142        const size_t offset_end_of_sig = (HDR_SS_FIELD + 8);
    143143        int i;
  • vendor/current/source4/libnet/libnet_passwd.c

    r740 r746  
    275275        DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
    276276        uint8_t confounder[16];
    277         struct MD5Context md5;
     277        MD5_CTX md5;
    278278
    279279        if (r->samr_handle.in.info21) {
     
    331331        DATA_BLOB confounded_session_key = data_blob_talloc(mem_ctx, NULL, 16);
    332332        uint8_t confounder[16];
    333         struct MD5Context md5;
     333        MD5_CTX md5;
    334334
    335335        if (!r->samr_handle.in.info21) {
  • vendor/current/source4/ntp_signd/ntp_signd.c

    r740 r746  
    108108        struct ldb_result *res;
    109109        const char *attrs[] = { "unicodePwd", "userAccountControl", "cn", NULL };
    110         struct MD5Context ctx;
     110        MD5_CTX ctx;
    111111        struct samr_Password *nt_hash;
    112112        uint32_t user_account_control;
  • vendor/current/source4/rpc_server/samr/samr_password.c

    r740 r746  
    545545        DATA_BLOB co_session_key;
    546546        DATA_BLOB session_key = data_blob(NULL, 0);
    547         struct MD5Context ctx;
     547        MD5_CTX ctx;
    548548
    549549        nt_status = dcesrv_fetch_session_key(dce_call->conn, &session_key);
  • vendor/current/source4/torture/ndr/ndr.c

    r740 r746  
    351351        torture_suite_add_suite(suite, ndr_drsuapi_suite(suite));
    352352        torture_suite_add_suite(suite, ndr_spoolss_suite(suite));
     353        torture_suite_add_suite(suite, ndr_ntprinting_suite(suite));
    353354        torture_suite_add_suite(suite, ndr_samr_suite(suite));
    354355        torture_suite_add_suite(suite, ndr_drsblobs_suite(suite));
  • vendor/current/source4/torture/ndr/ndr.h

    r740 r746  
    4444                _torture_suite_add_ndr_pull_test(suite, #name, \
    4545                         (ndr_pull_flags_fn_t)ndr_pull_ ## name, data_blob_talloc(suite, data, sizeof(data)), \
    46                          sizeof(struct name), 0, (bool (*) (struct torture_context *, void *)) check_fn);
     46                         sizeof(struct name), NDR_SCALARS|NDR_BUFFERS, (bool (*) (struct torture_context *, void *)) check_fn);
    4747
    4848#define torture_suite_add_ndr_pull_fn_test(suite,name,data,flags,check_fn) \
  • vendor/current/source4/torture/ndr/samr.c

    r740 r746  
    278278};
    279279
     280static const uint8_t samr_changepassworduser3_w2k8r2_out_data[] = {
     281        0x00, 0x00, 0x02, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
     282        0x00, 0x80, 0xa6, 0x0a, 0xff, 0xde, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
     283        0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00,
     284        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0xc0
     285};
     286
     287static bool samr_changepassworduser3_w2k8r2_out_check(struct torture_context *tctx,
     288                                                      struct samr_ChangePasswordUser3 *r)
     289{
     290        struct samr_DomInfo1 *dominfo = *r->out.dominfo;
     291        struct userPwdChangeFailureInformation *reject = *r->out.reject;
     292
     293        torture_assert_int_equal(tctx, dominfo->min_password_length, 7, "min_password_length");
     294        torture_assert_int_equal(tctx, dominfo->password_history_length, 0, "password_history_length");
     295        torture_assert_int_equal(tctx, dominfo->password_properties, DOMAIN_PASSWORD_COMPLEX, "password_properties");
     296        torture_assert_u64_equal(tctx, dominfo->max_password_age, 0xffffdeff0aa68000, "max_password_age");
     297        torture_assert_u64_equal(tctx, dominfo->min_password_age, 0x0000000000000000, "min_password_age");
     298
     299        torture_assert_int_equal(tctx, reject->extendedFailureReason, SAM_PWD_CHANGE_NOT_COMPLEX, "extendedFailureReason");
     300        torture_assert_int_equal(tctx, reject->filterModuleName.length, 0, "filterModuleName.length");
     301        torture_assert_int_equal(tctx, reject->filterModuleName.size, 0, "filterModuleName.size");
     302
     303        torture_assert_ntstatus_equal(tctx, r->out.result, NT_STATUS_PASSWORD_RESTRICTION, "result");
     304
     305        return true;
     306}
     307
    280308struct torture_suite *ndr_samr_suite(TALLOC_CTX *ctx)
    281309{
     
    314342        torture_suite_add_ndr_pull_fn_test(suite, samr_ChangePasswordUser3, samr_changepassworduser3_w2k_out_data, NDR_OUT, NULL);
    315343#endif
     344        torture_suite_add_ndr_pull_fn_test(suite,
     345                                           samr_ChangePasswordUser3,
     346                                           samr_changepassworduser3_w2k8r2_out_data,
     347                                           NDR_OUT,
     348                                           samr_changepassworduser3_w2k8r2_out_check);
     349
    316350        return suite;
    317351}
  • vendor/current/source4/torture/ntp/ntp_signd.c

    r740 r746  
    7979        int sys_errno;
    8080
    81         struct MD5Context ctx;
     81        MD5_CTX ctx;
    8282        uint8_t sig[16];
    8383        enum ndr_err_code ndr_err;
  • vendor/current/source4/torture/rpc/samba3rpc.c

    r740 r746  
    775775                DATA_BLOB confounded_session_key = data_blob_talloc(
    776776                        mem_ctx, NULL, 16);
    777                 struct MD5Context ctx;
     777                MD5_CTX ctx;
    778778                uint8_t confounder[16];
    779779
  • vendor/current/source4/torture/rpc/samlogon.c

    r740 r746  
    10761076        uint8_t client_chall[8];
    10771077
    1078         struct MD5Context md5_session_nonce_ctx;
     1078        MD5_CTX md5_session_nonce_ctx;
    10791079        HMACMD5Context hmac_ctx;
    10801080
  • vendor/current/source4/torture/rpc/samr.c

    r740 r746  
    772772        char *newpass;
    773773        struct dcerpc_binding_handle *b = p->binding_handle;
    774         struct MD5Context ctx;
     774        MD5_CTX ctx;
    775775        struct samr_GetUserPwInfo pwp;
    776776        struct samr_PwInfo info;
     
    857857        DATA_BLOB session_key;
    858858        DATA_BLOB confounded_session_key = data_blob_talloc(tctx, NULL, 16);
    859         struct MD5Context ctx;
     859        MD5_CTX ctx;
    860860        uint8_t confounder[16];
    861861        char *newpass;
     
    11411141        DATA_BLOB session_key;
    11421142        DATA_BLOB confounded_session_key = data_blob_talloc(tctx, NULL, 16);
    1143         struct MD5Context ctx;
     1143        MD5_CTX ctx;
    11441144        uint8_t confounder[16];
    11451145        char *newpass;
     
    24592459        DATA_BLOB confounded_session_key = data_blob_talloc(tctx, NULL, 16);
    24602460        uint8_t confounder[16];
    2461         struct MD5Context ctx;
     2461        MD5_CTX ctx;
    24622462
    24632463        bool ret = true;
  • vendor/current/source4/torture/rpc/spoolss.c

    r740 r746  
    3636#include "libcli/raw/raw_proto.h"
    3737#include "libcli/resolve/resolve.h"
     38#include "libcli/smb2/smb2.h"
     39#include "libcli/smb2/smb2_calls.h"
    3840#include "lib/cmdline/popt_common.h"
    3941#include "system/filesys.h"
    4042#include "torture/ndr/ndr.h"
     43#include "torture/smb2/proto.h"
    4144
    4245#define TORTURE_WELLKNOWN_PRINTER       "torture_wkn_printer"
     
    5053#define TORTURE_DRIVER_ADOBE_CUPSADDSMB "torture_driver_adobe_cupsaddsmb"
    5154#define TORTURE_DRIVER_TIMESTAMPS       "torture_driver_timestamps"
     55#define TORTURE_DRIVER_DELETER          "torture_driver_deleter"
     56#define TORTURE_DRIVER_DELETERIN        "torture_driver_deleterin"
     57#define TORTURE_PRINTER_STATIC1         "print1"
    5258
    5359#define TOP_LEVEL_PRINT_KEY "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print"
     
    54985504        TEST_SET_SZ("description", comment, "newval");
    54995505        TEST_SET_SZ("location", location, "newval");
     5506        TEST_SET_SZ("driverName", drivername, "newval");
    55005507/*      TEST_SET_DWORD("priority", priority, 25); */
    55015508
     
    77247731}
    77257732
    7726 static bool test_printer_sd(struct torture_context *tctx,
    7727                             void *private_data)
     7733/* use smbd file IO to spool a print job */
     7734static bool test_print_test_smbd(struct torture_context *tctx,
     7735                                 void *private_data)
    77287736{
    77297737        struct torture_printer_context *t =
     
    77317739        struct dcerpc_pipe *p = t->spoolss_pipe;
    77327740        struct dcerpc_binding_handle *b = p->binding_handle;
    7733 
    7734         torture_assert(tctx,
    7735                 test_PrinterInfo_SD(tctx, b, &t->handle),
    7736                 "failed to test security descriptors");
    7737 
    7738         return true;
    7739 }
    7740 
    7741 static bool test_printer_dm(struct torture_context *tctx,
     7741        NTSTATUS status;
     7742        uint32_t count;
     7743        union spoolss_JobInfo *info = NULL;
     7744        int i;
     7745
     7746        struct smb2_tree *tree;
     7747        struct smb2_handle job_h;
     7748        struct cli_credentials *credentials = cmdline_credentials;
     7749        struct smbcli_options options;
     7750        TALLOC_CTX *mem_ctx = talloc_new(tctx);
     7751        /*
     7752         * Do not test against the dynamically added printers, printing via
     7753         * smbd means that a different spoolss process may handle the
     7754         * OpenPrinter request to the one that handled the AddPrinter request.
     7755         * This currently leads to an ugly race condition where one process
     7756         * sees the new printer and one doesn't.
     7757         */
     7758        const char *share = TORTURE_PRINTER_STATIC1;
     7759
     7760        torture_comment(tctx, "Testing smbd job spooling\n");
     7761        lpcfg_smbcli_options(tctx->lp_ctx, &options);
     7762
     7763        status = smb2_connect(tctx,
     7764                              torture_setting_string(tctx, "host", NULL),
     7765                              lpcfg_smb_ports(tctx->lp_ctx),
     7766                              share,
     7767                              lpcfg_resolve_context(tctx->lp_ctx),
     7768                              credentials,
     7769                              &tree,
     7770                              tctx->ev,
     7771                              &options,
     7772                              lpcfg_socket_options(tctx->lp_ctx),
     7773                              lpcfg_gensec_settings(tctx, tctx->lp_ctx));
     7774        if (!NT_STATUS_IS_OK(status)) {
     7775                printf("Failed to connect to SMB2 printer %s - %s\n",
     7776                       share, nt_errstr(status));
     7777                return false;
     7778        }
     7779
     7780        status = torture_smb2_testfile(tree, "smbd_spooler_job", &job_h);
     7781        torture_assert_ntstatus_ok(tctx, status, "smbd spool job create");
     7782
     7783        status = smb2_util_write(tree, job_h, "exciting print job data", 0,
     7784                                 sizeof("exciting print job data"));
     7785        torture_assert_ntstatus_ok(tctx, status, "smbd spool job write");
     7786
     7787        /* check back end spoolss job was created */
     7788        torture_assert(tctx,
     7789                test_EnumJobs_args(tctx, b, &t->handle, 1, &count, &info),
     7790                "EnumJobs level 1 failed");
     7791
     7792        for (i = 0; i < count; i++) {
     7793                if (!strcmp(info[i].info1.document_name, "smbd_spooler_job")) {
     7794                        break;
     7795                }
     7796        }
     7797        torture_assert(tctx, (i != count), "smbd_spooler_job not found");
     7798
     7799        status = smb2_util_close(tree, job_h);
     7800        torture_assert_ntstatus_ok(tctx, status, "smbd spool job close");
     7801
     7802        /* disconnect from printer share */
     7803        talloc_free(mem_ctx);
     7804
     7805        return true;
     7806}
     7807
     7808static bool test_printer_sd(struct torture_context *tctx,
    77427809                            void *private_data)
    7743 {
    7744         struct torture_printer_context *t =
    7745                 (struct torture_printer_context *)talloc_get_type_abort(private_data, struct torture_printer_context);
    7746         struct dcerpc_pipe *p = t->spoolss_pipe;
    7747 
    7748         torture_assert(tctx,
    7749                 test_PrinterInfo_DevMode(tctx, p, &t->handle, t->info2.printername, t->devmode),
    7750                 "failed to test devicemodes");
    7751 
    7752         return true;
    7753 }
    7754 
    7755 static bool test_printer_info_winreg(struct torture_context *tctx,
    7756                                      void *private_data)
    7757 {
    7758         struct torture_printer_context *t =
    7759                 (struct torture_printer_context *)talloc_get_type_abort(private_data, struct torture_printer_context);
    7760         struct dcerpc_pipe *p = t->spoolss_pipe;
    7761 
    7762         torture_assert(tctx,
    7763                 test_PrinterInfo_winreg(tctx, p, &t->handle, t->info2.printername),
    7764                 "failed to test printer info winreg");
    7765 
    7766         return true;
    7767 }
    7768 
    7769 static bool test_printer_change_id(struct torture_context *tctx,
    7770                                    void *private_data)
    7771 {
    7772         struct torture_printer_context *t =
    7773                 (struct torture_printer_context *)talloc_get_type_abort(private_data, struct torture_printer_context);
    7774         struct dcerpc_pipe *p = t->spoolss_pipe;
    7775 
    7776         torture_assert(tctx,
    7777                 test_ChangeID(tctx, p, &t->handle),
    7778                 "failed to test change id");
    7779 
    7780         return true;
    7781 }
    7782 
    7783 static bool test_printer_keys(struct torture_context *tctx,
    7784                               void *private_data)
    77857810{
    77867811        struct torture_printer_context *t =
     
    77907815
    77917816        torture_assert(tctx,
     7817                test_PrinterInfo_SD(tctx, b, &t->handle),
     7818                "failed to test security descriptors");
     7819
     7820        return true;
     7821}
     7822
     7823static bool test_printer_dm(struct torture_context *tctx,
     7824                            void *private_data)
     7825{
     7826        struct torture_printer_context *t =
     7827                (struct torture_printer_context *)talloc_get_type_abort(private_data, struct torture_printer_context);
     7828        struct dcerpc_pipe *p = t->spoolss_pipe;
     7829
     7830        torture_assert(tctx,
     7831                test_PrinterInfo_DevMode(tctx, p, &t->handle, t->info2.printername, t->devmode),
     7832                "failed to test devicemodes");
     7833
     7834        return true;
     7835}
     7836
     7837static bool test_printer_info_winreg(struct torture_context *tctx,
     7838                                     void *private_data)
     7839{
     7840        struct torture_printer_context *t =
     7841                (struct torture_printer_context *)talloc_get_type_abort(private_data, struct torture_printer_context);
     7842        struct dcerpc_pipe *p = t->spoolss_pipe;
     7843
     7844        torture_assert(tctx,
     7845                test_PrinterInfo_winreg(tctx, p, &t->handle, t->info2.printername),
     7846                "failed to test printer info winreg");
     7847
     7848        return true;
     7849}
     7850
     7851static bool test_printer_change_id(struct torture_context *tctx,
     7852                                   void *private_data)
     7853{
     7854        struct torture_printer_context *t =
     7855                (struct torture_printer_context *)talloc_get_type_abort(private_data, struct torture_printer_context);
     7856        struct dcerpc_pipe *p = t->spoolss_pipe;
     7857
     7858        torture_assert(tctx,
     7859                test_ChangeID(tctx, p, &t->handle),
     7860                "failed to test change id");
     7861
     7862        return true;
     7863}
     7864
     7865static bool test_printer_keys(struct torture_context *tctx,
     7866                              void *private_data)
     7867{
     7868        struct torture_printer_context *t =
     7869                (struct torture_printer_context *)talloc_get_type_abort(private_data, struct torture_printer_context);
     7870        struct dcerpc_pipe *p = t->spoolss_pipe;
     7871        struct dcerpc_binding_handle *b = p->binding_handle;
     7872
     7873        torture_assert(tctx,
    77927874                test_printer_all_keys(tctx, b, &t->handle),
    77937875                "failed to test printer keys");
     
    79057987        torture_tcase_add_simple_test(tcase, "print_test", test_print_test);
    79067988        torture_tcase_add_simple_test(tcase, "print_test_extended", test_print_test_extended);
     7989        torture_tcase_add_simple_test(tcase, "print_test_smbd", test_print_test_smbd);
    79077990        torture_tcase_add_simple_test(tcase, "printer_info", test_printer_info);
    79087991        torture_tcase_add_simple_test(tcase, "sd", test_printer_sd);
     
    89239006}
    89249007
     9008static bool check_printer_driver_file(struct torture_context *tctx,
     9009                                      struct smbcli_state *cli,
     9010                                      struct torture_driver_context *d,
     9011                                      const char *file_name)
     9012{
     9013        const char *remote_arch_dir = driver_directory_dir(d->remote.driver_directory);
     9014        const char *remote_name = talloc_asprintf(tctx, "%s\\%d\\%s",
     9015                                                  remote_arch_dir,
     9016                                                  d->info8.version,
     9017                                                  file_name);
     9018        int fnum;
     9019
     9020        torture_assert(tctx, (file_name && strlen(file_name) != 0), "invalid filename");
     9021
     9022        torture_comment(tctx, "checking for driver file at %s\n", remote_name);
     9023
     9024        fnum = smbcli_open(cli->tree, remote_name, O_RDONLY, DENY_NONE);
     9025        if (fnum == -1) {
     9026                return false;
     9027        }
     9028
     9029        torture_assert_ntstatus_ok(tctx,
     9030                smbcli_close(cli->tree, fnum),
     9031                "failed to close driver file");
     9032
     9033        return true;
     9034}
     9035
     9036static bool check_printer_driver_files(struct torture_context *tctx,
     9037                                       const char *server_name,
     9038                                       struct torture_driver_context *d,
     9039                                       bool expect_exist)
     9040{
     9041        struct smbcli_state *cli;
     9042        const char *share_name = driver_directory_share(tctx, d->remote.driver_directory);
     9043        int i;
     9044
     9045        torture_assert(tctx,
     9046                connect_printer_driver_share(tctx, server_name, share_name, &cli),
     9047                "failed to connect to driver share");
     9048
     9049        torture_comment(tctx, "checking %sexistent driver files at \\\\%s\\%s\n",
     9050                        (expect_exist ? "": "non-"),
     9051                        server_name, share_name);
     9052
     9053        if (d->info8.driver_path && d->info8.driver_path[0]) {
     9054                torture_assert(tctx,
     9055                        check_printer_driver_file(tctx, cli, d, d->info8.driver_path) == expect_exist,
     9056                        "failed driver_path check");
     9057        }
     9058        if (d->info8.data_file && d->info8.data_file[0]) {
     9059                torture_assert(tctx,
     9060                        check_printer_driver_file(tctx, cli, d, d->info8.data_file) == expect_exist,
     9061                        "failed data_file check");
     9062        }
     9063        if (d->info8.config_file && d->info8.config_file[0]) {
     9064                torture_assert(tctx,
     9065                        check_printer_driver_file(tctx, cli, d, d->info8.config_file) == expect_exist,
     9066                        "failed config_file check");
     9067        }
     9068        if (d->info8.help_file && d->info8.help_file[0]) {
     9069                torture_assert(tctx,
     9070                        check_printer_driver_file(tctx, cli, d, d->info8.help_file) == expect_exist,
     9071                        "failed help_file check");
     9072        }
     9073        if (d->info8.dependent_files) {
     9074                for (i=0; d->info8.dependent_files->string && d->info8.dependent_files->string[i] != NULL; i++) {
     9075                        torture_assert(tctx,
     9076                                check_printer_driver_file(tctx, cli, d, d->info8.dependent_files->string[i]) == expect_exist,
     9077                                "failed dependent_files check");
     9078                }
     9079        }
     9080
     9081        talloc_free(cli);
     9082
     9083        return true;
     9084}
     9085
    89259086static bool remove_printer_driver_file(struct torture_context *tctx,
    89269087                                       struct smbcli_state *cli,
     
    92079368        struct torture_driver_context *d;
    92089369
     9370        if (!torture_setting_bool(tctx, "samba3", false)) {
     9371                torture_skip(tctx, "skipping adobe test which only works against samba3");
     9372        }
     9373
    92099374        d = talloc_zero(tctx, struct torture_driver_context);
    92109375
     
    93729537}
    93739538
     9539static bool test_del_driver_all_files(struct torture_context *tctx,
     9540                                      struct dcerpc_pipe *p)
     9541{
     9542        struct torture_driver_context *d;
     9543        struct spoolss_StringArray *a;
     9544        uint32_t add_flags = APD_COPY_NEW_FILES;
     9545        uint32_t delete_flags = DPD_DELETE_ALL_FILES;
     9546        struct dcerpc_binding_handle *b = p->binding_handle;
     9547        const char *server_name_slash = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
     9548
     9549        d = talloc_zero(tctx, struct torture_driver_context);
     9550
     9551        d->ex                           = true;
     9552        d->info8.version                = SPOOLSS_DRIVER_VERSION_200X;
     9553        d->info8.driver_name            = TORTURE_DRIVER_DELETER;
     9554        d->info8.architecture           = NULL;
     9555        d->info8.driver_path            = talloc_strdup(d, "pscript5.dll");
     9556        d->info8.data_file              = talloc_strdup(d, "cups6.ppd");
     9557        d->info8.config_file            = talloc_strdup(d, "cupsui6.dll");
     9558        d->info8.help_file              = talloc_strdup(d, "pscript.hlp");
     9559        d->local.environment            = talloc_strdup(d, SPOOLSS_ARCHITECTURE_x64);
     9560        d->local.driver_directory       = talloc_strdup(d, "/usr/share/cups/drivers/x64");
     9561
     9562        a                               = talloc_zero(d, struct spoolss_StringArray);
     9563        a->string                       = talloc_zero_array(a, const char *, 3);
     9564        a->string[0]                    = talloc_strdup(a->string, "cups6.inf");
     9565        a->string[1]                    = talloc_strdup(a->string, "cups6.ini");
     9566
     9567        d->info8.dependent_files        = a;
     9568        d->info8.architecture           = d->local.environment;
     9569
     9570        torture_assert(tctx,
     9571                fillup_printserver_info(tctx, p, d),
     9572                "failed to fillup printserver info");
     9573
     9574        if (!directory_exist(d->local.driver_directory)) {
     9575                torture_skip(tctx, "Skipping Printer Driver test as no local driver is available");
     9576        }
     9577
     9578        torture_assert(tctx,
     9579                upload_printer_driver(tctx, dcerpc_server_name(p), d),
     9580                "failed to upload printer driver");
     9581
     9582        torture_assert(tctx,
     9583                test_AddPrinterDriver_args_level_3(tctx, b, server_name_slash, &d->info8, add_flags, true, NULL),
     9584                "failed to add driver");
     9585
     9586        torture_assert(tctx,
     9587                test_DeletePrinterDriverEx(tctx, b, server_name_slash,
     9588                                           d->info8.driver_name,
     9589                                           d->local.environment,
     9590                                           delete_flags,
     9591                                           d->info8.version),
     9592                "failed to delete driver");
     9593
     9594        torture_assert(tctx,
     9595                check_printer_driver_files(tctx, dcerpc_server_name(p), d, false),
     9596                "printer driver file check failed");
     9597
     9598        talloc_free(d);
     9599        return true;
     9600}
     9601
     9602static bool test_del_driver_unused_files(struct torture_context *tctx,
     9603                                         struct dcerpc_pipe *p)
     9604{
     9605        struct torture_driver_context *d1;
     9606        struct torture_driver_context *d2;
     9607        uint32_t add_flags = APD_COPY_NEW_FILES;
     9608        struct dcerpc_binding_handle *b = p->binding_handle;
     9609        const char *server_name_slash = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
     9610
     9611        d1 = talloc_zero(tctx, struct torture_driver_context);
     9612        d1->ex                          = true;
     9613        d1->info8.version               = SPOOLSS_DRIVER_VERSION_200X;
     9614        d1->info8.driver_name           = TORTURE_DRIVER_DELETER;
     9615        d1->info8.architecture          = NULL;
     9616        d1->info8.driver_path           = talloc_strdup(d1, "pscript5.dll");
     9617        d1->info8.data_file             = talloc_strdup(d1, "cups6.ppd");
     9618        d1->info8.config_file           = talloc_strdup(d1, "cupsui6.dll");
     9619        d1->info8.help_file             = talloc_strdup(d1, "pscript.hlp");
     9620        d1->local.environment           = talloc_strdup(d1, SPOOLSS_ARCHITECTURE_x64);
     9621        d1->local.driver_directory      = talloc_strdup(d1, "/usr/share/cups/drivers/x64");
     9622        d1->info8.architecture          = d1->local.environment;
     9623
     9624        d2 = talloc_zero(tctx, struct torture_driver_context);
     9625        d2->ex                          = true;
     9626        d2->info8.version               = SPOOLSS_DRIVER_VERSION_200X;
     9627        d2->info8.driver_name           = TORTURE_DRIVER_DELETERIN;
     9628        d2->info8.architecture          = NULL;
     9629        d2->info8.driver_path           = talloc_strdup(d2, "pscript5.dll");    /* overlapping */
     9630        d2->info8.data_file             = talloc_strdup(d2, "cupsps6.dll");
     9631        d2->info8.config_file           = talloc_strdup(d2, "cups6.ini");
     9632        d2->info8.help_file             = talloc_strdup(d2, "pscript.hlp");     /* overlapping */
     9633        d2->local.environment           = talloc_strdup(d2, SPOOLSS_ARCHITECTURE_x64);
     9634        d2->local.driver_directory      = talloc_strdup(d2, "/usr/share/cups/drivers/x64");
     9635        d2->info8.architecture          = d2->local.environment;
     9636
     9637        torture_assert(tctx,
     9638                fillup_printserver_info(tctx, p, d1),
     9639                "failed to fillup printserver info");
     9640        torture_assert(tctx,
     9641                fillup_printserver_info(tctx, p, d2),
     9642                "failed to fillup printserver info");
     9643
     9644        if (!directory_exist(d1->local.driver_directory)) {
     9645                torture_skip(tctx, "Skipping Printer Driver test as no local driver is available");
     9646        }
     9647
     9648        torture_assert(tctx,
     9649                upload_printer_driver(tctx, dcerpc_server_name(p), d1),
     9650                "failed to upload printer driver");
     9651        torture_assert(tctx,
     9652                test_AddPrinterDriver_args_level_3(tctx, b, server_name_slash, &d1->info8, add_flags, true, NULL),
     9653                "failed to add driver");
     9654
     9655        torture_assert(tctx,
     9656                upload_printer_driver(tctx, dcerpc_server_name(p), d2),
     9657                "failed to upload printer driver");
     9658        torture_assert(tctx,
     9659                test_AddPrinterDriver_args_level_3(tctx, b, server_name_slash, &d2->info8, add_flags, true, NULL),
     9660                "failed to add driver");
     9661
     9662        /* some files are in use by a separate driver, should fail */
     9663        torture_assert(tctx,
     9664                test_DeletePrinterDriverEx_exp(tctx, b, server_name_slash,
     9665                                               d1->info8.driver_name,
     9666                                               d1->local.environment,
     9667                                               DPD_DELETE_ALL_FILES,
     9668                                               d1->info8.version,
     9669                                               WERR_PRINTER_DRIVER_IN_USE),
     9670                "invalid delete driver response");
     9671
     9672        /* should only delete files not in use by other driver */
     9673        torture_assert(tctx,
     9674                test_DeletePrinterDriverEx_exp(tctx, b, server_name_slash,
     9675                                               d1->info8.driver_name,
     9676                                               d1->local.environment,
     9677                                               DPD_DELETE_UNUSED_FILES,
     9678                                               d1->info8.version,
     9679                                               WERR_OK),
     9680                "failed to delete driver (unused files)");
     9681
     9682        /* check non-overlapping were deleted */
     9683        d1->info8.driver_path = NULL;
     9684        d1->info8.help_file = NULL;
     9685        torture_assert(tctx,
     9686                check_printer_driver_files(tctx, dcerpc_server_name(p), d1, false),
     9687                "printer driver file check failed");
     9688        /* d2 files should be uneffected */
     9689        torture_assert(tctx,
     9690                check_printer_driver_files(tctx, dcerpc_server_name(p), d2, true),
     9691                "printer driver file check failed");
     9692
     9693        torture_assert(tctx,
     9694                test_DeletePrinterDriverEx_exp(tctx, b, server_name_slash,
     9695                                               d2->info8.driver_name,
     9696                                               d2->local.environment,
     9697                                               DPD_DELETE_ALL_FILES,
     9698                                               d2->info8.version,
     9699                                               WERR_OK),
     9700                "failed to delete driver");
     9701
     9702        torture_assert(tctx,
     9703                check_printer_driver_files(tctx, dcerpc_server_name(p), d2, false),
     9704                "printer driver file check failed");
     9705
     9706        talloc_free(d1);
     9707        talloc_free(d2);
     9708        return true;
     9709}
     9710
    93749711struct torture_suite *torture_rpc_spoolss_driver(TALLOC_CTX *mem_ctx)
    93759712{
     
    93929729        torture_rpc_tcase_add_test(tcase, "multiple_drivers", test_multiple_drivers);
    93939730
     9731        torture_rpc_tcase_add_test(tcase, "del_driver_all_files", test_del_driver_all_files);
     9732
     9733        torture_rpc_tcase_add_test(tcase, "del_driver_unused_files", test_del_driver_unused_files);
     9734
    93949735        return suite;
    93959736}
  • vendor/current/source4/torture/smb2/compound.c

    r740 r746  
    3333                goto done; \
    3434        }} while (0)
    35 
    36 #define TARGET_IS_W2K8(_tctx) (torture_setting_bool(_tctx, "w2k8", false))
    37 #define TARGET_IS_WIN7(_tctx) (torture_setting_bool(_tctx, "win7", false))
    3835
    3936static bool test_compound_related1(struct torture_context *tctx,
     
    167164        CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
    168165        status = smb2_close_recv(req[3], &cl);
    169         CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
     166        CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
    170167        status = smb2_close_recv(req[4], &cl);
    171         CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
     168        CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
    172169
    173170        tree->tid = saved_tid;
     
    253250        struct smb2_close cl;
    254251        bool ret = true;
    255         struct smb2_request *req[2];
    256 
    257         smb2_transport_credits_ask_num(tree->session->transport, 2);
     252        struct smb2_request *req[3];
     253
     254        smb2_transport_credits_ask_num(tree->session->transport, 3);
    258255
    259256        smb2_util_unlink(tree, fname);
     
    279276        cr.in.fname                     = fname;
    280277
    281         smb2_transport_compound_start(tree->session->transport, 2);
     278        smb2_transport_compound_start(tree->session->transport, 3);
    282279
    283280        /* passing the first request with the related flag is invalid */
     
    292289        cl.in.file.handle = hd;
    293290        req[1] = smb2_close_send(tree, &cl);
     291
     292        smb2_transport_compound_set_related(tree->session->transport, false);
     293        req[2] = smb2_close_send(tree, &cl);
    294294
    295295        status = smb2_create_recv(req[0], tree, &cr);
     
    298298        status = smb2_close_recv(req[1], &cl);
    299299        CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
     300        status = smb2_close_recv(req[2], &cl);
     301        CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
    300302
    301303        smb2_util_unlink(tree, fname);
     
    368370        CHECK_STATUS(status, NT_STATUS_OK);
    369371        status = smb2_close_recv(req[2], &cl);
    370         CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
     372        CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
    371373        status = smb2_close_recv(req[3], &cl);
    372         CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
     374        CHECK_STATUS(status, NT_STATUS_USER_SESSION_DELETED);
    373375        status = smb2_close_recv(req[4], &cl);
    374376        CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
     
    440442        CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
    441443        status = smb2_close_recv(req[3], &cl);
    442         CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
     444        CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
    443445        status = smb2_close_recv(req[4], &cl);
    444         CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
     446        CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
    445447
    446448        smb2_util_unlink(tree, fname);
     
    466468     * SMB2 spec as noted in MS-SMB2 <159>, <162>.  This, test currently
    467469     * verifies the Windows behavior, not the general spec behavior. */
    468     if (!TARGET_IS_WIN7(tctx) && !TARGET_IS_W2K8(tctx)) {
    469             torture_skip(tctx, "Interim test is specific to Windows server "
    470                                "behavior.\n");
    471     }
    472470
    473471    smb2_transport_credits_ask_num(tree->session->transport, 5);
     
    537535     * SMB2 spec as noted in MS-SMB2 <159>, <162>.  This, test currently
    538536     * verifies the Windows behavior, not the general spec behavior. */
    539     if (!TARGET_IS_WIN7(tctx) && !TARGET_IS_W2K8(tctx)) {
    540             torture_skip(tctx, "Interim test is specific to Windows server "
    541                                "behavior.\n");
    542     }
    543537
    544538    smb2_transport_credits_ask_num(tree->session->transport, 5);
  • vendor/current/source4/torture/smb2/connect.c

    r740 r746  
    7272        DATA_BLOB data;
    7373        int i;
     74        uint32_t size = torture_setting_int(tctx, "smb2maxwrite", 64*1024);
    7475       
    75         if (torture_setting_bool(tctx, "dangerous", false)) {
    76                 data = data_blob_talloc(tree, NULL, 160000);
    77         } else if (torture_setting_bool(tctx, "samba4", false)) {
    78                 data = data_blob_talloc(tree, NULL, UINT16_MAX);
    79         } else {
    80                 data = data_blob_talloc(tree, NULL, torture_setting_int(tctx, "smb2maxwrite", 120000));
    81         }
     76        data = data_blob_talloc(tree, NULL, size);
     77        if (size != data.length) {
     78                printf("data_blob_talloc(%s) failed\n", size);
     79                return NT_STATUS_NO_MEMORY;
     80        }
     81
    8282        for (i=0;i<data.length;i++) {
    8383                data.data[i] = i;
  • vendor/current/source4/torture/smb2/oplock.c

    r740 r746  
    23852385        int te;
    23862386
    2387         if (torture_setting_bool(tctx, "samba3", false)) {
    2388                 torture_skip(tctx, "BATCH22 disabled against samba3\n");
    2389         }
    2390 
    23912387        status = torture_smb2_testdir(tree1, BASEDIR, &h);
    23922388        torture_assert_ntstatus_ok(tctx, status, "Error creating directory");
     
    27272723                {&fname_default_stream, true,  SMB2_OPLOCK_LEVEL_EXCLUSIVE, SMB2_OPLOCK_LEVEL_II},
    27282724        };
    2729 
    2730         /* Only passes against windows at the moment. */
    2731         if (torture_setting_bool(tctx, "samba3", false) ||
    2732             torture_setting_bool(tctx, "samba4", false)) {
    2733                 torture_skip(tctx, "STREAM1 disabled against samba3+4\n");
    2734         }
    27352725
    27362726        fname_stream = talloc_asprintf(tctx, "%s:%s", fname_base, stream);
  • vendor/current/source4/torture/smb2/read.c

    r740 r746  
    5252        NTSTATUS status;
    5353        struct smb2_handle h;
    54         uint8_t buf[70000];
     54        uint8_t buf[64*1024];
    5555        struct smb2_read rd;
    5656        TALLOC_CTX *tmp_ctx = talloc_new(tree);
     
    135135        NTSTATUS status;
    136136        struct smb2_handle h;
    137         uint8_t buf[70000];
     137        uint8_t buf[64*1024];
    138138        struct smb2_read rd;
    139139        TALLOC_CTX *tmp_ctx = talloc_new(tree);
  • vendor/current/source4/torture/wscript_build

    r740 r746  
    3434
    3535bld.SAMBA_SUBSYSTEM('TORTURE_NDR',
    36         source='ndr/ndr.c ndr/winreg.c ndr/atsvc.c ndr/lsa.c ndr/epmap.c ndr/dfs.c ndr/netlogon.c ndr/drsuapi.c ndr/spoolss.c ndr/samr.c ndr/dfsblob.c ndr/drsblobs.c ndr/nbt.c ndr/ntlmssp.c ndr/backupkey.c',
     36        source='ndr/ndr.c ndr/winreg.c ndr/atsvc.c ndr/lsa.c ndr/epmap.c ndr/dfs.c ndr/netlogon.c ndr/drsuapi.c ndr/spoolss.c ndr/ntprinting.c ndr/samr.c ndr/dfsblob.c ndr/drsblobs.c ndr/nbt.c ndr/ntlmssp.c ndr/backupkey.c',
    3737        autoproto='ndr/proto.h',
    3838        deps='torture'
Note: See TracChangeset for help on using the changeset viewer.