moved get_unixgroups it will be needed by the unix instance of the group
authorLuke Leighton <lkcl@samba.org>
Thu, 3 Dec 1998 17:41:14 +0000 (17:41 +0000)
committerLuke Leighton <lkcl@samba.org>
Thu, 3 Dec 1998 17:41:14 +0000 (17:41 +0000)
DB API

source/include/proto.h
source/lib/util.c
source/smbd/password.c

index c1f46da32d6f42a7a0698d15adf50ed8574f1e5e..fb4a9b75ea8b90fe5bee29a8e9d382b541f0489f 100644 (file)
@@ -400,6 +400,7 @@ void standard_sub(connection_struct *conn,char *str);
 BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
 struct hostent *Get_Hostbyname(const char *name);
 BOOL process_exists(int pid);
 BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask);
 struct hostent *Get_Hostbyname(const char *name);
 BOOL process_exists(int pid);
+int get_unixgroups(char *user, uid_t uid, gid_t gid, int *p_ngroups, gid_t **p_groups);
 char *uidtoname(uid_t uid);
 char *gidtoname(gid_t gid);
 BOOL nametogid(const char *name, gid_t *gid);
 char *uidtoname(uid_t uid);
 char *gidtoname(gid_t gid);
 BOOL nametogid(const char *name, gid_t *gid);
@@ -2739,7 +2740,6 @@ BOOL set_challenge(unsigned char *challenge);
 user_struct *get_valid_user_struct(uint16 vuid);
 void invalidate_vuid(uint16 vuid);
 char *validated_username(uint16 vuid);
 user_struct *get_valid_user_struct(uint16 vuid);
 void invalidate_vuid(uint16 vuid);
 char *validated_username(uint16 vuid);
-int get_unixgroups(char *user, uid_t uid, gid_t gid, int *p_ngroups, gid_t **p_groups);
 uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name, BOOL guest);
 void add_session_user(char *user);
 BOOL smb_password_check(char *password, unsigned char *part_passwd, unsigned char *c8);
 uint16 register_vuid(uid_t uid,gid_t gid, char *unix_name, char *requested_name, BOOL guest);
 void add_session_user(char *user);
 BOOL smb_password_check(char *password, unsigned char *part_passwd, unsigned char *c8);
index 98c840efceaeb5ecec2d4ba0ae8e52d8dae0961c..dc11c7789c3b0592e6a5bbb0a18cfd42b657c38e 100644 (file)
@@ -2321,6 +2321,55 @@ BOOL process_exists(int pid)
 }
 
 
 }
 
 
+/****************************************************************************
+Setup the groups a user belongs to.
+****************************************************************************/
+int get_unixgroups(char *user, uid_t uid, gid_t gid, int *p_ngroups, gid_t **p_groups)
+{
+       int i,ngroups;
+       gid_t grp = 0;
+       gid_t *groups = NULL;
+
+       if (-1 == initgroups(user,gid))
+       {
+               if (getuid() == 0)
+               {
+                       DEBUG(0,("Unable to initgroups!\n"));
+                       if (gid < 0 || gid > 16000 || uid < 0 || uid > 16000)
+                       {
+                               DEBUG(0,("This is probably a problem with the account %s\n", user));
+                       }
+               }
+               return -1;
+       }
+
+       ngroups = sys_getgroups(0,&grp);
+       if (ngroups <= 0)
+       {
+               ngroups = 32;
+       }
+
+       if((groups = (gid_t *)malloc(sizeof(gid_t)*ngroups)) == NULL)
+       {
+               DEBUG(0,("get_unixgroups malloc fail !\n"));
+               return -1;
+       }
+
+       ngroups = sys_getgroups(ngroups,groups);
+
+       (*p_ngroups) = ngroups;
+       (*p_groups) = groups;
+
+       DEBUG( 3, ( "%s is in %d groups: ", user, ngroups ) );
+       for (i = 0; i < ngroups; i++ )
+       {
+               DEBUG( 3, ( "%s%d", (i ? ", " : ""), (int)groups[i] ) );
+       }
+       DEBUG( 3, ( "\n" ) );
+
+       return 0;
+}
+
 /*******************************************************************
 turn a uid into a user name
 ********************************************************************/
 /*******************************************************************
 turn a uid into a user name
 ********************************************************************/
index ed47e6d3e51133c06f84508fdd686455b1bea153..8718e75c3b314b23a516156f96e0c992011e3553 100644 (file)
@@ -150,55 +150,6 @@ char *validated_username(uint16 vuid)
 }
 
 
 }
 
 
-/****************************************************************************
-Setup the groups a user belongs to.
-****************************************************************************/
-int get_unixgroups(char *user, uid_t uid, gid_t gid, int *p_ngroups, gid_t **p_groups)
-{
-       int i,ngroups;
-       gid_t grp = 0;
-       gid_t *groups = NULL;
-
-       if (-1 == initgroups(user,gid))
-       {
-               if (getuid() == 0)
-               {
-                       DEBUG(0,("Unable to initgroups!\n"));
-                       if (gid < 0 || gid > 16000 || uid < 0 || uid > 16000)
-                       {
-                               DEBUG(0,("This is probably a problem with the account %s\n", user));
-                       }
-               }
-               return -1;
-       }
-
-       ngroups = sys_getgroups(0,&grp);
-       if (ngroups <= 0)
-       {
-               ngroups = 32;
-       }
-
-       if((groups = (gid_t *)malloc(sizeof(gid_t)*ngroups)) == NULL)
-       {
-               DEBUG(0,("get_unixgroups malloc fail !\n"));
-               return -1;
-       }
-
-       ngroups = sys_getgroups(ngroups,groups);
-
-       (*p_ngroups) = ngroups;
-       (*p_groups) = groups;
-
-       DEBUG( 3, ( "%s is in %d groups: ", user, ngroups ) );
-       for (i = 0; i < ngroups; i++ )
-       {
-               DEBUG( 3, ( "%s%d", (i ? ", " : ""), (int)groups[i] ) );
-       }
-       DEBUG( 3, ( "\n" ) );
-
-       return 0;
-}
-
 
 /****************************************************************************
 register a uid/name pair as being valid and that a valid password
 
 /****************************************************************************
 register a uid/name pair as being valid and that a valid password