summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-11 21:46:52 -0800
committerJeremy Allison <jra@samba.org>2007-11-11 21:46:52 -0800
commitd068bc64b6f16bc0b4a8170b56f6aadd487d7203 (patch)
tree13f578c3343d7330a907a8510d3b1730879328bf /source3
parent91c1933e675ed8bc0a0fad49a6f651273f29df95 (diff)
downloadsamba-d068bc64b6f16bc0b4a8170b56f6aadd487d7203.tar.gz
samba-d068bc64b6f16bc0b4a8170b56f6aadd487d7203.tar.bz2
samba-d068bc64b6f16bc0b4a8170b56f6aadd487d7203.zip
Three more pstring removals.
Jeremy. (This used to be commit c15819b75751a1e15cfed2ef94dae10ee72d769c)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/chgpasswd.c10
-rw-r--r--source3/smbd/process.c12
-rw-r--r--source3/smbd/server.c3
3 files changed, 17 insertions, 8 deletions
diff --git a/source3/smbd/chgpasswd.c b/source3/smbd/chgpasswd.c
index d89442150f..6e7ef208c1 100644
--- a/source3/smbd/chgpasswd.c
+++ b/source3/smbd/chgpasswd.c
@@ -262,14 +262,18 @@ static int expect(int master, char *issue, char *expected)
{
/* Eat leading/trailing whitespace before match. */
- pstring str;
- pstrcpy( str, buffer);
- trim_char( str, ' ', ' ');
+ char *str = SMB_STRDUP(buffer);
+ if (!str) {
+ DEBUG(2,("expect: ENOMEM\n"));
+ return False;
+ }
+ trim_char(str, ' ', ' ');
if ((match = unix_wild_match(expected, str)) == True) {
/* Now data has started to return, lower timeout. */
timeout = lp_passwd_chat_timeout() * 100;
}
+ SAFE_FREE(str);
}
}
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 5601a7fb6e..ffc9e106f6 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -1260,13 +1260,18 @@ void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes)
static void smb_dump(const char *name, int type, const char *data, ssize_t len)
{
int fd, i;
- pstring fname;
- if (DEBUGLEVEL < 50) return;
+ char *fname = NULL;
+ if (DEBUGLEVEL < 50) {
+ return;
+ }
if (len < 4) len = smb_len(data)+4;
for (i=1;i<100;i++) {
- slprintf(fname,sizeof(fname)-1, "/tmp/%s.%d.%s", name, i,
+ asprintf(&fname, "/tmp/%s.%d.%s", name, i,
type ? "req" : "resp");
+ if (!fname) {
+ return;
+ }
fd = open(fname, O_WRONLY|O_CREAT|O_EXCL, 0644);
if (fd != -1 || errno != EEXIST) break;
}
@@ -1277,6 +1282,7 @@ static void smb_dump(const char *name, int type, const char *data, ssize_t len)
close(fd);
DEBUG(0,("created %s len %lu\n", fname, (unsigned long)len));
}
+ SAFE_FREE(fname);
}
/****************************************************************************
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index e89a94599e..028dacc27e 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -728,8 +728,7 @@ bool reload_services(bool test)
bool ret;
if (lp_loaded()) {
- pstring fname;
- pstrcpy(fname,lp_configfile());
+ char *fname = lp_configfile();
if (file_exist(fname, NULL) &&
!strcsequal(fname, dyn_CONFIGFILE)) {
pstrcpy(dyn_CONFIGFILE, fname);