Ignore:
Timestamp:
Jun 13, 2013, 6:01:30 AM (11 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/walk_nss.h

    r1825 r2432  
     1/*
     2 * walk_nss.h
     3 * NSS walking template for nss_nonlocal proxy
     4 *
     5 * Copyright © 2011 Anders Kaseorg <andersk@mit.edu> and Tim Abbott
     6 * <tabbott@mit.edu>
     7 *
     8 * This file is part of nss_nonlocal.
     9 *
     10 * nss_nonlocal is free software; you can redistribute it and/or
     11 * modify it under the terms of the GNU Lesser General Public License
     12 * as published by the Free Software Foundation; either version 2.1 of
     13 * the License, or (at your option) any later version.
     14 *
     15 * nss_nonlocal is distributed in the hope that it will be useful, but
     16 * WITHOUT ANY WARRANTY; without even the implied warranty of
     17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     18 * Lesser General Public License for more details.
     19 *
     20 * You should have received a copy of the GNU Lesser General Public
     21 * License along with nss_nonlocal; if not, write to the Free Software
     22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
     23 * 02110-1301  USA
     24 */
     25
    126{
    2     static service_user *startp = NULL;
    3     static void *fct_start = NULL;
     27    static bool initialized = false;
     28    static service_user *startp;
     29    static void *fct_start;
    430
    531    service_user *nip;
     
    1036    int old_errno = errno;
    1137
    12     if (fct_start == NULL &&
    13         w.lookup(&startp, w.fct_name, &fct_start) != 0) {
    14         *w.status = NSS_STATUS_UNAVAIL;
    15         goto walk_nss_out;
     38    if (!initialized) {
     39        if (w.lookup(&startp, w.fct_name, &fct_start) != 0) {
     40            *w.status = NSS_STATUS_UNAVAIL;
     41            goto walk_nss_out;
     42        }
     43        __sync_synchronize();
     44        initialized = true;
    1645    }
    1746
     
    5180            goto walk_nss_morebuf;
    5281        }
    53     } while (__nss_next(&nip, w.fct_name, &fct.ptr, *w.status, 0) == 0);
     82    } while (__nss_next(&nip, w.fct_name, &fct.ptr, *w.status, w.all_values) ==
     83             0);
    5484
    5585    if (w.buf != NULL && *w.status != NSS_STATUS_SUCCESS) {
Note: See TracChangeset for help on using the changeset viewer.