From 3bf8d26f7c5705f832034cf676942551ba1e1a73 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Wed, 14 Jun 2000 09:57:51 +0000 Subject: Merged parse_domain_user() from TNG. (This used to be commit f64ac9d9068901862290f7b25874156d6f0d4d73) --- source3/lib/util_str.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source3/lib') diff --git a/source3/lib/util_str.c b/source3/lib/util_str.c index d703670860..41c012ba34 100644 --- a/source3/lib/util_str.c +++ b/source3/lib/util_str.c @@ -1247,3 +1247,23 @@ char *string_truncate(char *s, int length) } return s; } + +/* Parse a string of the form DOMAIN/user into a domain and a user */ + +void parse_domain_user(char *domuser, fstring domain, fstring user) +{ + char *p; + char *sep = lp_winbind_separator(); + if (!sep) sep = "\\"; + p = strchr(domuser,*sep); + if (!p) p = strchr(domuser,'\\'); + if (!p) { + fstrcpy(domain,""); + fstrcpy(user, domuser); + return; + } + + fstrcpy(user, p+1); + fstrcpy(domain, domuser); + domain[PTR_DIFF(p, domuser)] = 0; +} -- cgit