Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

Location:
vendor/current/source4/client
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source4/client/cifsdd.c

    r740 r988  
    153153                        break;
    154154                case ARG_SIZE:
    155                         if (!conv_str_size(val, &arg->arg_val.nval)) {
     155                        if (!conv_str_size_error(val, &arg->arg_val.nval)) {
    156156                                goto fail;
    157157                        }
     
    449449                                &session_options,
    450450                                lpcfg_gensec_settings(lp_ctx, lp_ctx)))) {
     451                SAFE_FREE(iobuf);
    451452                return(FILESYS_EXIT_CODE);
    452453        }
     
    457458                                &session_options,
    458459                                lpcfg_gensec_settings(lp_ctx, lp_ctx)))) {
     460                SAFE_FREE(iobuf);
    459461                return(FILESYS_EXIT_CODE);
    460462        }
     
    488490                                if (!dd_flush_block(ofile, iobuf,
    489491                                                        &data_size, obs)) {
     492                                        SAFE_FREE(iobuf);
    490493                                        return(IOERROR_EXIT_CODE);
    491494                                }
     
    498501                 */
    499502                if (!dd_fill_block(ifile, iobuf, &data_size, obs, ibs)) {
     503                        SAFE_FREE(iobuf);
    500504                        return(IOERROR_EXIT_CODE);
    501505                }
     
    521525                if (data_size &&
    522526                    !dd_flush_block(ofile, iobuf, &data_size, obs)) {
     527                        SAFE_FREE(iobuf);
    523528                        return(IOERROR_EXIT_CODE);
    524529                }
     
    526531
    527532done:
     533        SAFE_FREE(iobuf);
    528534        print_transfer_stats();
    529535        return(0);
     
    566572        set_arg_val("count", (uint64_t)-1);
    567573        set_arg_val("seek", (uint64_t)0);
    568         set_arg_val("seek", (uint64_t)0);
     574        set_arg_val("skip", (uint64_t)0);
    569575        /* Files. */
    570576        set_arg_val("if", NULL);
     
    598604        ev = s4_event_context_init(talloc_autofree_context());
    599605
    600         gensec_init(cmdline_lp_ctx);
     606        gensec_init();
    601607        dump_args();
    602608
  • vendor/current/source4/client/client.c

    r740 r988  
    3636#include "lib/cmdline/popt_common.h"
    3737#include "librpc/gen_ndr/ndr_srvsvc_c.h"
     38#include "librpc/gen_ndr/ndr_lsa.h"
     39#include "librpc/gen_ndr/ndr_security.h"
    3840#include "libcli/util/clilsa.h"
    3941#include "system/dir.h"
     
    310312       
    311313        if (is_case_sensitive)
    312                 return ms_fnmatch(pattern, string,
     314                return ms_fnmatch_protocol(pattern, string,
    313315                                  c->transport->negotiate.protocol) == 0;
    314316
    315317        p2 = strlower_talloc(NULL, pattern);
    316318        s2 = strlower_talloc(NULL, string);
    317         ret = ms_fnmatch(p2, s2, c->transport->negotiate.protocol) == 0;
     319        ret = ms_fnmatch_protocol(p2, s2, c->transport->negotiate.protocol) == 0;
    318320        talloc_free(p2);
    319321        talloc_free(s2);
     
    453455{
    454456        char *dlq;
    455         long new_end = do_list_queue_end + ((long)strlen(entry)) + 1;
     457        long new_end;
     458
     459        if (entry == NULL) {
     460                entry = "";
     461        }
     462
     463        new_end = do_list_queue_end + ((long)strlen(entry)) + 1;
    456464        while (new_end > do_list_queue_size)
    457465        {
     
    474482        if (do_list_queue)
    475483        {
    476                 safe_strcpy(do_list_queue + do_list_queue_end, entry,
    477                             do_list_queue_size - do_list_queue_end - 1);
     484                strlcpy(do_list_queue + do_list_queue_end, entry,
     485                            do_list_queue_size - do_list_queue_end);
    478486                do_list_queue_end = new_end;
    479487                DEBUG(4,("added %s to do_list_queue (start=%d, end=%d)\n",
     
    697705
    698706
    699         lname = talloc_strdup(ctx, p_lname);
    700707        GetTimeOfDay(&tp_start);
    701708
    702709        if (ctx->lowercase) {
    703                 strlower(lname);
     710                lname = strlower_talloc(ctx, p_lname);
     711        } else {
     712                lname = talloc_strdup(ctx, p_lname);
    704713        }
    705714
     
    720729                                if (start == -1) {
    721730                                        d_printf("Error seeking local file\n");
     731                                        close(handle);
    722732                                        return 1;
    723733                                }
     
    739749                          &attr, &size, NULL, NULL, NULL))) {
    740750                d_printf("getattrib: %s\n",smbcli_errstr(ctx->cli->tree));
     751                if (newhandle) {
     752                        close(handle);
     753                }
    741754                return 1;
    742755        }
     
    748761                d_printf("malloc fail for size %d\n", read_size);
    749762                smbcli_close(ctx->cli->tree, fnum);
     763                if (newhandle) {
     764                        close(handle);
     765                }
    750766                return 1;
    751767        }
     
    885901        ctx->remote_cur_dir = talloc_asprintf_append_buffer(NULL, "%s\\", finfo->name);
    886902
    887         l_fname = talloc_strdup(ctx, finfo->name);
    888 
     903        if (ctx->lowercase) {
     904                l_fname = strlower_talloc(ctx, finfo->name);
     905        } else {
     906                l_fname = talloc_strdup(ctx, finfo->name);
     907        }
     908       
    889909        string_replace(l_fname, '\\', '/');
    890         if (ctx->lowercase) {
    891                 strlower(l_fname);
    892         }
    893        
     910
    894911        if (!directory_exist(l_fname) &&
    895912            mkdir(l_fname, 0777) != 0) {
     
    924941        int fd;
    925942        int rc = 0;
     943        mode_t mask;
    926944
    927945        lname = talloc_asprintf(ctx, "%s/smbmore.XXXXXX",tmpdir());
     946        mask = umask(S_IRWXO | S_IRWXG);
    928947        fd = mkstemp(lname);
     948        umask(mask);
    929949        if (fd == -1) {
    930950                d_printf("failed to create temporary file for more\n");
     
    10581078static int cmd_altname(struct smbclient_context *ctx, const char **args)
    10591079{
    1060         const char *altname;
     1080        const char *p;
     1081        char *altname;
    10611082        char *name;
    10621083 
     
    10681089        name = talloc_asprintf(ctx, "%s%s", ctx->remote_cur_dir, args[1]);
    10691090
    1070         if (!NT_STATUS_IS_OK(smbcli_qpathinfo_alt_name(ctx->cli->tree, name, &altname))) {
     1091        if (!NT_STATUS_IS_OK(smbcli_qpathinfo_alt_name(ctx->cli->tree, name, &p))) {
    10711092                d_printf("%s getting alt name for %s\n",
    10721093                         smbcli_errstr(ctx->cli->tree),name);
    10731094                return(false);
    10741095        }
     1096        altname = discard_const_p(char, p);
    10751097        d_printf("%s\n", altname);
     1098
     1099        SAFE_FREE(altname);
    10761100
    10771101        return 0;
     
    11271151                        if (x_tseek(f, start, SEEK_SET) == -1) {
    11281152                                d_printf("Error seeking local file\n");
     1153                                x_fclose(f);
    11291154                                return 1;
    11301155                        }
     
    11441169        if (!buf) {
    11451170                d_printf("ERROR: Not enough memory!\n");
     1171                x_fclose(f);
    11461172                return 1;
    11471173        }
     
    15951621        {"fullsize-information", RAW_QFS_FULL_SIZE_INFORMATION},
    15961622        {"objectid", RAW_QFS_OBJECTID_INFORMATION},
     1623        {"sector-size-info", RAW_QFS_SECTOR_SIZE_INFORMATION},
    15971624        {NULL, RAW_QFS_GENERIC}
    15981625};
     
    17381765                         (unsigned long long) fsinfo.objectid_information.out.unknown[5] );
    17391766                break;
     1767        case RAW_QFS_SECTOR_SIZE_INFORMATION:
     1768                d_printf("\tlogical_bytes_per_sector:                   %u\n",
     1769                         (unsigned)fsinfo.sector_size_info.out.logical_bytes_per_sector);
     1770                d_printf("\tphys_bytes_per_sector_atomic:               %u\n",
     1771                         (unsigned)fsinfo.sector_size_info.out.phys_bytes_per_sector_atomic);
     1772                d_printf("\tphys_bytes_per_sector_perf:                 %u\n",
     1773                         (unsigned)fsinfo.sector_size_info.out.phys_bytes_per_sector_perf);
     1774                d_printf("\tfs_effective_phys_bytes_per_sector_atomic:  %u\n",
     1775                         (unsigned)fsinfo.sector_size_info.out.fs_effective_phys_bytes_per_sector_atomic);
     1776                d_printf("\tflags:                                      0x%x\n",
     1777                         (unsigned)fsinfo.sector_size_info.out.flags);
     1778                d_printf("\tbyte_off_sector_align:                      %u\n",
     1779                         (unsigned)fsinfo.sector_size_info.out.byte_off_sector_align);
     1780                d_printf("\tbyte_off_partition_align:                   %u\n",
     1781                         (unsigned)fsinfo.sector_size_info.out.byte_off_partition_align);
     1782                break;
    17401783        case RAW_QFS_GENERIC:
    17411784                d_printf("\twrong level returned\n");
     
    21302173
    21312174/****************************************************************************
     2175open a file
    21322176****************************************************************************/
    21332177static int cmd_open(struct smbclient_context *ctx, const char **args)
    21342178{
    2135         char *mask;
    2136        
     2179        char *filename;
     2180        union smb_open io;
     2181        NTSTATUS status;
     2182        TALLOC_CTX *tmp_ctx;
     2183
    21372184        if (!args[1]) {
    21382185                d_printf("open <filename>\n");
    21392186                return 1;
    21402187        }
    2141         mask = talloc_asprintf(ctx, "%s%s", ctx->remote_cur_dir, args[1]);
    2142 
    2143         smbcli_open(ctx->cli->tree, mask, O_RDWR, DENY_ALL);
     2188        tmp_ctx = talloc_new(ctx);
     2189
     2190        filename = talloc_asprintf(tmp_ctx, "%s%s", ctx->remote_cur_dir, args[1]);
     2191
     2192        io.generic.level = RAW_OPEN_NTCREATEX;
     2193        io.ntcreatex.in.root_fid.fnum = 0;
     2194        io.ntcreatex.in.flags = 0;
     2195        io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
     2196        io.ntcreatex.in.create_options = 0;
     2197        io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
     2198        io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ;
     2199        io.ntcreatex.in.alloc_size = 0;
     2200        io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
     2201        io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
     2202        io.ntcreatex.in.security_flags = 0;
     2203        io.ntcreatex.in.fname = filename;
     2204
     2205        status = smb_raw_open(ctx->cli->tree, tmp_ctx, &io);
     2206        talloc_free(tmp_ctx);
     2207
     2208        if (NT_STATUS_IS_OK(status)) {
     2209                d_printf("Opened file with fnum %u\n", (unsigned)io.ntcreatex.out.file.fnum);
     2210        } else {
     2211                d_printf("Opened failed: %s\n", nt_errstr(status));
     2212        }
     2213
     2214        return 0;
     2215}
     2216
     2217/****************************************************************************
     2218close a file
     2219****************************************************************************/
     2220static int cmd_close(struct smbclient_context *ctx, const char **args)
     2221{
     2222        union smb_close io;
     2223        NTSTATUS status;
     2224        uint16_t fnum;
     2225
     2226        if (!args[1]) {
     2227                d_printf("close <fnum>\n");
     2228                return 1;
     2229        }
     2230
     2231        fnum = atoi(args[1]);
     2232
     2233        ZERO_STRUCT(io);
     2234        io.generic.level = RAW_CLOSE_CLOSE;
     2235        io.close.in.file.fnum = fnum;
     2236
     2237        status = smb_raw_close(ctx->cli->tree, &io);
     2238
     2239        if (NT_STATUS_IS_OK(status)) {
     2240                d_printf("Closed file OK\n");
     2241        } else {
     2242                d_printf("Close failed: %s\n", nt_errstr(status));
     2243        }
    21442244
    21452245        return 0;
     
    26932793  {"newer",cmd_newer,"<file> only mget files newer than the specified local file",{COMPL_LOCAL,COMPL_NONE}},
    26942794  {"open",cmd_open,"<mask> open a file",{COMPL_REMOTE,COMPL_NONE}},
     2795  {"close",cmd_close,"<fnum> close a file",{COMPL_NONE,COMPL_NONE}},
    26952796  {"privileges",cmd_privileges,"<user> show privileges for a user",{COMPL_NONE,COMPL_NONE}},
    26962797  {"print",cmd_print,"<file name> print a file",{COMPL_NONE,COMPL_NONE}},
     
    28402941        info.text = text;
    28412942        info.len = len;
    2842  
     2943        info.count = 0;
     2944
    28432945        if (len >= PATH_MAX)
    28442946                return(NULL);
     
    29993101static int process_line(struct smbclient_context *ctx, const char *cline)
    30003102{
    3001         const char **args;
     3103        char **args;
    30023104        int i;
    30033105
    30043106        /* and get the first part of the command */
    3005         args = (const char **) str_list_make_shell(ctx, cline, NULL);
     3107        args = str_list_make_shell(ctx, cline, NULL);
    30063108        if (!args || !args[0])
    30073109                return 0;
    30083110
    30093111        if ((i = process_tok(args[0])) >= 0) {
    3010                 i = commands[i].fn(ctx, args);
     3112                const char **a = discard_const_p(const char *, args);
     3113                i = commands[i].fn(ctx, a);
    30113114        } else if (i == -2) {
    30123115                d_printf("%s: command abbreviation ambiguous\n",args[0]);
     
    30713174        if (strncmp(specified_share, "\\\\", 2) == 0 ||
    30723175            strncmp(specified_share, "//", 2) == 0) {
    3073                 smbcli_parse_unc(specified_share, ctx, &server, &share);
     3176                bool ok;
     3177
     3178                ok = smbcli_parse_unc(specified_share, ctx, &server, &share);
     3179                if (!ok) {
     3180                        d_printf("Failed to parse UNC\n");
     3181                        talloc_free(ctx);
     3182                        return false;
     3183                }
    30743184        } else {
    30753185                share = talloc_strdup(ctx, specified_share);
    30763186                server = talloc_strdup(ctx, specified_server);
     3187                if (share == NULL || server == NULL) {
     3188                        d_printf("Failed to allocate memory for server and share\n");
     3189                        talloc_free(ctx);
     3190                        return false;
     3191                }
    30773192        }
    30783193
    30793194        ctx->remote_cur_dir = talloc_strdup(ctx, "\\");
    3080        
     3195        if (ctx->remote_cur_dir == NULL) {
     3196                talloc_free(ctx);
     3197                return false;
     3198        }
     3199
    30813200        status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
    30823201                                        share, NULL,
     
    31233242        const char *server_name;
    31243243        struct smbcli_state *cli;
     3244        bool ok;
    31253245
    31263246        make_nbt_name_client(&calling, netbios_name);
     
    31303250        server_name = destip ? destip : desthost;
    31313251
    3132         if (!(cli = smbcli_state_init(NULL)) ||
    3133             !smbcli_socket_connect(cli, server_name, destports,
     3252        cli = smbcli_state_init(NULL);
     3253        if (cli == NULL) {
     3254                d_printf("smbcli_state_init() failed\n");
     3255                return 1;
     3256        }
     3257
     3258        ok = smbcli_socket_connect(cli, server_name, destports,
    31343259                                   ev_ctx, resolve_ctx, options,
    3135                    socket_options)) {
     3260                                   socket_options,
     3261                                   &calling, &called);
     3262        if (!ok) {
    31363263                d_printf("Connection to %s failed\n", server_name);
    3137                 return 1;
    3138         }
    3139 
    3140         if (!smbcli_transport_establish(cli, &calling, &called)) {
    3141                 d_printf("session request failed\n");
    3142                 talloc_free(cli);
    31433264                return 1;
    31443265        }
     
    31543275  main program
    31553276****************************************************************************/
    3156  int main(int argc,char *argv[])
     3277 int main(int argc, const char *argv[])
    31573278{
    31583279        char *base_directory = NULL;
     
    32023323        ctx->io_bufsize = 64512;
    32033324
    3204         pc = poptGetContext("smbclient", argc, (const char **) argv, long_options, 0);
     3325        pc = poptGetContext("smbclient", argc, argv, long_options, 0);
    32053326        poptSetOtherOptionHelp(pc, "[OPTIONS] service <password>");
    32063327
     
    32323353        }
    32333354
    3234         gensec_init(cmdline_lp_ctx);
     3355        gensec_init();
    32353356
    32363357        if(poptPeekArg(pc)) {
  • vendor/current/source4/client/tests/test_cifsdd.sh

    r414 r988  
    1717. `dirname $0`/../../../testprogs/blackbox/subunit.sh
    1818
    19 samba4bindir="$BUILDDIR/bin"
    20 DD="$samba4bindir/cifsdd$EXEEXT"
     19samba4bindir="$BINDIR"
     20DD="$samba4bindir/cifsdd"
    2121
    2222SHARE=tmp
  • vendor/current/source4/client/tests/test_smbclient.sh

    r740 r988  
    66if [ $# -lt 5 ]; then
    77cat <<EOF
    8 Usage: test_smbclient.sh SERVER USERNAME PASSWORD DOMAIN PREFIX
     8Usage: test_smbclient.sh SERVER USERNAME PASSWORD DOMAIN PREFIX SMBCLIENT
    99EOF
    1010exit 1;
     
    1616DOMAIN=$4
    1717PREFIX=$5
    18 shift 5
     18smbclient=$6
     19shift 6
    1920failed=0
    20 
    21 samba4bindir="$BUILDDIR/bin"
    22 smbclient="$samba4bindir/smbclient$EXEEXT"
    2321
    2422. `dirname $0`/../../../testprogs/blackbox/subunit.sh
Note: See TracChangeset for help on using the changeset viewer.