"Fossies" - the Fresh Open Source Software Archive

Member "nss_ldap-265/irs-nss.c" (6 Nov 2009, 2126 Bytes) of package /linux/privat/old/nss_ldap-265.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* Copyright (C) 1997-2005 Luke Howard.
    2    This file is part of the nss_ldap library.
    3    Contributed by Luke Howard, <lukeh@padl.com>, 1997.
    4 
    5    The nss_ldap library is free software; you can redistribute it and/or
    6    modify it under the terms of the GNU Library General Public License as
    7    published by the Free Software Foundation; either version 2 of the
    8    License, or (at your option) any later version.
    9 
   10    The nss_ldap library is distributed in the hope that it will be useful,
   11    but WITHOUT ANY WARRANTY; without even the implied warranty of
   12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13    Library General Public License for more details.
   14 
   15    You should have received a copy of the GNU Library General Public
   16    License along with the nss_ldap library; see the file COPYING.LIB.  If not,
   17    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   18    Boston, MA 02111-1307, USA.
   19  */
   20 
   21 static char rcsId[] = "$Id: irs-nss.c,v 2.16 2005/05/20 05:30:39 lukeh Exp $";
   22 
   23 #include "config.h"
   24 
   25 #ifdef HAVE_IRS_H
   26 
   27 #ifndef HAVE_USERSEC_H
   28 
   29 #include <stdlib.h>
   30 #include <string.h>
   31 #include <stdio.h>
   32 #include <errno.h>
   33 
   34 #ifdef HAVE_LBER_H
   35 #include <lber.h>
   36 #endif
   37 
   38 #ifdef HAVE_LDAP_H
   39 #include <ldap.h>
   40 #endif
   41 
   42 #include "irs-nss.h"
   43 #include "ldap-nss.h"
   44 #include "ltf.h"
   45 #include "util.h"
   46 
   47 static void irs_ldap_close (struct irs_acc *this);
   48 
   49 /* Dispatch table for IRS LDAP module */
   50 
   51 struct irs_acc *
   52 irs_ldap_acc (const char *options)
   53 {
   54   struct irs_acc *acc;
   55 
   56   if (!(acc = malloc (sizeof (*acc))))
   57     {
   58       errno = ENOMEM;
   59       return NULL;
   60     }
   61 
   62   memset (acc, 0x5e, sizeof *acc);
   63 
   64   /* private stuff gets kept as static in ldap-nss.c. */
   65   acc->private = NULL;
   66 
   67   acc->gr_map = irs_ldap_gr;
   68 #ifdef WANT_IRS_PW
   69   acc->pw_map = irs_ldap_pw;
   70 #endif
   71   acc->sv_map = irs_ldap_sv;
   72   acc->pr_map = irs_ldap_pr;
   73   acc->ho_map = irs_ldap_ho;
   74   acc->nw_map = irs_ldap_nw;
   75   acc->ng_map = irs_ldap_ng;
   76 
   77   acc->close = irs_ldap_close;
   78 
   79   return (acc);
   80 }
   81 
   82 /* Methods */
   83 
   84 static void
   85 irs_ldap_close (struct irs_acc *this)
   86 {
   87   free (this);
   88 }
   89 #endif /* HAVE_USERSEC_H */
   90 #endif /* HAVE_IRS_H */