summaryrefslogtreecommitdiff
path: root/source3/smbd/password.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2010-06-02 19:39:18 +0200
committerSimo Sorce <idra@samba.org>2010-06-04 12:12:37 -0400
commit9097bdddd03f81579699e0d0ce725a7453a3a158 (patch)
tree452b12b712e1ed4053d755ee7cdd74dcaaac7156 /source3/smbd/password.c
parentfad86ddf5531c8f5862b697e99c24a7bd526d73e (diff)
downloadsamba-9097bdddd03f81579699e0d0ce725a7453a3a158.tar.gz
samba-9097bdddd03f81579699e0d0ce725a7453a3a158.tar.bz2
samba-9097bdddd03f81579699e0d0ce725a7453a3a158.zip
s3-auth: Moved smbd user functions to a generic place.
Reviewed-by: Simo Sorce <idra@samba.org>
Diffstat (limited to 'source3/smbd/password.c')
-rw-r--r--source3/smbd/password.c133
1 files changed, 0 insertions, 133 deletions
diff --git a/source3/smbd/password.c b/source3/smbd/password.c
index 640e634da9..e85f23074f 100644
--- a/source3/smbd/password.c
+++ b/source3/smbd/password.c
@@ -404,139 +404,6 @@ const char *get_session_workgroup(struct smbd_server_connection *sconn)
}
/****************************************************************************
- Check if a user is in a netgroup user list. If at first we don't succeed,
- try lower case.
-****************************************************************************/
-
-bool user_in_netgroup(const char *user, const char *ngname)
-{
-#ifdef HAVE_NETGROUP
- static char *my_yp_domain = NULL;
- fstring lowercase_user;
-
- if (my_yp_domain == NULL) {
- yp_get_default_domain(&my_yp_domain);
- }
-
- if (my_yp_domain == NULL) {
- DEBUG(5,("Unable to get default yp domain, "
- "let's try without specifying it\n"));
- }
-
- DEBUG(5,("looking for user %s of domain %s in netgroup %s\n",
- user, my_yp_domain?my_yp_domain:"(ANY)", ngname));
-
- if (innetgr(ngname, NULL, user, my_yp_domain)) {
- DEBUG(5,("user_in_netgroup: Found\n"));
- return true;
- }
-
- /*
- * Ok, innetgr is case sensitive. Try once more with lowercase
- * just in case. Attempt to fix #703. JRA.
- */
- fstrcpy(lowercase_user, user);
- strlower_m(lowercase_user);
-
- if (strcmp(user,lowercase_user) == 0) {
- /* user name was already lower case! */
- return false;
- }
-
- DEBUG(5,("looking for user %s of domain %s in netgroup %s\n",
- lowercase_user, my_yp_domain?my_yp_domain:"(ANY)", ngname));
-
- if (innetgr(ngname, NULL, lowercase_user, my_yp_domain)) {
- DEBUG(5,("user_in_netgroup: Found\n"));
- return true;
- }
-#endif /* HAVE_NETGROUP */
- return false;
-}
-
-/****************************************************************************
- Check if a user is in a user list - can check combinations of UNIX
- and netgroup lists.
-****************************************************************************/
-
-bool user_in_list(const char *user,const char **list)
-{
- if (!list || !*list)
- return False;
-
- DEBUG(10,("user_in_list: checking user %s in list\n", user));
-
- while (*list) {
-
- DEBUG(10,("user_in_list: checking user |%s| against |%s|\n",
- user, *list));
-
- /*
- * Check raw username.
- */
- if (strequal(user, *list))
- return(True);
-
- /*
- * Now check to see if any combination
- * of UNIX and netgroups has been specified.
- */
-
- if(**list == '@') {
- /*
- * Old behaviour. Check netgroup list
- * followed by UNIX list.
- */
- if(user_in_netgroup(user, *list +1))
- return True;
- if(user_in_group(user, *list +1))
- return True;
- } else if (**list == '+') {
-
- if((*(*list +1)) == '&') {
- /*
- * Search UNIX list followed by netgroup.
- */
- if(user_in_group(user, *list +2))
- return True;
- if(user_in_netgroup(user, *list +2))
- return True;
-
- } else {
-
- /*
- * Just search UNIX list.
- */
-
- if(user_in_group(user, *list +1))
- return True;
- }
-
- } else if (**list == '&') {
-
- if(*(*list +1) == '+') {
- /*
- * Search netgroup list followed by UNIX list.
- */
- if(user_in_netgroup(user, *list +2))
- return True;
- if(user_in_group(user, *list +2))
- return True;
- } else {
- /*
- * Just search netgroup list.
- */
- if(user_in_netgroup(user, *list +1))
- return True;
- }
- }
-
- list++;
- }
- return(False);
-}
-
-/****************************************************************************
Check if a username is valid.
****************************************************************************/