summaryrefslogtreecommitdiff
path: root/source3/smbd/message.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-13 12:51:31 -0800
committerJeremy Allison <jra@samba.org>2007-11-13 12:51:31 -0800
commit052efa9a33d7a9a3b9ae9b038f6b3943c85c4bfc (patch)
treefcfd470f6db1ac8262e76f1bd29af2db5e2b4aee /source3/smbd/message.c
parentb2f942cfe2672fac9449ce730b18cf7b5fc6e1f0 (diff)
downloadsamba-052efa9a33d7a9a3b9ae9b038f6b3943c85c4bfc.tar.gz
samba-052efa9a33d7a9a3b9ae9b038f6b3943c85c4bfc.tar.bz2
samba-052efa9a33d7a9a3b9ae9b038f6b3943c85c4bfc.zip
Remove last pstring from smbd/*.c
Jeremy. (This used to be commit f1680bada913af4eaf5c0d686983018d6c8b3e5f)
Diffstat (limited to 'source3/smbd/message.c')
-rw-r--r--source3/smbd/message.c51
1 files changed, 40 insertions, 11 deletions
diff --git a/source3/smbd/message.c b/source3/smbd/message.c
index b044b6f92d..12a4bc0d54 100644
--- a/source3/smbd/message.c
+++ b/source3/smbd/message.c
@@ -38,7 +38,8 @@ static fstring msgto;
static void msg_deliver(void)
{
- pstring name;
+ TALLOC_CTX *ctx = talloc_tos();
+ char *name = NULL;
int i;
int fd;
char *msg;
@@ -52,7 +53,10 @@ static void msg_deliver(void)
}
/* put it in a temporary file */
- slprintf(name,sizeof(name)-1, "%s/msg.XXXXXX",tmpdir());
+ name = talloc_asprintf(ctx, "%s/msg.XXXXXX",tmpdir());
+ if (!name) {
+ return;
+ }
fd = smb_mkstemp(name);
if (fd == -1) {
@@ -63,7 +67,7 @@ static void msg_deliver(void)
/*
* Incoming message is in DOS codepage format. Convert to UNIX.
*/
-
+
if ((len = (int)convert_string_allocate(NULL,CH_DOS, CH_UNIX, msgbuf, msgpos, (void **)(void *)&msg, True)) < 0 || !msg) {
DEBUG(3,("Conversion failed, delivering message in DOS codepage format\n"));
for (i = 0; i < msgpos;) {
@@ -95,14 +99,39 @@ static void msg_deliver(void)
if (*lp_msg_command()) {
fstring alpha_msgfrom;
fstring alpha_msgto;
- pstring s;
-
- pstrcpy(s,lp_msg_command());
- pstring_sub(s,"%f",alpha_strcpy(alpha_msgfrom,msgfrom,NULL,sizeof(alpha_msgfrom)));
- pstring_sub(s,"%t",alpha_strcpy(alpha_msgto,msgto,NULL,sizeof(alpha_msgto)));
- standard_sub_basic(current_user_info.smb_name,
- current_user_info.domain, s, sizeof(s));
- pstring_sub(s,"%s",name);
+ char *s = talloc_strdup(ctx,
+ lp_msg_command());
+
+ if (!s) {
+ return;
+ }
+ s = talloc_string_sub(ctx, s, "%f",
+ alpha_strcpy(alpha_msgfrom,
+ msgfrom,
+ NULL,
+ sizeof(alpha_msgfrom)));
+ if (!s) {
+ return;
+ }
+ s = talloc_string_sub(ctx, s, "%t",
+ alpha_strcpy(alpha_msgto,
+ msgto,
+ NULL,
+ sizeof(alpha_msgto)));
+ if (!s) {
+ return;
+ }
+ s = talloc_sub_basic(ctx,
+ current_user_info.smb_name,
+ current_user_info.domain,
+ s);
+ if (!s) {
+ return;
+ }
+ s = talloc_string_sub(ctx, s, "%s",name);
+ if (!s) {
+ return;
+ }
smbrun(s,NULL);
}