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
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
current_user.vuid = UID_FIELD_INVALID;
TALLOC_FREE(pass);
- pass = NULL;
- return True;
+ return true;
}
/*******************************************************************