diff options
author | Andrew Bartlett <abartlet@samba.org> | 2003-04-23 13:27:35 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2003-04-23 13:27:35 +0000 |
commit | 2a3a9f0bf43c3bf99a71f7296bb5ff6199893fea (patch) | |
tree | 44885a8b68275050bed851eca36937f19317eb3e /source3/smbd | |
parent | 13b54b9cfad9519f63f35fa284ce1c82b73d656a (diff) | |
download | samba-2a3a9f0bf43c3bf99a71f7296bb5ff6199893fea.tar.gz samba-2a3a9f0bf43c3bf99a71f7296bb5ff6199893fea.tar.bz2 samba-2a3a9f0bf43c3bf99a71f7296bb5ff6199893fea.zip |
Merge the 'safe' parts of my StrnCpy patch - many of the users really wanted
a pstrcpy/fstrcpy or at most a safe_strcpy().
These have the advantage of being compiler-verifiable.
Get these out of the way, along with a rewrite of 'get_short_archi' in the
spoolss client and server. (This pushes around const string pointers, rather
than copied strings).
Andrew Bartlett
(This used to be commit 32fb801ddc035e8971e9911ed4b6e51892e9d1cc)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/open.c | 2 | ||||
-rw-r--r-- | source3/smbd/password.c | 6 | ||||
-rw-r--r-- | source3/smbd/reply.c | 2 | ||||
-rw-r--r-- | source3/smbd/service.c | 7 | ||||
-rw-r--r-- | source3/smbd/statcache.c | 12 |
5 files changed, 9 insertions, 20 deletions
diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 5e4f3caca7..9e49a0bc22 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -73,7 +73,7 @@ static void check_for_pipe(char *fname) { /* special case of pipe opens */ char s[10]; - StrnCpy(s,fname,sizeof(s)-1); + safe_strcpy(s,fname,sizeof(s)-1); strlower(s); if (strstr(s,"pipe/")) { DEBUG(3,("Rejecting named pipe open for %s\n",fname)); diff --git a/source3/smbd/password.c b/source3/smbd/password.c index b47dcc0a97..8dff42471f 100644 --- a/source3/smbd/password.c +++ b/source3/smbd/password.c @@ -250,7 +250,7 @@ void add_session_user(const char *user) if (!(passwd = Get_Pwnam(user))) return; - StrnCpy(suser,passwd->pw_name,sizeof(suser)-1); + fstrcpy(suser,passwd->pw_name); if (suser && *suser && !in_list(suser,session_users,False)) { @@ -448,7 +448,7 @@ and given password ok\n", user)); if (!ok && lp_username(snum)) { char *auser; pstring user_list; - StrnCpy(user_list,lp_username(snum),sizeof(pstring)); + pstrcpy(user_list,lp_username(snum)); pstring_sub(user_list,"%S",lp_servicename(snum)); @@ -478,7 +478,7 @@ and given password ok (%s)\n", user)); /* check for a normal guest connection */ if (!ok && GUEST_OK(snum)) { fstring guestname; - StrnCpy(guestname,lp_guestaccount(),sizeof(guestname)-1); + fstrcpy(guestname,lp_guestaccount()); if (Get_Pwnam(guestname)) { fstrcpy(user,guestname); ok = True; diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c index 3bb161e0cb..9577196bfe 100644 --- a/source3/smbd/reply.c +++ b/source3/smbd/reply.c @@ -3107,7 +3107,7 @@ static BOOL resolve_wildcards(const char *name1, char *name2) if (ext2[0]) { snprintf(pname2, available_space - 1, "%s.%s", root2, ext2); } else { - StrnCpy(pname2, root2, available_space - 1); + pstrcpy_base(pname2, root2, name2); } return(True); diff --git a/source3/smbd/service.c b/source3/smbd/service.c index 18a92bc82f..cfb5e0e414 100644 --- a/source3/smbd/service.c +++ b/source3/smbd/service.c @@ -486,13 +486,14 @@ static connection_struct *make_connection_snum(int snum, user_struct *vuser, pstring tmp_gname; BOOL user_must_be_member = False; - StrnCpy(tmp_gname,lp_force_group(snum),sizeof(pstring)-1); + pstrcpy(tmp_gname,lp_force_group(snum)); if (tmp_gname[0] == '+') { user_must_be_member = True; - StrnCpy(gname,&tmp_gname[1],sizeof(pstring)-2); + /* even now, tmp_gname is null terminated */ + pstrcpy(gname,&tmp_gname[1]); } else { - StrnCpy(gname,tmp_gname,sizeof(pstring)-1); + pstrcpy(gname,tmp_gname); } /* default service may be a group name */ pstring_sub(gname,"%S",lp_servicename(snum)); diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c index 0f42a3a83f..44bae48990 100644 --- a/source3/smbd/statcache.c +++ b/source3/smbd/statcache.c @@ -128,18 +128,6 @@ void stat_cache_add( const char *full_orig_name, const char *orig_translated_pat original_path_length = translated_path_length; } -#if 0 - /* - * We will only replace namelen characters - * of full_orig_name. - * StrnCpy always null terminates. - */ - - smbStrnCpy(orig_name, full_orig_name, namelen); - if(!case_sensitive) - strupper( orig_name ); -#endif - /* * Check this name doesn't exist in the cache before we * add it. |