diff options
Diffstat (limited to 'source3/client')
-rw-r--r-- | source3/client/client.c | 11 | ||||
-rw-r--r-- | source3/client/clitar.c | 50 | ||||
-rw-r--r-- | source3/client/smbmount.c | 2 |
3 files changed, 30 insertions, 33 deletions
diff --git a/source3/client/client.c b/source3/client/client.c index 1248c25659..5da12fd984 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -1291,7 +1291,7 @@ static int file_find(struct file_list **list, const char *directory, int ret; char *path; BOOL isdir; - const char *dname; + char *dname; dir = opendir(directory); if (!dir) return -1; @@ -2269,9 +2269,6 @@ static void readline_callback(void) last_t = t; - if (cli->fd == -1) - return; - again: FD_ZERO(&fds); FD_SET(cli->fd,&fds); @@ -2349,7 +2346,7 @@ static struct cli_state *do_connect(const char *server, const char *share) char *sharename; /* make a copy so we don't modify the global string 'service' */ - fstrcpy(servicename, share); + safe_strcpy(servicename, share, sizeof(servicename)-1); sharename = servicename; if (*sharename == '\\') { server = sharename+2; @@ -2624,9 +2621,9 @@ static int do_message_op(void) make_nmb_name(&calling, global_myname(), 0x0); make_nmb_name(&called , desthost, name_type); - fstrcpy(server_name, desthost); + safe_strcpy(server_name, desthost, sizeof(server_name)); snprintf(name_type_hex, sizeof(name_type_hex), "#%X", name_type); - fstrcat(server_name, name_type_hex); + safe_strcat(server_name, name_type_hex, sizeof(server_name)); zero_ip(&ip); if (have_ip) ip = dest_ip; diff --git a/source3/client/clitar.c b/source3/client/clitar.c index dfda997ca2..612a383ce0 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -202,7 +202,7 @@ static void writetarheader(int f, const char *aname, SMB_BIG_UINT size, time_t m /* write out a "standard" tar format header */ hb.dbuf.name[NAMSIZ-1]='\0'; - safe_strcpy(hb.dbuf.mode, amode, sizeof(hb.dbuf.mode)-1); + safe_strcpy(hb.dbuf.mode, amode, strlen(amode)); oct_it((SMB_BIG_UINT)0, 8, hb.dbuf.uid); oct_it((SMB_BIG_UINT)0, 8, hb.dbuf.gid); oct_it((SMB_BIG_UINT) size, 13, hb.dbuf.size); @@ -796,11 +796,11 @@ static void do_tar(file_info *finfo) DEBUG(5, ("Excl: strlen(cur_dir) = %d\n", (int)strlen(cur_dir))); - pstrcpy(exclaim, cur_dir); + safe_strcpy(exclaim, cur_dir, sizeof(pstring)); *(exclaim+strlen(exclaim)-1)='\0'; - pstrcat(exclaim, "\\"); - pstrcat(exclaim, finfo->name); + safe_strcat(exclaim, "\\", sizeof(pstring)); + safe_strcat(exclaim, finfo->name, sizeof(exclaim)); DEBUG(5, ("...tar_re_search: %d\n", tar_re_search)); @@ -820,12 +820,12 @@ static void do_tar(file_info *finfo) pstring saved_curdir; pstring mtar_mask; - pstrcpy(saved_curdir, cur_dir); + safe_strcpy(saved_curdir, cur_dir, sizeof(saved_curdir)); DEBUG(5, ("Sizeof(cur_dir)=%d, strlen(cur_dir)=%d, strlen(finfo->name)=%d\nname=%s,cur_dir=%s\n", (int)sizeof(cur_dir), (int)strlen(cur_dir), (int)strlen(finfo->name), finfo->name, cur_dir)); - pstrcat(cur_dir,finfo->name); - pstrcat(cur_dir,"\\"); + safe_strcat(cur_dir,finfo->name, sizeof(cur_dir)); + safe_strcat(cur_dir,"\\", sizeof(cur_dir)); DEBUG(5, ("Writing a dir, Name = %s\n", cur_dir)); @@ -836,16 +836,16 @@ static void do_tar(file_info *finfo) DEBUG(0,(" directory %s\n", cur_dir)); } ntarf++; /* Make sure we have a file on there */ - pstrcpy(mtar_mask,cur_dir); - pstrcat(mtar_mask,"*"); + safe_strcpy(mtar_mask,cur_dir, sizeof(pstring)); + safe_strcat(mtar_mask,"*", sizeof(pstring)); DEBUG(5, ("Doing list with mtar_mask: %s\n", mtar_mask)); do_list(mtar_mask, attribute, do_tar, False, True); - pstrcpy(cur_dir,saved_curdir); + safe_strcpy(cur_dir,saved_curdir, sizeof(pstring)); } else { - pstrcpy(rname,cur_dir); - pstrcat(rname,finfo->name); + safe_strcpy(rname,cur_dir, sizeof(pstring)); + safe_strcat(rname,finfo->name, sizeof(pstring)); do_atar(rname,finfo->name,finfo); } } @@ -1089,7 +1089,7 @@ static char * get_longfilename(file_info2 finfo) BOOL first = True; DEBUG(5, ("Restoring a long file name: %s\n", finfo.name)); - DEBUG(5, ("Len = %.0f\n", (double)finfo.size)); + DEBUG(5, ("Len = %d\n", (int)finfo.size)); if (longname == NULL) { @@ -1362,8 +1362,8 @@ int cmd_setmode(void) return 1; } - pstrcpy(fname, cur_dir); - pstrcat(fname, buf); + safe_strcpy(fname, cur_dir, sizeof(pstring)); + safe_strcat(fname, buf, sizeof(pstring)); while (next_token_nr(NULL,buf,NULL,sizeof(buf))) { q=buf; @@ -1459,32 +1459,32 @@ int process_tar(void) if (strrchr_m(cliplist[i], '\\')) { pstring saved_dir; - pstrcpy(saved_dir, cur_dir); + safe_strcpy(saved_dir, cur_dir, sizeof(pstring)); if (*cliplist[i]=='\\') { - pstrcpy(tarmac, cliplist[i]); + safe_strcpy(tarmac, cliplist[i], sizeof(pstring)); } else { - pstrcpy(tarmac, cur_dir); - pstrcat(tarmac, cliplist[i]); + safe_strcpy(tarmac, cur_dir, sizeof(pstring)); + safe_strcat(tarmac, cliplist[i], sizeof(pstring)); } - pstrcpy(cur_dir, tarmac); + safe_strcpy(cur_dir, tarmac, sizeof(pstring)); *(strrchr_m(cur_dir, '\\')+1)='\0'; DEBUG(5, ("process_tar, do_list with tarmac: %s\n", tarmac)); do_list(tarmac,attribute,do_tar, False, True); - pstrcpy(cur_dir,saved_dir); + safe_strcpy(cur_dir,saved_dir, sizeof(pstring)); } else { - pstrcpy(tarmac, cur_dir); - pstrcat(tarmac, cliplist[i]); + safe_strcpy(tarmac, cur_dir, sizeof(pstring)); + safe_strcat(tarmac, cliplist[i], sizeof(pstring)); DEBUG(5, ("process_tar, do_list with tarmac: %s\n", tarmac)); do_list(tarmac,attribute,do_tar, False, True); } } } else { pstring mask; - pstrcpy(mask,cur_dir); + safe_strcpy(mask,cur_dir, sizeof(pstring)); DEBUG(5, ("process_tar, do_list with mask: %s\n", mask)); - pstrcat(mask,"\\*"); + safe_strcat(mask,"\\*", sizeof(pstring)); do_list(mask,attribute,do_tar,False, True); } diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index 98302485e4..e2372d02b4 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -398,7 +398,7 @@ static void send_fs_socket(char *the_service, char *mount_point, struct cli_stat } /* here we are no longer interactive */ - set_remote_machine_name("smbmount", False); /* sneaky ... */ + set_remote_machine_name("smbmount"); /* sneaky ... */ setup_logging("mount.smbfs", False); reopen_logs(); DEBUG(0, ("mount.smbfs: entering daemon mode for service %s, pid=%d\n", the_service, sys_getpid())); |