summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2007-12-12 00:42:22 +0100
committerGünther Deschner <gd@samba.org>2007-12-12 00:58:58 +0100
commit68a9bd0bf612c7a2583956e978a0080bc5b02b88 (patch)
treee0b004710a8c59c757162f198ee497d101653510 /source3/lib
parentf0d2edb9a0a98e732c23a3661933a2bf6c50cacd (diff)
downloadsamba-68a9bd0bf612c7a2583956e978a0080bc5b02b88.tar.gz
samba-68a9bd0bf612c7a2583956e978a0080bc5b02b88.tar.bz2
samba-68a9bd0bf612c7a2583956e978a0080bc5b02b88.zip
Add split_domain_user() (not to mix with winbind variants).
Guenther (This used to be commit bd5308e5f63e4f692761557d0ecdee7226b66a15)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 19c3e0c65b..73b035b22b 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -3197,6 +3197,30 @@ int get_safe_IVAL(const char *buf_base, size_t buf_len, char *ptr, size_t off, i
return IVAL(ptr,off);
}
+/****************************************************************
+ Split DOM\user into DOM and user. Do not mix with winbind variants of that
+ call (they take care of winbind separator and other winbind specific settings).
+****************************************************************/
+
+void split_domain_user(TALLOC_CTX *mem_ctx,
+ const char *full_name,
+ char **domain,
+ char **user)
+{
+ const char *p = NULL;
+
+ p = strchr_m(full_name, '\\');
+
+ if (p != NULL) {
+ *domain = talloc_strndup(mem_ctx, full_name,
+ PTR_DIFF(p, full_name));
+ *user = talloc_strdup(mem_ctx, p+1);
+ } else {
+ *domain = talloc_strdup(mem_ctx, "");
+ *user = talloc_strdup(mem_ctx, full_name);
+ }
+}
+
#if 0
Disable these now we have checked all code paths and ensured