summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-09-22 10:37:11 +0200
committerMichael Adam <obnox@samba.org>2008-09-23 10:00:26 +0200
commit1b9c2ccb1f1ba4d67ee0d82f4ff89b0abd62cbe2 (patch)
tree3ba28e5030b1168dc4a7a8faa17c63231ae90e61 /source3/winbindd
parente401ce6de79e696d8dda7b56568b1565d2e21f62 (diff)
downloadsamba-1b9c2ccb1f1ba4d67ee0d82f4ff89b0abd62cbe2.tar.gz
samba-1b9c2ccb1f1ba4d67ee0d82f4ff89b0abd62cbe2.tar.bz2
samba-1b9c2ccb1f1ba4d67ee0d82f4ff89b0abd62cbe2.zip
[s3]winbindd_util: add fill_domain_username_talloc().
A talloc version of fill_domain_username(). Michael
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/winbindd_util.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c
index b296465ed5..5b5ca41a74 100644
--- a/source3/winbindd/winbindd_util.c
+++ b/source3/winbindd/winbindd_util.c
@@ -1213,6 +1213,33 @@ void fill_domain_username(fstring name, const char *domain, const char *user, bo
}
}
+/**
+ * talloc version of fill_domain_username()
+ * return NULL on talloc failure.
+ */
+char *fill_domain_username_talloc(TALLOC_CTX *mem_ctx,
+ const char *domain,
+ const char *user,
+ bool can_assume)
+{
+ char *tmp_user, *name;
+
+ tmp_user = talloc_strdup(mem_ctx, user);
+ strlower_m(tmp_user);
+
+ if (can_assume && assume_domain(domain)) {
+ name = tmp_user;
+ } else {
+ name = talloc_asprintf(mem_ctx, "%s%c%s",
+ domain,
+ *lp_winbind_separator(),
+ tmp_user);
+ TALLOC_FREE(tmp_user);
+ }
+
+ return name;
+}
+
/*
* Winbindd socket accessor functions
*/