Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <alloca.h>
#include <assert.h>
extern void *__nss_lookup_function (service_user *ni, const char *fct_name);
extern service_user *__nss_group_database attribute_hidden;
-static service_user *initgroups_database;
+service_user *__nss_initgroups_database;
static bool use_initgroups_entry;
/* Start is one, because we have the first group as parameter. */
long int start = 1;
- if (initgroups_database == NULL)
+ if (__nss_initgroups_database == NULL)
{
- no_more = __nss_database_lookup ("initgroups", NULL, "",
- &initgroups_database);
- if (no_more == 0 && initgroups_database == NULL)
+ if (__nss_database_lookup ("initgroups", NULL, "",
+ &__nss_initgroups_database) < 0)
{
if (__nss_group_database == NULL)
no_more = __nss_database_lookup ("group", NULL, "compat files",
&__nss_group_database);
- initgroups_database = __nss_group_database;
- }
- else if (initgroups_database != NULL)
- {
- assert (no_more == 0);
- use_initgroups_entry = true;
+ __nss_initgroups_database = __nss_group_database;
}
+ else
+ use_initgroups_entry = true;
}
+ else
+ /* __nss_initgroups_database might have been set through
+ __nss_configure_lookup in which case use_initgroups_entry was
+ not set here. */
+ use_initgroups_entry = __nss_initgroups_database != __nss_group_database;
- service_user *nip = initgroups_database;
+ service_user *nip = __nss_initgroups_database;
while (! no_more)
{
long int prev_start = start;