summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-01-30 14:24:06 +0000
committerVolker Lendecke <vl@samba.org>2014-02-05 13:47:52 +0100
commit0ce46318715577bd8273ed9c0880be54542f227f (patch)
tree8f65ed99b23eb939d967d98ea196b41c2571901b /source3
parent741e5dca09053d0fc9a6e2a112113f1828a95759 (diff)
downloadsamba-0ce46318715577bd8273ed9c0880be54542f227f.tar.gz
samba-0ce46318715577bd8273ed9c0880be54542f227f.tar.xz
samba-0ce46318715577bd8273ed9c0880be54542f227f.zip
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
Diffstat (limited to 'source3')
-rw-r--r--source3/winbindd/wb_fill_pwent.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c
index 359946f172..c1f83e5e91 100644
--- a/source3/winbindd/wb_fill_pwent.c
+++ b/source3/winbindd/wb_fill_pwent.c
@@ -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;