From 9441d1ba87313e0ecc6e6971a25e7ad0c280fdd7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 12 Nov 2007 18:12:26 -0800 Subject: More pstring removal from smbd/*.c Jeremy. (This used to be commit 01663c2312467ceebeb2e2fb1aa432ad96c626e5) --- source3/smbd/map_username.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'source3') 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; } -- cgit