From 2742ec0e34c06ded2885aa2607f1c1729a57b034 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Tue, 3 May 2011 12:16:16 +1000 Subject: Remove strlower_m() and strupper_m() from source4 and common code. This function is problematic because a string may expand in size when changed into upper or lower case. This will then push characters off the end of the string in the s3 implementation, or panic in the former s4 implementation. Andrew Bartlett --- source4/client/client.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'source4/client/client.c') diff --git a/source4/client/client.c b/source4/client/client.c index c6c0088b3c..923a6f3a23 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -696,11 +696,12 @@ static int do_get(struct smbclient_context *ctx, char *rname, const char *p_lnam char *lname; - lname = talloc_strdup(ctx, p_lname); GetTimeOfDay(&tp_start); if (ctx->lowercase) { - strlower(lname); + lname = strlower_talloc(ctx, p_lname); + } else { + lname = talloc_strdup(ctx, p_lname); } fnum = smbcli_open(ctx->cli->tree, rname, O_RDONLY, DENY_NONE); @@ -884,13 +885,14 @@ static void do_mget(struct smbclient_context *ctx, struct clilist_file_info *fin ctx->remote_cur_dir = talloc_asprintf_append_buffer(NULL, "%s\\", finfo->name); - l_fname = talloc_strdup(ctx, finfo->name); - - string_replace(l_fname, '\\', '/'); if (ctx->lowercase) { - strlower(l_fname); + l_fname = strlower_talloc(ctx, finfo->name); + } else { + l_fname = talloc_strdup(ctx, finfo->name); } + string_replace(l_fname, '\\', '/'); + if (!directory_exist(l_fname) && mkdir(l_fname, 0777) != 0) { d_printf("failed to create directory %s\n", l_fname); -- cgit From 017e0c8d95fe8212b006e1c14aef8d96fed30674 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 3 May 2011 13:10:01 -0700 Subject: Fix simple uses of safe_strcpy -> strlcpy. Easy ones where we just remove -1. --- source4/client/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/client/client.c') diff --git a/source4/client/client.c b/source4/client/client.c index 923a6f3a23..a226982296 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -473,8 +473,8 @@ static void add_to_do_list_queue(const char* entry) } if (do_list_queue) { - safe_strcpy(do_list_queue + do_list_queue_end, entry, - do_list_queue_size - do_list_queue_end - 1); + strlcpy(do_list_queue + do_list_queue_end, entry ? entry : "", + do_list_queue_size - do_list_queue_end); do_list_queue_end = new_end; DEBUG(4,("added %s to do_list_queue (start=%d, end=%d)\n", entry, (int)do_list_queue_start, (int)do_list_queue_end)); -- cgit From 3892112e7b3143f808932771a7b71f4fd335f8cb Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 4 May 2011 20:53:33 +1000 Subject: lib/util Rename ms_fnmatch() to ms_fnmatch_protocol() to avoid dup symbol This verison of the function takes a protcol as argument to determine matching rules. Andrew Bartlett --- source4/client/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/client/client.c') diff --git a/source4/client/client.c b/source4/client/client.c index a226982296..27535a1cd3 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -309,12 +309,12 @@ static bool mask_match(struct smbcli_state *c, const char *string, return false; if (is_case_sensitive) - return ms_fnmatch(pattern, string, + return ms_fnmatch_protocol(pattern, string, c->transport->negotiate.protocol) == 0; p2 = strlower_talloc(NULL, pattern); s2 = strlower_talloc(NULL, string); - ret = ms_fnmatch(p2, s2, c->transport->negotiate.protocol) == 0; + ret = ms_fnmatch_protocol(p2, s2, c->transport->negotiate.protocol) == 0; talloc_free(p2); talloc_free(s2); -- cgit From 907cdb5de7f16a2540299aeba211bf2a5ae6fafe Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 6 Jun 2011 14:58:28 +1000 Subject: s4-modules Remove lp_ctx from init functions that no longer need it Now that we don't allow the smb.conf to change the modules dir, many functions that simply load modules or initialise a subsytem that may load modules no longer need an lp_ctx. Andrew Bartlett --- source4/client/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/client/client.c') diff --git a/source4/client/client.c b/source4/client/client.c index 27535a1cd3..2f353aec4e 100644 --- a/source4/client/client.c +++ b/source4/client/client.c @@ -3233,7 +3233,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, } } - gensec_init(cmdline_lp_ctx); + gensec_init(); if(poptPeekArg(pc)) { char *s = strdup(poptGetArg(pc)); -- cgit