diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-12-17 15:38:41 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:05:52 -0500 |
commit | e7f348fcf871e8559ecf4e3e597627a78187d1da (patch) | |
tree | 91f761bc9fb659cc9fbb095080d21f61d60ac0d6 /source/lib | |
parent | 95094ef758089cfc62700509d45b53bc0980654d (diff) | |
download | samba-e7f348fcf871e8559ecf4e3e597627a78187d1da.tar.gz samba-e7f348fcf871e8559ecf4e3e597627a78187d1da.tar.xz samba-e7f348fcf871e8559ecf4e3e597627a78187d1da.zip |
r12303: Move split_domain_and_name to util_getent.c and make it static there.
Volker
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/username.c | 28 | ||||
-rw-r--r-- | source/lib/util_getent.c | 31 |
2 files changed, 31 insertions, 28 deletions
diff --git a/source/lib/username.c b/source/lib/username.c index 1973a8c7c60..403a0bc09f3 100644 --- a/source/lib/username.c +++ b/source/lib/username.c @@ -35,34 +35,6 @@ static 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. ****************************************************************************/ diff --git a/source/lib/util_getent.c b/source/lib/util_getent.c index 475b0da87bf..7c045fccb22 100644 --- a/source/lib/util_getent.c +++ b/source/lib/util_getent.c @@ -239,6 +239,37 @@ static struct sys_userlist *add_members_to_userlist(struct sys_userlist *list_he return list_head; } +/***************************************************************** + Splits passed user or group name to domain and user/group name parts + Returns True if name was splitted and False otherwise. +*****************************************************************/ + +static 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 the list of UNIX users in a group. We have to enumerate the /etc/group file as some UNIX getgrnam() |