diff options
author | Tim Potter <tpot@samba.org> | 2000-06-14 09:57:51 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2000-06-14 09:57:51 +0000 |
commit | 3bf8d26f7c5705f832034cf676942551ba1e1a73 (patch) | |
tree | 9eed76ab939b15bc4db8cfbecdf944da655089ba /source3/lib | |
parent | cc5502a4d01bfc4946fbd198aad75ea03e9734d3 (diff) | |
download | samba-3bf8d26f7c5705f832034cf676942551ba1e1a73.tar.gz samba-3bf8d26f7c5705f832034cf676942551ba1e1a73.tar.bz2 samba-3bf8d26f7c5705f832034cf676942551ba1e1a73.zip |
Merged parse_domain_user() from TNG.
(This used to be commit f64ac9d9068901862290f7b25874156d6f0d4d73)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_str.c | 20 |
1 files changed, 20 insertions, 0 deletions
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; +} |