From 1b92ea5559bfa00016103508feac9a06ea4b66ae Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 6 Dec 2007 17:16:33 -0800 Subject: Remove pstrings from client/client.c by doing a large rewrite. Mostly compiles.... Jeremy. (This used to be commit c87f3eba9aa52f4ab25d77e2167262bf5c43b1a6) --- source3/include/client.h | 5 ++-- source3/include/popt_common.h | 4 +-- source3/include/safe_string.h | 59 ++++++++++++++++++++++++++++++++++--------- 3 files changed, 51 insertions(+), 17 deletions(-) (limited to 'source3/include') diff --git a/source3/include/client.h b/source3/include/client.h index c601e1a91c..0047b2bf23 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -142,7 +142,7 @@ struct cli_state { smb_sign_info sign_info; - /* the session key for this CLI, outside + /* the session key for this CLI, outside any per-pipe authenticaion */ DATA_BLOB user_session_key; @@ -173,8 +173,7 @@ typedef struct file_info { struct timespec mtime_ts; struct timespec atime_ts; struct timespec ctime_ts; - char name[1024]; - char dir[1024]; /* Should use allocated PATH_MAX here.... */ + char *name; char short_name[13*3]; /* the *3 is to cope with multi-byte */ } file_info; diff --git a/source3/include/popt_common.h b/source3/include/popt_common.h index 274cd1ba70..86faa144f3 100644 --- a/source3/include/popt_common.h +++ b/source3/include/popt_common.h @@ -42,8 +42,8 @@ extern const struct poptOption popt_common_dynconfig[]; "Build-time configuration overrides:", NULL }, struct user_auth_info { - pstring username; - pstring password; + char *username; + char *password; bool got_pass; bool use_kerberos; int signing_state; diff --git a/source3/include/safe_string.h b/source3/include/safe_string.h index 53ee7d312e..439a0cf760 100644 --- a/source3/include/safe_string.h +++ b/source3/include/safe_string.h @@ -128,18 +128,53 @@ size_t __unsafe_string_function_usage_here_char__(void); * long. This is not a good situation, because we can't do the normal * sanity checks. Don't use in new code! */ -#define overmalloc_safe_strcpy(dest,src,maxlength) safe_strcpy_fn(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE,dest,src,maxlength) -#define safe_strcpy(dest,src,maxlength) safe_strcpy_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE,dest,src,maxlength) -#define safe_strcat(dest,src,maxlength) safe_strcat_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE,dest,src,maxlength) -#define push_string(base_ptr, dest, src, dest_len, flags) push_string_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, base_ptr, 0, dest, src, dest_len, flags) -#define pull_string(base_ptr, smb_flags2, dest, src, dest_len, src_len, flags) pull_string_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, base_ptr, smb_flags2, dest, src, dest_len, src_len, flags) -#define pull_string_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags) pull_string_talloc_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, ctx, base_ptr, smb_flags2, dest, src, src_len, flags) -#define clistr_push(cli, dest, src, dest_len, flags) clistr_push_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, cli, dest, src, dest_len, flags) -#define clistr_pull(cli, dest, src, dest_len, src_len, flags) clistr_pull_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, cli, dest, src, dest_len, src_len, flags) -#define srvstr_push(base_ptr, smb_flags2, dest, src, dest_len, flags) srvstr_push_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, base_ptr, smb_flags2, dest, src, dest_len, flags) - -#define alpha_strcpy(dest,src,other_safe_chars,maxlength) alpha_strcpy_fn(SAFE_STRING_FUNCTION_NAME,SAFE_STRING_LINE,dest,src,other_safe_chars,maxlength) -#define StrnCpy(dest,src,n) StrnCpy_fn(SAFE_STRING_FUNCTION_NAME,SAFE_STRING_LINE,dest,src,n) +#define overmalloc_safe_strcpy(dest,src,maxlength) \ + safe_strcpy_fn(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + dest,src,maxlength) + +#define safe_strcpy(dest,src,maxlength) \ + safe_strcpy_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + dest,src,maxlength) + +#define safe_strcat(dest,src,maxlength) \ + safe_strcat_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + dest,src,maxlength) + +#define push_string(base_ptr, dest, src, dest_len, flags) \ + push_string_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + base_ptr, 0, dest, src, dest_len, flags) + +#define pull_string(base_ptr, smb_flags2, dest, src, dest_len, src_len, flags) \ + pull_string_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + base_ptr, smb_flags2, dest, src, dest_len, src_len, flags) + +#define pull_string_talloc(ctx, base_ptr, smb_flags2, dest, src, src_len, flags) \ + pull_string_talloc_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + ctx, base_ptr, smb_flags2, dest, src, src_len, flags) + +#define clistr_push(cli, dest, src, dest_len, flags) \ + clistr_push_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + cli, dest, src, dest_len, flags) + +#define clistr_pull(cli, dest, src, dest_len, src_len, flags) \ + clistr_pull_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + cli, dest, src, dest_len, src_len, flags) + +#define clistr_pull_talloc(ctx, cli, pp_dest, src, src_len, flags) \ + clistr_pull_talloc_fn(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + ctx, cli, pp_dest, src, src_len, flags) + +#define srvstr_push(base_ptr, smb_flags2, dest, src, dest_len, flags) \ + srvstr_push_fn2(SAFE_STRING_FUNCTION_NAME, SAFE_STRING_LINE, \ + base_ptr, smb_flags2, dest, src, dest_len, flags) + +#define alpha_strcpy(dest,src,other_safe_chars,maxlength) \ + alpha_strcpy_fn(SAFE_STRING_FUNCTION_NAME,SAFE_STRING_LINE, \ + dest,src,other_safe_chars,maxlength) + +#define StrnCpy(dest,src,n) \ + StrnCpy_fn(SAFE_STRING_FUNCTION_NAME,SAFE_STRING_LINE, \ + dest,src,n) #ifdef HAVE_COMPILER_WILL_OPTIMIZE_OUT_FNS -- cgit