summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-01-08 09:04:30 +0100
committerStefan Metzmacher <metze@samba.org>2009-01-08 12:22:19 +0100
commit0a0cd1396a0572dd1f04e8fdd99f682e4e4f91ee (patch)
tree8dad76ff3aef7439bbcae2a0e48bc9c1150d5439 /source3
parent9ae0c5e5a7375ef58e4dff84eb154be77564d205 (diff)
downloadsamba-0a0cd1396a0572dd1f04e8fdd99f682e4e4f91ee.tar.gz
samba-0a0cd1396a0572dd1f04e8fdd99f682e4e4f91ee.tar.bz2
samba-0a0cd1396a0572dd1f04e8fdd99f682e4e4f91ee.zip
s3:smbd: remove pointless static variable in uid.c
We always free the value at the end of the function, so we don't need a static variable to hold just NULL for the time the function isn't executed. metze
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/uid.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/source3/smbd/uid.c b/source3/smbd/uid.c
index 5a4b8a52e7..82204e97e9 100644
--- a/source3/smbd/uid.c
+++ b/source3/smbd/uid.c
@@ -28,13 +28,11 @@ extern struct current_user current_user;
bool change_to_guest(void)
{
- static struct passwd *pass=NULL;
+ struct passwd *pass;
+ pass = getpwnam_alloc(talloc_autofree_context(), lp_guestaccount());
if (!pass) {
- /* Don't need to free() this as its stored in a static */
- pass = getpwnam_alloc(talloc_autofree_context(), lp_guestaccount());
- if (!pass)
- return(False);
+ return false;
}
#ifdef AIX
@@ -49,9 +47,8 @@ bool change_to_guest(void)
current_user.vuid = UID_FIELD_INVALID;
TALLOC_FREE(pass);
- pass = NULL;
- return True;
+ return true;
}
/*******************************************************************