Changeset 740 for vendor/current/source4/client
- Timestamp:
- Nov 14, 2012, 12:59:34 PM (13 years ago)
- Location:
- vendor/current/source4/client
- Files:
-
- 1 added
- 2 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source4/client/cifsdd.c
r414 r740 61 61 /* ------------------------------------------------------------------------- */ 62 62 63 static const struct { 64 enum argtype arg_type; 65 const char * arg_name; 66 } names [] = { 67 { ARG_NUMERIC, "COUNT" }, 68 { ARG_SIZE, "SIZE" }, 69 { ARG_PATHNAME, "FILE" }, 70 { ARG_BOOL, "BOOLEAN" }, 71 }; 72 63 73 static const char * argtype_str(enum argtype arg_type) 64 74 { 65 static const struct {66 enum argtype arg_type;67 const char * arg_name;68 } names [] =69 {70 { ARG_NUMERIC, "COUNT" },71 { ARG_SIZE, "SIZE" },72 { ARG_PATHNAME, "FILE" },73 { ARG_BOOL, "BOOLEAN" },74 };75 76 75 int i; 77 76 … … 361 360 const char *socket_options, 362 361 struct smbcli_session_options *smb_session_options, 363 struct smb_iconv_convenience *iconv_convenience,364 362 struct gensec_settings *gensec_settings) 365 363 { … … 386 384 socket_options, 387 385 smb_options, smb_session_options, 388 iconv_convenience,389 386 gensec_settings); 390 387 } else if (strcmp(which, "of") == 0) { … … 395 392 socket_options, 396 393 smb_options, smb_session_options, 397 iconv_convenience,398 394 gensec_settings); 399 395 } else { … … 429 425 count = check_arg_numeric("count"); 430 426 431 lp _smbcli_options(lp_ctx, &options);432 lp _smbcli_session_options(lp_ctx, &session_options);427 lpcfg_smbcli_options(lp_ctx, &options); 428 lpcfg_smbcli_session_options(lp_ctx, &session_options); 433 429 434 430 /* Allocate IO buffer. We need more than the max IO size because we … … 448 444 (unsigned long long)iomax, options.max_xmit)); 449 445 450 if (!(ifile = open_file(lp _resolve_context(lp_ctx), ev, "if",451 lp _smb_ports(lp_ctx), &options,452 lp _socket_options(lp_ctx),453 &session_options, lp_iconv_convenience(lp_ctx),454 lp _gensec_settings(lp_ctx, lp_ctx)))) {446 if (!(ifile = open_file(lpcfg_resolve_context(lp_ctx), ev, "if", 447 lpcfg_smb_ports(lp_ctx), &options, 448 lpcfg_socket_options(lp_ctx), 449 &session_options, 450 lpcfg_gensec_settings(lp_ctx, lp_ctx)))) { 455 451 return(FILESYS_EXIT_CODE); 456 452 } 457 453 458 if (!(ofile = open_file(lp _resolve_context(lp_ctx), ev, "of",459 lp _smb_ports(lp_ctx), &options,460 lp _socket_options(lp_ctx),454 if (!(ofile = open_file(lpcfg_resolve_context(lp_ctx), ev, "of", 455 lpcfg_smb_ports(lp_ctx), &options, 456 lpcfg_socket_options(lp_ctx), 461 457 &session_options, 462 lp_iconv_convenience(lp_ctx), 463 lp_gensec_settings(lp_ctx, lp_ctx)))) { 458 lpcfg_gensec_settings(lp_ctx, lp_ctx)))) { 464 459 return(FILESYS_EXIT_CODE); 465 460 } -
vendor/current/source4/client/cifsdd.h
r414 r740 101 101 struct smbcli_options *smb_options, 102 102 struct smbcli_session_options *smb_session_options, 103 struct smb_iconv_convenience *iconv_convenience,104 103 struct gensec_settings *gensec_settings); 105 104 bool dd_fill_block(struct dd_iohandle * h, uint8_t * buf, -
vendor/current/source4/client/cifsddio.c
r414 r740 21 21 #include "includes.h" 22 22 #include "system/filesys.h" 23 #include "libcli/raw/libcliraw.h"24 23 #include "libcli/libcli.h" 25 24 #include "lib/cmdline/popt_common.h" … … 229 228 struct smbcli_options *options, 230 229 struct smbcli_session_options *session_options, 231 struct smb_iconv_convenience *iconv_convenience,232 230 struct gensec_settings *gensec_settings) 233 231 { … … 244 242 ev, options, 245 243 session_options, 246 iconv_convenience,247 244 gensec_settings); 248 245 … … 314 311 struct smbcli_options *smb_options, 315 312 struct smbcli_session_options *smb_session_options, 316 struct smb_iconv_convenience *iconv_convenience,317 313 struct gensec_settings *gensec_settings) 318 314 { … … 338 334 socket_options, 339 335 smb_options, smb_session_options, 340 iconv_convenience,341 336 gensec_settings)) == NULL) { 342 337 return(NULL); … … 363 358 struct smbcli_options *smb_options, 364 359 struct smbcli_session_options *smb_session_options, 365 struct smb_iconv_convenience *iconv_convenience,366 360 struct gensec_settings *gensec_settings) 367 361 { … … 384 378 socket_options, smb_options, 385 379 smb_session_options, 386 iconv_convenience,387 380 gensec_settings)); 388 381 } -
vendor/current/source4/client/client.c
r414 r740 36 36 #include "lib/cmdline/popt_common.h" 37 37 #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"41 38 #include "libcli/util/clilsa.h" 42 39 #include "system/dir.h" … … 49 46 #include "libcli/resolve/resolve.h" 50 47 #include "libcli/security/security.h" 51 #include " lib/smbreadline/smbreadline.h"48 #include "../libcli/smbreadline/smbreadline.h" 52 49 #include "librpc/gen_ndr/ndr_nbt.h" 53 50 #include "param/param.h" 54 #include "librpc/rpc/dcerpc.h"55 51 #include "libcli/raw/raw_proto.h" 56 52 … … 77 73 /* timing globals */ 78 74 static uint64_t get_total_size = 0; 79 static u int_t get_total_time_ms = 0;75 static unsigned int get_total_time_ms = 0; 80 76 static uint64_t put_total_size = 0; 81 static u int_t put_total_time_ms = 0;77 static unsigned int put_total_time_ms = 0; 82 78 83 79 /* Unfortunately, there is no way to pass the a context to the completion function as an argument */ … … 265 261 new directory is invalid */ 266 262 if (newdir[0] == '\\') 267 dname = talloc_strdup( NULL, newdir);263 dname = talloc_strdup(ctx, newdir); 268 264 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); 270 266 271 267 dos_format(dname); … … 686 682 get a file from rname to lname 687 683 ****************************************************************************/ 688 static int do_get(struct smbclient_context *ctx, char *rname, const char * lname, bool reget)684 static int do_get(struct smbclient_context *ctx, char *rname, const char *p_lname, bool reget) 689 685 { 690 686 int handle = 0, fnum; … … 698 694 off_t nread = 0; 699 695 int rc = 0; 700 696 char *lname; 697 698 699 lname = talloc_strdup(ctx, p_lname); 701 700 GetTimeOfDay(&tp_start); 702 701 703 702 if (ctx->lowercase) { 704 strlower( discard_const_p(char, lname));703 strlower(lname); 705 704 } 706 705 … … 859 858 char *mget_mask; 860 859 char *saved_curdir; 860 char *l_fname; 861 861 862 862 if (ISDOT(finfo->name) || ISDOTDOT(finfo->name)) … … 864 864 865 865 if (finfo->attrib & FILE_ATTRIBUTE_DIRECTORY) 866 asprintf(&quest, "Get directory %s? ",finfo->name);866 quest = talloc_asprintf(ctx, "Get directory %s? ",finfo->name); 867 867 else 868 asprintf(&quest, "Get file %s? ",finfo->name);868 quest = talloc_asprintf(ctx, "Get file %s? ",finfo->name); 869 869 870 870 if (ctx->prompt && !yesno(quest)) return; 871 871 872 SAFE_FREE(quest);872 talloc_free(quest); 873 873 874 874 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); 876 877 do_get(ctx, rname, finfo->name, false); 877 SAFE_FREE(rname);878 talloc_free(rname); 878 879 return; 879 880 } 880 881 881 882 /* handle directories */ 882 saved_curdir = talloc_strdup( NULL, ctx->remote_cur_dir);883 saved_curdir = talloc_strdup(ctx, ctx->remote_cur_dir); 883 884 884 885 ctx->remote_cur_dir = talloc_asprintf_append_buffer(NULL, "%s\\", finfo->name); 885 886 886 string_replace(discard_const_p(char, finfo->name), '\\', '/'); 887 l_fname = talloc_strdup(ctx, finfo->name); 888 889 string_replace(l_fname, '\\', '/'); 887 890 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); 894 897 return; 895 898 } 896 899 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); 899 902 return; 900 903 } 901 904 902 mget_mask = talloc_asprintf( NULL, "%s*", ctx->remote_cur_dir);905 mget_mask = talloc_asprintf(ctx, "%s*", ctx->remote_cur_dir); 903 906 904 907 do_list(ctx, mget_mask, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY,do_mget,false, true); … … 964 967 965 968 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); 967 970 if(mget_mask[strlen(mget_mask)-1]!='\\') 968 971 mget_mask = talloc_append_string(ctx, mget_mask, "\\"); … … 1293 1296 { 1294 1297 talloc_free(ctx->fileselection); 1295 ctx->fileselection = talloc_strdup( NULL, args[1]);1298 ctx->fileselection = talloc_strdup(ctx, args[1]); 1296 1299 1297 1300 return 0; … … 1534 1537 return 1; 1535 1538 } 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]); 1537 1540 1538 1541 if (NT_STATUS_IS_ERR(smbcli_unlink(ctx->cli->tree, mask))) { … … 2249 2252 if (NT_STATUS_IS_ERR(smbcli_unix_chmod(ctx->cli->tree, src, mode))) { 2250 2253 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); 2252 2255 return 1; 2253 2256 } … … 2604 2607 do { 2605 2608 ZERO_STRUCT(ctr1); 2606 status = dcerpc_srvsvc_NetShareEnumAll (p, mem_ctx, &r);2609 status = dcerpc_srvsvc_NetShareEnumAll_r(p->binding_handle, mem_ctx, &r); 2607 2610 2608 2611 if (NT_STATUS_IS_OK(status) && … … 2831 2834 { 2832 2835 char *dirmask; 2833 int i ;2836 int i, ret; 2834 2837 completion_remote_t info; 2835 2838 … … 2854 2857 info.dirmask = talloc_strndup(NULL, text, i+1); 2855 2858 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 } 2859 2867 2860 2868 if (smbcli_list(rl_ctx->cli->tree, dirmask, … … 2995 3003 2996 3004 /* 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); 2998 3006 if (!args || !args[0]) 2999 3007 return 0; … … 3054 3062 struct smbcli_options *options, 3055 3063 struct smbcli_session_options *session_options, 3056 struct smb_iconv_convenience *iconv_convenience,3057 3064 struct gensec_settings *gensec_settings) 3058 3065 { … … 3077 3084 cred, resolve_ctx, 3078 3085 ev_ctx, options, session_options, 3079 iconv_convenience,3080 3086 gensec_settings); 3081 3087 if (!NT_STATUS_IS_OK(status)) { … … 3083 3089 server, share, nt_errstr(status)); 3084 3090 talloc_free(ctx); 3085 return NULL;3086 } 3087 3088 return ctx;3091 return false; 3092 } 3093 3094 return true; 3089 3095 } 3090 3096 … … 3112 3118 struct resolve_context *resolve_ctx, 3113 3119 struct smbcli_options *options, 3114 struct smb_iconv_convenience *iconv_convenience,3115 3120 const char *socket_options) 3116 3121 { … … 3128 3133 !smbcli_socket_connect(cli, server_name, destports, 3129 3134 ev_ctx, resolve_ctx, options, 3130 iconv_convenience,3131 3135 socket_options)) { 3132 3136 d_printf("Connection to %s failed\n", server_name); … … 3152 3156 int main(int argc,char *argv[]) 3153 3157 { 3154 c onst char *base_directory = NULL;3158 char *base_directory = NULL; 3155 3159 const char *dest_ip = NULL; 3156 3160 int opt; 3157 3161 const char *query_host = NULL; 3158 3162 bool message = false; 3159 c onst char *desthost = NULL;3163 char *desthost = NULL; 3160 3164 poptContext pc; 3161 3165 const char *service = NULL; … … 3258 3262 poptFreeContext(pc); 3259 3263 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); 3262 3266 3263 3267 ev_ctx = s4_event_context_init(talloc_autofree_context()); … … 3273 3277 if (query_host) { 3274 3278 rc = do_host_query(cmdline_lp_ctx, ev_ctx, query_host, 3275 lp _workgroup(cmdline_lp_ctx));3279 lpcfg_workgroup(cmdline_lp_ctx)); 3276 3280 return rc; 3277 3281 } 3278 3282 3279 3283 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, 3282 3286 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)); 3286 3290 return rc; 3287 3291 } 3288 3292 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), 3292 3296 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))) 3295 3298 return 1; 3296 3299 -
vendor/current/source4/client/tests/test_smbclient.sh
r414 r740 117 117 118 118 # do some simple operations using old protocol versions 119 runcmd "List directory with LANMAN1" 'ls' -m LANMAN1 || failed=`expr $failed + 1`120 runcmd "List directory with LANMAN2" 'ls' -m LANMAN2 || failed=`expr $failed + 1`119 runcmd "List directory with LANMAN1" 'ls' -m LANMAN1 --option=clientntlmv2auth=no || failed=`expr $failed + 1` 120 runcmd "List directory with LANMAN2" 'ls' -m LANMAN2 --option=clientntlmv2auth=no || failed=`expr $failed + 1` 121 121 122 122 runcmd "Print current working directory" 'pwd'|| failed=`expr $failed + 1`
Note:
See TracChangeset
for help on using the changeset viewer.