diff options
author | Volker Lendecke <vl@samba.org> | 2009-10-17 17:00:13 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-10-17 17:13:02 +0200 |
commit | 3e3214fd91471bca5b6c4d3782e922d252d588fb (patch) | |
tree | 28e8d4705baba0214987875c0b47fe04b905fa9a /source3/winbindd/wb_fill_pwent.c | |
parent | 46b7938d7e66c2ce25e605cd7c579f905c146616 (diff) | |
download | samba-3e3214fd91471bca5b6c4d3782e922d252d588fb.tar.gz samba-3e3214fd91471bca5b6c4d3782e922d252d588fb.tar.bz2 samba-3e3214fd91471bca5b6c4d3782e922d252d588fb.zip |
s3:winbind: Move fillup_pw_field() as static to wb_fill_pwent.c
Diffstat (limited to 'source3/winbindd/wb_fill_pwent.c')
-rw-r--r-- | source3/winbindd/wb_fill_pwent.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/source3/winbindd/wb_fill_pwent.c b/source3/winbindd/wb_fill_pwent.c index 4f4819ca23..8998bf991d 100644 --- a/source3/winbindd/wb_fill_pwent.c +++ b/source3/winbindd/wb_fill_pwent.c @@ -27,6 +27,14 @@ struct wb_fill_pwent_state { struct winbindd_pw *pw; }; +static bool fillup_pw_field(const char *lp_template, + const char *username, + const char *domname, + uid_t uid, + gid_t gid, + const char *in, + fstring out); + static void wb_fill_pwent_sid2uid_done(struct tevent_req *subreq); static void wb_fill_pwent_sid2gid_done(struct tevent_req *subreq); @@ -153,3 +161,42 @@ NTSTATUS wb_fill_pwent_recv(struct tevent_req *req) { return tevent_req_simple_recv_ntstatus(req); } + +static bool fillup_pw_field(const char *lp_template, + const char *username, + const char *domname, + uid_t uid, + gid_t gid, + const char *in, + fstring out) +{ + char *templ; + + 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. */ + + if ((in != NULL) && (in[0] != '\0') && (lp_security() == SEC_ADS)) { + templ = talloc_sub_specified(talloc_tos(), in, + username, domname, + uid, gid); + } else { + templ = talloc_sub_specified(talloc_tos(), lp_template, + username, domname, + uid, gid); + } + + if (!templ) + return False; + + safe_strcpy(out, templ, sizeof(fstring) - 1); + TALLOC_FREE(templ); + + return True; + +} |