1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-13 13:18:06 +03:00

winbind3: Simplify fillup_pw_field

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Feb  5 13:47:52 CET 2014 on sn-devel-104
This commit is contained in:
Volker Lendecke 2014-01-30 14:24:06 +00:00
parent 741e5dca09
commit 0ce4631871

View File

@ -214,32 +214,31 @@ static bool fillup_pw_field(const char *lp_template,
const char *in,
fstring out)
{
char *templ;
const char *templ;
char *result;
if (out == NULL)
return False;
/* The substitution of %U and %D in the 'template
homedir' is done by talloc_sub_specified() below.
If we have an in string (which means the value has already
been set in the nss_info backend), then use that.
Otherwise use the template value passed in. */
templ = lp_template;
if ((in != NULL) && (in[0] != '\0') && (lp_security() == SEC_ADS)) {
templ = talloc_sub_specified(talloc_tos(), in,
username, grpname, domname,
uid, gid);
} else {
templ = talloc_sub_specified(talloc_tos(), lp_template,
username, grpname, domname,
uid, gid);
/*
* The backend has already filled in the required value. Use
* that instead of the template.
*/
templ = in;
}
if (!templ)
result = talloc_sub_specified(talloc_tos(), templ,
username, grpname, domname,
uid, gid);
if (result == NULL) {
return False;
}
fstrcpy(out, templ);
TALLOC_FREE(templ);
TALLOC_FREE(result);
return True;