Ignore:
Timestamp:
Nov 14, 2012, 12:59:34 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to 3.6.0

File:
1 edited

Legend:

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

    r414 r740  
    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"
    40 #include "libcli/raw/libcliraw.h"
    4138#include "libcli/util/clilsa.h"
    4239#include "system/dir.h"
     
    4946#include "libcli/resolve/resolve.h"
    5047#include "libcli/security/security.h"
    51 #include "lib/smbreadline/smbreadline.h"
     48#include "../libcli/smbreadline/smbreadline.h"
    5249#include "librpc/gen_ndr/ndr_nbt.h"
    5350#include "param/param.h"
    54 #include "librpc/rpc/dcerpc.h"
    5551#include "libcli/raw/raw_proto.h"
    5652
     
    7773/* timing globals */
    7874static uint64_t get_total_size = 0;
    79 static uint_t get_total_time_ms = 0;
     75static unsigned int get_total_time_ms = 0;
    8076static uint64_t put_total_size = 0;
    81 static uint_t put_total_time_ms = 0;
     77static unsigned int put_total_time_ms = 0;
    8278
    8379/* Unfortunately, there is no way to pass the a context to the completion function as an argument */
     
    265261           new directory is invalid */
    266262        if (newdir[0] == '\\')
    267                 dname = talloc_strdup(NULL, newdir);
     263                dname = talloc_strdup(ctx, newdir);
    268264        else
    269                 dname = talloc_asprintf(NULL, "%s\\%s", ctx->remote_cur_dir, newdir);
     265                dname = talloc_asprintf(ctx, "%s\\%s", ctx->remote_cur_dir, newdir);
    270266
    271267        dos_format(dname);
     
    686682  get a file from rname to lname
    687683  ****************************************************************************/
    688 static int do_get(struct smbclient_context *ctx, char *rname, const char *lname, bool reget)
     684static int do_get(struct smbclient_context *ctx, char *rname, const char *p_lname, bool reget)
    689685
    690686        int handle = 0, fnum;
     
    698694        off_t nread = 0;
    699695        int rc = 0;
    700 
     696        char *lname;
     697
     698
     699        lname = talloc_strdup(ctx, p_lname);
    701700        GetTimeOfDay(&tp_start);
    702701
    703702        if (ctx->lowercase) {
    704                 strlower(discard_const_p(char, lname));
     703                strlower(lname);
    705704        }
    706705
     
    859858        char *mget_mask;
    860859        char *saved_curdir;
     860        char *l_fname;
    861861
    862862        if (ISDOT(finfo->name) || ISDOTDOT(finfo->name))
     
    864864
    865865        if (finfo->attrib & FILE_ATTRIBUTE_DIRECTORY)
    866                 asprintf(&quest, "Get directory %s? ",finfo->name);
     866                quest = talloc_asprintf(ctx, "Get directory %s? ",finfo->name);
    867867        else
    868                 asprintf(&quest, "Get file %s? ",finfo->name);
     868                quest = talloc_asprintf(ctx, "Get file %s? ",finfo->name);
    869869
    870870        if (ctx->prompt && !yesno(quest)) return;
    871871
    872         SAFE_FREE(quest);
     872        talloc_free(quest);
    873873
    874874        if (!(finfo->attrib & FILE_ATTRIBUTE_DIRECTORY)) {
    875                 asprintf(&rname, "%s%s",ctx->remote_cur_dir,finfo->name);
     875                rname = talloc_asprintf(ctx, "%s%s",ctx->remote_cur_dir,
     876                                        finfo->name);
    876877                do_get(ctx, rname, finfo->name, false);
    877                 SAFE_FREE(rname);
     878                talloc_free(rname);
    878879                return;
    879880        }
    880881
    881882        /* handle directories */
    882         saved_curdir = talloc_strdup(NULL, ctx->remote_cur_dir);
     883        saved_curdir = talloc_strdup(ctx, ctx->remote_cur_dir);
    883884
    884885        ctx->remote_cur_dir = talloc_asprintf_append_buffer(NULL, "%s\\", finfo->name);
    885886
    886         string_replace(discard_const_p(char, finfo->name), '\\', '/');
     887        l_fname = talloc_strdup(ctx, finfo->name);
     888
     889        string_replace(l_fname, '\\', '/');
    887890        if (ctx->lowercase) {
    888                 strlower(discard_const_p(char, finfo->name));
    889         }
    890        
    891         if (!directory_exist(finfo->name) &&
    892             mkdir(finfo->name,0777) != 0) {
    893                 d_printf("failed to create directory %s\n",finfo->name);
     891                strlower(l_fname);
     892        }
     893       
     894        if (!directory_exist(l_fname) &&
     895            mkdir(l_fname, 0777) != 0) {
     896                d_printf("failed to create directory %s\n", l_fname);
    894897                return;
    895898        }
    896899       
    897         if (chdir(finfo->name) != 0) {
    898                 d_printf("failed to chdir to directory %s\n",finfo->name);
     900        if (chdir(l_fname) != 0) {
     901                d_printf("failed to chdir to directory %s\n", l_fname);
    899902                return;
    900903        }
    901904
    902         mget_mask = talloc_asprintf(NULL, "%s*", ctx->remote_cur_dir);
     905        mget_mask = talloc_asprintf(ctx, "%s*", ctx->remote_cur_dir);
    903906       
    904907        do_list(ctx, mget_mask, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,do_mget,false, true);
     
    964967       
    965968        for (i = 1; args[i]; i++) {
    966                 mget_mask = talloc_strdup(ctx,ctx->remote_cur_dir);
     969                mget_mask = talloc_strdup(ctx, ctx->remote_cur_dir);
    967970                if(mget_mask[strlen(mget_mask)-1]!='\\')
    968971                        mget_mask = talloc_append_string(ctx, mget_mask, "\\");
     
    12931296{
    12941297        talloc_free(ctx->fileselection);
    1295         ctx->fileselection = talloc_strdup(NULL, args[1]);
     1298        ctx->fileselection = talloc_strdup(ctx, args[1]);
    12961299
    12971300        return 0;
     
    15341537                return 1;
    15351538        }
    1536         mask = talloc_asprintf(ctx,"%s%s", ctx->remote_cur_dir, args[1]);
     1539        mask = talloc_asprintf(ctx, "%s%s", ctx->remote_cur_dir, args[1]);
    15371540
    15381541        if (NT_STATUS_IS_ERR(smbcli_unlink(ctx->cli->tree, mask))) {
     
    22492252        if (NT_STATUS_IS_ERR(smbcli_unix_chmod(ctx->cli->tree, src, mode))) {
    22502253                d_printf("%s chmod file %s 0%o\n",
    2251                         smbcli_errstr(ctx->cli->tree), src, (mode_t)mode);
     2254                        smbcli_errstr(ctx->cli->tree), src, (unsigned)mode);
    22522255                return 1;
    22532256        }
     
    26042607        do {
    26052608                ZERO_STRUCT(ctr1);
    2606                 status = dcerpc_srvsvc_NetShareEnumAll(p, mem_ctx, &r);
     2609                status = dcerpc_srvsvc_NetShareEnumAll_r(p->binding_handle, mem_ctx, &r);
    26072610
    26082611                if (NT_STATUS_IS_OK(status) &&
     
    28312834{
    28322835        char *dirmask;
    2833         int i;
     2836        int i, ret;
    28342837        completion_remote_t info;
    28352838
     
    28542857                info.dirmask = talloc_strndup(NULL, text, i+1);
    28552858                info.dirmask[i+1] = 0;
    2856                 asprintf(&dirmask, "%s%*s*", rl_ctx->remote_cur_dir, i-1, text);
    2857         } else
    2858                 asprintf(&dirmask, "%s*", rl_ctx->remote_cur_dir);
     2859                ret = asprintf(&dirmask, "%s%*s*", rl_ctx->remote_cur_dir, i-1,
     2860                               text);
     2861        } else {
     2862                ret = asprintf(&dirmask, "%s*", rl_ctx->remote_cur_dir);
     2863        }
     2864        if (ret < 0) {
     2865                goto cleanup;
     2866        }
    28592867
    28602868        if (smbcli_list(rl_ctx->cli->tree, dirmask,
     
    29953003
    29963004        /* and get the first part of the command */
    2997         args = str_list_make_shell(ctx, cline, NULL);
     3005        args = (const char **) str_list_make_shell(ctx, cline, NULL);
    29983006        if (!args || !args[0])
    29993007                return 0;
     
    30543062                       struct smbcli_options *options,
    30553063                       struct smbcli_session_options *session_options,
    3056                            struct smb_iconv_convenience *iconv_convenience,
    30573064                           struct gensec_settings *gensec_settings)
    30583065{
     
    30773084                                        cred, resolve_ctx,
    30783085                                        ev_ctx, options, session_options,
    3079                                         iconv_convenience,
    30803086                                        gensec_settings);
    30813087        if (!NT_STATUS_IS_OK(status)) {
     
    30833089                         server, share, nt_errstr(status));
    30843090                talloc_free(ctx);
    3085                 return NULL;
    3086         }
    3087 
    3088         return ctx;
     3091                return false;
     3092        }
     3093
     3094        return true;
    30893095}
    30903096
     
    31123118                         struct resolve_context *resolve_ctx,
    31133119                         struct smbcli_options *options,
    3114                          struct smb_iconv_convenience *iconv_convenience,
    31153120             const char *socket_options)
    31163121{
     
    31283133            !smbcli_socket_connect(cli, server_name, destports,
    31293134                                   ev_ctx, resolve_ctx, options,
    3130                                    iconv_convenience,
    31313135                   socket_options)) {
    31323136                d_printf("Connection to %s failed\n", server_name);
     
    31523156 int main(int argc,char *argv[])
    31533157{
    3154         const char *base_directory = NULL;
     3158        char *base_directory = NULL;
    31553159        const char *dest_ip = NULL;
    31563160        int opt;
    31573161        const char *query_host = NULL;
    31583162        bool message = false;
    3159         const char *desthost = NULL;
     3163        char *desthost = NULL;
    31603164        poptContext pc;
    31613165        const char *service = NULL;
     
    32583262        poptFreeContext(pc);
    32593263
    3260         lp_smbcli_options(cmdline_lp_ctx, &smb_options);
    3261         lp_smbcli_session_options(cmdline_lp_ctx, &smb_session_options);
     3264        lpcfg_smbcli_options(cmdline_lp_ctx, &smb_options);
     3265        lpcfg_smbcli_session_options(cmdline_lp_ctx, &smb_session_options);
    32623266
    32633267        ev_ctx = s4_event_context_init(talloc_autofree_context());
     
    32733277        if (query_host) {
    32743278                rc = do_host_query(cmdline_lp_ctx, ev_ctx, query_host,
    3275                                    lp_workgroup(cmdline_lp_ctx));
     3279                                   lpcfg_workgroup(cmdline_lp_ctx));
    32763280                return rc;
    32773281        }
    32783282
    32793283        if (message) {
    3280                 rc = do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost,
    3281                                    lp_smb_ports(cmdline_lp_ctx), dest_ip,
     3284                rc = do_message_op(lpcfg_netbios_name(cmdline_lp_ctx), desthost,
     3285                                   lpcfg_smb_ports(cmdline_lp_ctx), dest_ip,
    32823286                                   name_type, ev_ctx,
    3283                                    lp_resolve_context(cmdline_lp_ctx),
    3284                                    &smb_options, lp_iconv_convenience(cmdline_lp_ctx),
    3285                    lp_socket_options(cmdline_lp_ctx));
     3287                                   lpcfg_resolve_context(cmdline_lp_ctx),
     3288                                   &smb_options,
     3289                   lpcfg_socket_options(cmdline_lp_ctx));
    32863290                return rc;
    32873291        }
    32883292       
    3289         if (!do_connect(ctx, ev_ctx, lp_resolve_context(cmdline_lp_ctx),
    3290                         desthost, lp_smb_ports(cmdline_lp_ctx), service,
    3291                         lp_socket_options(cmdline_lp_ctx),
     3293        if (!do_connect(ctx, ev_ctx, lpcfg_resolve_context(cmdline_lp_ctx),
     3294                        desthost, lpcfg_smb_ports(cmdline_lp_ctx), service,
     3295                        lpcfg_socket_options(cmdline_lp_ctx),
    32923296                        cmdline_credentials, &smb_options, &smb_session_options,
    3293                         lp_iconv_convenience(cmdline_lp_ctx),
    3294                         lp_gensec_settings(ctx, cmdline_lp_ctx)))
     3297                        lpcfg_gensec_settings(ctx, cmdline_lp_ctx)))
    32953298                return 1;
    32963299
Note: See TracChangeset for help on using the changeset viewer.