Changeset 1553


Ignore:
Timestamp:
May 3, 2010, 1:20:42 AM (14 years ago)
Author:
andersk
Message:
Update nss_nonlocal to 1.11.
Location:
trunk/server
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/common/oursrc/nss_nonlocal/README

    r750 r1553  
    99group:          compat nonlocal
    1010group_nonlocal: hesiod
     11
     12Copyright © 2007–2010 Anders Kaseorg <andersk@mit.edu> and Tim Abbott
     13<tabbott@mit.edu>
     14
     15nss_nonlocal is free software; you can redistribute it and/or modify
     16it under the terms of the GNU Lesser General Public License as
     17published by the Free Software Foundation; either version 2.1 of the
     18License, or (at your option) any later version.
     19
     20nss_nonlocal is distributed in the hope that it will be useful, but
     21WITHOUT ANY WARRANTY; without even the implied warranty of
     22MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     23Lesser General Public License for more details.
     24
     25You should have received a copy of the GNU Lesser General Public
     26License along with nss_nonlocal; if not, write to the Free Software
     27Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
     2802110-1301  USA
  • trunk/server/common/oursrc/nss_nonlocal/configure.ac

    r1131 r1553  
    1 AC_INIT([nss_nonlocal], [1.9], [andersk@mit.edu])
     1AC_INIT([nss_nonlocal], [1.11], [andersk@mit.edu])
    22AC_CANONICAL_TARGET
    33AM_INIT_AUTOMAKE([-Wall -Werror foreign])
     4m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
    45
    56AC_PREFIX_DEFAULT([/])
  • trunk/server/common/oursrc/nss_nonlocal/nonlocal-group.c

    r1131 r1553  
    33 * group database for nss_nonlocal proxy
    44 *
    5  * Copyright © 2007 Anders Kaseorg <andersk@mit.edu> and Tim Abbott
    6  * <tabbott@mit.edu>
     5 * Copyright © 2007–2010 Anders Kaseorg <andersk@mit.edu> and Tim
     6 * Abbott <tabbott@mit.edu>
    77 *
    8  * Permission is hereby granted, free of charge, to any person
    9  * obtaining a copy of this software and associated documentation
    10  * files (the "Software"), to deal in the Software without
    11  * restriction, including without limitation the rights to use, copy,
    12  * modify, merge, publish, distribute, sublicense, and/or sell copies
    13  * of the Software, and to permit persons to whom the Software is
    14  * furnished to do so, subject to the following conditions:
     8 * This file is part of nss_nonlocal.
    159 *
    16  * The above copyright notice and this permission notice shall be
    17  * included in all copies or substantial portions of the Software.
     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.
    1814 *
    19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    22  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
    23  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
    24  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    25  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    26  * SOFTWARE.
     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
    2724 */
    2825
     
    8279    int old_errno = errno;
    8380
    84     int buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
     81    size_t buflen = sysconf(_SC_GETGR_R_SIZE_MAX);
    8582    char *buf = malloc(buflen);
    8683    if (buf == NULL) {
     
    117114
    118115    if (status == NSS_STATUS_SUCCESS) {
    119         syslog(LOG_WARNING, "nss_nonlocal: removing local group %u (%s) from non-local user %s\n", gbuf.gr_gid, gbuf.gr_name, user);
     116        syslog(LOG_DEBUG, "nss_nonlocal: removing local group %u (%s) from non-local user %s\n", gbuf.gr_gid, gbuf.gr_name, user);
    120117        status = NSS_STATUS_NOTFOUND;
    121118    } else if (status != NSS_STATUS_TRYAGAIN) {
     
    125122    free(buf);
    126123    return status;
     124}
     125
     126enum nss_status
     127check_nonlocal_group(const char *user, struct group *grp, int *errnop)
     128{
     129    enum nss_status status = NSS_STATUS_SUCCESS;
     130    int old_errno = errno;
     131    char *end;
     132    unsigned long gid;
     133
     134    errno = 0;
     135    gid = strtoul(grp->gr_name, &end, 10);
     136    if (errno == 0 && *end == '\0' && (gid_t)gid == gid)
     137        status = check_nonlocal_gid(user, gid, errnop);
     138    errno = old_errno;
     139    if (status != NSS_STATUS_SUCCESS)
     140        return status;
     141
     142    return check_nonlocal_gid(user, grp->gr_gid, errnop);
    127143}
    128144
     
    281297                status = DL_CALL_FCT(grent_fct.l, (grp, buffer, buflen, errnop));
    282298            while (status == NSS_STATUS_SUCCESS &&
    283                    check_nonlocal_gid("(unknown)", grp->gr_gid, &nonlocal_errno) != NSS_STATUS_SUCCESS);
     299                   check_nonlocal_group("(unknown)", grp, &nonlocal_errno) != NSS_STATUS_SUCCESS);
    284300        }
    285301        if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
     
    330346        return status;
    331347
    332     return check_nonlocal_gid(name, grp->gr_gid, errnop);
     348    if (strcmp(name, grp->gr_name) != 0) {
     349        syslog(LOG_ERR, "nss_nonlocal: discarding group %s from lookup for group %s\n", grp->gr_name, name);
     350        return NSS_STATUS_NOTFOUND;
     351    }
     352
     353    return check_nonlocal_group(name, grp, errnop);
    333354}
    334355
     
    368389        return status;
    369390
    370     return check_nonlocal_gid(grp->gr_name, grp->gr_gid, errnop);
     391    if (gid != grp->gr_gid) {
     392        syslog(LOG_ERR, "nss_nonlocal: discarding gid %d from lookup for gid %d\n", grp->gr_gid, gid);
     393        return NSS_STATUS_NOTFOUND;
     394    }
     395
     396    return check_nonlocal_group(grp->gr_name, grp, errnop);
    371397}
    372398
     
    391417    int is_local = 0;
    392418    char *buffer;
     419    int old_errno;
     420    int in, out, i;
    393421
    394422    /* Check that the user is a nonlocal user before adding any groups. */
     
    399427        is_local = 1;
    400428
    401     int old_errno = errno;
     429    old_errno = errno;
    402430
    403431    status = get_local_group(MAGIC_LOCAL_GROUPNAME,
     
    462490        return NSS_STATUS_SUCCESS;
    463491
    464     int in = *start, out = *start, i;
     492    in = out = *start;
    465493
    466494    nip = nss_group_nonlocal_database();
  • trunk/server/common/oursrc/nss_nonlocal/nonlocal-passwd.c

    r1131 r1553  
    33 * passwd database for nss_nonlocal proxy.
    44 *
    5  * Copyright © 2007 Anders Kaseorg <andersk@mit.edu> and Tim Abbott
    6  * <tabbott@mit.edu>
     5 * Copyright © 2007–2010 Anders Kaseorg <andersk@mit.edu> and Tim
     6 * Abbott <tabbott@mit.edu>
    77 *
    8  * Permission is hereby granted, free of charge, to any person
    9  * obtaining a copy of this software and associated documentation
    10  * files (the "Software"), to deal in the Software without
    11  * restriction, including without limitation the rights to use, copy,
    12  * modify, merge, publish, distribute, sublicense, and/or sell copies
    13  * of the Software, and to permit persons to whom the Software is
    14  * furnished to do so, subject to the following conditions:
     8 * This file is part of nss_nonlocal.
    159 *
    16  * The above copyright notice and this permission notice shall be
    17  * included in all copies or substantial portions of the Software.
     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.
    1814 *
    19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    20  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    22  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
    23  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
    24  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    25  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    26  * SOFTWARE.
     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
    2724 */
    2825
     
    8077    int old_errno = errno;
    8178
    82     int buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
     79    size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
    8380    char *buf = malloc(buflen);
    8481    if (buf == NULL) {
     
    126123
    127124enum nss_status
     125check_nonlocal_passwd(const char *user, struct passwd *pwd, int *errnop)
     126{
     127    enum nss_status status = NSS_STATUS_SUCCESS;
     128    int old_errno = errno;
     129    char *end;
     130    unsigned long uid;
     131
     132    errno = 0;
     133    uid = strtoul(pwd->pw_name, &end, 10);
     134    if (errno == 0 && *end == '\0' && (uid_t)uid == uid)
     135        status = check_nonlocal_uid(user, uid, errnop);
     136    errno = old_errno;
     137    if (status != NSS_STATUS_SUCCESS)
     138        return status;
     139
     140    return check_nonlocal_uid(user, pwd->pw_uid, errnop);
     141}
     142
     143enum nss_status
    128144check_nonlocal_user(const char *user, int *errnop)
    129145{
     
    141157    int old_errno = errno;
    142158
    143     int buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
     159    size_t buflen = sysconf(_SC_GETPW_R_SIZE_MAX);
    144160    char *buf = malloc(buflen);
    145161    if (buf == NULL) {
     
    280296                status = DL_CALL_FCT(pwent_fct.l, (pwd, buffer, buflen, errnop));
    281297            while (status == NSS_STATUS_SUCCESS &&
    282                    check_nonlocal_uid(pwd->pw_name, pwd->pw_uid, &nonlocal_errno) != NSS_STATUS_SUCCESS);
     298                   check_nonlocal_passwd(pwd->pw_name, pwd, &nonlocal_errno) != NSS_STATUS_SUCCESS);
    283299        }
    284300        if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
     
    330346        return status;
    331347
    332     status = check_nonlocal_uid(name, pwd->pw_uid, errnop);
     348    if (strcmp(name, pwd->pw_name) != 0) {
     349        syslog(LOG_ERR, "nss_nonlocal: discarding user %s from lookup for user %s\n", pwd->pw_name, name);
     350        return NSS_STATUS_NOTFOUND;
     351    }
     352
     353    status = check_nonlocal_passwd(name, pwd, errnop);
    333354    if (status != NSS_STATUS_SUCCESS)
    334355        return status;
     
    376397        return status;
    377398
    378     status = check_nonlocal_uid(pwd->pw_name, pwd->pw_uid, errnop);
     399    if (uid != pwd->pw_uid) {
     400        syslog(LOG_ERR, "nss_nonlocal: discarding uid %d from lookup for uid %d\n", pwd->pw_uid, uid);
     401        return NSS_STATUS_NOTFOUND;
     402    }
     403
     404    status = check_nonlocal_passwd(pwd->pw_name, pwd, errnop);
    379405    if (status != NSS_STATUS_SUCCESS)
    380406        return status;
  • trunk/server/common/oursrc/nss_nonlocal/nonlocal-shadow.c

    r750 r1553  
    33 * shadow database for nss_nonlocal proxy.
    44 *
    5  * Copyright © 2007 Anders Kaseorg <andersk@mit.edu>
     5 * Copyright © 2007–2010 Anders Kaseorg <andersk@mit.edu>
    66 *
    7  * Permission is hereby granted, free of charge, to any person
    8  * obtaining a copy of this software and associated documentation
    9  * files (the "Software"), to deal in the Software without
    10  * restriction, including without limitation the rights to use, copy,
    11  * modify, merge, publish, distribute, sublicense, and/or sell copies
    12  * of the Software, and to permit persons to whom the Software is
    13  * furnished to do so, subject to the following conditions:
     7 * This file is part of nss_nonlocal.
    148 *
    15  * The above copyright notice and this permission notice shall be
    16  * included in all copies or substantial portions of the Software.
     9 * nss_nonlocal is free software; you can redistribute it and/or
     10 * modify it under the terms of the GNU Lesser General Public License
     11 * as published by the Free Software Foundation; either version 2.1 of
     12 * the License, or (at your option) any later version.
    1713 *
    18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    19  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    21  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
    22  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
    23  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
    24  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    25  * SOFTWARE.
     14 * nss_nonlocal is distributed in the hope that it will be useful, but
     15 * WITHOUT ANY WARRANTY; without even the implied warranty of
     16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     17 * Lesser General Public License for more details.
     18 *
     19 * You should have received a copy of the GNU Lesser General Public
     20 * License along with nss_nonlocal; if not, write to the Free Software
     21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
     22 * 02110-1301  USA
    2623 */
    2724
     
    3431#include <dlfcn.h>
    3532#include <stdio.h>
     33#include <syslog.h>
    3634#include <errno.h>
    3735#include <shadow.h>
     
    180178            break;
    181179    } while (__nss_next(&nip, fct_name, &fct.ptr, status, 0) == 0);
    182     return status;
     180    if (status != NSS_STATUS_SUCCESS)
     181        return status;
     182
     183    if (strcmp(name, pwd->sp_namp) != 0) {
     184        syslog(LOG_ERR, "nss_nonlocal: discarding shadow %s from lookup for shadow %s\n", pwd->sp_namp, name);
     185        return NSS_STATUS_NOTFOUND;
     186    }
     187
     188    return NSS_STATUS_SUCCESS;
    183189}
  • trunk/server/fedora/specs/nss_nonlocal.spec

    r1508 r1553  
    22Group: System Environment/Libraries
    33Name: nss_nonlocal
    4 Version: 1.9
     4Version: 1.11
    55Release: 1
    66URL: http://debathena.mit.edu/nss_nonlocal/
     
    5858%changelog
    5959
     60* Sun May  2 2010 Anders Kaseorg <andersk@mit.edu> 1.11-1
     61- New upstream version.
     62
    6063* Fri Mar 12 2010 Mitchell Berger <mitchb@mit.edu> 1.9-1
    6164- Per Fedora packaging guidelines, don't ever remove groups.
Note: See TracChangeset for help on using the changeset viewer.