diff options
-rw-r--r-- | source3/client/smbmount.c | 4 | ||||
-rw-r--r-- | source3/include/includes.h | 5 | ||||
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/lib/util.c | 71 | ||||
-rw-r--r-- | source3/locking/locking_slow.c | 2 | ||||
-rw-r--r-- | source3/nmbd/nmbd_winsserver.c | 2 | ||||
-rw-r--r-- | source3/utils/make_smbcodepage.c | 2 |
7 files changed, 15 insertions, 75 deletions
diff --git a/source3/client/smbmount.c b/source3/client/smbmount.c index 1610a8986b..505552997b 100644 --- a/source3/client/smbmount.c +++ b/source3/client/smbmount.c @@ -426,7 +426,7 @@ static int process_tok(fstring tok) /**************************************************************************** help ****************************************************************************/ -void cmd_help(void) +void cmd_help(char *dum_in, char *dum_out) { int i=0,j; fstring buf; @@ -636,7 +636,7 @@ static BOOL process(char *base_directory) DEBUG(0,("%s: command not found\n",CNV_LANG(tok))); } - cli_send_logout(); + cli_send_logout(InBuffer,OutBuffer); return(True); } diff --git a/source3/include/includes.h b/source3/include/includes.h index d345ea38de..ae073d1df8 100644 --- a/source3/include/includes.h +++ b/source3/include/includes.h @@ -263,6 +263,7 @@ Here come some platform specific sections #include <sys/acct.h> #include <sys/vfs.h> #include <string.h> +#include <strings.h> #include <errno.h> #include <sys/wait.h> #include <signal.h> @@ -291,6 +292,7 @@ typedef unsigned short mode_t; #define USE_SYSV_IPC /* SunOS doesn't have POSIX atexit */ #define atexit on_exit +#define NOSTRCASECMP #endif @@ -335,7 +337,6 @@ extern int innetgr (const char *, const char *, const char *, const char *); #ifndef QSORT_CAST #define QSORT_CAST (int (*)(const void *, const void *)) #endif /* QSORT_CAST */ -#define HAVE_VSNPRINTF #endif @@ -1372,7 +1373,7 @@ extern int errno; #ifdef sprintf #undef sprintf #endif /* sprintf */ -#define sprintf __ERROR__XX__NEVER_USE_SPRINTF__>; +#define sprintf __ERROR__XX__NEVER_USE_SPRINTF__; #define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1) #define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1) diff --git a/source3/include/proto.h b/source3/include/proto.h index 79d46b1e4b..e574861b65 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -860,10 +860,6 @@ void make_wks_r_query_info(WKS_R_QUERY_INFO *r_u, int status) ; void wks_io_r_query_info(char *desc, WKS_R_QUERY_INFO *r_u, prs_struct *ps, int depth); -/*The following definitions come from lib/rpc/server/srv_ldap_helpers.c */ - -void ldap_helper_dummy(void); - /*The following definitions come from lib/rpc/server/srv_lsa.c */ BOOL api_ntlsa_rpc(pipes_struct *p, prs_struct *data); diff --git a/source3/lib/util.c b/source3/lib/util.c index f1ea1931c5..1e4a6fc27f 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -3370,10 +3370,11 @@ duplicate a string char *strdup(char *s) { char *ret = NULL; + int len; if (!s) return(NULL); - ret = (char *)malloc(strlen(s)+1); + ret = (char *)malloc((len = strlen(s))+1); if (!ret) return(NULL); - pstrcpy(ret,s); + safe_strcpy(ret,s,len); return(ret); } #endif @@ -4793,68 +4794,9 @@ int unistrcpy(char *dst, char *src) return num_wchars; } -#if 0 -/******************************************************************* -safe string copy into a fstring -********************************************************************/ -void fstrcpy(char *dest, char *src) -{ - int maxlength = sizeof(fstring) - 1; - int len; - if (!dest) { - DEBUG(0,("ERROR: NULL dest in fstrcpy\n")); - return; - } - - if (!src) { - *dest = 0; - return; - } - - len = strlen(src); - - if (len > maxlength) { - DEBUG(0,("ERROR: string overflow by %d in fstrcpy [%.50s]\n", - len-maxlength, src)); - len = maxlength; - } - - memcpy(dest, src, len); - dest[len] = 0; -} - -/******************************************************************* -safe string cat into a fstring -********************************************************************/ -void fstrcat(char *dest, char *src) -{ - int maxlength = sizeof(fstring) - 1; - int src_len, dest_len; - if (!dest) { - DEBUG(0,("ERROR: NULL dest in fstrcat\n")); - return; - } - - if (!src) { - return; - } - - src_len = strlen(src); - dest_len = strlen(dest); - - if (src_len + dest_len > maxlength) { - DEBUG(0,("ERROR: string overflow by %d in fstrcat [%.50s]\n", - src_len + dest_len - maxlength, src)); - src_len = maxlength - dest_len; - } - - memcpy(&dest[dest_len], src, src_len); - dest[dest_len + src_len] = 0; -} -#endif - /******************************************************************* -safe string copy into a known length string +safe string copy into a known length string. maxlength does not +include the terminating zero. ********************************************************************/ char *safe_strcpy(char *dest, char *src, int maxlength) { @@ -4884,7 +4826,8 @@ char *safe_strcpy(char *dest, char *src, int maxlength) } /******************************************************************* -safe string cat into a string +safe string cat into a string. maxlength does not +include the terminating zero. ********************************************************************/ char *safe_strcat(char *dest, char *src, int maxlength) { diff --git a/source3/locking/locking_slow.c b/source3/locking/locking_slow.c index 635cd08e9a..183acd1f44 100644 --- a/source3/locking/locking_slow.c +++ b/source3/locking/locking_slow.c @@ -86,7 +86,7 @@ static BOOL share_name(int cnum, uint32 dev, uint32 inode, char *name) trim_string(name,"","/"); if (!*name) return(False); len = strlen(name); - name += strlen(name); + name += len; slprintf(name, sizeof(pstring) - len - 1, "/share.%u.%u",dev,inode); return(True); diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c index acab815926..e1f0fbae8f 100644 --- a/source3/nmbd/nmbd_winsserver.c +++ b/source3/nmbd/nmbd_winsserver.c @@ -1522,7 +1522,7 @@ void wins_write_database(void) if(!lp_we_are_a_wins_server()) return; - fstrcpy(fname,lp_lockdir()); + pstrcpy(fname,lp_lockdir()); trim_string(fname,NULL,"/"); pstrcat(fname,"/"); pstrcat(fname,WINS_LIST); diff --git a/source3/utils/make_smbcodepage.c b/source3/utils/make_smbcodepage.c index ce45a7bc60..b0970a7d25 100644 --- a/source3/utils/make_smbcodepage.c +++ b/source3/utils/make_smbcodepage.c @@ -94,7 +94,7 @@ int clean_data( char **buf, uint32 *size) if(*cp == '\0') continue; - pstrcpy(newbuf_p, cp); + safe_strcpy(newbuf_p, cp, *size - (newbuf_p - newbuf)); num_lines++; newbuf_p += (strlen(newbuf_p) + 1); } |