From 7b671e34f599b9d27c615c1be35db4ae10ce6481 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sun, 27 Jan 2002 12:12:22 +0000 Subject: Some more 'winbind default domain' support patches from Alexander Bokovoy . This patch is designed to remove the 'special cases' required for this support. In particular this now kills off winbind_initgroups, as it appears no longer to be required. Andrew Bartlett (This used to be commit f1d8d509766e9169d39332559162cfec249bfc70) --- source3/lib/username.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'source3/lib/username.c') diff --git a/source3/lib/username.c b/source3/lib/username.c index f256b1d6f8..ca191ce94e 100644 --- a/source3/lib/username.c +++ b/source3/lib/username.c @@ -36,6 +36,33 @@ BOOL name_is_local(const char *name) return !(strchr_m(name, *lp_winbind_separator())); } +/***************************************************************** + Splits passed user or group name to domain and user/group name parts + Returns True if name was splitted and False otherwise. +*****************************************************************/ + +BOOL split_domain_and_name(const char *name, char *domain, char* username) +{ + char *p = strchr(name,*lp_winbind_separator()); + + + /* Parse a string of the form DOMAIN/user into a domain and a user */ + DEBUG(10,("split_domain_and_name: checking whether name |%s| local or not\n", name)); + + if (p) { + fstrcpy(username, p+1); + fstrcpy(domain, name); + domain[PTR_DIFF(p, name)] = 0; + } else if (lp_winbind_use_default_domain()) { + fstrcpy(username, name); + fstrcpy(domain, lp_workgroup()); + } else + return False; + + DEBUG(10,("split_domain_and_name: all is fine, domain is |%s| and name is |%s|\n", domain, username)); + return True; +} + /**************************************************************************** Get a users home directory. ****************************************************************************/ -- cgit