diff options
author | Derrell Lipman <derrell@samba.org> | 2006-01-07 20:43:36 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:06:03 -0500 |
commit | 96d0d186db42c61fa907b9b24f412b834359e2d8 (patch) | |
tree | 6d6207822f15e93d4c2a207a1150439b5f1e148e /examples/libsmbclient/smbwrapper/smbsh.c | |
parent | f396e2248ad36e4ac24792f6278366b0c737f8d7 (diff) | |
download | samba-96d0d186db42c61fa907b9b24f412b834359e2d8.tar.gz samba-96d0d186db42c61fa907b9b24f412b834359e2d8.tar.bz2 samba-96d0d186db42c61fa907b9b24f412b834359e2d8.zip |
r12759: r12128@cabra: derrell | 2006-01-07 15:34:01 -0500
Incorporate a number of changes suggested by David Collier-Brown Thanks, David!
(This used to be commit 0ae65b9af566e02eece9bb7865047c037468d470)
Diffstat (limited to 'examples/libsmbclient/smbwrapper/smbsh.c')
-rw-r--r-- | examples/libsmbclient/smbwrapper/smbsh.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/examples/libsmbclient/smbwrapper/smbsh.c b/examples/libsmbclient/smbwrapper/smbsh.c index 7b33de766f..23b1ac26c7 100644 --- a/examples/libsmbclient/smbwrapper/smbsh.c +++ b/examples/libsmbclient/smbwrapper/smbsh.c @@ -28,6 +28,7 @@ #include <limits.h> #include <string.h> #include <libsmbclient.h> +#include "bsd-strlfunc.h" #ifndef FALSE # define FALSE (0) @@ -67,13 +68,13 @@ int main(int argc, char *argv[]) switch (opt) { case 'p': /* prepend library before smbwrapper.so */ if (*pre != '\0') - strncat(pre, " ", PATH_MAX - strlen(pre)); - strncat(pre, optarg, PATH_MAX - strlen(pre)); + smbw_strlcat(pre, " ", sizeof(pre)); + smbw_strlcat(pre, optarg, sizeof(pre)); break; case 'a': /* append library after smbwrapper.so */ - strncat(post, " ", PATH_MAX - strlen(post)); - strncat(post, optarg, PATH_MAX - strlen(post)); + smbw_strlcat(post, " ", sizeof(post)); + smbw_strlcat(post, optarg, sizeof(post)); break; case 'd': @@ -121,20 +122,22 @@ int main(int argc, char *argv[]) } } - strncpy(line, pre, PATH_MAX - strlen(line)); - strncat(line, " ", PATH_MAX - strlen(line)); - strncat(line, libd, PATH_MAX - strlen(line)); - strncat(line, "/smbwrapper.so", PATH_MAX - strlen(line)); - strncat(line, post, PATH_MAX - strlen(line)); + smbw_strlcpy(line, pre, PATH_MAX - strlen(line)); + smbw_strlcat(line, " ", sizeof(line)); + smbw_strlcat(line, libd, sizeof(line)); + smbw_strlcat(line, "/smbwrapper.so", sizeof(line)); + smbw_strlcat(line, post, sizeof(line)); setenv("LD_PRELOAD", line, TRUE); setenv("LD_BIND_NOW", "true", TRUE); snprintf(line,sizeof(line)-1,"%s/smbwrapper.32.so", libd); if (stat(line, &statbuf) == 0 && S_ISREG(statbuf.st_mode)) { - snprintf(line,sizeof(line)-1,"%s/smbwrapper.32.so:DEFAULT", libd); + snprintf(line, sizeof(line)-1, + "%s/smbwrapper.32.so:DEFAULT", libd); setenv("_RLD_LIST", line, TRUE); - snprintf(line,sizeof(line)-1,"%s/smbwrapper.so:DEFAULT", libd); + snprintf(line, sizeof(line)-1, + "%s/smbwrapper.so:DEFAULT", libd); setenv("_RLDN32_LIST", line, TRUE); } else { snprintf(line,sizeof(line)-1,"%s/smbwrapper.so:DEFAULT", libd); |