s3-auth: Moved smbd user functions to a generic place.
[kai/samba.git] / source3 / smbd / password.c
index 640e634da91ba3513a2b5d6c78cc754b6a43de13..e85f23074f0853f2c24f41179de3d694ccd9b676 100644 (file)
@@ -403,139 +403,6 @@ const char *get_session_workgroup(struct smbd_server_connection *sconn)
        return sconn->smb1.sessions.session_workgroup;
 }
 
-/****************************************************************************
- 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.
 ****************************************************************************/