diff options
author | Jeremy Allison <jra@samba.org> | 2007-12-03 18:48:41 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-12-03 18:48:41 -0800 |
commit | adf6d848de8ae32a83c7271d8ccd24d2cf8b47f7 (patch) | |
tree | a6b9ac6f4175a10b4e71829d61db9e076aad969e /source3/utils/smbtree.c | |
parent | 328a57e1ca5fc0e0206fdb565d5951912e84dc5e (diff) | |
download | samba-adf6d848de8ae32a83c7271d8ccd24d2cf8b47f7.tar.gz samba-adf6d848de8ae32a83c7271d8ccd24d2cf8b47f7.tar.xz samba-adf6d848de8ae32a83c7271d8ccd24d2cf8b47f7.zip |
Getting to the home stretch for elimination of pstrings...
Jeremy.
(This used to be commit 041163551194102ca67fef52c57d87020a1d09bc)
Diffstat (limited to 'source3/utils/smbtree.c')
-rw-r--r-- | source3/utils/smbtree.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c index bcacddc414..23090013a3 100644 --- a/source3/utils/smbtree.c +++ b/source3/utils/smbtree.c @@ -32,7 +32,7 @@ static enum tree_level level = LEV_SHARE; struct name_list { struct name_list *prev, *next; - pstring name, comment; + char *name, *comment; uint32 server_type; }; @@ -57,10 +57,17 @@ static void add_name(const char *machine_name, uint32 server_type, ZERO_STRUCTP(new_name); - pstrcpy(new_name->name, machine_name); - pstrcpy(new_name->comment, comment); + new_name->name = SMB_STRDUP(machine_name); + new_name->comment = SMB_STRDUP(comment); new_name->server_type = server_type; + if (!new_name->name || !new_name->comment) { + SAFE_FREE(new_name->name); + SAFE_FREE(new_name->comment); + SAFE_FREE(new_name); + return; + } + DLIST_ADD(*name_list, new_name); } @@ -199,7 +206,7 @@ static bool get_shares(char *server_name, struct user_auth_info *user_info) if (get_rpc_shares(cli, add_name, &shares)) return True; - + if (!cli_RNetShareEnum(cli, add_name, &shares)) return False; @@ -268,7 +275,7 @@ static bool print_tree(struct user_auth_info *user_info) POPT_TABLEEND }; poptContext pc; - + /* Initialise samba stuff */ load_case_tables(); @@ -278,7 +285,7 @@ static bool print_tree(struct user_auth_info *user_info) setup_logging(argv[0],True); - pc = poptGetContext("smbtree", argc, (const char **)argv, long_options, + pc = poptGetContext("smbtree", argc, (const char **)argv, long_options, POPT_CONTEXT_KEEP_FIRST); while(poptGetNextOpt(pc) != -1); poptFreeContext(pc); @@ -291,9 +298,11 @@ static bool print_tree(struct user_auth_info *user_info) if (!cmdline_auth_info.got_pass) { char *pass = getpass("Password: "); if (pass) { - pstrcpy(cmdline_auth_info.password, pass); + strlcpy(cmdline_auth_info.password, + pass, + sizeof(cmdline_auth_info.password)); } - cmdline_auth_info.got_pass = True; + cmdline_auth_info.got_pass = true; } /* Now do our stuff */ |