From eab235dd4a58f2bf80837928c094d60fa77a4582 Mon Sep 17 00:00:00 2001 From: Luke Leighton Date: Mon, 23 Nov 1998 22:16:37 +0000 Subject: cvs being STUPID (This used to be commit ba78b5932a1ed3f7c07720703b9131234f035689) --- source3/groupdb/groupdb.c | 54 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 3 deletions(-) diff --git a/source3/groupdb/groupdb.c b/source3/groupdb/groupdb.c index 5b85bb127c..7b9a14c7df 100644 --- a/source3/groupdb/groupdb.c +++ b/source3/groupdb/groupdb.c @@ -30,7 +30,7 @@ extern int DEBUGLEVEL; * that points to the correct function for the selected database. JRA. */ -static struct groupdb_ops *gpdb_ops; +static struct groupdb_ops *gpdb_ops = NULL; /*************************************************************** Initialise the group db operations. @@ -47,8 +47,8 @@ BOOL initialise_group_db(void) gpdb_ops = nisplus_initialise_group_db(); #elif defined(WITH_LDAP) gpdb_ops = ldap_initialise_group_db(); -#else - gpdb_ops = file_initialise_group_db(); +#elif defined(USE_SMBUNIX_DB) + gpdb_ops = unix_initialise_group_db(); #endif return (gpdb_ops != NULL); @@ -383,3 +383,51 @@ void gpdb_init_grp(DOMAIN_GRP *grp) ZERO_STRUCTP(grp); } +/************************************************************************* + turns a list of groups into a string. +*************************************************************************/ +BOOL make_group_line(char *p, int max_len, + DOMAIN_GRP *grp, + DOMAIN_GRP_MEMBER **mem, int *num_mem) +{ + int i; + int len; + len = slprintf(p, max_len-1, "%s:%s:%d:", grp->name, grp->comment, grp->rid); + + if (len == -1) + { + DEBUG(0,("make_group_line: cannot create entry\n")); + return False; + } + + p += len; + max_len -= len; + + if (mem == NULL || num_mem == NULL) + { + return True; + } + + for (i = 0; i < (*num_mem); i++) + { + len = strlen((*mem)[i].name); + p = safe_strcpy(p, (*mem)[i].name, max_len); + + if (p == NULL) + { + DEBUG(0, ("make_group_line: out of space for groups!\n")); + return False; + } + + max_len -= len; + + if (i != (*num_mem)-1) + { + *p = ','; + p++; + max_len--; + } + } + + return True; +} -- cgit