Ignore:
Timestamp:
Jun 13, 2013, 6:01:30 AM (9 years ago)
Author:
andersk
Message:
Update nss_nonlocal to 2.1

- Support Automake 1.12.
- Guard one-time initialization with memory barriers.
- Make initgroups_dyn succeed when adding only magic groups.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/common/oursrc/nss_nonlocal/nonlocal-group.c

    r1825 r2432  
    2525
    2626#define _GNU_SOURCE
     27
    2728#include <sys/types.h>
    28 #include <unistd.h>
    29 #include <stdlib.h>
    30 #include <stdint.h>
    31 #include <string.h>
    3229#include <dlfcn.h>
    33 #include <stdio.h>
    34 #include <syslog.h>
    3530#include <errno.h>
    36 #include <pwd.h>
    3731#include <grp.h>
    3832#include <nss.h>
     33#include <pwd.h>
     34#include <stdbool.h>
     35#include <stddef.h>
     36#include <stdlib.h>
     37#include <string.h>
     38#include <syslog.h>
     39#include <unistd.h>
     40
    3941#include "nsswitch-internal.h"
    4042#include "nonlocal.h"
     
    170172}
    171173
     174static bool grent_initialized = false;
    172175static service_user *grent_startp, *grent_nip;
    173176static void *grent_fct_start;
     
    194197        return status;
    195198
    196     if (grent_fct_start == NULL)
     199    if (!grent_initialized) {
    197200        __nss_group_nonlocal_lookup(&grent_startp, grent_fct_name,
    198201                                    &grent_fct_start);
     202        __sync_synchronize();
     203        grent_initialized = true;
     204    }
    199205    grent_nip = grent_startp;
    200206    grent_fct.ptr = grent_fct_start;
     
    208214    const struct walk_nss w = {
    209215        .lookup = &__nss_group_nonlocal_lookup, .fct_name = "endgrent",
    210         .status = &status
     216        .status = &status, .all_values = 1,
    211217    };
    212218    const __typeof__(&_nss_nonlocal_endgrent) self = NULL;
     
    356362    const struct walk_nss w = {
    357363        .lookup = &__nss_group_nonlocal_lookup, .fct_name = "initgroups_dyn",
    358         .status = &status, .errnop = errnop
     364        .status = &status, .all_values = 1, .errnop = errnop
    359365    };
    360366    const __typeof__(&_nss_nonlocal_initgroups_dyn) self = NULL;
     
    445451#include "walk_nss.h"
    446452#undef args
    447     if (status != NSS_STATUS_SUCCESS)
     453    if (status == NSS_STATUS_NOTFOUND || status == NSS_STATUS_UNAVAIL)
     454        return NSS_STATUS_SUCCESS;
     455    else if (status != NSS_STATUS_SUCCESS)
    448456        return status;
    449457
Note: See TracChangeset for help on using the changeset viewer.