summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-12 18:12:26 -0800
committerJeremy Allison <jra@samba.org>2007-11-12 18:12:26 -0800
commit9441d1ba87313e0ecc6e6971a25e7ad0c280fdd7 (patch)
treeba86d1917085b23a0f84e06e0d5e94e02b0a2a9d /source3
parentd5791deefaa8ef67ee0573cd41f5eb22b37261a9 (diff)
downloadsamba-9441d1ba87313e0ecc6e6971a25e7ad0c280fdd7.tar.gz
samba-9441d1ba87313e0ecc6e6971a25e7ad0c280fdd7.tar.bz2
samba-9441d1ba87313e0ecc6e6971a25e7ad0c280fdd7.zip
More pstring removal from smbd/*.c
Jeremy. (This used to be commit 01663c2312467ceebeb2e2fb1aa432ad96c626e5)
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/map_username.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/source3/smbd/map_username.c b/source3/smbd/map_username.c
index d9ad81a3e1..c04e0f1ae2 100644
--- a/source3/smbd/map_username.c
+++ b/source3/smbd/map_username.c
@@ -39,30 +39,36 @@ bool map_username(fstring user)
XFILE *f;
char *mapfile = lp_username_map();
char *s;
- pstring buf;
+ char buf[512];
bool mapped_user = False;
char *cmd = lp_username_map_script();
-
+
if (!*user)
- return False;
-
+ return false;
+
if (strequal(user,last_to))
- return False;
+ return false;
if (strequal(user,last_from)) {
DEBUG(3,("Mapped user %s to %s\n",user,last_to));
fstrcpy(user,last_to);
- return True;
+ return true;
}
-
+
/* first try the username map script */
-
+
if ( *cmd ) {
char **qlines;
- pstring command;
+ char *command = NULL;
int numlines, ret, fd;
- pstr_sprintf( command, "%s \"%s\"", cmd, user );
+ command = talloc_asprintf(talloc_tos(),
+ "%s \"%s\"",
+ cmd,
+ user);
+ if (!command) {
+ return false;
+ }
DEBUG(10,("Running [%s]\n", command));
ret = smbrun(command, &fd);
@@ -87,7 +93,7 @@ bool map_username(fstring user)
}
file_lines_free(qlines);
-
+
return numlines != 0;
}