Flyttet noe kode inn i common.c
Nå kan man også se alle brukere som gruppene man er medlem i, har
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* @(#) $Header: /tmp/cvs/mysql-admutils/mysql-dbadm.c,v 1.4 2002-03-06 16:47:12 tlan Exp $
|
||||
* @(#) $Header: /tmp/cvs/mysql-admutils/mysql-dbadm.c,v 1.5 2002-03-06 17:05:05 tlan Exp $
|
||||
*
|
||||
* mysql-dbadm.c
|
||||
*
|
||||
@@ -111,37 +111,6 @@ drop(MYSQL *pmysql, char *db)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* return a list of the user's groupnames */
|
||||
/* numgroups is the total number of groups found */
|
||||
char **get_group_names(int *numgroups)
|
||||
{
|
||||
char **grouplist;
|
||||
gid_t gids[33];
|
||||
int nr_groups, i;
|
||||
struct group *g;
|
||||
|
||||
nr_groups = 0;
|
||||
|
||||
nr_groups = getgroups(32, &gids[0]); /* Allow a max of 32 groups */
|
||||
|
||||
if (nr_groups == -1) {
|
||||
dberror(NULL, "Error while trying to fetch group info");
|
||||
return NULL;
|
||||
}
|
||||
*numgroups = nr_groups;
|
||||
|
||||
grouplist = malloc((nr_groups+1) * sizeof(char *));
|
||||
|
||||
for (i = 0; i < nr_groups; i++) {
|
||||
g = getgrgid(gids[i]);
|
||||
|
||||
grouplist[i] = strdup(g->gr_name);
|
||||
}
|
||||
grouplist[i] = NULL;
|
||||
|
||||
return grouplist;
|
||||
}
|
||||
|
||||
/* return a list of the user's databases */
|
||||
char **
|
||||
list(MYSQL *pmysql)
|
||||
|
||||
Reference in New Issue
Block a user