diff options
author | Luke Leighton <lkcl@samba.org> | 1998-11-23 22:16:37 +0000 |
---|---|---|
committer | Luke Leighton <lkcl@samba.org> | 1998-11-23 22:16:37 +0000 |
commit | eab235dd4a58f2bf80837928c094d60fa77a4582 (patch) | |
tree | 95e47c53106165e4307c67addcdd2da26fe1f225 /source3 | |
parent | db24da8b36776311ade183a264e1c395551a2173 (diff) | |
download | samba-eab235dd4a58f2bf80837928c094d60fa77a4582.tar.gz samba-eab235dd4a58f2bf80837928c094d60fa77a4582.tar.bz2 samba-eab235dd4a58f2bf80837928c094d60fa77a4582.zip |
cvs being STUPID
(This used to be commit ba78b5932a1ed3f7c07720703b9131234f035689)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/groupdb/groupdb.c | 54 |
1 files 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; +} |