ITS#6488 update from nss-ldapd to nss-pam-ldapd, refer to nss-pam-ldapd

home page instead of bundling the full code
This commit is contained in:
Howard Chu 2010-04-12 03:04:02 +00:00
parent 1dbefa75be
commit b463d6164a
135 changed files with 512 additions and 49805 deletions

View file

@ -24,7 +24,7 @@ OPT=-g -O2
CC=gcc
LDAP_INC=-I$(LDAPOBJ)/include -I$(LDAPSRC)/include -I$(LDAPSRC)/servers/slapd
NLDAPD_INC=-Inss-ldapd
NLDAPD_INC=-Inss-pam-ldapd
INCS=$(LDAP_INC) $(NLDAPD_INC)
LDAP_LIB=-lldap_r -llber
@ -40,7 +40,7 @@ moduledir = $(libexecdir)$(ldap_subdir)
sysconfdir = $(prefix)/etc$(ldap_subdir)
schemadir = $(sysconfdir)/schema
all: install
all: nssov.la
XOBJS = tio.lo
@ -52,8 +52,8 @@ OBJS = alias.lo ether.lo group.lo host.lo netgroup.lo network.lo \
.c.lo:
$(LIBTOOL) --mode=compile $(CC) $(OPT) $(DEFS) $(INCS) -c $<
tio.lo: nss-ldapd/common/tio.c
$(LIBTOOL) --mode=compile $(CC) $(OPT) $(DEFS) $(NLDAPD_INC) -c $?
tio.lo: nss-pam-ldapd/tio.c
$(LIBTOOL) --mode=compile $(CC) $(OPT) $(DEFS) $(INCS) -c $?
$(OBJS): nssov.h
@ -68,3 +68,4 @@ install: nssov.la
clean:
rm -f *.*o *.la .libs/*
rm -rf .libs

View file

@ -4,12 +4,15 @@ same IPC protocol as Arthur de Jong's nss-ldapd, and a complete
copy of the nss-ldapd source is included here. It also handles
PAM requests.
To use this code, you will need the client-side stub library from
nss-ldapd (which resides in nss-ldapd/nss). You will not need the
nslcd daemon; this overlay replaces that part. You should already
be familiar with the RFC2307 and RFC2307bis schema to use this
overlay. See the nss-ldapd/README for more information on the
schema and which features are supported.
To use this code, you will need the client-side stuf library from
nss-pam-ldapd. You can get it from:
http://arthurdejong.org/nss-pam-ldapd
You will not need the nslcd daemon; this overlay replaces that part.
To disable building of the nslcd daemon in nss-pam-ldapd, add the
--disable-nslcd option to the nss-pam-ldapd configure script. You
should already be familiar with the RFC2307 and RFC2307bis schema
to use this overlay. See the nss-pam-ldapd README for more information
on the schema and which features are supported.
To use the overlay, add:

View file

@ -83,7 +83,7 @@ static int write_alias(nssov_alias_cbp *cbp,Entry *entry)
/* for each name, write an entry */
for (i=0;!BER_BVISNULL(&names[i]);i++)
{
WRITE_INT32(cbp->fp,NSLCD_RESULT_SUCCESS);
WRITE_INT32(cbp->fp,NSLCD_RESULT_BEGIN);
WRITE_BERVAL(cbp->fp,&names[i]);
WRITE_BVARRAY(cbp->fp,members);
}
@ -97,7 +97,7 @@ NSSOV_HANDLE(
char fbuf[1024];
struct berval filter = {sizeof(fbuf)};
filter.bv_val = fbuf;
READ_STRING_BUF2(fp,cbp.buf,sizeof(cbp.buf));
READ_STRING(fp,cbp.buf);
cbp.name.bv_len = tmpint32;
cbp.name.bv_val = cbp.buf;,
Debug(LDAP_DEBUG_TRACE,"nssov_alias_byname(%s)\n",cbp.name.bv_val,0,0);,

View file

@ -111,7 +111,7 @@ static int write_ether(nssov_ether_cbp *cbp,Entry *entry)
for (i=0;!BER_BVISNULL(&names[i]);i++)
for (j=0;!BER_BVISNULL(&ethers[j]);j++)
{
WRITE_INT32(cbp->fp,NSLCD_RESULT_SUCCESS);
WRITE_INT32(cbp->fp,NSLCD_RESULT_BEGIN);
WRITE_BERVAL(cbp->fp,&names[i]);
WRITE_ETHER(cbp->fp,ethers[j]);
}
@ -126,7 +126,7 @@ NSSOV_HANDLE(
struct berval filter = {sizeof(fbuf)};
filter.bv_val = fbuf;
BER_BVZERO(&cbp.addr);
READ_STRING_BUF2(fp,cbp.buf,sizeof(cbp.buf));
READ_STRING(fp,cbp.buf);
cbp.name.bv_len = tmpint32;
cbp.name.bv_val = cbp.buf;,
Debug(LDAP_DEBUG_TRACE,"nssov_ether_byname(%s)\n",cbp.name.bv_val,0,0);,

View file

@ -248,7 +248,7 @@ static int write_group(nssov_group_cbp *cbp,Entry *entry)
names[i].bv_val);
continue;
}
WRITE_INT32(cbp->fp,NSLCD_RESULT_SUCCESS);
WRITE_INT32(cbp->fp,NSLCD_RESULT_BEGIN);
WRITE_BERVAL(cbp->fp,&names[i]);
WRITE_BERVAL(cbp->fp,&passwd);
WRITE_TYPE(cbp->fp,gid,gid_t);
@ -277,7 +277,7 @@ NSSOV_HANDLE(
char fbuf[1024];
struct berval filter = {sizeof(fbuf)};
filter.bv_val = fbuf;
READ_STRING_BUF2(fp,cbp.buf,sizeof(cbp.buf));
READ_STRING(fp,cbp.buf);
cbp.name.bv_len = tmpint32;
cbp.name.bv_val = cbp.buf;
if (!isvalidgroupname(&cbp.name)) {
@ -316,7 +316,7 @@ NSSOV_HANDLE(
char fbuf[1024];
struct berval filter = {sizeof(fbuf)};
filter.bv_val = fbuf;
READ_STRING_BUF2(fp,cbp.buf,sizeof(cbp.buf));
READ_STRING(fp,cbp.buf);
cbp.user.bv_len = tmpint32;
cbp.user.bv_val = cbp.buf;
if (!isvalidusername(&cbp.user)) {

View file

@ -91,7 +91,7 @@ static int write_host(nssov_host_cbp *cbp,Entry *entry)
addrs = a->a_vals;
numaddr = a->a_numvals;
/* write the entry */
WRITE_INT32(cbp->fp,NSLCD_RESULT_SUCCESS);
WRITE_INT32(cbp->fp,NSLCD_RESULT_BEGIN);
WRITE_BERVAL(cbp->fp,&name);
if ( dupname >= 0 ) {
WRITE_INT32(cbp->fp,numname-1);
@ -118,7 +118,7 @@ NSSOV_HANDLE(
struct berval filter = {sizeof(fbuf)};
filter.bv_val = fbuf;
BER_BVZERO(&cbp.addr);
READ_STRING_BUF2(fp,cbp.buf,sizeof(cbp.buf));
READ_STRING(fp,cbp.buf);
cbp.name.bv_len = tmpint32;
cbp.name.bv_val = cbp.buf;,
Debug(LDAP_DEBUG_TRACE,"nssov_host_byname(%s)\n",cbp.name.bv_val,0,0);,

View file

@ -140,8 +140,8 @@ static int write_netgroup_triple(TFILE *fp,const char *triple)
return 0;
}
/* write strings */
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_INT32(fp,NETGROUP_TYPE_TRIPLE);
WRITE_INT32(fp,NSLCD_RESULT_BEGIN);
WRITE_INT32(fp,NSLCD_NETGROUP_TYPE_TRIPLE);
WRITE_STRING_STRIPSPACE_LEN(fp,triple+hostb,hoste-hostb)
WRITE_STRING_STRIPSPACE_LEN(fp,triple+userb,usere-userb)
WRITE_STRING_STRIPSPACE_LEN(fp,triple+domainb,domaine-domainb)
@ -171,9 +171,9 @@ static int write_netgroup(nssov_netgroup_cbp *cbp,Entry *entry)
for (i=0;i<a->a_numvals;i++)
{
/* write the result code */
WRITE_INT32(cbp->fp,NSLCD_RESULT_SUCCESS);
WRITE_INT32(cbp->fp,NSLCD_RESULT_BEGIN);
/* write triple indicator */
WRITE_INT32(cbp->fp,NETGROUP_TYPE_NETGROUP);
WRITE_INT32(cbp->fp,NSLCD_NETGROUP_TYPE_NETGROUP);
/* write netgroup name */
if (write_string_stripspace_len(cbp->fp,a->a_vals[i].bv_val,a->a_vals[i].bv_len))
return -1;
@ -190,7 +190,7 @@ NSSOV_HANDLE(
char fbuf[1024];
struct berval filter = {sizeof(fbuf)};
filter.bv_val = fbuf;
READ_STRING_BUF2(fp,cbp.buf,sizeof(cbp.buf));,
READ_STRING(fp,cbp.buf);,
cbp.name.bv_len = tmpint32;
cbp.name.bv_val = cbp.buf;
Debug(LDAP_DEBUG_TRACE,"nssov_netgroup_byname(%s)\n",cbp.name.bv_val,0,0);,

View file

@ -91,7 +91,7 @@ static int write_network(nssov_network_cbp *cbp,Entry *entry)
addrs = a->a_vals;
numaddr = a->a_numvals;
/* write the entry */
WRITE_INT32(cbp->fp,NSLCD_RESULT_SUCCESS);
WRITE_INT32(cbp->fp,NSLCD_RESULT_BEGIN);
WRITE_BERVAL(cbp->fp,&name);
if ( dupname >= 0 ) {
WRITE_INT32(cbp->fp,numname-1);
@ -118,7 +118,7 @@ NSSOV_HANDLE(
struct berval filter = {sizeof(fbuf)};
filter.bv_val = fbuf;
BER_BVZERO(&cbp.addr);
READ_STRING_BUF2(fp,cbp.buf,sizeof(cbp.buf));
READ_STRING(fp,cbp.buf);
cbp.name.bv_len = tmpint32;
cbp.name.bv_val = cbp.buf;,
Debug(LDAP_DEBUG_TRACE,"nssov_network_byname(%s)\n",cbp.name.bv_val,0,0);,

View file

@ -1,76 +0,0 @@
The original nss_ldap library was written by Luke Howard of PADL Software Pty
Ltd. In 2006 Arthur de Jong of West Consuling forked the library to split it
into a thin NSS part and a server part. The copyright holders of most of the
code are:
Luke Howard <lukeh@padl.com>
West Consulting <info@west.nl>
Arthur de Jong <arthur@ch.tudelft.nl>
The following people (in no particular order) have also volunteered their
time, effort, and ideas to make this software available. If you feel you are
unjustly left out of this list, please send an email.
Steven Barrus <sbarrus@eng.utah.edu>
David Begley <david@avarice.nepean.uws.edu.au>
Maxim Batourine <Batourine_M@ald.utoronto.ca>
Michael Brownea <mbrown@fensystems.co.uk>
Max Caines <Max.Caines@wlv.ac.uk>
Carlos Celso <carlos.celso@embraer.com.br>
Peter Cherny <peterc@luddite.com.au>
Howard Chu <hyc@symas.com>
Ben Collins <bcollins@debian.org>
Stephan Cremer <scremer@dohle.com>
Alejandro Forero Cuervo <azul@freaks-unidos.net>
Guenther Deschner <gd@samba.org>
Luca Filipozzi <lucaf+nssldap@ece.ubc.ca>
Andrew Findlay <Andrew.Findlay@skills-1st.co.uk>
Cristian Gafton <gafton@redhat.com>
Gabor Gombas <gombasg@inf.elte.hu>
DJ Gregor <dj@gregor.com>
Bob Guo <bob@mail.ied.ac.cn>
Daniel Hanks <hanksdc@plug.org>
Leif Hedstrom <leif@ogre.com>
Emile Heitor <eheitor@isdnet.net>
Geert Jansen <undisclosed>
Szymon Juraszczyk <szymon@ssk.pl>
Anselm Kruis <kruis@till-photonics.com>
Thorsten Kukuk <kukuk@suse.de>
Steve Langasek <vorlon@netexpress.net>
Joe Little <jlittle@open-it.org>
Phillip Liu <phillip@loudcloud.com>
Larry Lile <llile@dreamworks.com>
Jeff Mandel <jeff.mandel@probes.com>
Peter Marschall <peter@adpm.de>
Michael Mattice <mike@bmisystems.com>
Dejan Muhamedagic <dejan.muhamedagic@at.ibm.com>
Doug Nazar <nazard@dragoninc.on.ca>
Frode Nordahl <frode@nordahl.net>
Lars Oergel <lars.oergel@innominate.de>
Fredrik Ohrn <ohrn@chl.chalmers.se>
Rakesh Patel <rpatel@globix.com>
Nathan Hawkins <Nathan.Hawkins@FMR.COM>
Andrew Rechenberg <ARechenberg@shermanfinancialgroup.com>
Greg Retowski <greg@rage.net>
Alain Richard <alain.richard@equation.fr>
Michael Shuey <shuey@ecn.purdue.edu>
Oliver Schulze L. <oliver@samera.com.py>
Alexander Spannagel <spannagel@jobpilot.com>
Scott M. Stone <sstone@foo3.com>
Gero Treuner <gero@faveve.uni-stuttgart.de>
Jarkko Turkulainen <jt@wapit.com>
Stein Vrale <stein@terminator.net>
Simon Wilkinson <sxw@sxw.org.uk>
Davide Puricelli <evo@debian.org>
Sami Haahtinen <ressu@debian.org>
Stephen Frost <sfrost@debian.org>
Américo Monteiro <a_monteiro@netcabo.pt>
Cyril Brulebois <cyril.brulebois@enst-bretagne.fr>
Kenshi Muto <kmuto@debian.org>
Andreas Schneider <anschneider@suse.de>
Ralf Haferkamp <rhafer@suse.de>
Michael Calmer <mc@suse.de>
Erik Schanze <eriks@debian.org>
Bart Cornelis <cobaco@skolelinux.no>
Rudy Godoy Guillén <rudy@debian.org>
Petter Reinholdtsen <pere@hungry.com>

View file

@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

File diff suppressed because it is too large Load diff

View file

@ -1,154 +0,0 @@
This document tries to describe the software layout and design of the library.
It should provide some help for contributing code to this package.
CONTRIBUTING TO NSS-LDAPD
=========================
Contributions to nss-ldapd are most welcome. However not all contributions
will be automatically integrated. Some notes:
* for large changes it is a good idea to send an email first
* send your patches in unified diff (diff -u) format
* try to use the svn version of the software to develop the patch
* clearly state which problem you're trying to solve and how this is
accomplished
* please follow the existing coding conventions
* patches will be integrated on a best-effort bases
* please test the patch and include information on testing with the patch
(platforms tested, etc)
* contributions will be acknowledged in the AUTHORS file
* include a copyright statement in the patched code if you feel the
contribution is significant enough (e.g. more than a few lines)
* when including third-party code, retain copyright information (copyright
holder and license) and ensure that the license is LGPL compatible
Please contact Arthur de Jong <arthur@ch.tudelft.nl> if you want to
contribute or use the Debian BTS if you're using the Debian package.
BUILD DEPENDENCIES
==================
For building svn snapshots the following tools are needed:
* autoconf (2.61 is used but 2.59 is minimal)
* automake (1.10 is used)
* check (0.9.5 is used)
and of course the usual build tools (gcc/make/etc). Also see debian/control
(Build-Depends field) for libraries you need.
To build the svn snapshot run the autogen.sh shell script to build the
configure script. When developing patches please use --enable-warnings with
configure and don't introduce too many new warnings. For building the manual
pages docbook2x is used.
RELEASE VERSIONING
==================
A new versioning scheme was chosen over the nss_ldap release scheme. The
scheme is a simple major.minor numbering starting with 0.1. Until a 1.0
release is made the code will be considered work in progress. The interfaces
may change and features may be added and removed.
GENERAL DESIGN
==============
The basic design splits the functionality in two parts. The NSS part
interfaces with libc and translates the NSS requests into simple generic
requests (e.g. "get user with name test", "get group with gid 101" or "get all
shadow entries"). Translating these requests into LDAP requests is then the
job of the daemon (nslcd) so that the NSS part won't have to know anything
about LDAP (in fact replacing it with another lookup method is very simple).
nslcd -> OpenLDAP -> LDAP server
^
libc NSS -> libnss_ldap.so
design goals
------------
* make it as simple as possible
* design as specified above
* simpler configuration and semantics
* simpler, clearer and completer documentation
* split source code into directories (src, src/hacks, src/aix, src/irs, etc)
* get rid of unneeded code and complexity
* split complexity in two parts (LDAP interface in server, NSS interface in
library)
* have a stable, easily maintainable piece of quality software
NSS PART
========
The NSS part is implemented in files in the nss directory. The functions are
split into files according to the database they support. All functions look
like:
_nss_ldap_FUNCTION_r(...)
This function opens the connection to the nslcd (with a time-out) builds the
correct data structures and does a request (write()) to the nslcd waiting
for an answer (again with a time-out)
Currently a number of macros are used to build most of the function bodies for
these functions. A more elegant solution is welcome.
Some handy links:
http://mirrors.usc.edu/pub/gnu/Manuals/glibc-2.2.3/html_chapter/libc_28.html#SEC596
http://www.gnu.org/software/libc/manual/html_node/index.html
THE COMMUNICATIONS PROTOCOL
===========================
The protocol used for communicating between the NSS library and the nslcd
daemon is very simple and almost fully described in the nslcd.h header file.
The nslcd-common.h header file defines some macros that are used for reading
and writing protocol entities (strings, 32-bit integers, etc).
Some of the protocol handling code is automatically generated from the macros
defined in nslcd.h. This cannot be done automatically in every case though so
changing the protocol requires manual checking in the relevant source files in
both the nss and the nslcd directories.
If the protocol is changed in an incompatible way the protocol version should
be incremented in nslcd.h. There is currently no versioning scheme available
for this.
A special module (common/tio.c) was made so we can define simpler semantics
for time-out values and buffer sizes. Both tha NSS library and nslcd use this
module which means that it includes functionality that is needed for both
(e.g. large write buffers for the server part and large resettable read
buffers for the NSS part). Maybe building two modules from the same source
with different features in them is an option (e.g. the NSS part needs the
read buffers and handling of SIGPIPE and the nslcd part needs the write
buffers and possibly flushing in the background).
SERVER PART
===========
At the server end a dispatcher picks up the request and delegates it to one of
the database specific functions.
nslcd_FUNCION(...)
This functions fills in the correct parameters from the request. This
function should write responses to the stream. Almost all these functions
are generated from a macro in common.h.
SECURITY NOTES
==============
This design does open up the system to more potential security issues as there
is now a local interface to a daemon with privileges. Before processes could
only potentially exploit bugs in the library and gain the privileges of the
process that was doing the name lookups. In this case the privileges of the
daemon are potentially exposed.
The deamon should be changed to set a specific less-privileged user and
group to minimize the riscs. Code for this is already in place. Configuration
options should be added and the Debian packaging should use this.

View file

@ -1,237 +0,0 @@
Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
2006, 2007 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, and a
file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
`configure' by a program called `autoconf'. You need `configure.ac' if
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
Running `configure' might take a while. While running, it prints
some messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
6. Often, you can also type `make uninstall' to remove the installed
files again.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that the
`configure' script does not know about. Run `./configure --help' for
details on some of the pertinent environment variables.
You can give `configure' initial values for configuration parameters
by setting variables in the command line or in the environment. Here
is an example:
./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
installed the package for one architecture, use `make distclean' before
reconfiguring for another architecture.
Installation Names
==================
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
pass the option `--exec-prefix=PREFIX' to `configure', the package uses
PREFIX as the prefix for installing programs and libraries.
Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' cannot figure out automatically,
but needs to determine by the type of machine the package will run on.
Usually, assuming the package is built to be run on the _same_
architectures, `configure' can figure that out, but if it prints a
message saying it cannot guess the machine type, give it the
`--build=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name which has the form:
CPU-COMPANY-SYSTEM
where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
platform different from the build platform, you should specify the
"host" platform (i.e., that on which the generated programs will
eventually be run) with `--host=TYPE'.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share, you
can create a site shell script called `config.site' that gives default
values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Defining Variables
==================
Variables not defined in a site shell script can be set in the
environment passed to `configure'. However, some packages may run
configure again during the build, and the customized values of these
variables may be lost. In order to avoid this problem, you should set
them in the `configure' command line, using `VAR=value'. For example:
./configure CC=/usr/local2/bin/gcc
causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
an Autoconf bug. Until the bug is fixed you can use this workaround:
CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
`configure' Invocation
======================
`configure' recognizes the following options to control how it operates.
`--help'
`-h'
Print a summary of the options to `configure', and exit.
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`--cache-file=FILE'
Enable the cache: use and save the results of the tests in FILE,
traditionally `config.cache'. FILE defaults to `/dev/null' to
disable caching.
`--config-cache'
`-C'
Alias for `--cache-file=config.cache'.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.

View file

@ -1,93 +0,0 @@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2006 Luke Howard
# Copyright (C) 2006 West Consulting
# Copyright (C) 2006, 2007, 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
SUBDIRS = compat common nss nslcd man tests
DEBIAN_FILES = debian/changelog debian/compat debian/control \
debian/copyright debian/rules \
debian/libnss-ldapd.docs \
debian/libnss-ldapd.examples \
debian/libnss-ldapd.lintian-overrides \
debian/libnss-ldapd.nslcd.init \
debian/libnss-ldapd.config \
debian/libnss-ldapd.templates \
debian/libnss-ldapd.postinst \
debian/libnss-ldapd.postrm \
$(wildcard debian/po/*.po) debian/po/templates.pot \
debian/po/POTFILES.in
EXTRA_DIST = nss-ldapd.conf nslcd.h nslcd-common.h \
$(wildcard m4/*.m4) HACKING $(DEBIAN_FILES)
DISTCHECK_CONFIGURE_FLAGS='--enable-warnings'
ACLOCAL_AMFLAGS = -I m4
NSS_LDAP_PATH_CONF = @NSS_LDAP_PATH_CONF@
install-data-local: install-ldap_conf
uninstall-local: uninstall-ldap_conf
# install a default configuration file if it is not already there
install-ldap_conf:
@if [ -f $(DESTDIR)$(NSS_LDAP_PATH_CONF) ]; then \
echo "$(DESTDIR)$(NSS_LDAP_PATH_CONF) already exists, install will not overwrite"; \
else \
$(INSTALL_DATA) -D $(srcdir)/nss-ldapd.conf $(DESTDIR)$(NSS_LDAP_PATH_CONF); \
fi
uninstall-ldap_conf:
-rm -f $(DESTDIR)$(NSS_LDAP_PATH_CONF)
# target for easily creating a Debian package
# the find is an ugly hack to fix a bug if being built on an nfs filesystem
deb: distdir
find $(distdir) -type d | xargs touch
cd $(distdir) && \
debuild
rm -rf $(distdir)
# target for generating the ChangeLog file
changelog:
( svn2cl -i --stdout -r HEAD:195 ; \
svn2cl -i --stdout -r 194:3 --strip-prefix='libnss_ldapd' ; \
svn2cl -i --stdout -r 2 --strip-prefix='libnss_ldap_251-5.2' ; \
svn2cl -i --stdout -r 1 --strip-prefix='nss_ldap-251' ; \
) > ChangeLog
flawfinder.html:
flawfinder --quiet --html --context --followdotdir . > $@
rats.html:
rats --quiet --html --context . > $@
splint.txt:
-env LARCH_PATH=/usr/share/splint/lib/ \
LCLIMPORTDIR=/usr/share/splint/imports/ \
splint -checks \
-warnposix +showsummary +showalluses +hints -namechecks \
-globstate -predboolint -mustfreeonly -temptrans -kepttrans \
-I. -I$(srcdir) -I$(top_builddir) $(DEFS) -D_REENTRANT -DDEBUG \
-D__signed__=signed -D__thread= -D__gnuc_va_list=__ptr_t \
-Dkrb5_int32=int32_t -Dkrb5_ui_4=uint32_t \
-D__u16=uint16_t -D__u32=uint32_t \
*.[ch] nss/*.[ch] nslcd/*.[ch] common/*.[ch] compat/*.[ch] > $@ 2>&1
.PHONY: flawfinder.html rats.html splint.txt

View file

@ -1,713 +0,0 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2006 Luke Howard
# Copyright (C) 2006 West Consulting
# Copyright (C) 2006, 2007, 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \
TODO compile config.guess config.sub depcomp install-sh \
missing mkinstalldirs
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
{ test ! -d $(distdir) \
|| { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOCBOOK2X_MAN = @DOCBOOK2X_MAN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NSLCD_PIDFILE = @NSLCD_PIDFILE@
NSLCD_SOCKET = @NSLCD_SOCKET@
NSS_LDAP_PATH_CONF = @NSS_LDAP_PATH_CONF@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RELEASE_MONTH = @RELEASE_MONTH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
acx_pthread_config = @acx_pthread_config@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
nslcd_LIBS = @nslcd_LIBS@
nss_ldap_so_LIBS = @nss_ldap_so_LIBS@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = compat common nss nslcd man tests
DEBIAN_FILES = debian/changelog debian/compat debian/control \
debian/copyright debian/rules \
debian/libnss-ldapd.docs \
debian/libnss-ldapd.examples \
debian/libnss-ldapd.lintian-overrides \
debian/libnss-ldapd.nslcd.init \
debian/libnss-ldapd.config \
debian/libnss-ldapd.templates \
debian/libnss-ldapd.postinst \
debian/libnss-ldapd.postrm \
$(wildcard debian/po/*.po) debian/po/templates.pot \
debian/po/POTFILES.in
EXTRA_DIST = nss-ldapd.conf nslcd.h nslcd-common.h \
$(wildcard m4/*.m4) HACKING $(DEBIAN_FILES)
DISTCHECK_CONFIGURE_FLAGS = '--enable-warnings'
ACLOCAL_AMFLAGS = -I m4
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
cd $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
echo ' $(SHELL) ./config.status'; \
$(SHELL) ./config.status;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: $(am__configure_deps)
cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: $(am__configure_deps)
cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
distclean-hdr:
-rm -f config.h stamp-h1
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
empty_fix=.; \
else \
include_option=--include; \
empty_fix=; \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
test -d $(distdir) || mkdir $(distdir)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \
distdir=`$(am__cd) $(distdir) && pwd`; \
top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
(cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$$top_distdir" \
distdir="$$distdir/$$subdir" \
am__remove_distdir=: \
am__skip_length_check=: \
distdir) \
|| exit 1; \
fi; \
done
-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|| chmod -R a+r $(distdir)
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
dist-tarZ: distdir
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.Z*) \
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
*.shar.gz*) \
GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
&& $(MAKE) $(AM_MAKEFLAGS) install \
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
distuninstallcheck \
&& chmod -R a-w "$$dc_install_base" \
&& ({ \
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
} || { rm -rf "$$dc_destdir"; exit 1; }) \
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@cd $(distuninstallcheck_dir) \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
fi ; \
$(distuninstallcheck_listfiles) ; \
exit 1; } >&2
distcleancheck: distclean
@if test '$(srcdir)' = . ; then \
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
exit 1 ; \
fi
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|| { echo "ERROR: files left in build directory after distclean:" ; \
$(distcleancheck_listfiles) ; \
exit 1; } >&2
check-am: all-am
check: check-recursive
all-am: Makefile config.h
installdirs: installdirs-recursive
installdirs-am:
install: install-recursive
install-exec: install-exec-recursive
install-data: install-data-recursive
uninstall: uninstall-recursive
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-recursive
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-recursive
clean-am: clean-generic mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
dvi: dvi-recursive
dvi-am:
html: html-recursive
info: info-recursive
info-am:
install-data-am: install-data-local
install-dvi: install-dvi-recursive
install-exec-am:
install-html: install-html-recursive
install-info: install-info-recursive
install-man:
install-pdf: install-pdf-recursive
install-ps: install-ps-recursive
installcheck-am:
maintainer-clean: maintainer-clean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -rf $(top_srcdir)/autom4te.cache
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
mostlyclean-am: mostlyclean-generic
pdf: pdf-recursive
pdf-am:
ps: ps-recursive
ps-am:
uninstall-am: uninstall-local
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \
dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \
distclean-generic distclean-hdr distclean-tags distcleancheck \
distdir distuninstallcheck dvi dvi-am html html-am info \
info-am install install-am install-data install-data-am \
install-data-local install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
uninstall-local
install-data-local: install-ldap_conf
uninstall-local: uninstall-ldap_conf
# install a default configuration file if it is not already there
install-ldap_conf:
@if [ -f $(DESTDIR)$(NSS_LDAP_PATH_CONF) ]; then \
echo "$(DESTDIR)$(NSS_LDAP_PATH_CONF) already exists, install will not overwrite"; \
else \
$(INSTALL_DATA) -D $(srcdir)/nss-ldapd.conf $(DESTDIR)$(NSS_LDAP_PATH_CONF); \
fi
uninstall-ldap_conf:
-rm -f $(DESTDIR)$(NSS_LDAP_PATH_CONF)
# target for easily creating a Debian package
# the find is an ugly hack to fix a bug if being built on an nfs filesystem
deb: distdir
find $(distdir) -type d | xargs touch
cd $(distdir) && \
debuild
rm -rf $(distdir)
# target for generating the ChangeLog file
changelog:
( svn2cl -i --stdout -r HEAD:195 ; \
svn2cl -i --stdout -r 194:3 --strip-prefix='libnss_ldapd' ; \
svn2cl -i --stdout -r 2 --strip-prefix='libnss_ldap_251-5.2' ; \
svn2cl -i --stdout -r 1 --strip-prefix='nss_ldap-251' ; \
) > ChangeLog
flawfinder.html:
flawfinder --quiet --html --context --followdotdir . > $@
rats.html:
rats --quiet --html --context . > $@
splint.txt:
-env LARCH_PATH=/usr/share/splint/lib/ \
LCLIMPORTDIR=/usr/share/splint/imports/ \
splint -checks \
-warnposix +showsummary +showalluses +hints -namechecks \
-globstate -predboolint -mustfreeonly -temptrans -kepttrans \
-I. -I$(srcdir) -I$(top_builddir) $(DEFS) -D_REENTRANT -DDEBUG \
-D__signed__=signed -D__thread= -D__gnuc_va_list=__ptr_t \
-Dkrb5_int32=int32_t -Dkrb5_ui_4=uint32_t \
-D__u16=uint16_t -D__u32=uint32_t \
*.[ch] nss/*.[ch] nslcd/*.[ch] common/*.[ch] compat/*.[ch] > $@ 2>&1
.PHONY: flawfinder.html rats.html splint.txt
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

File diff suppressed because it is too large Load diff

View file

@ -1,317 +0,0 @@
nss-ldapd - NSS library for name lookups using LDAP
nss-ldapd is a fork from nss_ldap which was originally written by
Luke Howard of PADL Software Pty Ltd.
http://www.padl.com/OSS/nss_ldap.html
In 2006 Arthur de Jong of West Consuling forked the library to
split it into a thin NSS part and a server part. Most of the code
was rewritten.
http://ch.tudelft.nl/~arthur/nss-ldapd/
Copyright (C) 1997-2006 Luke Howard
Copyright (C) 2006, 2007 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
INTRODUCTION
============
This is the nss-ldapd library which is an NSS module to do name lookups to an
LDAP directory server. This library was forked from nss_ldap as provided by
Luke Howard of PADL Software Pty Ltd.
The library allows distributing account, group, host and other configuration
information from a central LDAP server throughout an organisation. Because
LDAP is a hierarchical directory service, you can distribute the information
in a manner which reflects an organisational structure. This contrasts with
the flat, single domain policy of NIS. LDAP has many of the advantages of NIS+
(security and scalability) without the complexity. The system will work
alongside your existing NIS, NIS+, DNS and flat file name services.
This library consists of a thin NSS part that communicates with a local daemon
that handles the LDAP lookups. This simplifies the architecture and fixes some
scalability and locking problems in the original design.
improvements over nss_ldap
--------------------------
The fork from nss_ldap was done to implement some major design changes to fix
some structural problems in the library.
The biggest of those problems were host name lookups through LDAP which could
cause deadlocks in most cases and some general name lookup problems during
booting (when the LDAP server was not started or not yet reachable).
With nss-ldapd a number of refactoring steps were taken to simplify the code
and improve maintainability. Legacy code was removed and support for non-Linux
operating systems was initially removed to make the code more readable.
Portability will be re-added once the architecture stabilises.
The most practical improvements of nss-ldapd over nss_ldap are:
- the LDAP library is not loaded for every process doing LDAP lookups
- the number of connections to the LDAP server is limited, because not every
process will open it's own connection (this problem is also mitigated by
using nscd)
- hostname lookups should now be deadlock-free because the LDAP server name is
no longer looked up using the ldap method
- the setup is easier to debug because logging on the server component can be
enabled without affecting "normal" processes
This package runs a local daemon that will be enabled during the boot process.
This daemon will handle connections to the LDAP server and accept NSS requests
from a named socket (/var/run/nslcd/socket). The thin NSS library will proxy
requests to the daemon.
Note that the package currently cannot be used on the same system alongside
nss_ldap.
supported C libraries
---------------------
This library currently only supports the GNU C Library. Support for other C
libraries has been removed in a refactoring step. Compatibility code and
support for other C libraries will be added in due time upon request.
supported name databases
------------------------
Currently the following name databases are supported:
aliases, ethers, group, hosts, netgroup, networks, passwd, protocols, rpc,
services and shadow
Note that for when using IPv6 hosts entries, the addresses in the LDAP
directory must be in their preferred form. The same is true for mac addresses
for the ethers database. Otherwise the address->entry lookups will not work.
For more details on the preferred form see
http://ldap.akbkhome.com/index.php/attribute/ipHostNumber.html
and
http://ldap.akbkhome.com/index.php/attribute/macAddress.html
automounter map lookups (which are also defined in /etc/nsswitch.conf) are not
supported because the NSS interface is not used for these. The common autofs
implementation (on GNU/Linux) currently uses it's own method for getting the
maps from LDAP.
Although aliases is exposed through NSS, most mailservers parse /etc/aliases
by themselves and getting aliases from LDAP requires some configuration in the
mailserver.
The publickey, bootparams and netmasks are currently also unsupported. Some
investigation should be done if these are needed for anything, which
interfaces should be exported and how the LDAP schema part should look like.
supported LDAP libraries
------------------------
The current version of nss-ldapd has been developed with OpenLDAP 2.4 but
adding support for other LDAP libraries with similar interfaces should not be
too hard.
unsupported features
--------------------
Since nss-ldapd was forked from nss_ldap most of the features that came with
nss_ldap are available. However, not all features have extensively tested yet
and may cause problems.
- attribute value default and overrides have been removed (but may reappear
some day if requested)
- SSL/TLS support is untested but will be tested when the core code stabilizes
- the configuration file formats are not fully compatible
- nested groups are currently unsupported
- rootbinddn/rootbindpw support is removed and is not likely to return
In general, the focus is to have the functionality that is present be well
tested and supported.
INSTALLATION
============
The nss-ldapd library uses autoconf and automake for building. Installing
nss-ldapd should be as simple as:
% ./configure
% make
% make install
That said, it is a good idea to go first through the options of configure by
running:
% ./configure --help
The last step (make install) should install the libnss_ldap.so.* file and the
daemon (nslcd). The boot process needs to be manually modified to start the
daemon at the right time.
CONFIGURATION
=============
After installation the name service switch configuration file
(/etc/nsswitch.conf) needs to be modified to do name lookups using the new
module. Also, the nss-ldapd configuration file (specified at configure time)
needs to be modified to contain to the correct LDAP configuration.
Editing nsswitch.conf consist mostly of adding ldap in the list of lookup
methods in the right place. See the nsswitch.conf(5) manual page for details
on the format. As an example the file could look a little like this:
# the following contain normal unix user and group information
passwd: files ldap
group: files ldap
shadow: files ldap
# hostname lookups through ldap before dns should work now
hosts: files ldap dns
networks: files ldap
# normal flat-file definitions
protocols: files ldap
services: files ldap
ethers: files ldap
rpc: files ldap
netgroup: ldap
# whether alias lookups really use NSS depends on the mail server
aliases: files ldap
Furthermore a configuration file (by default /etc/nss-ldapd.conf) needs to be
made. The location of this file can be specified with configure. See the
shipped manual page for details on the format and options. It should at least
contain something like:
# the location of LDAP server
uri ldap://localhost/
# search base for all queries.
base dc=example,dc=net
service discovery through DNS
-----------------------------
nss-ldapd supports looking up LDAP server names through DNS SRV records as
specified in RFC 2782. However, Priority and Weight are not considered
separately and a single list of servers in added as if they had been specified
with uri options in the configuration file.
To use this feature specify DNS as an uri in the configuration file and
include something like the following in your zone:
_ldap._tcp SRV 10 0 389 ldapserver
LDAP SCHEMA
===========
nss-ldapd supports a wide range of possible LDAP schema configurations.
Furthermore it can be customized heavily. The LDAP schema used is described in
RFC 2307. Groups with distinguished name members (instead of login names) (RFC
2307bis) are also supported, although use of memberUid has much better
performance.
default attributes
------------------
This paragraph describes the mapping between the NSS lookups and the LDAP
database. The mapping may be modified by changeging the nss-ldapd.conf
configuration file. See the nss-ldapd.conf(5) manual page for details.
aliases (objectClass=nisMailAlias)
cn - alias name
rfc822MailMember - members of the alias (recipients)
ethers (objectClass=ieee802Device)
cn - host name
macAddress - ethernet address
group (objectClass=posixGroup)
cn - group name
userPassword - password
gidNumber - gid
memberUid - members (user names)
uniqueMember - members (DN values)
hosts (objectClass=ipHost)
cn - host name (and aliases)
ipHostNumber - addresses
netgroup (objectClass=nisNetgroup)
cn - netgroup name
nisNetgroupTriple - triplets describing netgroup entries
memberNisNetgroup - reference to other netgroup
networks (objectClass=ipNetwork)
cn - network name
ipNetworkNumber - network address
ipNetmaskNumber - network netmask
passwd (objectClass=posixAccount)
uid - account name
userPassword - password
uidNumber - uid
gidNumber - gid
gecos - gecos
cn - gecos (if gecos is unset)
homeDirectory - home directory
loginShell - shell
protocols (objectClass=ipProtocol)
cn - protocol name
ipProtocolNumber - protocol number
rpc (oncRpc)
cn - rpc name
oncRpcNumber - rpc number
services (objectClass=ipService)
cn - service name
ipServicePort - service port
ipServiceProtocol - service protocol
shadow (objectClass=shadowAccount)
uid - use name
userPassword - password
shadowLastChange - last change of password
shadowMax - days before password may be changed
shadowMin - days after which password must be changed
shadowWarning - expiry warning
shadowInactive - account is disabled if no password is changed
shadowExpire - account expiration
shadowFlag - reserved field
using Microsoft Active Directory
--------------------------------
When using Microsoft Active Directory server (typically on Microsoft Windows
2000) some changes need to be made to the nss-ldapd.conf configuration file.
The included sample configuration file has some commented out attribute
mappings for such a set-up.
MISC NOTES
==========
Most values in the NSS databases are considered case-sensitive (e.g. the user
"Foo" is a different user from "foo"). Values in an LDAP database are however
case-insensitive. This may cause problems in some corner cases, especially
when nscd is used for caching. For example, when doing a lookup for the user
"Foo" the user "foo" will be returned if it exists in the database.
REPORTING BUGS
==============
If you find any bugs or missing features please send email to
arthur@ch.tudelft.nl
If you are using the Debian package you are encouraged to use the BTS.
Please include as much information as needed (platform, output of configure
if compilation fails, output of the failure, etc). Patches are more than
welcome (also see the file HACKING).

View file

@ -1,59 +0,0 @@
probably before we can call this stable
---------------------------------------
* fix usage of strerror() as it is not thread safe
* fix race condition when setting signal mask in common/tio.c
(using pthread_sigmask() adds a dependency on the pthread library,
we should probably just do locking)
* find problem with reachability of LDAP server
* find out why HAVE_GSSPAI is not always set to what configure outputs
* have the daemon run under a special uid/gid
other items
-----------
* set up (test) connection to LDAP server before creating socket
* Debian packaging: maybe remove stuff from /etc/nsswitch.conf on remove or
purge (maybe prompt?)
* probably document that you should use libpam-ldap for authentication without
exposing the passwords through NSS
* document test suite (instructions for setting up environment (server), LDIF
file, nsswitch.conf and nss-ldapd.conf)
* write more unit tests
* maybe support bootparams (check README also)
* maybe support publickey (check README also)
* maybe support netmasks (check README also)
* maybe implement a connection object in the myldap module that is shared
by different sessions (sessions need to be cleaned up)
* add sanity checking code (e.g. not too large buffer allocation and checking
that host, user, etc do not contain funky characters) in all server modules
* log some statistics: "passwd=100 shadow=10 host=20 rpc=10" (10 req/minute)
* in the server: once the request is done pass the flushing of the buffers to
a separate thread so our workers are available to handle new requests
* reconfigure or upgrade of Debian package should restart nslcd instead of
stop and later on start
* tune the filter and parameter buffer sizes
* maybe document how to set up automounting in LDAP (Linux and Solaris)
* make sure to translate timelimit 0 into timelimit -1 where needed
* split out idle checking into separate function so we may be able to call it
periodically from elsewhere (e.g. the main loop)
* add an option to create an extra socket somewhere (so it may be used with
chroot jails)
* make I/O timeout between NSS lib and daemon configurable with configure
* ethers: also look in ipHostNumber attribute to look up an IPv4 (IPv6)
address and return it as an alternative entry
* protocols/rpc: the description attribute should be used as an alias?
* do more checks with failing LDAP connections (e.g. killing connections)
* maybe make myldap code thread-safe (use locking)
* review changes in nss_ldap and merge any useful changes
* maybe rate-limit LDAP entry warnings
* consider returning the canonical value as it is stored in LDAP, not
the requested value (they can differ in case)
* test non-ASCII characters in fields (mostly cn)
* implement attribute defaults (for when they're missing from the directory)
* implement attribute overrides (to always return a specific value, no matter
what the directory says)
* see if we can use LD_LIBRARY_PATH to run our tests in so we don't need to
install NSS library in system path
* only parse configuration options if they are available on the platform
* have some more general mechanism to disable NSS module in nslcd
* do not use LDAP_DEPRECATED enabled functions
* support searchbase autodetection

View file

@ -1,903 +0,0 @@
# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(AC_AUTOCONF_VERSION, [2.61],,
[m4_warning([this file was generated for autoconf 2.61.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.10'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.10.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
# _AM_AUTOCONF_VERSION(VERSION)
# -----------------------------
# aclocal traces this macro to find the Autoconf version.
# This is a private macro too. Using m4_define simplifies
# the logic in aclocal, which can simply ignore this definition.
m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.10.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
#
# Of course, Automake must honor this variable whenever it calls a
# tool from the auxiliary directory. The problem is that $srcdir (and
# therefore $ac_aux_dir as well) can be either absolute or relative,
# depending on how configure is run. This is pretty annoying, since
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
# source directory, any form will work fine, but in subdirectories a
# relative path needs to be adjusted first.
#
# $ac_aux_dir/missing
# fails when called from a subdirectory if $ac_aux_dir is relative
# $top_srcdir/$ac_aux_dir/missing
# fails if $ac_aux_dir is absolute,
# fails when called from a subdirectory in a VPATH build with
# a relative $ac_aux_dir
#
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
# are both prefixed by $srcdir. In an in-source build this is usually
# harmless because $srcdir is `.', but things will broke when you
# start a VPATH build or use an absolute $srcdir.
#
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
# and then we would define $MISSING as
# MISSING="\${SHELL} $am_aux_dir/missing"
# This will work as long as MISSING is not called from configure, because
# unfortunately $(top_srcdir) has no meaning in configure.
# However there are other variables, like CC, which are often used in
# configure, and could therefore not use this "fixed" $ac_aux_dir.
#
# Another solution, used here, is to always expand $ac_aux_dir to an
# absolute PATH. The drawback is that using absolute paths prevent a
# configured tree to be moved without reconfiguration.
AC_DEFUN([AM_AUX_DIR_EXPAND],
[dnl Rely on autoconf to set up CDPATH properly.
AC_PREREQ([2.50])dnl
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
])
# AM_CONDITIONAL -*- Autoconf -*-
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 8
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
# Define a conditional.
AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
else
$1_TRUE='#'
$1_FALSE=
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
AC_MSG_ERROR([[conditional "$1" was never defined.
Usually this means the macro was only invoked conditionally.]])
fi])])
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 9
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
# written in clear, in which case automake, when reading aclocal.m4,
# will think it sees a *use*, and therefore will trigger all it's
# C support machinery. Also note that it means that autoscan, seeing
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
# _AM_DEPENDENCIES(NAME)
# ----------------------
# See how the compiler implements dependency checking.
# NAME is "CC", "CXX", "GCJ", or "OBJC".
# We try a few techniques and use that to set a single cache variable.
#
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
# dependency, and given that the user is not expected to run this macro,
# just rely on AC_PROG_CC.
AC_DEFUN([_AM_DEPENDENCIES],
[AC_REQUIRE([AM_SET_DEPDIR])dnl
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
AC_REQUIRE([AM_DEP_TRACK])dnl
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
[$1], CXX, [depcc="$CXX" am_compiler_list=],
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
[$1], UPC, [depcc="$UPC" am_compiler_list=],
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
[depcc="$$1" am_compiler_list=])
AC_CACHE_CHECK([dependency style of $depcc],
[am_cv_$1_dependencies_compiler_type],
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
# We make a subdir and do the tests there. Otherwise we can end up
# making bogus files that we don't know about and never remove. For
# instance it was reported that on HP-UX the gcc test will end up
# making a dummy file named `D' -- because `-MD' means `put the output
# in D'.
mkdir conftest.dir
# Copy depcomp to subdir because otherwise we won't find it if we're
# using a relative directory.
cp "$am_depcomp" conftest.dir
cd conftest.dir
# We will build objects and dependencies in a subdirectory because
# it helps to detect inapplicable dependency modes. For instance
# both Tru64's cc and ICC support -MD to output dependencies as a
# side effect of compilation, but ICC will put the dependencies in
# the current directory while Tru64 will put them in the object
# directory.
mkdir sub
am_cv_$1_dependencies_compiler_type=none
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
for depmode in $am_compiler_list; do
# Setup a source with many dependencies, because some compilers
# like to wrap large dependency lists on column 80 (with \), and
# we should not choose a depcomp mode which is confused by this.
#
# We need to recreate these files for each test, as the compiler may
# overwrite some of them when testing with obscure command lines.
# This happens at least with the AIX C compiler.
: > sub/conftest.c
for i in 1 2 3 4 5 6; do
echo '#include "conftst'$i'.h"' >> sub/conftest.c
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
# Solaris 8's {/usr,}/bin/sh.
touch sub/conftst$i.h
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
case $depmode in
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
if test "x$enable_dependency_tracking" = xyes; then
continue
else
break
fi
;;
none) break ;;
esac
# We check with `-c' and `-o' for the sake of the "dashmstdout"
# mode. It turns out that the SunPro C++ compiler does not properly
# handle `-M -o', and we need to detect this.
if depmode=$depmode \
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
# icc doesn't choke on unknown options, it will just issue warnings
# or remarks (even with -Werror). So we grep stderr for any message
# that says an option was ignored or not supported.
# When given -MP, icc 7.0 and 7.1 complain thusly:
# icc: Command line warning: ignoring option '-M'; no argument required
# The diagnosis changed in icc 8.0:
# icc: Command line remark: option '-MP' not supported
if (grep 'ignoring option' conftest.err ||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
am_cv_$1_dependencies_compiler_type=$depmode
break
fi
fi
done
cd ..
rm -rf conftest.dir
else
am_cv_$1_dependencies_compiler_type=none
fi
])
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
AM_CONDITIONAL([am__fastdep$1], [
test "x$enable_dependency_tracking" != xno \
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
])
# AM_SET_DEPDIR
# -------------
# Choose a directory name for dependency files.
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
AC_DEFUN([AM_SET_DEPDIR],
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
])
# AM_DEP_TRACK
# ------------
AC_DEFUN([AM_DEP_TRACK],
[AC_ARG_ENABLE(dependency-tracking,
[ --disable-dependency-tracking speeds up one-time build
--enable-dependency-tracking do not reject slow dependency extractors])
if test "x$enable_dependency_tracking" != xno; then
am_depcomp="$ac_aux_dir/depcomp"
AMDEPBACKSLASH='\'
fi
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
AC_SUBST([AMDEPBACKSLASH])dnl
_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
])
# Generate code to set up dependency tracking. -*- Autoconf -*-
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
#serial 3
# _AM_OUTPUT_DEPENDENCY_COMMANDS
# ------------------------------
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
[for mf in $CONFIG_FILES; do
# Strip MF so we end up with the name of the file.
mf=`echo "$mf" | sed -e 's/:.*$//'`
# Check whether this is an Automake generated Makefile or not.
# We used to match only the files named `Makefile.in', but
# some people rename them; so instead we look at the file content.
# Grep'ing the first line is not enough: some people post-process
# each Makefile.in and add a new line on top of each file to say so.
# Grep'ing the whole file is not good either: AIX grep has a line
# limit of 2048, but all sed's we know have understand at least 4000.
if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
dirpart=`AS_DIRNAME("$mf")`
else
continue
fi
# Extract the definition of DEPDIR, am__include, and am__quote
# from the Makefile without running `make'.
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
test -z "$DEPDIR" && continue
am__include=`sed -n 's/^am__include = //p' < "$mf"`
test -z "am__include" && continue
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
# When using ansi2knr, U may be empty or an underscore; expand it
U=`sed -n 's/^U = //p' < "$mf"`
# Find all dependency output files, they are included files with
# $(DEPDIR) in their names. We invoke sed twice because it is the
# simplest approach to changing $(DEPDIR) to its actual value in the
# expansion.
for file in `sed -n "
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
# Make sure the directory exists.
test -f "$dirpart/$file" && continue
fdir=`AS_DIRNAME(["$file"])`
AS_MKDIR_P([$dirpart/$fdir])
# echo "creating $dirpart/$file"
echo '# dummy' > "$dirpart/$file"
done
done
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
# AM_OUTPUT_DEPENDENCY_COMMANDS
# -----------------------------
# This macro should only be invoked once -- use via AC_REQUIRE.
#
# This code is only required when automatic dependency tracking
# is enabled. FIXME. This creates each `.P' file that we will
# need in order to bootstrap the dependency handling code.
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
[AC_CONFIG_COMMANDS([depfiles],
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
])
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 13
# This macro actually does too much. Some checks are only needed if
# your package does certain things. But this isn't really a big deal.
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
# The call with PACKAGE and VERSION arguments is the old style
# call (pre autoconf-2.50), which is being phased out. PACKAGE
# and VERSION should now be passed to AC_INIT and removed from
# the call to AM_INIT_AUTOMAKE.
# We support both call styles for the transition. After
# the next Automake release, Autoconf can make the AC_INIT
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.60])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
if test "`cd $srcdir && pwd`" != "`pwd`"; then
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output
# is not polluted with repeated "-I."
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
# test to see if srcdir already configured
if test -f $srcdir/config.status; then
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
fi
# test whether we have cygpath
if test -z "$CYGPATH_W"; then
if (cygpath --version) >/dev/null 2>/dev/null; then
CYGPATH_W='cygpath -w'
else
CYGPATH_W=echo
fi
fi
AC_SUBST([CYGPATH_W])
# Define the identity of the package.
dnl Distinguish between old-style and new-style calls.
m4_ifval([$2],
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
_AM_IF_OPTION([no-define],,
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
# Some tools Automake needs.
AC_REQUIRE([AM_SANITY_CHECK])dnl
AC_REQUIRE([AC_ARG_PROGRAM])dnl
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
AM_PROG_INSTALL_SH
AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
[_AM_PROG_TAR([v7])])])
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
[_AM_DEPENDENCIES(CC)],
[define([AC_PROG_CC],
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
[_AM_DEPENDENCIES(CXX)],
[define([AC_PROG_CXX],
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
[_AM_DEPENDENCIES(OBJC)],
[define([AC_PROG_OBJC],
defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
])
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
# that is generated. The stamp files are numbered to have different names.
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
# loop where config.status creates the headers, so we can generate
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
_am_arg=$1
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
$_am_arg | $_am_arg:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
AC_DEFUN([AM_SET_LEADING_DOT],
[rm -rf .tst 2>/dev/null
mkdir .tst 2>/dev/null
if test -d .tst; then
am__leading_dot=.
else
am__leading_dot=_
fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
# Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# AM_MAKE_INCLUDE()
# -----------------
# Check to see how make treats includes.
AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
@echo done
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
AC_MSG_CHECKING([for style of include used by $am_make])
am__include="#"
am__quote=
_am_result=none
# First try GNU make style include.
echo "include confinc" > confmf
# We grep out `Entering directory' and `Leaving directory'
# messages which can occur if `w' ends up in MAKEFLAGS.
# In particular we don't look at `^make:' because GNU make might
# be invoked under some other name (usually "gmake"), in which
# case it prints its new name instead of `make'.
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
am__include=include
am__quote=
_am_result=GNU
fi
# Now try BSD make style include.
if test "$am__include" = "#"; then
echo '.include "confinc"' > confmf
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
am__include=.include
am__quote="\""
_am_result=BSD
fi
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_PROG_CC_C_O
# --------------
# Like AC_PROG_CC_C_O, but changed for automake.
AC_DEFUN([AM_PROG_CC_C_O],
[AC_REQUIRE([AC_PROG_CC_C_O])dnl
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([compile])dnl
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
# A longer-term fix would be to have automake use am__CC in this case,
# and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
CC="$am_aux_dir/compile $CC"
fi
dnl Make sure AC_PROG_CC is never called again, or it will override our
dnl setting of CC.
m4_define([AC_PROG_CC],
[m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
])
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 5
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
AC_DEFUN([AM_MISSING_PROG],
[AC_REQUIRE([AM_MISSING_HAS_RUN])
$1=${$1-"${am_missing_run}$2"}
AC_SUBST($1)])
# AM_MISSING_HAS_RUN
# ------------------
# Define MISSING if not defined so far and test if it supports --run.
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
AC_MSG_WARN([`missing' script is too old or missing])
fi
])
# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_MKDIR_P
# ---------------
# Check for `mkdir -p'.
AC_DEFUN([AM_PROG_MKDIR_P],
[AC_PREREQ([2.60])dnl
AC_REQUIRE([AC_PROG_MKDIR_P])dnl
dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
dnl while keeping a definition of mkdir_p for backward compatibility.
dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
dnl Makefile.ins that do not define MKDIR_P, so we do our own
dnl adjustment using top_builddir (which is defined more often than
dnl MKDIR_P).
AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
case $mkdir_p in
[[\\/$]]* | ?:[[\\/]]*) ;;
*/*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
esac
])
# Helper functions for option handling. -*- Autoconf -*-
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 3
# _AM_MANGLE_OPTION(NAME)
# -----------------------
AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
# Check to make sure that the build environment is sane. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
# Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 4
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
# Just in case
sleep 1
echo timestamp > conftest.file
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
# If neither matched, then we have a broken ls. This can happen
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
alias in your environment])
fi
test "$[2]" = conftest.file
)
then
# Ok.
:
else
AC_MSG_ERROR([newly created file is older than distributed files!
Check your system clock])
fi
AC_MSG_RESULT(yes)])
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_PROG_INSTALL_STRIP
# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
# is unlikely to handle the host's binaries.
# Fortunately install-sh will honor a STRIPPROG variable, so we
# always use install-sh in `make install-strip', and initialize
# STRIPPROG with the value of the STRIP variable (set by the user).
AC_DEFUN([AM_PROG_INSTALL_STRIP],
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
# Installed binaries are usually stripped using `strip' when the user
# run `make install-strip'. However `strip' might not be the right
# tool to use in cross-compilation environments, therefore Automake
# will honor the `STRIP' environment variable to overrule this program.
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
# Copyright (C) 2006 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# _AM_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# serial 2
# _AM_PROG_TAR(FORMAT)
# --------------------
# Check how to create a tarball in format FORMAT.
# FORMAT should be one of `v7', `ustar', or `pax'.
#
# Substitute a variable $(am__tar) that is a command
# writing to stdout a FORMAT-tarball containing the directory
# $tardir.
# tardir=directory && $(am__tar) > result.tar
#
# Substitute a variable $(am__untar) that extract such
# a tarball read from stdin.
# $(am__untar) < result.tar
AC_DEFUN([_AM_PROG_TAR],
[# Always define AMTAR for backward compatibility.
AM_MISSING_PROG([AMTAR], [tar])
m4_if([$1], [v7],
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
[m4_case([$1], [ustar],, [pax],,
[m4_fatal([Unknown tar format])])
AC_MSG_CHECKING([how to create a $1 tar archive])
# Loop over all known methods to create a tar archive until one works.
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
# Do not fold the above two line into one, because Tru64 sh and
# Solaris sh will not grok spaces in the rhs of `-'.
for _am_tool in $_am_tools
do
case $_am_tool in
gnutar)
for _am_tar in tar gnutar gtar;
do
AM_RUN_LOG([$_am_tar --version]) && break
done
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
am__untar="$_am_tar -xf -"
;;
plaintar)
# Must skip GNU tar: if it does not support --format= it doesn't create
# ustar tarball either.
(tar --version) >/dev/null 2>&1 && continue
am__tar='tar chf - "$$tardir"'
am__tar_='tar chf - "$tardir"'
am__untar='tar xf -'
;;
pax)
am__tar='pax -L -x $1 -w "$$tardir"'
am__tar_='pax -L -x $1 -w "$tardir"'
am__untar='pax -r'
;;
cpio)
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
am__untar='cpio -i -H $1 -d'
;;
none)
am__tar=false
am__tar_=false
am__untar=false
;;
esac
# If the value was cached, stop now. We just wanted to have am__tar
# and am__untar set.
test -n "${am_cv_prog_tar_$1}" && break
# tar/untar a dummy directory, and stop if the command works
rm -rf conftest.dir
mkdir conftest.dir
echo GrepMe > conftest.dir/file
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
rm -rf conftest.dir
if test -s conftest.tar; then
AM_RUN_LOG([$am__untar <conftest.tar])
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
fi
done
rm -rf conftest.dir
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([m4/acx_pthread.m4])

View file

@ -1,28 +0,0 @@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2007, 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
noinst_LIBRARIES = libtio.a libdict.a
AM_CPPFLAGS=-I$(top_srcdir)
AM_CFLAGS = -fPIC
libtio_a_SOURCES = tio.c tio.h
libdict_a_SOURCES = dict.c dict.h \
set.c set.h

View file

@ -1,447 +0,0 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2007, 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = common
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
AR = ar
ARFLAGS = cru
libdict_a_AR = $(AR) $(ARFLAGS)
libdict_a_LIBADD =
am_libdict_a_OBJECTS = dict.$(OBJEXT) set.$(OBJEXT)
libdict_a_OBJECTS = $(am_libdict_a_OBJECTS)
libtio_a_AR = $(AR) $(ARFLAGS)
libtio_a_LIBADD =
am_libtio_a_OBJECTS = tio.$(OBJEXT)
libtio_a_OBJECTS = $(am_libtio_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libdict_a_SOURCES) $(libtio_a_SOURCES)
DIST_SOURCES = $(libdict_a_SOURCES) $(libtio_a_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOCBOOK2X_MAN = @DOCBOOK2X_MAN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NSLCD_PIDFILE = @NSLCD_PIDFILE@
NSLCD_SOCKET = @NSLCD_SOCKET@
NSS_LDAP_PATH_CONF = @NSS_LDAP_PATH_CONF@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RELEASE_MONTH = @RELEASE_MONTH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
acx_pthread_config = @acx_pthread_config@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
nslcd_LIBS = @nslcd_LIBS@
nss_ldap_so_LIBS = @nss_ldap_so_LIBS@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LIBRARIES = libtio.a libdict.a
AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = -fPIC
libtio_a_SOURCES = tio.c tio.h
libdict_a_SOURCES = dict.c dict.h \
set.c set.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu common/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu common/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libdict.a: $(libdict_a_OBJECTS) $(libdict_a_DEPENDENCIES)
-rm -f libdict.a
$(libdict_a_AR) libdict.a $(libdict_a_OBJECTS) $(libdict_a_LIBADD)
$(RANLIB) libdict.a
libtio.a: $(libtio_a_OBJECTS) $(libtio_a_DEPENDENCIES)
-rm -f libtio.a
$(libtio_a_AR) libtio.a $(libtio_a_OBJECTS) $(libtio_a_LIBADD)
$(RANLIB) libtio.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dict.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tio.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -1,267 +0,0 @@
/*
dict.c - dictionary functions
This file is part of the nss-ldapd library.
Copyright (C) 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <ctype.h>
#include <stdint.h>
#include "dict.h"
/*
This module uses a hashtable to store it's key to value mappings. The
structure is basically as follows:
[struct dictionary]
\- holds an array of pointers to a linked list of [struct dict_entry]
\- each entry has a key/value mapping
The hashmap can be resized when the total number of elements in the hashmap
exceeds a certain load factor.
All the keys are copied in a separate linked list of buffers where each new
buffer that is allocated is larger than the previous one. The first buffer
in the linked list is always the current one.
Note that the initial sizes of hashtable and the loadfactor still need to
be tuned to the use in this application.
*/
/* an entry stores one key/value pair */
struct dict_entry {
uint32_t hash; /* used for quick matching and rehashing */
const char *key; /* a reference to a copy of the key */
void *value; /* the stored value */
struct dict_entry *next;
};
/* the initial size of the hashtable */
#define DICT_INITSIZE 7
/* load factor at which point to grow hashtable */
#define DICT_LOADPERCENTAGE 400
/* the dictionary is a hashtable */
struct dictionary {
int size; /* size of the hashtable */
int num; /* total number of keys stored */
struct dict_entry **table; /* the hashtable */
int loop_idx; /* for looping */
struct dict_entry *loop_entry; /* for looping */
};
/* Simple hash function that computes the hash value of a lower-cased
string. */
static uint32_t stringhash(const char *str)
{
uint32_t hash=0;
while (*str!='\0')
hash=3*hash+tolower(*str++);
return hash;
}
/* Grow the hashtable. */
static void growhashtable(DICT *dict)
{
int i;
int newsize;
struct dict_entry **newtable;
struct dict_entry *entry,*tmp;
newsize=dict->size*3+1;
/* allocate room for new hashtable */
newtable=(struct dict_entry **)malloc(newsize*sizeof(struct dict_entry *));
if (newtable==NULL)
return; /* allocating memory failed continue to fill the existing table */
/* clear new table */
for (i=0;i<newsize;i++)
newtable[i]=NULL;
/* copy old hashtable into new table */
for (i=0;i<dict->size;i++)
{
/* go over elements in linked list */
entry=dict->table[i];
while (entry!=NULL)
{
tmp=entry;
entry=entry->next;
/* put in new position */
tmp->next=newtable[tmp->hash%newsize];
newtable[tmp->hash%newsize]=tmp;
}
}
/* free the old hashtable */
free(dict->table);
/* put new hashtable in place */
dict->size=newsize;
dict->table=newtable;
}
DICT *dict_new(void)
{
struct dictionary *dict;
int i;
/* allocate room for dictionary information */
dict=(struct dictionary *)malloc(sizeof(struct dictionary));
if (dict==NULL)
return NULL;
dict->size=DICT_INITSIZE;
dict->num=0;
/* allocate initial hashtable */
dict->table=(struct dict_entry **)malloc(DICT_INITSIZE*sizeof(struct dict_entry *));
if (dict->table==NULL)
{
free(dict);
return NULL;
}
/* clear the hashtable */
for (i=0;i<DICT_INITSIZE;i++)
dict->table[i]=NULL;
/* we're done */
return dict;
}
void dict_free(DICT *dict)
{
struct dict_entry *entry,*etmp;
int i;
/* free hashtable entries */
for (i=0;i<dict->size;i++)
{
entry=dict->table[i];
while (entry!=NULL)
{
etmp=entry;
entry=entry->next;
free(etmp);
}
}
/* free the hashtable */
free(dict->table);
/* free dictionary struct itself */
free(dict);
}
void *dict_get(DICT *dict,const char *key)
{
uint32_t hash;
struct dict_entry *entry;
/* calculate the hash */
hash=stringhash(key);
/* loop over the linked list in the hashtable */
for (entry=dict->table[hash%dict->size];entry!=NULL;entry=entry->next)
{
if ( (entry->hash==hash) &&
(strcasecmp(entry->key,key)==0) )
return entry->value;
}
/* no matches found */
return NULL;
}
int dict_put(DICT *dict,const char *key,void *value)
{
uint32_t hash;
int l;
char *buf;
int idx;
struct dict_entry *entry,*prev;
/* check if we should grow the hashtable */
if ( dict->num >= ((dict->size*DICT_LOADPERCENTAGE)/100) )
growhashtable(dict);
/* calculate the hash and position in the hashtable */
hash=stringhash(key);
idx=hash%dict->size;
/* check if the entry is already present */
for (entry=dict->table[idx],prev=NULL;
entry!=NULL;
prev=entry,entry=entry->next)
{
if ( (entry->hash==hash) &&
(strcasecmp(entry->key,key)==0) )
{
/* check if we should unset the entry */
if (value==NULL)
{
/* remove from linked list */
if (prev==NULL)
dict->table[idx]=entry->next;
else
prev->next=entry->next;
/* free entry memory and register removal */
free(entry);
dict->num--;
return 0;
}
/* just set the new value */
entry->value=value;
return 0;
}
}
/* if entry should be unset we're done */
if (value==NULL)
return 0;
/* entry is not present, make new entry */
l=strlen(key)+1;
buf=(char *)malloc(sizeof(struct dict_entry)+l);
if (buf==NULL)
return -1;
entry=(struct dict_entry *)buf;
buf+=sizeof(struct dict_entry);
strcpy(buf,key);
entry->hash=hash;
entry->key=buf;
entry->value=value;
/* insert into hashtable/linked list */
entry->next=dict->table[idx];
dict->table[idx]=entry;
/* increment number of stored items */
dict->num++;
return 0;
}
void dict_loop_first(DICT *dict)
{
dict->loop_idx=0;
dict->loop_entry=NULL;
}
const char *dict_loop_next(DICT *dict,const char **key,void **value)
{
struct dict_entry *entry;
/* find non-empty entry */
while ( (dict->loop_idx<dict->size) && (dict->loop_entry==NULL) )
dict->loop_entry=dict->table[dict->loop_idx++];
if (dict->loop_entry==NULL)
return NULL; /* no more entries to check */
/* save current result and go to next entry */
entry=dict->loop_entry;
dict->loop_entry=entry->next;
/* return results */
if (key!=NULL)
*key=entry->key;
if (value!=NULL)
*value=entry->value;
return entry->key;
}

View file

@ -1,75 +0,0 @@
/*
dict.h - dictionary functions
This file is part of the nss-ldapd library.
Copyright (C) 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _DICT_H
#define _DICT_H
#include "compat/attrs.h"
/*
These functions provide a mapping between a case insensitive
string and a pointer.
*/
typedef struct dictionary DICT;
/* Create a new instance of a dictionary. Returns NULL
in case of memory allocation errors. */
DICT *dict_new(void)
LIKE_MALLOC MUST_USE;
/* Add a relation in the dictionary. The key is duplicated
and can be reused by the caller. The pointer is just stored.
This function returns non-0 in case of memory allocation
errors. If the key was previously in use the value
is replaced. All key comparisons are case insensitive. */
int dict_put(DICT *dict,const char *key,void *value);
/* Look up a key in the dictionary and return the associated
value. NULL is returned if the key is not found in the dictionary.
All key comparisons are case insensitive. */
void *dict_get(DICT *dict,const char *key)
MUST_USE;
/* Delete a key-value association from the dictionary.
All key comparisons are case insensitive. */
/*void dict_del(DICT *dict,const char *key);*/
/* Remove the dictionary from memory. All allocated storage
for the dictionary and the keys is freed.
Note that values are not freed. This is the responsibility
of the caller. */
void dict_free(DICT *dict);
/* Function for looping over all dictionary keys and values.
This resets the search to the beginning of the dictionary.
This is required before calling dict_loop_next(); */
void dict_loop_first(DICT *dict);
/* Function for looping over all dictionary keys and values.
This returns a stored key. NULL is returned when all
keys have been returned. The key and value are
stored in the key and value parameters if they aren't
NULL. */
const char *dict_loop_next(DICT *dict,const char **key,void **value)
MUST_USE;
#endif /* _DICT_H */

View file

@ -1,64 +0,0 @@
/*
set.c - set functions
This file is part of the nss-ldapd library.
Copyright (C) 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "set.h"
#include "dict.h"
SET *set_new(void)
{
return (SET *)dict_new();
}
int set_add(SET *set,const char *value)
{
return dict_put((DICT *)set,value,set);
}
int set_contains(SET *set,const char *value)
{
return dict_get((DICT *)set,value)!=NULL;
}
void set_free(SET *set)
{
dict_free((DICT *)set);
}
void set_loop_first(SET *set)
{
dict_loop_first((DICT *)set);
}
const char *set_loop_next(SET *set)
{
const char *value=NULL;
if (dict_loop_next((DICT *)set,&value,NULL)==NULL)
return NULL;
return value;
}

View file

@ -1,65 +0,0 @@
/*
set.h - set functions
This file is part of the nss-ldapd library.
Copyright (C) 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _SET_H
#define _SET_H
#include "compat/attrs.h"
/*
These functions provide a set of string in an unordered
collection.
*/
typedef struct set SET;
/* Create a new instance of a set. Returns NULL
in case of memory allocation errors. */
SET *set_new(void)
LIKE_MALLOC MUST_USE;
/* Add a string in the set. The value is duplicated
and can be reused by the caller.
This function returns non-0 in case of memory allocation
errors. All value comparisons are case insensitive. */
int set_add(SET *set,const char *value);
/* Return non-zero if the value is in the set.
All value comparisons are case insensitive. */
int set_contains(SET *set,const char *value)
MUST_USE;
/* Remove the set from memory. All allocated storage
for the set and the values is freed. */
void set_free(SET *set);
/* Function for looping over all set values.
This resets the search to the beginning of the set.
This is required before calling set_loop_next(); */
void set_loop_first(SET *set);
/* Function for looping over all set values.
This returns a stored value. NULL is returned when all
values have been returned. */
const char *set_loop_next(SET *set)
MUST_USE;
#endif /* _SET_H */

View file

@ -1,31 +0,0 @@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
noinst_LIBRARIES = libcompat.a
AM_CPPFLAGS=-I$(top_srcdir)
AM_CFLAGS = -fPIC
EXTRA_DIST = getopt_long.c getopt_long.h \
daemon.c daemon.h \
pagectrl.c pagectrl.h \
ether.c ether.h
libcompat_a_SOURCES = getpeercred.c getpeercred.h
libcompat_a_LIBADD = @LIBOBJS@

View file

@ -1,445 +0,0 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = compat
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in daemon.c \
ether.c getopt_long.c pagectrl.c
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
AR = ar
ARFLAGS = cru
libcompat_a_AR = $(AR) $(ARFLAGS)
libcompat_a_DEPENDENCIES = @LIBOBJS@
am_libcompat_a_OBJECTS = getpeercred.$(OBJEXT)
libcompat_a_OBJECTS = $(am_libcompat_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libcompat_a_SOURCES)
DIST_SOURCES = $(libcompat_a_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOCBOOK2X_MAN = @DOCBOOK2X_MAN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NSLCD_PIDFILE = @NSLCD_PIDFILE@
NSLCD_SOCKET = @NSLCD_SOCKET@
NSS_LDAP_PATH_CONF = @NSS_LDAP_PATH_CONF@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RELEASE_MONTH = @RELEASE_MONTH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
acx_pthread_config = @acx_pthread_config@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
nslcd_LIBS = @nslcd_LIBS@
nss_ldap_so_LIBS = @nss_ldap_so_LIBS@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
noinst_LIBRARIES = libcompat.a
AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = -fPIC
EXTRA_DIST = getopt_long.c getopt_long.h \
daemon.c daemon.h \
pagectrl.c pagectrl.h \
ether.c ether.h
libcompat_a_SOURCES = getpeercred.c getpeercred.h
libcompat_a_LIBADD = @LIBOBJS@
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu compat/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu compat/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libcompat.a: $(libcompat_a_OBJECTS) $(libcompat_a_DEPENDENCIES)
-rm -f libcompat.a
$(libcompat_a_AR) libcompat.a $(libcompat_a_OBJECTS) $(libcompat_a_LIBADD)
$(RANLIB) libcompat.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/daemon.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/ether.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/getopt_long.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pagectrl.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getpeercred.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf $(DEPDIR) ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf $(DEPDIR) ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -1,71 +0,0 @@
/*
daemon.c - implementation of daemon() for systems that lack it
Copyright (C) 2002, 2003, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "daemon.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int daemon(int nochdir,int noclose)
{
/* change directory */
if (!nochdir)
if (chdir("/")!=0)
return -1;
/* fork() and exit() to detach from the parent process */
switch (fork())
{
case 0: /* we are the child */
break;
case -1: /* we are the parent, but have an error */
return -1;
default: /* we are the parent and we're done*/
_exit(0);
}
/* become process leader */
if (setsid()<0)
{
return -1;
}
/* fork again so we cannot allocate a pty */
switch (fork())
{
case 0: /* we are the child */
break;
case -1: /* we are the parent, but have an error */
return -1;
default: /* we are the parent and we're done*/
_exit(0);
}
/* close stdin, stdout and stderr and reconnect to /dev/null */
if (!noclose)
{
close(0); /* stdin */
close(1); /* stdout */
close(2); /* stderr */
open("/dev/null",O_RDWR); /* stdin, fd=0 */
dup(0); /* stdout, fd=1 */
dup(0); /* stderr, fd=2 */
}
return 0;
}

View file

@ -1,31 +0,0 @@
/*
daemon.h - definition of daemon() for systems that lack it
Copyright (C) 2002, 2003, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _DAEMON_H
#define _DAEMON_H 1
#include <unistd.h>
/* deamonize process, optionally chdir to / and optionally close stdin,
strdout and stderr and redirect them to /dev/null */
int daemon(int nochdir,int noclose);
#endif /* not _DAEMON_H */

View file

@ -1,52 +0,0 @@
/*
ether.c - useful ethernet functions for systems lacking those
Copyright (C) 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include "ether.h"
/* these functions are not really reentrant */
#ifndef HAVE_ETHER_NTOA_R
char *ether_ntoa_r(const struct ether_addr *addr,char *buf)
{
char *tmp;
tmp=ether_ntoa(addr);
if (tmp==NULL)
return NULL;
strcpy(buf,tmp);
return buf;
}
#endif /* not HAVE_ETHER_NTOA_R */
#ifndef HAVE_ETHER_ATON_R
struct ether_addr *ether_aton_r(const char *asc,struct ether_addr *addr)
{
struct ether_addr *tmp;
tmp=ether_aton(asc);
if (tmp==NULL)
return NULL;
memcpy(addr,tmp,sizeof(struct ether_addr));
return addr;
}
#endif /* not HAVE_ETHER_ATON_R */

View file

@ -1,49 +0,0 @@
/*
ether.h - ethernet definitions for systems lacking those
Copyright (C) 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _COMPAT_ETHER_H
#define _COMPAT_ETHER_H 1
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
#ifdef HAVE_NETINET_ETHER_H
#include <netinet/ether.h>
#endif
#ifndef HAVE_STRUCT_ETHER_ADDR
struct ether_addr {
uint8_t ether_addr_octet[6];
};
#endif /* not HAVE_STRUCT_ETHER_ADDR */
#ifndef HAVE_ETHER_NTOA_R
char *ether_ntoa_r(const struct ether_addr *addr,char *buf);
#endif /* not HAVE_ETHER_NTOA_R */
#ifndef HAVE_ETHER_ATON_R
struct ether_addr *ether_aton_r(const char *asc,struct ether_addr *addr);
#endif /* not HAVE_ETHER_ATON_R */
#endif /* not _COMPAT_ETHER_H */

View file

@ -1,92 +0,0 @@
/*
getopt_long.c - implementation of getopt_long() for systems that lack it
Copyright (C) 2001, 2002, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "getopt_long.h"
/* this is a (poor) getopt_long() replacement for systems that don't have it
(getopt_long() is generaly a GNU extention)
this implementation is by no meens flawless, especialy the optional arguments
to options and options following filenames is not quite right, allso
minimal error checking is provided
*/
int getopt_long(int argc,char * const argv[],
const char *optstring,
const struct option *longopts,int *longindex)
{
int i; /* for looping through options */
int l; /* for length */
/* first check if there realy is a -- option */
if ( (optind>0)&&(optind<argc) &&
(strncmp(argv[optind],"--",2)==0) &&
(argv[optind][2]!='\0') )
{
/* check the longopts list for a valid option */
for (i=0;longopts[i].name!=NULL;i++)
{
/* save the length for later */
l=strlen(longopts[i].name);
if (strncmp(argv[optind]+2,longopts[i].name,l)==0)
{
/* we have a match */
if ( (longopts[i].has_arg==no_argument) &&
(argv[optind][2+l]=='\0') )
{
optind++;
return longopts[i].val;
}
else if ( (longopts[i].has_arg==required_argument) &&
(argv[optind][2+l]=='=') )
{
optarg=argv[optind]+3+l;
optind++;
return longopts[i].val;
}
else if ( (longopts[i].has_arg==required_argument) &&
(argv[optind][2+l]=='\0') )
{
optarg=argv[optind+1];
optind+=2;
return longopts[i].val;
}
else if ( (longopts[i].has_arg==optional_argument) &&
(argv[optind][2+l]=='=') )
{
optarg=argv[optind]+3+l;
optind++;
return longopts[i].val;
}
else if ( (longopts[i].has_arg==optional_argument) &&
(argv[optind][2+l]=='\0') )
{
optind++;
return longopts[i].val;
}
}
}
}
/* if all else fails use plain getopt() */
return getopt(argc,argv,optstring);
}

View file

@ -1,50 +0,0 @@
/*
getopt_long.h - definition of getopt_long() for systems that lack it
Copyright (C) 2001, 2002, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _GETOPT_LONG_H
#define _GETOPT_LONG_H 1
#ifndef HAVE_GETOPT_LONG
#define no_argument 0
#define required_argument 1
#define optional_argument 2
struct option {
const char *name;
int has_arg;
int *flag;
int val;
};
/* this is a (poor) getopt_long() replacement for systems that don't have it
(this is generaly a GNU extention)
this implementation is by no meens flawless, especialy the optional arguments
to options and options following filenames is not quite right, allso
minimal error checking
*/
int getopt_long(int argc,char * const argv[],
const char *optstring,
const struct option *longopts,int *longindex);
#endif /* not HAVE_GETOPT_LONG */
#endif /* _GETOPT_LONG_H */

View file

@ -1,106 +0,0 @@
/*
getpeercred.h - function for determining information about the
other end of a unix socket
This file is part of the nss-ldapd library.
Copyright (C) 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/un.h>
#ifdef HAVE_SYS_UCRED_H
#include <sys/ucred.h>
#endif /* HAVE SYS_UCRED_H */
#include <errno.h>
#ifdef HAVE_UCRED_H
#include <ucred.h>
#endif /* HAVE_UCRED_H */
#include "getpeercred.h"
/* Note: most of this code is untested, except for the first
implementation (it may even fail to compile) */
int getpeercred(int sock,uid_t *uid,gid_t *gid,pid_t *pid)
{
#if defined(SO_PEERCRED)
socklen_t l;
struct ucred cred;
/* initialize client information (in case getsockopt() breaks) */
cred.pid=(pid_t)0;
cred.uid=(uid_t)-1;
cred.gid=(gid_t)-1;
/* look up process information from peer */
l=(socklen_t)sizeof(struct ucred);
if (getsockopt(sock,SOL_SOCKET,SO_PEERCRED,&cred,&l) < 0)
return -1; /* errno already set */
/* return the data */
if (uid!=NULL) *uid=cred.uid;
if (gid!=NULL) *gid=cred.gid;
if (pid!=NULL) *pid=cred.pid;
return 0;
#elif defined(LOCAL_PEERCRED)
socklen_t l;
struct xucred cred;
/* look up process information from peer */
l=(socklen_t)sizeof(struct xucred);
if (getsockopt(sock,0,LOCAL_PEERCRED,&cred,&l) < 0)
return -1; /* errno already set */
if (cred.cr_version!=XUCRED_VERSION)
{
errno=EINVAL;
return -1;
}
/* return the data */
if (uid!=NULL) *uid=cred.uid;
if (gid!=NULL) *gid=cred.gid;
if (pid!=NULL) *pid=(pid_t)-1;
return 0;
#elif defined(HAVE_GETPEERUCRED)
ucred_t *cred=NULL;
if (getpeerucred(client,&cred))
return -1;
/* save the data */
if (uid!=NULL) *uid=ucred_geteuid(&cred);
if (gid!=NULL) *gid=ucred_getegid(&cred);
if (pid!=NULL) *pid=ucred_getpid(&cred);
/* free cred and return */
ucred_free(&ucred);
return 0;
#elif defined(HAVE_GETPEEREID)
uid_t tuid;
gid_t tgid;
if (uid==NULL) uid=&tuid;
if (gid==NULL) gid=&tguid;
if (getpeereid(sock,uid,gid))
return -1;
/* return the data */
if (uid!=NULL) *uid=cred.uid;
if (gid!=NULL) *gid=cred.gid;
if (pid!=NULL) *pid=-1; /* we return a -1 pid because we have no usable pid */
return 0;
#else
/* nothing found that is supported */
errno=ENOSYS;
return -1;
#endif
}

View file

@ -1,35 +0,0 @@
/*
getpeercred.h - function for determining information about the
other end of a unix socket
This file is part of the nss-ldapd library.
Copyright (C) 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _COMPAT_GETPEERCRED_H
#define _COMPAT_GETPEERCRED_H 1
/* This function tries to determine the (effective) user id, group id
and process id of the other end of the specified socket.
Any of the uid, gid and pid paramaters may be NULL to not update
that information.
On success, zero is returned. On error, -1 is returned, and errno
is set appropriately. */
int getpeercred(int sock,uid_t *uid,gid_t *gid,pid_t *pid);
#endif /* not _COMPAT_GETPEERCRED_H */

View file

@ -1,217 +0,0 @@
/*
pagectrl.c - provide a replacement ldap_create_page_control() function.
This file was part of the nss_ldap library which has been
forked into the nss-ldapd library.
Copyright (C) 2002 Max Caines
This software is not subject to any license of the University
of Wolverhampton.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <lber.h>
#include <ldap.h>
#include "pagectrl.h"
#ifndef LDAP_CONTROL_PAGE_OID
#define LDAP_CONTROL_PAGE_OID "1.2.840.113556.1.4.319"
#endif
#ifndef HAVE_LDAP_CREATE_PAGE_CONTROL
/*---
ldap_create_page_control
Create and encode the Paged Results control.
ld (IN) An LDAP session handle, as obtained from a call to
ldap_init().
pagesize (IN) The number of entries to return in each page
cookiep (IN) Pointer to a berVal structure that the server uses to
determine the current location in the
result set (opaque). Set to NULL the
first time.
iscritical (IN) Is this control critical to the search?
ctrlp (OUT) A result parameter that will be assigned the address
of an LDAPControl structure that contains the
PagedResult control created by this function.
The memory occupied by the LDAPControl structure
SHOULD be freed when it is no longer in use by
calling ldap_control_free().
Ber encoding
PageResult ::= SEQUENCE {
pageSize INTEGER
cookie OCTET STRING }
Note: The first time the Page control is created, the cookie
should be set to a zero-length string. The cookie obtained
from calling ldap_parse_page_control() should be used as
the cookie in the next ldap_create_page_control call.
---*/
int
ldap_create_page_control (LDAP * ld,
unsigned long pagesize,
struct berval *cookiep,
int iscritical, LDAPControl ** ctrlp)
{
ber_tag_t tag;
BerElement *ber;
BerElement *ldap_alloc_ber_with_options (LDAP * ld);
int rc;
if ((ld == NULL) || (ctrlp == NULL))
{
return (LDAP_PARAM_ERROR);
}
if ((ber = ldap_alloc_ber_with_options (ld)) == NULL)
{
return (LDAP_NO_MEMORY);
}
tag = ber_printf (ber, "{i", pagesize);
if (tag == LBER_ERROR)
goto exit;
if (cookiep == NULL)
tag = ber_printf (ber, "o", "", 0);
else
tag = ber_printf (ber, "O", cookiep);
if (tag == LBER_ERROR)
goto exit;
tag = ber_printf (ber, /*{ */ "N}");
if (tag == LBER_ERROR)
goto exit;
rc = ldap_create_control (LDAP_CONTROL_PAGE_OID, ber, iscritical, ctrlp);
ber_free (ber, 1);
return (rc);
exit:
ber_free (ber, 1);
return (LDAP_ENCODING_ERROR);
}
#endif /* not HAVE_LDAP_CREATE_PAGE_CONTROL */
#ifndef HAVE_LDAP_PARSE_PAGE_CONTROL
/*---
ldap_parse_page_control
Decode the Virtual List View control return information.
ld (IN) An LDAP session handle.
ctrls (IN) The address of a NULL-terminated array of
LDAPControl structures, typically obtained
by a call to ldap_parse_result().
list_countp (OUT) This result parameter is filled in with the number
of entries returned in this page
cookiep (OUT) This result parameter is filled in with the address
of a struct berval that contains the server-
generated cookie.
The returned cookie SHOULD be used in the next call
to create a Page sort control. The struct berval
returned SHOULD be disposed of by calling ber_bvfree()
when it is no longer needed.
---*/
int
ldap_parse_page_control (LDAP * ld,
LDAPControl ** ctrls,
unsigned long *list_countp, struct berval **cookiep)
{
BerElement *ber;
LDAPControl *pControl;
int i;
unsigned long count;
ber_tag_t tag;
if (cookiep)
{
*cookiep = NULL; /* Make sure we return a NULL if error occurs. */
}
if (ld == NULL)
{
return (LDAP_PARAM_ERROR);
}
if (ctrls == NULL)
{
return (LDAP_CONTROL_NOT_FOUND);
}
/* Search the list of control responses for a Page control. */
for (i = 0; ctrls[i]; i++)
{
pControl = ctrls[i];
if (!strcmp (LDAP_CONTROL_PAGE_OID, pControl->ldctl_oid))
goto foundPageControl;
}
/* No page control was found. */
return (LDAP_CONTROL_NOT_FOUND);
foundPageControl:
/* Create a BerElement from the berval returned in the control. */
ber = ber_init (&pControl->ldctl_value);
if (ber == NULL)
{
return (LDAP_NO_MEMORY);
}
/* Extract the data returned in the control. */
tag = ber_scanf (ber, "{iO" /*} */ , &count, cookiep);
if (tag == LBER_ERROR)
{
ber_free (ber, 1);
return (LDAP_DECODING_ERROR);
}
ber_free (ber, 1);
/* Return data to the caller for items that were requested. */
if (list_countp)
{
*list_countp = count;
}
return (LDAP_SUCCESS);
}
#endif /* not HAVE_LDAP_PARSE_PAGE_CONTROL */

View file

@ -1,45 +0,0 @@
/*
pagectrl.h - provide a replacement ldap_create_page_control() function.
This file was part of the nss_ldap library which has been
forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _LDAP_NSS_LDAP_PAGECTRL_H
#define _LDAP_NSS_LDAP_PAGECTRL_H
#ifndef HAVE_LDAP_CREATE_PAGE_CONTROL
int
ldap_create_page_control( LDAP *ld,
unsigned long pagesize,
struct berval *cookiep,
int iscritical,
LDAPControl **ctrlp );
#endif /* not HAVE_LDAP_CREATE_PAGE_CONTROL */
#ifndef HAVE_LDAP_PARSE_PAGE_CONTROL
int
ldap_parse_page_control(
LDAP *ld,
LDAPControl **ctrls,
unsigned long *list_countp,
struct berval **cookiep );
#endif /* not HAVE_LDAP_PARSE_PAGE_CONTROL */
#endif /* _LDAP_NSS_LDAP_UTIL_H */

View file

@ -1,142 +0,0 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
scriptversion=2005-05-14.22
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand `-c -o'.
Remove `-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file `INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
esac
ofile=
cfile=
eat=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as `compile cc -o foo foo.c'.
# So we strip `-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no `-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# `.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
# Create the lock directory.
# Note: use `[/.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

File diff suppressed because it is too large Load diff

View file

@ -1,338 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <aliases.h> header file. */
#undef HAVE_ALIASES_H
/* Define to 1 if you have the <ctype.h> header file. */
#undef HAVE_CTYPE_H
/* Define to 1 if you have the `daemon' function. */
#undef HAVE_DAEMON
/* Define to 1 if you have the `ether_aton' function. */
#undef HAVE_ETHER_ATON
/* Define to 1 if you have the `ether_aton_r' function. */
#undef HAVE_ETHER_ATON_R
/* Define to 1 if you have the `ether_ntoa' function. */
#undef HAVE_ETHER_NTOA
/* Define to 1 if you have the `ether_ntoa_r' function. */
#undef HAVE_ETHER_NTOA_R
/* Define to 1 if you have the `gethostbyname' function. */
#undef HAVE_GETHOSTBYNAME
/* Define to 1 if you have the <getopt.h> header file. */
#undef HAVE_GETOPT_H
/* Define to 1 if you have the `getopt_long' function. */
#undef HAVE_GETOPT_LONG
/* Define to 1 if you have the `getpeereid' function. */
#undef HAVE_GETPEEREID
/* Define to 1 if you have the `getpeerucred' function. */
#undef HAVE_GETPEERUCRED
/* Define to 1 if you have the <grp.h> header file. */
#undef HAVE_GRP_H
/* Define to 1 if you have the <gssapi/gssapi_krb5.h> header file. */
#undef HAVE_GSSAPI_GSSAPI_KRB5_H
/* Define to 1 if you have the <gssapi.h> header file. */
#undef HAVE_GSSAPI_H
/* Define to 1 if you have the <gssldap.h> header file. */
#undef HAVE_GSSLDAP_H
/* Define to 1 if you have the <gsssasl.h> header file. */
#undef HAVE_GSSSASL_H
/* Define to 1 if you have the `gss_krb5_ccache_name' function. */
#undef HAVE_GSS_KRB5_CCACHE_NAME
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <lber.h> header file. */
#undef HAVE_LBER_H
/* Define to 1 if you have the `ldap_abandon' function. */
#undef HAVE_LDAP_ABANDON
/* Define to 1 if you have the `ldap_controls_free' function. */
#undef HAVE_LDAP_CONTROLS_FREE
/* Define to 1 if you have the `ldap_control_free' function. */
#undef HAVE_LDAP_CONTROL_FREE
/* Define to 1 if you have the `ldap_create_control' function. */
#undef HAVE_LDAP_CREATE_CONTROL
/* Define to 1 if you have the `ldap_create_page_control' function. */
#undef HAVE_LDAP_CREATE_PAGE_CONTROL
/* Define to 1 if you have the `ldap_domain2dn' function. */
#undef HAVE_LDAP_DOMAIN2DN
/* Define to 1 if you have the `ldap_domain2hostlist' function. */
#undef HAVE_LDAP_DOMAIN2HOSTLIST
/* Define to 1 if you have the `ldap_err2string' function. */
#undef HAVE_LDAP_ERR2STRING
/* Define to 1 if you have the `ldap_explode_dn' function. */
#undef HAVE_LDAP_EXPLODE_DN
/* Define to 1 if you have the `ldap_explode_rdn' function. */
#undef HAVE_LDAP_EXPLODE_RDN
/* Define to 1 if you have the `ldap_get_dn' function. */
#undef HAVE_LDAP_GET_DN
/* Define to 1 if you have the `ldap_get_option' function. */
#undef HAVE_LDAP_GET_OPTION
/* Define to 1 if you have the `ldap_get_values' function. */
#undef HAVE_LDAP_GET_VALUES
/* Define to 1 if you have the <ldap.h> header file. */
#undef HAVE_LDAP_H
/* Define to 1 if you have the `ldap_initialize' function. */
#undef HAVE_LDAP_INITIALIZE
/* Define to 1 if you have the `ldap_memfree' function. */
#undef HAVE_LDAP_MEMFREE
/* Define to 1 if you have the `ldap_msgfree' function. */
#undef HAVE_LDAP_MSGFREE
/* Define to 1 if you have the `ldap_parse_page_control' function. */
#undef HAVE_LDAP_PARSE_PAGE_CONTROL
/* Define to 1 if you have the `ldap_parse_result' function. */
#undef HAVE_LDAP_PARSE_RESULT
/* Define to 1 if you have the `ldap_result' function. */
#undef HAVE_LDAP_RESULT
/* Define to 1 if you have the `ldap_sasl_interactive_bind_s' function. */
#undef HAVE_LDAP_SASL_INTERACTIVE_BIND_S
/* Define to 1 if you have the `ldap_search_ext' function. */
#undef HAVE_LDAP_SEARCH_EXT
/* Define to 1 if you have the `ldap_set_option' function. */
#undef HAVE_LDAP_SET_OPTION
/* Define to 1 if you have the `ldap_set_rebind_proc' function. */
#undef HAVE_LDAP_SET_REBIND_PROC
/* Define to 1 if you have the `ldap_simple_bind_s' function. */
#undef HAVE_LDAP_SIMPLE_BIND_S
/* Define to 1 if you have the <ldap_ssl.h> header file. */
#undef HAVE_LDAP_SSL_H
/* Define to 1 if you have the `ldap_unbind' function. */
#undef HAVE_LDAP_UNBIND
/* Define to 1 if you have the `ldap_value_free' function. */
#undef HAVE_LDAP_VALUE_FREE
/* Define to 1 if you have the `pthread' library (-lpthread). */
#undef HAVE_LIBPTHREAD
/* Define to 1 if you have the `sasl2' library (-lsasl2). */
#undef HAVE_LIBSASL2
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <netinet/ether.h> header file. */
#undef HAVE_NETINET_ETHER_H
/* Define to 1 if you have the <nss.h> header file. */
#undef HAVE_NSS_H
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
/* Define to 1 if you have the `pthread_atfork' function. */
#undef HAVE_PTHREAD_ATFORK
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
/* Define to 1 if you have the `sasl_auxprop_request' function. */
#undef HAVE_SASL_AUXPROP_REQUEST
/* Define to 1 if you have the <sasl.h> header file. */
#undef HAVE_SASL_H
/* Define to 1 if you have a `sasl_interact_t' definition. */
#undef HAVE_SASL_INTERACT_T
/* Define to 1 if you have the <sasl/sasl.h> header file. */
#undef HAVE_SASL_SASL_H
/* Define to 1 if you have the `setgroups' function. */
#undef HAVE_SETGROUPS
/* Define to 1 if you have the <shadow.h> header file. */
#undef HAVE_SHADOW_H
/* Define to 1 if you have the `sigaction' function. */
#undef HAVE_SIGACTION
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have a `struct ether_addr' definition. */
#undef HAVE_STRUCT_ETHER_ADDR
/* Define to 1 if you have a `struct ucred' definition. */
#undef HAVE_STRUCT_UCRED
/* Define to 1 if you have the <sys/socket.h> header file. */
#undef HAVE_SYS_SOCKET_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <sys/ucred.h> header file. */
#undef HAVE_SYS_UCRED_H
/* Define to 1 if you have the <sys/un.h> header file. */
#undef HAVE_SYS_UN_H
/* Define to 1 if you have the <ucred.h> header file. */
#undef HAVE_UCRED_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the `__nss_configure_lookup' function. */
#undef HAVE___NSS_CONFIGURE_LOOKUP
/* Define to the number of arguments to ldap_set_rebindproc. */
#undef LDAP_SET_REBIND_PROC_ARGS
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* The location of the pidfile used for checking availability of the nslcd. */
#undef NSLCD_PIDFILE
/* The location of the socket used for communicating. */
#undef NSLCD_SOCKET
/* Path to LDAP configuration file. */
#undef NSS_LDAP_PATH_CONF
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to necessary symbol if this constant uses a non-standard name on
your system. */
#undef PTHREAD_CREATE_JOINABLE
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Enable extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Define to empty if compiler does not support `__thread' keyword. */
#undef __thread
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t
/* Define to `sockaddr_in' if not defined elsewhere. */
#undef sockaddr_storage
/* Define to `size_t' if not defined elswhere. */
#undef socklen_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,350 +0,0 @@
# configure.ac - process this file with autoconf to produce configure
#
# Copyright (C) 2006 Luke Howard
# Copyright (C) 2006 West Consulting
# Copyright (C) 2006, 2007, 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
AC_PREREQ(2.59)
AC_COPYRIGHT(
[Copyright (C) 2006 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This configure script is derived from configure.ac which is free software;
you can redistribute it and/or modify it under the terms of the GNU Lesser
General Public License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version. See the
configure.ac file for more details.])
# initialize and set version and bugreport address
AC_INIT([nss-ldapd],[0.6.2],[arthur@ch.tudelft.nl])
RELEASE_MONTH="May 2008"
AC_SUBST(RELEASE_MONTH)
AC_CONFIG_SRCDIR([nslcd.h])
AC_CANONICAL_TARGET
AC_PREFIX_DEFAULT()
# display notice and initialize automake
AC_MSG_NOTICE([configuring AC_PACKAGE_TARNAME AC_PACKAGE_VERSION])
AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME,AC_PACKAGE_VERSION)
# create a config.h file (Automake will add -DHAVE_CONFIG_H)
AC_CONFIG_HEADERS([config.h])
# check for programs
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_RANLIB
AM_PROG_CC_C_O
AC_USE_SYSTEM_EXTENSIONS
# checks for tool to convert docbook to man
AC_PATH_PROGS(DOCBOOK2X_MAN, docbook2x-man)
if test "x${DOCBOOK2X_MAN}" = x
then
AC_MSG_WARN([docbook2x-man not found: not generating man pages])
fi
AM_CONDITIONAL([GENMAN], [test "x${DOCBOOK2X_MAN}" != x])
# start with default options
nss_ldap_so_LIBS=
nslcd_LIBS=
# check for debugging options
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],
[enable extensive debugging and logging]),
[if test "x$enableval" != "xno" ; then CFLAGS="-g -DDEBUG $CFLAGS" ; fi])
DESIRED_CFLAGS=""
# check for extra compiler warnings
AC_ARG_ENABLE(warnings,
AS_HELP_STRING([--enable-warnings],
[enable extra compiler warnings (gcc)]),
[if test "x$enableval" != "no"
then
CFLAGS="$CFLAGS -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Waggregate-return -Wmissing-declarations -Wunused -Wformat=2 -Wswitch-default -Wswitch-enum -Wfloat-equal -Wbad-function-cast -Wunreachable-code -Wredundant-decls"
DESIRED_CFLAGS="$DESIRED_CFLAGS -Wextra -Wdeclaration-after-statement -Werror-implicit-function-declaration"
fi])
test_gcc_flag() {
AC_LANG_CONFTEST([int main() {}])
$CC -c conftest.c $CFLAGS $@ > /dev/null 2> /dev/null
ret=$?
rm -f conftest.o
return $ret
}
for flag in $DESIRED_CFLAGS
do
AC_MSG_CHECKING([whether $CC accepts $flag])
if test_gcc_flag $flag
then
CFLAGS="$CFLAGS $flag"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
done
AC_ARG_WITH(ldap-lib,
AS_HELP_STRING([--with-ldap-lib=TYPE],
[select ldap library (auto|netscape5|netscape4|netscape3|umich|openldap) @<:@auto@:>@]))
if test -z "$with_ldap_lib"
then
with_ldap_lib=auto
fi
AC_ARG_WITH(ldap-conf-file,
AS_HELP_STRING([--with-ldap-conf-file=PATH],
[path to LDAP configuration file @<:@/etc/nss-ldapd.conf@:>@]),
[ NSS_LDAP_PATH_CONF="$with_ldap_conf_file" ],
[ NSS_LDAP_PATH_CONF="/etc/nss-ldapd.conf" ])
AC_DEFINE_UNQUOTED(NSS_LDAP_PATH_CONF,"$NSS_LDAP_PATH_CONF",[Path to LDAP configuration file.])
AC_SUBST(NSS_LDAP_PATH_CONF)
AC_ARG_WITH(nslcd-pidfile,
AS_HELP_STRING([--with-nslcd-pidfile=PATH],
[path to pidfile @<:@/var/run/nslcd/nslcd.pid@:>@]),
[ NSLCD_PIDFILE="$with_nslcd_pidfile" ],
[ NSLCD_PIDFILE="/var/run/nslcd/nslcd.pid" ])
AC_DEFINE_UNQUOTED(NSLCD_PIDFILE,"$NSLCD_PIDFILE",[The location of the pidfile used for checking availability of the nslcd.])
AC_SUBST(NSLCD_PIDFILE)
AC_ARG_WITH(nslcd-socket,
AS_HELP_STRING([--with-nslcd-socket=PATH],
[path to socket @<:@/var/run/nslcd/socket@:>@]),
[ NSLCD_SOCKET="$with_nslcd_socket" ],
[ NSLCD_SOCKET="/var/run/nslcd/socket" ])
AC_DEFINE_UNQUOTED(NSLCD_SOCKET,"$NSLCD_SOCKET",[The location of the socket used for communicating.])
AC_SUBST(NSLCD_SOCKET)
# checks for availability of header files
AC_CHECK_HEADERS(lber.h)
AC_CHECK_HEADERS(ldap.h,,AC_MSG_ERROR([could not locate <ldap.h>]),[
#if HAVE_LBER_H
#include <lber.h>
#endif
])
AC_CHECK_HEADERS(ldap_ssl.h)
AC_CHECK_HEADERS(nss.h)
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_HEADERS(shadow.h)
AC_CHECK_HEADERS(aliases.h)
AC_CHECK_HEADERS(netinet/ether.h)
AC_CHECK_HEADERS(ctype.h)
AC_CHECK_HEADERS(getopt.h)
AC_CHECK_HEADERS(sys/un.h)
AC_CHECK_HEADERS(sasl.h sasl/sasl.h)
AC_CHECK_HEADERS(strings.h)
AC_CHECK_HEADERS(gssldap.h)
AC_CHECK_HEADERS(gsssasl.h)
AC_CHECK_HEADERS(gssapi/gssapi_krb5.h gssapi.h)
AC_CHECK_HEADERS(grp.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(sys/ucred.h)
AC_CHECK_HEADERS(ucred.h)
# set up directory with compatibility replacement files
AC_CONFIG_LIBOBJ_DIR([compat])
# checks for availability of system libraries for nslcd
save_LIBS="$LIBS"
LIBS="$nslcd_LIBS"
AC_SEARCH_LIBS(gethostbyname,nsl socket)
AC_SEARCH_LIBS(socket,socket)
#AC_CHECK_LIB(resolv,main)
nslcd_LIBS="$LIBS"
LIBS="$save_LIBS"
# check for availability of system libraries for nss part
save_LIBS="$LIBS"
LIBS="$nss_ldap_so_LIBS"
AC_SEARCH_LIBS(socket,socket)
nss_ldap_so_LIBS="$LIBS"
LIBS="$save_LIBS"
# TODO: simplify the above since we need a correct LIBS for the following
# tests
# checks for availability of functions
AC_CHECK_FUNCS(sigaction)
AC_CHECK_FUNCS(snprintf)
AC_CHECK_FUNCS(gethostbyname)
AC_CHECK_FUNCS(setgroups)
AC_CHECK_FUNCS(getpeereid)
AC_CHECK_FUNCS(getpeerucred)
AC_CHECK_FUNCS(__nss_configure_lookup)
# replace getopt_long() function if it is not on the system
AC_REPLACE_FUNCS(getopt_long)
# replace daemon() function if it is not on the system
AC_SEARCH_LIBS(daemon,bsd)
AC_REPLACE_FUNCS(daemon)
# replace ether_ntoa_r() and ether_aton_r() if they are not found
AC_CHECK_FUNCS(ether_aton_r ether_ntoa_r,,[AC_CHECK_FUNCS(ether_aton ether_ntoa)
AC_LIBOBJ(ether)])
# checks for types
AC_C_CONST
AC_TYPE_SIGNAL
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
AC_TYPE_UID_T
# check for support for the __thread keyword
AC_CACHE_CHECK([whether $CC supports '__thread'], [mn_cv_c___thread_supported],
[AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[static __thread i;]], []),
[mn_cv_c___thread_supported=yes],
[mn_cv_c___thread_supported=no])])
if test $mn_cv_c___thread_supported != yes
then
AC_MSG_WARN([$CC does not support '__thread' keyword])
AC_DEFINE(__thread,,[Define to empty if compiler does not support `__thread' keyword.])
fi
# check for support for the struct ether_addr structure
AC_CHECK_TYPE(struct ether_addr,
AC_DEFINE(HAVE_STRUCT_ETHER_ADDR,1,[Define to 1 if you have a `struct ether_addr' definition.]),,[
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>])
# check to see if socklen_t is defined
AC_CHECK_TYPE(socklen_t,,
AC_DEFINE(socklen_t,size_t,[Define to `size_t' if not defined elswhere.]),[
#include <sys/types.h>
#include <sys/socket.h>])
# check to see if struct sockaddr_storage is defined
AC_CHECK_TYPE(struct sockaddr_storage,,
AC_DEFINE(sockaddr_storage,sockaddr_in,[Define to `sockaddr_in' if not defined elsewhere.]),[
#include <sys/types.h>
#include <sys/socket.h>])
# check for support for the struct ucred structure
AC_CHECK_TYPE(struct ucred,
AC_DEFINE(HAVE_STRUCT_UCRED,1,[Define to 1 if you have a `struct ucred' definition.]),,[
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/types.h>])
AC_CHECK_TYPE(sasl_interact_t,
AC_DEFINE(HAVE_SASL_INTERACT_T,1,[Define to 1 if you have a `sasl_interact_t' definition.]))
# checks for LDAP library
save_LIBS="$LIBS"
LIBS="$nslcd_LIBS"
save_CFLAGS="$CFLAGS"
# check threading stuff
ACX_PTHREAD(,AC_MSG_ERROR([no support for pthreads]))
AC_CHECK_FUNCS(pthread_atfork)
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_CHECK_LIB(gssapi, gss_krb5_ccache_name,[LIBS="-lgssapi $LIBS" found_gssapi_lib=yes],,$LIBS)
if test -z "$found_gssapi_lib"
then
AC_CHECK_LIB(gssapi_krb5, gss_krb5_ccache_name,[LIBS="-lgssapi_krb5 $LIBS"],,$LIBS)
fi
if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = umich -o $with_ldap_lib = openldap \)
then
AC_SEARCH_LIBS(ldap_search_ext,[ldap_r ldap],found_ldap_lib=yes,,)
fi
if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape5 \)
then
AC_CHECK_LIB(ldap50, main, LIBS="-lldap50 -lssldap50 -lssl3 -lnss3 -lnspr4 -lprldap50 -lplc4 -lplds4 $LIBS" found_ldap_lib=yes need_pthread=yes,, -lpthread)
fi
if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape4 \)
then
AC_CHECK_LIB(ldapssl41, main, LIBS="-lldapssl41 -lplc3 -lplds3 -lnspr3 $LIBS" found_ldap_lib=yes need_pthread=yes,, -lpthread)
if test -z "$found_ldap_lib"
then
AC_CHECK_LIB(ldapssl40, main, LIBS="-lldapssl40 $LIBS" found_ldap_lib=yes need_pthread=yes,, -lpthread)
fi
if test -z "$found_ldap_lib"
then
AC_CHECK_LIB(ldap41, main, LIBS="-lldap41 $LIBS" found_ldap_lib=yes need_pthread=no,,)
fi
if test -z "$found_ldap_lib"
then
AC_CHECK_LIB(ldap40, main, LIBS="-lldap40 $LIBS" found_ldap_lib=yes need_pthread=no,,)
fi
fi
if test -z "$found_ldap_lib" -a \( $with_ldap_lib = auto -o $with_ldap_lib = netscape3 \)
then
AC_CHECK_LIB(ldapssl30, main, LIBS="-lldapssl30 $LIBS" found_ldap_lib=yes need_pthread=yes,, -lpthread)
fi
if test -z "$found_ldap_lib"
then
AC_MSG_ERROR(could not locate a valid LDAP library)
fi
if test "$need_pthread" = "yes"
then
AC_CHECK_LIB(pthread, main)
fi
AC_CHECK_LIB(gssldap, ldap_gss_bind,[LIBS="-lgssldap $LIBS"],,$LIBS)
AC_CHECK_LIB(sasl2, sasl_client_init)
AC_CHECK_FUNCS(sasl_auxprop_request)
AC_CHECK_FUNCS(gss_krb5_ccache_name)
AC_CHECK_FUNCS(ldap_parse_result ldap_memfree ldap_controls_free ldap_control_free)
AC_CHECK_FUNCS(ldap_explode_dn ldap_explode_rdn ldap_set_option ldap_get_option)
AC_CHECK_FUNCS(ldap_abandon ldap_simple_bind_s ldap_unbind ldap_set_rebind_proc)
AC_CHECK_FUNCS(ldap_sasl_interactive_bind_s ldap_initialize ldap_search_ext)
AC_CHECK_FUNCS(ldap_create_control)
AC_CHECK_FUNCS(ldap_domain2hostlist ldap_domain2dn)
AC_CHECK_FUNCS(ldap_get_values ldap_value_free ldap_get_dn)
AC_CHECK_FUNCS(ldap_err2string ldap_msgfree ldap_result)
# replace ldap_create_page_control() and ldap_parse_page_control()
AC_CHECK_FUNCS(ldap_create_page_control ldap_parse_page_control,,[AC_LIBOBJ(pagectrl)])
# check the number of arguments that ldap_set_rebind_proc() uses
AC_CACHE_CHECK(
[number of arguments to ldap_set_rebind_proc],
nss_ldapd_cv_ldap_set_rebind_proc,
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#include <lber.h>
#include <ldap.h>]],
[[ldap_set_rebind_proc(0, 0, 0);]])],
[nss_ldapd_cv_ldap_set_rebind_proc=3],
[nss_ldapd_cv_ldap_set_rebind_proc=2]) ])
AC_DEFINE_UNQUOTED(LDAP_SET_REBIND_PROC_ARGS,$nss_ldapd_cv_ldap_set_rebind_proc,
[Define to the number of arguments to ldap_set_rebindproc.])
CFLAGS="$save_CFLAGS"
nslcd_LIBS="$LIBS"
LIBS="$save_LIBS"
AC_SUBST(nss_ldap_so_LIBS)
AC_SUBST(nslcd_LIBS)
# generate files
AC_CONFIG_FILES([Makefile compat/Makefile common/Makefile
nss/Makefile nslcd/Makefile man/Makefile tests/Makefile])
AC_OUTPUT

View file

@ -1,589 +0,0 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2007-03-29.01
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -1,519 +0,0 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2006-12-25.00
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -1,279 +0,0 @@
##### http://autoconf-archive.cryp.to/acx_pthread.html
#
# SYNOPSIS
#
# ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
#
# DESCRIPTION
#
# This macro figures out how to build C programs using POSIX threads.
# It sets the PTHREAD_LIBS output variable to the threads library and
# linker flags, and the PTHREAD_CFLAGS output variable to any special
# C compiler flags that are needed. (The user can also force certain
# compiler flags/libs to be tested by setting these environment
# variables.)
#
# Also sets PTHREAD_CC to any special C compiler that is needed for
# multi-threaded programs (defaults to the value of CC otherwise).
# (This is necessary on AIX to use the special cc_r compiler alias.)
#
# NOTE: You are assumed to not only compile your program with these
# flags, but also link it with them as well. e.g. you should link
# with $PTHREAD_CC $CFLAGS $PTHREAD_CFLAGS $LDFLAGS ... $PTHREAD_LIBS
# $LIBS
#
# If you are only building threads programs, you may wish to use
# these variables in your default LIBS, CFLAGS, and CC:
#
# LIBS="$PTHREAD_LIBS $LIBS"
# CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# CC="$PTHREAD_CC"
#
# In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
# constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE to
# that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
#
# ACTION-IF-FOUND is a list of shell commands to run if a threads
# library is found, and ACTION-IF-NOT-FOUND is a list of commands to
# run it if it is not found. If ACTION-IF-FOUND is not specified, the
# default action will define HAVE_PTHREAD.
#
# Please let the authors know if this macro fails on any platform, or
# if you have any other suggestions or comments. This macro was based
# on work by SGJ on autoconf scripts for FFTW (http://www.fftw.org/)
# (with help from M. Frigo), as well as ac_pthread and hb_pthread
# macros posted by Alejandro Forero Cuervo to the autoconf macro
# repository. We are also grateful for the helpful feedback of
# numerous users.
#
# LAST MODIFICATION
#
# 2007-07-29
#
# COPYLEFT
#
# Copyright (c) 2007 Steven G. Johnson <stevenj@alum.mit.edu>
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright
# owner gives unlimited permission to copy, distribute and modify the
# configure scripts that are the output of Autoconf when processing
# the Macro. You need not follow the terms of the GNU General Public
# License when using or distributing such scripts, even though
# portions of the text of the Macro appear in them. The GNU General
# Public License (GPL) does govern all other use of the material that
# constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the
# Autoconf Macro released by the Autoconf Macro Archive. When you
# make and distribute a modified version of the Autoconf Macro, you
# may extend this special exception to the GPL to apply to your
# modified version as well.
AC_DEFUN([ACX_PTHREAD], [
AC_REQUIRE([AC_CANONICAL_HOST])
AC_LANG_SAVE
AC_LANG_C
acx_pthread_ok=no
# We used to check for pthread.h first, but this fails if pthread.h
# requires special compiler flags (e.g. on True64 or Sequent).
# It gets checked for in the link test anyway.
# First of all, check if the user has set any of the PTHREAD_LIBS,
# etcetera environment variables, and if threads linking works using
# them:
if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
AC_MSG_RESULT($acx_pthread_ok)
if test x"$acx_pthread_ok" = xno; then
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
fi
# We must check for the threads library under a number of different
# names; the ordering is very important because some systems
# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
# libraries is broken (non-POSIX).
# Create a list of thread flags to try. Items starting with a "-" are
# C compiler flags, and other items are library names, except for "none"
# which indicates that we try without any flags at all, and "pthread-config"
# which is a program returning the flags for the Pth emulation library.
acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt pthread-config"
# The ordering *is* (sometimes) important. Some notes on the
# individual items follow:
# pthreads: AIX (must check this before -lpthread)
# none: in case threads are in libc; should be tried before -Kthread and
# other compiler flags to prevent continual compiler warnings
# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
# -pthreads: Solaris/gcc
# -mthreads: Mingw32/gcc, Lynx/gcc
# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
# doesn't hurt to check since this sometimes defines pthreads too;
# also defines -D_REENTRANT)
# ... -mt is also the pthreads flag for HP/aCC
# pthread: Linux, etcetera
# --thread-safe: KAI C++
# pthread-config: use pthread-config program (for GNU Pth library)
case "${host_cpu}-${host_os}" in
*solaris*)
# On Solaris (at least, for some versions), libc contains stubbed
# (non-functional) versions of the pthreads routines, so link-based
# tests will erroneously succeed. (We need to link with -pthreads/-mt/
# -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
# a function called by this macro, so we could check for that, but
# who knows whether they'll stub that too in a future libc.) So,
# we'll just look for -pthreads and -lpthread first:
acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags"
;;
esac
if test x"$acx_pthread_ok" = xno; then
for flag in $acx_pthread_flags; do
case $flag in
none)
AC_MSG_CHECKING([whether pthreads work without any flags])
;;
-*)
AC_MSG_CHECKING([whether pthreads work with $flag])
PTHREAD_CFLAGS="$flag"
;;
pthread-config)
AC_CHECK_PROG(acx_pthread_config, pthread-config, yes, no)
if test x"$acx_pthread_config" = xno; then continue; fi
PTHREAD_CFLAGS="`pthread-config --cflags`"
PTHREAD_LIBS="`pthread-config --ldflags` `pthread-config --libs`"
;;
*)
AC_MSG_CHECKING([for the pthreads library -l$flag])
PTHREAD_LIBS="-l$flag"
;;
esac
save_LIBS="$LIBS"
save_CFLAGS="$CFLAGS"
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Check for various functions. We must include pthread.h,
# since some functions may be macros. (On the Sequent, we
# need a special flag -Kthread to make this header compile.)
# We check for pthread_join because it is in -lpthread on IRIX
# while pthread_create is in libc. We check for pthread_attr_init
# due to DEC craziness with -lpthreads. We check for
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
[acx_pthread_ok=yes])
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
AC_MSG_RESULT($acx_pthread_ok)
if test "x$acx_pthread_ok" = xyes; then
break;
fi
PTHREAD_LIBS=""
PTHREAD_CFLAGS=""
done
fi
# Various other checks:
if test "x$acx_pthread_ok" = xyes; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
# Detect AIX lossage: JOINABLE attribute is called UNDETACHED.
AC_MSG_CHECKING([for joinable pthread attribute])
attr_name=unknown
for attr in PTHREAD_CREATE_JOINABLE PTHREAD_CREATE_UNDETACHED; do
AC_TRY_LINK([#include <pthread.h>], [int attr=$attr; return attr;],
[attr_name=$attr; break])
done
AC_MSG_RESULT($attr_name)
if test "$attr_name" != PTHREAD_CREATE_JOINABLE; then
AC_DEFINE_UNQUOTED(PTHREAD_CREATE_JOINABLE, $attr_name,
[Define to necessary symbol if this constant
uses a non-standard name on your system.])
fi
AC_MSG_CHECKING([if more special flags are required for pthreads])
flag=no
case "${host_cpu}-${host_os}" in
*-aix* | *-freebsd* | *-darwin*) flag="-D_THREAD_SAFE";;
*solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
esac
AC_MSG_RESULT(${flag})
if test "x$flag" != xno; then
PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
fi
LIBS="$save_LIBS"
CFLAGS="$save_CFLAGS"
# More AIX lossage: must compile with xlc_r or cc_r
if test x"$GCC" != xyes; then
AC_CHECK_PROGS(PTHREAD_CC, xlc_r cc_r, ${CC})
else
PTHREAD_CC=$CC
fi
else
PTHREAD_CC="$CC"
fi
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(PTHREAD_CFLAGS)
AC_SUBST(PTHREAD_CC)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x"$acx_pthread_ok" = xyes; then
ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
:
else
acx_pthread_ok=no
$2
fi
AC_LANG_RESTORE
])dnl ACX_PTHREAD

View file

@ -1,35 +0,0 @@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2007 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
dist_man_MANS = nss-ldapd.conf.5 nslcd.8
EXTRA_DIST = nss-ldapd.conf.5.xml nslcd.8.xml
if GENMAN
MAINTAINERCLEANFILES = $(dist_man_MANS)
SUFFIXES = .xml
.xml:
$(DOCBOOK2X_MAN) \
--string-param header-3='$(RELEASE_MONTH)' \
--string-param header-4='Version $(VERSION)' \
$<
endif

View file

@ -1,450 +0,0 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2007 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = man
DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
SOURCES =
DIST_SOURCES =
man5dir = $(mandir)/man5
am__installdirs = "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"
man8dir = $(mandir)/man8
NROFF = nroff
MANS = $(dist_man_MANS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOCBOOK2X_MAN = @DOCBOOK2X_MAN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NSLCD_PIDFILE = @NSLCD_PIDFILE@
NSLCD_SOCKET = @NSLCD_SOCKET@
NSS_LDAP_PATH_CONF = @NSS_LDAP_PATH_CONF@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RELEASE_MONTH = @RELEASE_MONTH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
acx_pthread_config = @acx_pthread_config@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
nslcd_LIBS = @nslcd_LIBS@
nss_ldap_so_LIBS = @nss_ldap_so_LIBS@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
dist_man_MANS = nss-ldapd.conf.5 nslcd.8
EXTRA_DIST = nss-ldapd.conf.5.xml nslcd.8.xml
@GENMAN_TRUE@MAINTAINERCLEANFILES = $(dist_man_MANS)
@GENMAN_TRUE@SUFFIXES = .xml
all: all-am
.SUFFIXES:
.SUFFIXES: .xml
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu man/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu man/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-man5: $(man5_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.5*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
5*) ;; \
*) ext='5' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \
done
uninstall-man5:
@$(NORMAL_UNINSTALL)
@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.5*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
5*) ;; \
*) ext='5' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
done
install-man8: $(man8_MANS) $(man_MANS)
@$(NORMAL_INSTALL)
test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
else file=$$i; fi; \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \
done
uninstall-man8:
@$(NORMAL_UNINSTALL)
@list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
for i in $$l2; do \
case "$$i" in \
*.8*) list="$$list $$i" ;; \
esac; \
done; \
for i in $$list; do \
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
case "$$ext" in \
8*) ;; \
*) ext='8' ;; \
esac; \
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
inst=`echo $$inst | sed -e 's/^.*\///'`; \
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \
rm -f "$(DESTDIR)$(man8dir)/$$inst"; \
done
tags: TAGS
TAGS:
ctags: CTAGS
CTAGS:
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(MANS)
installdirs:
for dir in "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am
clean-am: clean-generic mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am: install-man
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man: install-man5 install-man8
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-man
uninstall-man: uninstall-man5 uninstall-man8
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic distclean \
distclean-generic distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-man5 install-man8 install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
pdf-am ps ps-am uninstall uninstall-am uninstall-man \
uninstall-man5 uninstall-man8
@GENMAN_TRUE@.xml:
@GENMAN_TRUE@ $(DOCBOOK2X_MAN) \
@GENMAN_TRUE@ --string-param header-3='$(RELEASE_MONTH)' \
@GENMAN_TRUE@ --string-param header-4='Version $(VERSION)' \
@GENMAN_TRUE@ $<
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -1,54 +0,0 @@
'\" -*- coding: us-ascii -*-
.if \n(.g .ds T< \\FC
.if \n(.g .ds T> \\F[\n[.fam]]
.de URL
\\$2 \(la\\$1\(ra\\$3
..
.if \n(.g .mso www.tmac
.TH nslcd 8 "May 2008" "Version 0.6.2" "System Manager's Manual"
.SH NAME
nslcd \- local LDAP name service daemon.
.SH SYNOPSIS
'nh
.fi
.ad l
\fBnslcd\fR \kx
.if (\nx>(\n(.l/2)) .nr x (\n(.l/5)
'in \n(.iu+\nxu
[
\fIoptions\fR
]
'in \n(.iu-\nxu
.ad b
'hy
.SH DESCRIPTION
\fBnslcd\fR is a daemon that will do LDAP queries
for local processes based on a simple configuration
file.
.PP
\fBnslcd\fR is configured through a configuration file
(see \fBnss-ldapd.conf\fR(5)).
.PP
See the included README for information on configuring the LDAP server.
.SH OPTIONS
\fBnslcd\fR accepts the following options:
.TP
\*(T<\fB\-d, \-\-debug\fR\*(T>
Enable debugging mode.
\fBnslcd\fR will not put itself in the background and sends
verbose debugging info to stderr.
\fBnslcd\fR will handle connections as usual.
This option is for debugging purposes only.
.TP
\*(T<\fB\-\-help\fR\*(T>
Display short help and exit.
.TP
\*(T<\fB\-V, \-\-version\fR\*(T>
Output version information and exit.
.SH FILES
\*(T<\fI/etc/nss\-ldapd.conf\fR\*(T> - the configuration file
(see \fBnss-ldapd.conf\fR(5))
.SH "SEE ALSO"
\fBnss-ldapd.conf\fR(5)
.SH AUTHOR
This manual was written by Arthur de Jong <arthur@ch.tudelft.nl>.

View file

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<!--
nslcd.8.xml - docbook manual page for nslcd
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
-->
<refentry id="nslcd8">
<refentryinfo>
<author>
<firstname>Arthur</firstname>
<surname>de Jong</surname>
</author>
</refentryinfo>
<refmeta>
<refentrytitle>nslcd</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class="version">Version 0.6.2</refmiscinfo>
<refmiscinfo class="manual">System Manager's Manual</refmiscinfo>
<refmiscinfo class="date">May 2008</refmiscinfo>
</refmeta>
<refnamediv id="name">
<refname>nslcd</refname>
<refpurpose>local LDAP name service daemon.</refpurpose>
</refnamediv>
<refsynopsisdiv id="synopsis">
<cmdsynopsis>
<command>nslcd</command>
<arg choice="opt">
<replaceable>options</replaceable>
</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id="description">
<title>Description</title>
<para>
<command>nslcd</command> is a daemon that will do LDAP queries
for local processes based on a simple configuration
file.
</para>
<para>
<command>nslcd</command> is configured through a configuration file
(see <citerefentry><refentrytitle>nss-ldapd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
</para>
<para>
See the included README for information on configuring the LDAP server.
</para>
</refsect1>
<refsect1 id="options">
<title>Options</title>
<para>
<command>nslcd</command> accepts the following options:</para>
<variablelist remap="TP">
<varlistentry>
<term>
<option>-d, --debug</option>
</term>
<listitem>
<para>
Enable debugging mode.
<command>nslcd</command> will not put itself in the background and sends
verbose debugging info to stderr.
<command>nslcd</command> will handle connections as usual.
This option is for debugging purposes only.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--help</option>
</term>
<listitem>
<para>Display short help and exit.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-V, --version</option>
</term>
<listitem>
<para>Output version information and exit.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="files">
<title>Files</title>
<para>
<filename>/etc/nss-ldapd.conf</filename> - the configuration file
(see <citerefentry><refentrytitle>nss-ldapd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
</para>
</refsect1>
<refsect1 id="see_also">
<title>See Also</title>
<para>
<citerefentry><refentrytitle>nss-ldapd.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
</para>
</refsect1>
<refsect1 id="author">
<title>Author</title>
<para>This manual was written by Arthur de Jong &lt;arthur@ch.tudelft.nl&gt;.</para>
</refsect1>
</refentry>

View file

@ -1,282 +0,0 @@
'\" -*- coding: us-ascii -*-
.if \n(.g .ds T< \\FC
.if \n(.g .ds T> \\F[\n[.fam]]
.de URL
\\$2 \(la\\$1\(ra\\$3
..
.if \n(.g .mso www.tmac
.TH nss-ldapd.conf 5 "May 2008" "Version 0.6.2" "System Manager's Manual"
.SH NAME
nss-ldapd.conf \- configuration file for LDAP nameservice provider
.SH DESCRIPTION
The \fInss-ldapd\fR module allows LDAP
directory servers to be used as a primary source of name service
information. (Name service information typically includes users, hosts,
groups, and other such data historically stored in flat files or
NIS.)
.PP
The file \*(T<\fInss\-ldapd.conf\fR\*(T> contains the
configuration information for running \fBnslcd\fR (see
\fBnslcd\fR(8)).
The file contains options, one on each line, defining the way
NSS lookups are mapped onto
LDAP lookups.
.SH OPTIONS
.SS "RUNTIME OPTIONS"
.TP
\*(T<\fBthreads\fR\*(T> \fINUM\fR
Specifies the number of threads to start that can handle requests
and perform LDAP queries.
The default is to start 5 threads.
.SS "GENERAL CONNECTION OPTIONS"
.TP
\*(T<\fBuri\fR\*(T> \fIURI\fR
Specifies the LDAP URI of the
server to connect to.
The URI scheme may be \fIldap\fR,
\fIldapi\fR or \fIldaps\fR, specifying
LDAP over TCP,
ICP or SSL respectively (if
supported by the LDAP library).
Alternatively, the value \fIDNS\fR may be
used to try to lookup the server using DNS
SRV records.
When using the ldapi scheme, %2f should be used to escape slashes
(e.g. ldapi://%2fvar%2frun%2fslapd%2fldapi/), although most of the
time this should not be needed.
This option may be specified multiple times. Normally, only the first
server will be used with the following servers as fall-back (see
\*(T<\fBbind_timelimit\fR\*(T> below).
If LDAP lookups are used for host name resolution,
any host names should be specified as an IP address or name that can be
resolved without using LDAP.
.TP
\*(T<\fBldap_version\fR\*(T> \fIVERSION\fR
Specifies the version of the LDAP protocol to use.
The default is to use the maximum version supported by the
LDAP library.
.TP
\*(T<\fBbinddn\fR\*(T> \fIDN\fR
Specifies the distinguished name with which to bind to the directory
server for lookups.
The default is to bind anonymously.
.TP
\*(T<\fBbindpw\fR\*(T> \fIPASSWORD\fR
Specifies the clear text credentials with which to bind.
This option is only applicable when used with \*(T<\fBbinddn\fR\*(T> above.
When binding to the directory using SASL or other
authentication mechanisms apart from simple binds, this option is not
used.
.SS "KERBEROS AUTHENTICATION OPTIONS"
.TP
\*(T<\fBkrb5_ccname\fR\*(T> \fINAME\fR
Set the name for the GSS-API Kerberos credentials cache.
.SS "SEARCH/MAPPING OPTIONS"
.TP
\*(T<\fBbase\fR\*(T> [\fIMAP\fR] \fIDN\fR
Specifies the base distinguished name (DN)
to use as search base.
A global search base may be specified or a MAP-specific one.
If no MAP-specific search base is defined the global one is used.
If, instead of a DN, the value
\fIDOMAIN\fR is specified, the hosts
DNS domain is used to construct a basedn.
.TP
\*(T<\fBscope\fR\*(T> [\fIMAP\fR] sub[tree]|one[level]|base
Specifies the search scope (subtree, one level or base object).
The default scope is subtree; base scope is almost never useful for
name service lookups.
.TP
\*(T<\fBderef\fR\*(T> never|searching|finding|always
Specifies the policy for dereferencing aliases.
The default policy is to never dereference aliases.
.TP
\*(T<\fBreferrals\fR\*(T> yes|no
Specifies whether automatic referral chasing should be enabled.
The default behaviour is to chase referrals.
.TP
\*(T<\fBfilter\fR\*(T> \fIMAP\fR \fIFILTER\fR
The \fIFILTER\fR
is an LDAP search filter to use for a
specific map.
The default filter is a basic search on the
objectClass for the map (e.g. \*(T<(objectClass=posixAccount)\*(T>).
.TP
\*(T<\fBmap\fR\*(T> \fIMAP\fR \fIATTRIBUTE\fR \fINEWATTRIBUTE\fR
This option allows for custom attributes to be looked up instead of
the default RFC 2307 attributes.
The \fIMAP\fR may be one of
the supported maps below.
The \fIATTRIBUTE\fR is the one as
used in RFC 2307 (e.g. \*(T<userPassword\*(T>,
\*(T<ipProtocolNumber\*(T> or \*(T<macAddress\*(T>).
The \fINEWATTRIBUTE\fR may be any attribute
as it is available in the directory.
.SS "TIMING/RECONNECT OPTIONS"
.TP
\*(T<\fBbind_timelimit\fR\*(T> \fISECONDS\fR
Specifies the time limit (in seconds) to use when connecting to the
directory server.
This is distinct from the time limit specified in
\*(T<\fBtimelimit\fR\*(T> and affects the setup of the connection only.
Note that not all LDAP client libraries have support
for setting the connection time out.
The default \*(T<\fBbind_timelimit\fR\*(T> is 30 seconds.
.TP
\*(T<\fBtimelimit\fR\*(T> \fISECONDS\fR
Specifies the time limit (in seconds) to wait for a response from the
LDAP server.
A value of zero (0), which is the default, is to wait indefinitely for
searches to be completed.
.TP
\*(T<\fBidle_timelimit\fR\*(T> \fISECONDS\fR
Specifies the period if inactivity (in seconds) after which the
connection to the LDAP server will be closed.
The default is not to time out connections.
.TP
\*(T<\fBreconnect_sleeptime\fR\*(T> \fISECONDS\fR
Specifies the number of seconds to sleep when connecting to all
LDAP servers fails.
By default 1 second is waited between the first failure and the first
retry.
.TP
\*(T<\fBreconnect_maxsleeptime\fR\*(T> \fISECONDS\fR
Specified the time after the last successful operation from which the
LDAP server is considered permanently unavailable.
Retries will be done only once in this time period.
The default value is 30 seconds.
.PP
Note that the reconnect logic as described above is the mechanism that
is used between \fBnslcd\fR and the LDAP
server. The mechanism between the NSS client library
and \fBnslcd\fR is simpler with a fixed compiled-in
time out of a 10 seconds for writing to \fBnslcd\fR and
a time out of 20 seconds for reading answers.
\fBnslcd\fR itself has a read time out of 0.5 seconds
and a write time out of 5 seconds.
.SS "SSL/TLS OPTIONS"
.TP
\fIssl <on|off|start_tls>\fR
Specifies whether to use SSL/TLS or not (the default is not to). If
\fIstart_tls\fR
is specified then StartTLS is used rather than raw LDAP over SSL.
Not all LDAP client libraries support both SSL
and StartTLS, and all related configuration options.
.TP
\fIsslpath <cert7_path>\fR
For the Netscape and Mozilla
LDAP
client libraries only, this specifies the path to the X.509
certificate database.
.TP
\fItls_checkpeer <yes|no>\fR
Specifies whether to require and verify the server certificate
or not, when using SSL/TLS
with the OpenLDAP client library.
The default is to use the default behaviour of the client
library; for OpenLDAP 2.0 and earlier it is "no", for OpenLDAP
2.1 and later it is "yes". At least one of
\fItls_cacertdir\fR
and
\fItls_cacertfile\fR
is required if peer verification is enabled.
.TP
\fItls_cacertdir <certificate_dir>\fR
Specifies the directory containing X.509 certificates for peer
authentication.
.TP
\fItls_cacertfile <certificate_file>\fR
Specifies the path to the X.509 certificate for peer authentication.
.TP
\fItls_randfile <entropy_file>\fR
Specifies the path to an entropy source.
.TP
\fItls_ciphers <ciphers>\fR
Specifies the ciphers to use for TLS.
See your TLS implementation's
documentation for further information.
.TP
\fItls_cert <certificate_file>\fR
Specifies the path to the file containing the local certificate for
client TLS authentication.
.TP
\fItls_key <key_file>\fR
Specifies the path to the file containing the private key for client
TLS authentication.
.SS "OTHER OPTIONS"
.TP
\*(T<\fBpagesize\fR\*(T> \fINUMBER\fR
Set this to a number greater than 0 to request paged results from
the LDAP server in accordance with RFC2696.
The default (0) is to not request paged results.
This is useful for LDAP servers that contain a
lot of entries (e.g. more than 500) and limit the number of entries
that are returned with one request.
For OpenLDAP servers you may need to set
\*(T<\fBsizelimit size.prtotal=unlimited\fR\*(T>
for allowing more entries to be returned over multiple pages.
.SH "SUPPORTED MAPS"
The following maps are supported. They are referenced as
\fIMAP\fR in the options above.
.TP
alias[es]
Mail aliases.
Note that most mail servers do not use the NSS
interface for requesting mail aliases and parse
\*(T<\fI/etc/aliases\fR\*(T> on their own.
.TP
ether[s]
Ethernet numbers (mac addresses).
.TP
group
Posix groups.
.TP
host[s]
Host names.
.TP
netgroup
Host and user groups used for access control.
.TP
network[s]
Network numbers.
.TP
passwd
Posix users.
.TP
protocol[s]
Protocol definitions (like in \*(T<\fI/etc/protocols\fR\*(T>).
.TP
rpc
Remote procedure call names and numbers.
.TP
service[s]
Network service names and numbers.
.TP
shadow
Shadow user password information.
.SH FILES
.TP
\*(T<\fI/etc/nss\-ldapd.conf\fR\*(T>
the main configuration file
.TP
\*(T<\fI/etc/nsswitch.conf\fR\*(T>
Name Service Switch configuration file
.SH "SEE ALSO"
\fBnslcd\fR(8),
\fBnsswitch.conf\fR(5)
.SH AUTHOR
This manual was written by Arthur de Jong <arthur@ch.tudelft.nl>
and is based on the
\fBnss_ldap\fR(5)
manual developed by PADL Software Pty Ltd.
.SH "KNOWN BUGS"
This manual page may be outdated and inaccurate and will be improved
in upcoming releases.
The features of \fInss-ldapd\fR are still under
development so these options may change in a future release.

View file

@ -1,652 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<!--
nss-ldapd.conf.5.xml - docbook manual page for nss-ldapd.conf
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
-->
<refentry id="nssldapdconf5">
<refentryinfo>
<author>
<firstname>Arthur</firstname>
<surname>de Jong</surname>
</author>
</refentryinfo>
<refmeta>
<refentrytitle>nss-ldapd.conf</refentrytitle>
<manvolnum>5</manvolnum>
<refmiscinfo class="version">Version 0.6.2</refmiscinfo>
<refmiscinfo class="manual">System Manager's Manual</refmiscinfo>
<refmiscinfo class="date">May 2008</refmiscinfo>
</refmeta>
<refnamediv id="name">
<refname>nss-ldapd.conf</refname>
<refpurpose>configuration file for LDAP nameservice provider</refpurpose>
</refnamediv>
<refsect1 id="description">
<title>Description</title>
<para>
The <emphasis>nss-ldapd</emphasis> module allows <acronym>LDAP</acronym>
directory servers to be used as a primary source of name service
information. (Name service information typically includes users, hosts,
groups, and other such data historically stored in flat files or
<acronym>NIS</acronym>.)
</para>
<para>
The file <filename>nss-ldapd.conf</filename> contains the
configuration information for running <command>nslcd</command> (see
<citerefentry><refentrytitle>nslcd</refentrytitle><manvolnum>8</manvolnum></citerefentry>).
The file contains options, one on each line, defining the way
<acronym>NSS</acronym> lookups are mapped onto
<acronym>LDAP</acronym> lookups.
</para>
</refsect1>
<refsect1 id="options">
<title>Options</title>
<refsect2 id='runtime_options'>
<title>Runtime options</title>
<variablelist>
<varlistentry>
<term><option>threads</option> <emphasis remap="I">NUM</emphasis></term>
<listitem>
<para>
Specifies the number of threads to start that can handle requests
and perform <acronym>LDAP</acronym> queries.
The default is to start 5 threads.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id='general_connection_options'>
<title>General connection options</title>
<variablelist>
<varlistentry>
<term><option>uri</option> <emphasis remap="I">URI</emphasis></term>
<listitem>
<para>
Specifies the <acronym>LDAP</acronym> <acronym>URI</acronym> of the
server to connect to.
The <acronym>URI</acronym> scheme may be <emphasis>ldap</emphasis>,
<emphasis>ldapi</emphasis> or <emphasis>ldaps</emphasis>, specifying
<acronym>LDAP</acronym> over <acronym>TCP</acronym>,
<acronym>ICP</acronym> or <acronym>SSL</acronym> respectively (if
supported by the <acronym>LDAP</acronym> library).
Alternatively, the value <emphasis remap="I">DNS</emphasis> may be
used to try to lookup the server using <acronym>DNS</acronym>
<acronym>SRV</acronym> records.
</para>
<para>
When using the ldapi scheme, %2f should be used to escape slashes
(e.g. ldapi://%2fvar%2frun%2fslapd%2fldapi/), although most of the
time this should not be needed.
</para>
<para>
This option may be specified multiple times. Normally, only the first
server will be used with the following servers as fall-back (see
<option>bind_timelimit</option> below).
</para>
<para>
If <acronym>LDAP</acronym> lookups are used for host name resolution,
any host names should be specified as an IP address or name that can be
resolved without using <acronym>LDAP</acronym>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>ldap_version</option> <emphasis remap="I">VERSION</emphasis></term>
<listitem>
<para>
Specifies the version of the <acronym>LDAP</acronym> protocol to use.
The default is to use the maximum version supported by the
<acronym>LDAP</acronym> library.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>binddn</option> <emphasis remap="I">DN</emphasis></term>
<listitem>
<para>
Specifies the distinguished name with which to bind to the directory
server for lookups.
The default is to bind anonymously.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>bindpw</option> <emphasis remap="I">PASSWORD</emphasis></term>
<listitem>
<para>
Specifies the clear text credentials with which to bind.
This option is only applicable when used with <option>binddn</option> above.
</para>
<para>
When binding to the directory using <acronym>SASL</acronym> or other
authentication mechanisms apart from simple binds, this option is not
used.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<!-- DO NOT DOCUMENT FOR NOW BECAUSE IT'S NOT SUPPORTED
<refsect2 id='sasl_authentication_options'>
<title>SASL authentication options</title>
<variablelist>
<varlistentry>
<term><emphasis remap="B">sasl_authid &lt;authid&gt;</emphasis></term>
<listitem>
<para>Specifies the authorization identity to be used when performing SASL
authentication.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap="B">sasl_secprops &lt;properties&gt;</emphasis></term>
<listitem>
<para>Specifies Cyrus SASL security properties. Allowed values are described
in the
<emphasis remap="B">ldap.conf(5)</emphasis>
manual page.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap="B">use_sasl &lt;yes|no&gt;</emphasis></term>
<listitem>
<para>Specifies whether SASL authentication should be used.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
-->
<refsect2 id='kerberos_authentication_options'>
<title>Kerberos authentication options</title>
<variablelist>
<varlistentry>
<term><option>krb5_ccname</option> <emphasis remap="I">NAME</emphasis></term>
<listitem>
<para>
Set the name for the GSS-API Kerberos credentials cache.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id='search_mapping_options'>
<title>Search/mapping options</title>
<variablelist>
<varlistentry>
<term><option>base</option>
<optional><emphasis remap="I">MAP</emphasis></optional>
<emphasis remap="I">DN</emphasis></term>
<listitem>
<para>
Specifies the base distinguished name (<acronym>DN</acronym>)
to use as search base.
A global search base may be specified or a MAP-specific one.
If no MAP-specific search base is defined the global one is used.
</para>
<para>
If, instead of a <acronym>DN</acronym>, the value
<emphasis remap="I">DOMAIN</emphasis> is specified, the hosts
<acronym>DNS</acronym> domain is used to construct a basedn.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>scope</option>
<optional><emphasis remap="I">MAP</emphasis></optional>
sub<optional>tree</optional>|one<optional>level</optional>|base</term>
<listitem>
<para>
Specifies the search scope (subtree, one level or base object).
The default scope is subtree; base scope is almost never useful for
name service lookups.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>deref</option> never|searching|finding|always</term>
<listitem>
<para>
Specifies the policy for dereferencing aliases.
The default policy is to never dereference aliases.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>referrals</option> yes|no</term>
<listitem>
<para>
Specifies whether automatic referral chasing should be enabled.
The default behaviour is to chase referrals.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>filter</option>
<emphasis remap="I">MAP</emphasis>
<emphasis remap="I">FILTER</emphasis></term>
<listitem>
<para>
The <emphasis remap="I">FILTER</emphasis>
is an <acronym>LDAP</acronym> search filter to use for a
specific map.
The default filter is a basic search on the
objectClass for the map (e.g. <code>(objectClass=posixAccount)</code>).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>map</option>
<emphasis remap="I">MAP</emphasis>
<emphasis remap="I">ATTRIBUTE</emphasis>
<emphasis remap="I">NEWATTRIBUTE</emphasis></term>
<listitem>
<para>
This option allows for custom attributes to be looked up instead of
the default RFC 2307 attributes.
The <emphasis remap="I">MAP</emphasis> may be one of
the supported maps below.
The <emphasis remap="I">ATTRIBUTE</emphasis> is the one as
used in <acronym>RFC</acronym> 2307 (e.g. <code>userPassword</code>,
<code>ipProtocolNumber</code> or <code>macAddress</code>).
The <emphasis remap="I">NEWATTRIBUTE</emphasis> may be any attribute
as it is available in the directory.
<!--
If the <emphasis remap="I">NEWATTRIBUTE</emphasis> is presented in
quotes (") the specfied value will be used instead of looking up the
value in the directory.
Specifies a value to use for the specified attribute in preference
to that contained in the actual entry.
-->
</para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term><option>default</option>
<emphasis remap="I">MAP</emphasis>
<emphasis remap="I">ATTRIBUTE</emphasis>
"<emphasis remap="I">VALUE</emphasis>"</term>
<listitem>
<para>
Specifies the default value to use for entries that lack the
specified attribute.
Use the specified <emphasis remap="I">VALUE</emphasis> if the
lookup in the directory for the specified attribute would not return
any data.
Note that if the <acronym>LDAP</acronym> server returns an empty string
for the attribute an empty string is returned.
</para>
</listitem>
</varlistentry>
-->
</variablelist>
</refsect2>
<refsect2 id='timing_reconnect_options'>
<title>Timing/reconnect options</title>
<variablelist>
<varlistentry>
<term><option>bind_timelimit</option> <emphasis remap="I">SECONDS</emphasis></term>
<listitem>
<para>
Specifies the time limit (in seconds) to use when connecting to the
directory server.
This is distinct from the time limit specified in
<option>timelimit</option> and affects the setup of the connection only.
Note that not all <acronym>LDAP</acronym> client libraries have support
for setting the connection time out.
The default <option>bind_timelimit</option> is 30 seconds.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>timelimit</option> <emphasis remap="I">SECONDS</emphasis></term>
<listitem>
<para>
Specifies the time limit (in seconds) to wait for a response from the
<acronym>LDAP</acronym> server.
A value of zero (0), which is the default, is to wait indefinitely for
searches to be completed.
</para>
</listitem>
</varlistentry>
<!-- FIXME: change the defaults to 10 and 20 seconds respectively -->
<varlistentry>
<term><option>idle_timelimit</option> <emphasis remap="I">SECONDS</emphasis></term>
<listitem>
<para>
Specifies the period if inactivity (in seconds) after which the
connection to the <acronym>LDAP</acronym> server will be closed.
The default is not to time out connections.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>reconnect_sleeptime</option> <emphasis remap="I">SECONDS</emphasis></term>
<listitem>
<para>
Specifies the number of seconds to sleep when connecting to all
<acronym>LDAP</acronym> servers fails.
By default 1 second is waited between the first failure and the first
retry.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>reconnect_maxsleeptime</option> <emphasis remap="I">SECONDS</emphasis></term>
<listitem>
<para>
Specified the time after the last successful operation from which the
<acronym>LDAP</acronym> server is considered permanently unavailable.
Retries will be done only once in this time period.
The default value is 30 seconds.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>
Note that the reconnect logic as described above is the mechanism that
is used between <command>nslcd</command> and the <acronym>LDAP</acronym>
server. The mechanism between the <acronym>NSS</acronym> client library
and <command>nslcd</command> is simpler with a fixed compiled-in
time out of a 10 seconds for writing to <command>nslcd</command> and
a time out of 20 seconds for reading answers.
<command>nslcd</command> itself has a read time out of 0.5 seconds
and a write time out of 5 seconds.
</para>
</refsect2>
<refsect2 id='ssl_tls_options'>
<title><acronym>SSL</acronym>/<acronym>TLS</acronym> options</title>
<variablelist>
<varlistentry>
<term><emphasis remap="B">ssl &lt;on|off|start_tls&gt;</emphasis></term>
<listitem>
<para>Specifies whether to use <acronym>SSL</acronym>/<acronym>TLS</acronym> or not (the default is not to). If
<emphasis remap="B">start_tls</emphasis>
is specified then StartTLS is used rather than raw <acronym>LDAP</acronym> over <acronym>SSL</acronym>.
Not all <acronym>LDAP</acronym> client libraries support both <acronym>SSL</acronym>
and StartTLS, and all related configuration options.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap="B">sslpath &lt;cert7_path&gt;</emphasis></term>
<listitem>
<para>For the Netscape and Mozilla
<acronym>LDAP</acronym>
client libraries only, this specifies the path to the X.509
certificate database.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap="B">tls_checkpeer &lt;yes|no&gt;</emphasis></term>
<listitem>
<para>Specifies whether to require and verify the server certificate
or not, when using <acronym>SSL</acronym>/<acronym>TLS</acronym>
with the OpenLDAP client library.
The default is to use the default behaviour of the client
library; for OpenLDAP 2.0 and earlier it is "no", for OpenLDAP
2.1 and later it is "yes". At least one of
<emphasis remap="B">tls_cacertdir</emphasis>
and
<emphasis remap="B">tls_cacertfile</emphasis>
is required if peer verification is enabled.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap="B">tls_cacertdir &lt;certificate_dir&gt;</emphasis></term>
<listitem>
<para>Specifies the directory containing X.509 certificates for peer
authentication.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap="B">tls_cacertfile &lt;certificate_file&gt;</emphasis></term>
<listitem>
<para>Specifies the path to the X.509 certificate for peer authentication.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap="B">tls_randfile &lt;entropy_file&gt;</emphasis></term>
<listitem>
<para>Specifies the path to an entropy source.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap="B">tls_ciphers &lt;ciphers&gt;</emphasis></term>
<listitem>
<para>Specifies the ciphers to use for <acronym>TLS</acronym>.
See your <acronym>TLS</acronym> implementation's
documentation for further information.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap="B">tls_cert &lt;certificate_file&gt;</emphasis></term>
<listitem>
<para>Specifies the path to the file containing the local certificate for
client <acronym>TLS</acronym> authentication.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis remap="B">tls_key &lt;key_file&gt;</emphasis></term>
<listitem>
<para>Specifies the path to the file containing the private key for client
<acronym>TLS</acronym> authentication.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id='other_options'>
<title>Other options</title>
<variablelist>
<!-- do not document this option for now as support it is not finalized
<varlistentry>
<term><emphasis remap="B">restart &lt;yes|no&gt;</emphasis></term>
<listitem>
<para>Specifies whether the
<acronym>LDAP</acronym>
client library should restart the
<emphasis remap="B">select(2)</emphasis>
system call when interrupted. This feature is not supported by all
client libraries.</para>
</listitem>
</varlistentry>
-->
<varlistentry>
<term><option>pagesize</option> <emphasis remap="I">NUMBER</emphasis></term>
<listitem>
<para>
Set this to a number greater than 0 to request paged results from
the <acronym>LDAP</acronym> server in accordance with RFC2696.
The default (0) is to not request paged results.
</para>
<para>
This is useful for <acronym>LDAP</acronym> servers that contain a
lot of entries (e.g. more than 500) and limit the number of entries
that are returned with one request.
For OpenLDAP servers you may need to set
<option>sizelimit size.prtotal=unlimited</option>
for allowing more entries to be returned over multiple pages.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>
<refsect1 id="maps">
<title>Supported maps</title>
<para>
The following maps are supported. They are referenced as
<emphasis remap="I">MAP</emphasis> in the options above.
</para>
<variablelist remap="TP">
<varlistentry>
<term>alias<optional>es</optional></term>
<listitem><para>
Mail aliases.
Note that most mail servers do not use the <acronym>NSS</acronym>
interface for requesting mail aliases and parse
<filename>/etc/aliases</filename> on their own.
</para></listitem>
</varlistentry>
<varlistentry>
<term>ether<optional>s</optional></term>
<listitem><para>Ethernet numbers (mac addresses).</para></listitem>
</varlistentry>
<varlistentry>
<term>group</term>
<listitem><para>Posix groups.</para></listitem>
</varlistentry>
<varlistentry>
<term>host<optional>s</optional></term>
<listitem><para>Host names.</para></listitem>
</varlistentry>
<varlistentry>
<term>netgroup</term>
<listitem><para>Host and user groups used for access control.</para></listitem>
</varlistentry>
<varlistentry>
<term>network<optional>s</optional></term>
<listitem><para>Network numbers.</para></listitem>
</varlistentry>
<varlistentry>
<term>passwd</term>
<listitem><para>Posix users.</para></listitem>
</varlistentry>
<varlistentry>
<term>protocol<optional>s</optional></term>
<listitem><para>Protocol definitions (like in <filename>/etc/protocols</filename>).</para></listitem>
</varlistentry>
<varlistentry>
<term>rpc</term>
<listitem><para>Remote procedure call names and numbers.</para></listitem>
</varlistentry>
<varlistentry>
<term>service<optional>s</optional></term>
<listitem><para>Network service names and numbers.</para></listitem>
</varlistentry>
<varlistentry>
<term>shadow</term>
<listitem><para>Shadow user password information.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="files">
<title>Files</title>
<variablelist remap="TP">
<varlistentry>
<term><filename>/etc/nss-ldapd.conf</filename></term>
<listitem><para>the main configuration file</para></listitem>
</varlistentry>
<varlistentry>
<term><filename>/etc/nsswitch.conf</filename></term>
<listitem><para>Name Service Switch configuration file</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="see_also">
<title>See Also</title>
<para>
<citerefentry><refentrytitle>nslcd</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
<citerefentry><refentrytitle>nsswitch.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
</para>
</refsect1>
<refsect1 id="author">
<title>Author</title>
<para>This manual was written by Arthur de Jong &lt;arthur@ch.tudelft.nl&gt;
and is based on the
<citerefentry><refentrytitle>nss_ldap</refentrytitle><manvolnum>5</manvolnum></citerefentry>
manual developed by PADL Software Pty Ltd.</para>
</refsect1>
<refsect1 id="known_bugs">
<title>Known Bugs</title>
<para>
This manual page may be outdated and inaccurate and will be improved
in upcoming releases.
The features of <emphasis>nss-ldapd</emphasis> are still under
development so these options may change in a future release.
</para>
</refsect1>
</refentry>

View file

@ -1,367 +0,0 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2006-05-10.23
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case $1 in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $1 in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -1,161 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2006-05-11.19
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
IFS=" "" $nl"
errstatus=0
dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit $?
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit $?
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp=$pathcomp/
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View file

@ -1,225 +0,0 @@
/*
nslcd.h - file describing client/server protocol
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _NSLCD_H
#define _NSLCD_H 1
/*
The protocol used between the nslcd client and server is a simple binary
protocol. It is request/response based where the client initiates a
connection, does a single request and closes the connection again. Any
mangled or not understood messages will be silently ignored by the server.
A request looks like:
int32 NSLCD_VERSION
int32 NSLCD_ACTION_*
[request parameters if any]
A response looks like:
int32 NSLCD_VERSION
int32 NSLCD_ACTION_* (the original request type)
[result(s)]
NSLCD_RESULT_END
A result looks like:
int32 NSLCD_RESULT_SUCCESS
[result value(s)]
If a response would return multiple values (e.g. for NSLCD_ACTION_*_ALL
functions) each return value will be preceded by a NSLCD_RESULT_SUCCESS
value. After the last returned result the server sends
NSLCD_RESULT_END. If some error occurs the server terminates the
connection to signal an error condition (breaking the protocol).
These are the available data types:
INT32 - 32-bit integer value
TYPE - a typed field that is transferred using sizeof()
STRING - a string length (32bit) followed by the string value (not
null-terminted) the string itself is assumed to be UTF-8
STRINGLIST - a 32-bit number noting the number of strings followed by
the strings one at a time
Compound datatypes (such as PASSWD) are defined below as a combination of
the above types. They are defined as macros so they can be expanded to
code later on.
The protocol uses host-byte order for all types (except where the normal
value in-memory is already in network-byte order like with some
addresses). This simple protocol makes it easy to support diffenrent NSS
implementations.
*/
/* used for transferring alias information */
#define NSLCD_ALIAS \
NSLCD_STRING(ALIAS_NAME) \
NSLCD_STRINGLIST(ALIAS_RCPTS)
/* used for transferring mac addresses */
#define NSLCD_ETHER \
NSLCD_STRING(ETHER_NAME) \
NSLCD_TYPE(ETHER_ADDR,uint8_t[6])
/* used for transferring group and membership information */
#define NSLCD_GROUP \
NSLCD_STRING(GROUP_NAME) \
NSLCD_STRING(GROUP_PASSWD) \
NSLCD_TYPE(GROUP_GID,gid_t) \
NSLCD_STRINGLIST(GROUP_MEMBERS)
/* used for storing address information for the host database */
/* Note: this marcos is not expanded to code, check manually */
#define NSLCD_ADDRESS \
NSLCD_INT32(ADDRESS_TYPE) /* type of address: e.g. AF_INET or AF_INET6 */ \
NSLCD_INT32(ADDRESS_LEN) /* length of the address to follow */ \
NSLCD_BUF(ADDRESS_ADDR) /* the address itself in network byte order */
/* used for transferring host (/etc/hosts) information */
/* Note: this marco is not expanded to code, check manually */
#define NSLCD_HOST \
NSLCD_STRING(HOST_NAME) \
NSLCD_STRINGLIST(HOST_ALIASES) \
NSLCD_ADDRESSLIST(HOST_ADDRS)
/* used for transferring netgroup entries one at a time */
/* Note: this marcos is not expanded to code, check manually */
/* netgroup messages are split into two parts, first a part
determining the type */
#define NETGROUP_TYPE_NETGROUP 123
#define NETGROUP_TYPE_TRIPLE 456
#define NSLCD_NETGROUP_TYPE \
NSLCD_INT32(NETGROUP_TYPE) /* one of the above values */
/* followed by one of these message parts */
#define NSLCD_NETGROUP_NETGROUP \
NSLCD_STRING(NETGROUP_NETGROUP)
#define NSLCD_NETGROUP_TRIPLE \
NSLCD_STRING(NETGROUP_HOST) \
NSLCD_STRING(NETGROUP_USER) \
NSLCD_STRING(NETGROUP_DOMAIN)
/* user for transferring network (/etc/networks) information */
/* Note: this marco is not expanded to code, check manually */
#define NSLCD_NETWORK \
NSLCD_STRING(NETWORK_NAME) \
NSLCD_STRINGLIST(NETWORK_ALIASES) \
NSLCD_ADDRESSLIST(NETWORK_ADDRS)
/* used for transferring user (/etc/passwd) information */
#define NSLCD_PASSWD \
NSLCD_STRING(PASSWD_NAME) \
NSLCD_STRING(PASSWD_PASSWD) \
NSLCD_TYPE(PASSWD_UID,uid_t) \
NSLCD_TYPE(PASSWD_GID,gid_t) \
NSLCD_STRING(PASSWD_GECOS) \
NSLCD_STRING(PASSWD_DIR) \
NSLCD_STRING(PASSWD_SHELL)
/* used for transferring protocol information */
#define NSLCD_PROTOCOL \
NSLCD_STRING(PROTOCOL_NAME) \
NSLCD_STRINGLIST(PROTOCOL_ALIASES) \
NSLCD_INT32(PROTOCOL_NUMBER)
/* for transferring struct rpcent structs */
#define NSLCD_RPC \
NSLCD_STRING(RPC_NAME) \
NSLCD_STRINGLIST(RPC_ALIASES) \
NSLCD_INT32(RPC_NUMBER)
/* for transferring struct servent information */
#define NSLCD_SERVICE \
NSLCD_STRING(SERVICE_NAME) \
NSLCD_STRINGLIST(SERVICE_ALIASES) \
NSLCD_INT32(SERVICE_NUMBER) \
NSLCD_STRING(SERVICE_PROTOCOL)
/* used for transferring account (/etc/shadow) information */
#define NSLCD_SHADOW \
NSLCD_STRING(SHADOW_NAME) \
NSLCD_STRING(SHADOW_PASSWD) \
NSLCD_INT32(SHADOW_LASTCHANGE) \
NSLCD_INT32(SHADOW_MINDAYS) \
NSLCD_INT32(SHADOW_MAXDAYS) \
NSLCD_INT32(SHADOW_WARN) \
NSLCD_INT32(SHADOW_INACT) \
NSLCD_INT32(SHADOW_EXPIRE) \
NSLCD_INT32(SHADOW_FLAG)
/* The current version of the protocol. Note that version 1
is experimental and this version will be used until a
1.0 release of nss-ldapd is made. */
#define NSLCD_VERSION 1
/* Request types. */
#define NSLCD_ACTION_ALIAS_BYNAME 4001
#define NSLCD_ACTION_ALIAS_ALL 4002
#define NSLCD_ACTION_ETHER_BYNAME 3001
#define NSLCD_ACTION_ETHER_BYETHER 3002
#define NSLCD_ACTION_ETHER_ALL 3005
#define NSLCD_ACTION_GROUP_BYNAME 5001
#define NSLCD_ACTION_GROUP_BYGID 5002
#define NSLCD_ACTION_GROUP_BYMEMBER 5003
#define NSLCD_ACTION_GROUP_ALL 5004
#define NSLCD_ACTION_HOST_BYNAME 6001
#define NSLCD_ACTION_HOST_BYADDR 6002
#define NSLCD_ACTION_HOST_ALL 6005
#define NSLCD_ACTION_NETGROUP_BYNAME 12001
#define NSLCD_ACTION_NETWORK_BYNAME 8001
#define NSLCD_ACTION_NETWORK_BYADDR 8002
#define NSLCD_ACTION_NETWORK_ALL 8005
#define NSLCD_ACTION_PASSWD_BYNAME 1001
#define NSLCD_ACTION_PASSWD_BYUID 1002
#define NSLCD_ACTION_PASSWD_ALL 1004
#define NSLCD_ACTION_PROTOCOL_BYNAME 9001
#define NSLCD_ACTION_PROTOCOL_BYNUMBER 9002
#define NSLCD_ACTION_PROTOCOL_ALL 9003
#define NSLCD_ACTION_RPC_BYNAME 10001
#define NSLCD_ACTION_RPC_BYNUMBER 10002
#define NSLCD_ACTION_RPC_ALL 10003
#define NSLCD_ACTION_SERVICE_BYNAME 11001
#define NSLCD_ACTION_SERVICE_BYNUMBER 11002
#define NSLCD_ACTION_SERVICE_ALL 11005
#define NSLCD_ACTION_SHADOW_BYNAME 2001
#define NSLCD_ACTION_SHADOW_ALL 2005
#define NSLCD_ACTION_PAM_AUTHC 20001
#define NSLCD_ACTION_PAM_AUTHZ 20002
#define NSLCD_ACTION_PAM_SESS_O 20003
#define NSLCD_ACTION_PAM_SESS_C 20004
#define NSLCD_ACTION_PAM_PWMOD 20005
/* Request result codes. */
#define NSLCD_RESULT_END 3 /* key was not found */
#define NSLCD_RESULT_SUCCESS 0 /* everything ok */
/* Partial list of PAM result codes. */
#define NSLCD_PAM_SUCCESS 0 /* everything ok */
#define NSLCD_PAM_PERM_DENIED 6 /* Permission denied */
#define NSLCD_PAM_AUTH_ERR 7 /* Authc failure */
#define NSLCD_PAM_CRED_INSUFFICIENT 8 /* Cannot access authc data */
#define NSLCD_PAM_AUTHINFO_UNAVAIL 9 /* Cannot retrieve authc info */
#define NSLCD_PAM_USER_UNKNOWN 10 /* User not known */
#define NSLCD_PAM_MAXTRIES 11 /* Retry limit reached */
#define NSLCD_PAM_NEW_AUTHTOK_REQD 12 /* Password expired */
#define NSLCD_PAM_ACCT_EXPIRED 13 /* Account expired */
#define NSLCD_PAM_SESSION_ERR 14 /* Cannot make/remove session record */
#define NSLCD_PAM_AUTHTOK_DISABLE_AGING 23 /* Password aging disabled */
#define NSLCD_PAM_IGNORE 25 /* Ignore module */
#define NSLCD_PAM_ABORT 26 /* Fatal error */
#endif /* not _NSLCD_H */

View file

@ -1,36 +0,0 @@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2006, 2007 West Consulting
# Copyright (C) 2006, 2007, 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
sbin_PROGRAMS = nslcd
AM_CPPFLAGS=-I$(top_srcdir)
AM_CFLAGS = $(PTHREAD_CFLAGS)
nslcd_SOURCES = nslcd.c ../nslcd.h ../nslcd-common.h \
../compat/attrs.h \
log.c log.h \
common.c common.h \
myldap.c myldap.h \
cfg.c cfg.h \
attmap.c attmap.h \
alias.c ether.c group.c host.c netgroup.c network.c \
passwd.c protocol.c rpc.c service.c shadow.c
nslcd_LDADD = @nslcd_LIBS@ ../common/libtio.a ../common/libdict.a \
../compat/libcompat.a

View file

@ -1,490 +0,0 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2006, 2007 West Consulting
# Copyright (C) 2006, 2007, 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
sbin_PROGRAMS = nslcd$(EXEEXT)
subdir = nslcd
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__installdirs = "$(DESTDIR)$(sbindir)"
sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(sbin_PROGRAMS)
am_nslcd_OBJECTS = nslcd.$(OBJEXT) log.$(OBJEXT) common.$(OBJEXT) \
myldap.$(OBJEXT) cfg.$(OBJEXT) attmap.$(OBJEXT) \
alias.$(OBJEXT) ether.$(OBJEXT) group.$(OBJEXT) host.$(OBJEXT) \
netgroup.$(OBJEXT) network.$(OBJEXT) passwd.$(OBJEXT) \
protocol.$(OBJEXT) rpc.$(OBJEXT) service.$(OBJEXT) \
shadow.$(OBJEXT)
nslcd_OBJECTS = $(am_nslcd_OBJECTS)
nslcd_DEPENDENCIES = ../common/libtio.a ../common/libdict.a \
../compat/libcompat.a
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(nslcd_SOURCES)
DIST_SOURCES = $(nslcd_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOCBOOK2X_MAN = @DOCBOOK2X_MAN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NSLCD_PIDFILE = @NSLCD_PIDFILE@
NSLCD_SOCKET = @NSLCD_SOCKET@
NSS_LDAP_PATH_CONF = @NSS_LDAP_PATH_CONF@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RELEASE_MONTH = @RELEASE_MONTH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
acx_pthread_config = @acx_pthread_config@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
nslcd_LIBS = @nslcd_LIBS@
nss_ldap_so_LIBS = @nss_ldap_so_LIBS@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = $(PTHREAD_CFLAGS)
nslcd_SOURCES = nslcd.c ../nslcd.h ../nslcd-common.h \
../compat/attrs.h \
log.c log.h \
common.c common.h \
myldap.c myldap.h \
cfg.c cfg.h \
attmap.c attmap.h \
alias.c ether.c group.c host.c netgroup.c network.c \
passwd.c protocol.c rpc.c service.c shadow.c
nslcd_LDADD = @nslcd_LIBS@ ../common/libtio.a ../common/libdict.a \
../compat/libcompat.a
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu nslcd/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu nslcd/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
install-sbinPROGRAMS: $(sbin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
if test -f $$p \
; then \
f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
$(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
else :; fi; \
done
uninstall-sbinPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(sbin_PROGRAMS)'; for p in $$list; do \
f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
rm -f "$(DESTDIR)$(sbindir)/$$f"; \
done
clean-sbinPROGRAMS:
-test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
nslcd$(EXEEXT): $(nslcd_OBJECTS) $(nslcd_DEPENDENCIES)
@rm -f nslcd$(EXEEXT)
$(LINK) $(nslcd_OBJECTS) $(nslcd_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alias.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attmap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ether.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/host.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/myldap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netgroup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nslcd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passwd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/service.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shadow.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(sbindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am: install-sbinPROGRAMS
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-sbinPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-sbinPROGRAMS ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-sbinPROGRAMS install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-sbinPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -1,146 +0,0 @@
/*
alias.c - alias entry lookup routines
Parts of this file were part of the nss_ldap library (as ldap-alias.c)
which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
/* Vendor-specific attributes and object classes.
* (Mainly from Sun.)
* ( 1.3.6.1.4.1.42.2.27.1.2.5 NAME 'nisMailAlias' SUP top STRUCTURAL
* DESC 'NIS mail alias'
* MUST cn
* MAY rfc822MailMember )
*/
/* the search base for searches */
const char *alias_base = NULL;
/* the search scope for searches */
int alias_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *alias_filter = "(objectClass=nisMailAlias)";
/* the attributes to request with searches */
const char *attmap_alias_cn = "cn";
const char *attmap_alias_rfc822MailMember = "rfc822MailMember";
/* the attribute list to request with searches */
static const char *alias_attrs[3];
/* create a search filter for searching an alias by name,
return -1 on errors */
static int mkfilter_alias_byname(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if (myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
alias_filter,
attmap_alias_cn,buf2);
}
static void alias_init(void)
{
/* set up base */
if (alias_base==NULL)
alias_base=nslcd_cfg->ldc_base;
/* set up scope */
if (alias_scope==LDAP_SCOPE_DEFAULT)
alias_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
alias_attrs[0]=attmap_alias_cn;
alias_attrs[1]=attmap_alias_rfc822MailMember;
alias_attrs[2]=NULL;
}
static int write_alias(TFILE *fp,MYLDAP_ENTRY *entry,const char *reqalias)
{
int32_t tmpint32,tmp2int32,tmp3int32;
const char *tmparr[2];
const char **names,**members;
int i;
/* get the name of the alias */
if (reqalias!=NULL)
{
names=tmparr;
names[0]=reqalias;
names[1]=NULL;
}
else
{
names=myldap_get_values(entry,attmap_alias_cn);
if ((names==NULL)||(names[0]==NULL))
{
log_log(LOG_WARNING,"alias entry %s does not contain %s value",
myldap_get_dn(entry),attmap_alias_cn);
return 0;
}
}
/* get the members of the alias */
members=myldap_get_values(entry,attmap_alias_rfc822MailMember);
/* for each name, write an entry */
for (i=0;names[i]!=NULL;i++)
{
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_STRING(fp,names[i]);
WRITE_STRINGLIST(fp,members);
}
return 0;
}
NSLCD_HANDLE(
alias,byname,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));,
log_log(LOG_DEBUG,"nslcd_alias_byname(%s)",name);,
NSLCD_ACTION_ALIAS_BYNAME,
mkfilter_alias_byname(name,filter,sizeof(filter)),
write_alias(fp,entry,name)
)
NSLCD_HANDLE(
alias,all,
const char *filter;
/* no parameters to read */,
log_log(LOG_DEBUG,"nslcd_alias_all()");,
NSLCD_ACTION_ALIAS_ALL,
(filter=alias_filter,0),
write_alias(fp,entry,NULL)
)

View file

@ -1,208 +0,0 @@
/*
attmap.c - attribute mapping values and functions
This file is part of the nss-ldapd library.
Copyright (C) 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdlib.h>
#include <strings.h>
#include "attmap.h"
const char *attmap_objectClass = "objectClass";
/* these are the bases that are defined per database */
extern const char *alias_base;
extern const char *ether_base;
extern const char *group_base;
extern const char *host_base;
extern const char *netgroup_base;
extern const char *network_base;
extern const char *passwd_base;
extern const char *protocol_base;
extern const char *rpc_base;
extern const char *service_base;
extern const char *shadow_base;
const char **base_get_var(enum ldap_map_selector map)
{
switch (map)
{
case LM_ALIASES: return &alias_base;
case LM_ETHERS: return &ether_base;
case LM_GROUP: return &group_base;
case LM_HOSTS: return &host_base;
case LM_NETGROUP: return &netgroup_base;
case LM_NETWORKS: return &network_base;
case LM_PASSWD: return &passwd_base;
case LM_PROTOCOLS: return &protocol_base;
case LM_RPC: return &rpc_base;
case LM_SERVICES: return &service_base;
case LM_SHADOW: return &shadow_base;
case LM_NONE:
default: return NULL;
}
}
/* these are the scopes that are defined per database */
extern int alias_scope;
extern int ether_scope;
extern int group_scope;
extern int host_scope;
extern int netgroup_scope;
extern int network_scope;
extern int passwd_scope;
extern int protocol_scope;
extern int rpc_scope;
extern int service_scope;
extern int shadow_scope;
int *scope_get_var(enum ldap_map_selector map)
{
switch (map)
{
case LM_ALIASES: return &alias_scope;
case LM_ETHERS: return &ether_scope;
case LM_GROUP: return &group_scope;
case LM_HOSTS: return &host_scope;
case LM_NETGROUP: return &netgroup_scope;
case LM_NETWORKS: return &network_scope;
case LM_PASSWD: return &passwd_scope;
case LM_PROTOCOLS: return &protocol_scope;
case LM_RPC: return &rpc_scope;
case LM_SERVICES: return &service_scope;
case LM_SHADOW: return &shadow_scope;
case LM_NONE:
default: return NULL;
}
}
/* these are the filters that are defined per database */
extern const char *alias_filter;
extern const char *ether_filter;
extern const char *group_filter;
extern const char *host_filter;
extern const char *netgroup_filter;
extern const char *network_filter;
extern const char *passwd_filter;
extern const char *protocol_filter;
extern const char *rpc_filter;
extern const char *service_filter;
extern const char *shadow_filter;
const char **filter_get_var(enum ldap_map_selector map)
{
switch (map)
{
case LM_ALIASES: return &alias_filter;
case LM_ETHERS: return &ether_filter;
case LM_GROUP: return &group_filter;
case LM_HOSTS: return &host_filter;
case LM_NETGROUP: return &netgroup_filter;
case LM_NETWORKS: return &network_filter;
case LM_PASSWD: return &passwd_filter;
case LM_PROTOCOLS: return &protocol_filter;
case LM_RPC: return &rpc_filter;
case LM_SERVICES: return &service_filter;
case LM_SHADOW: return &shadow_filter;
case LM_NONE:
default: return NULL;
}
}
const char **attmap_get_var(enum ldap_map_selector map,const char *name)
{
if (map==LM_ALIASES)
{
if (strcasecmp(name,"cn")==0) return &attmap_alias_cn;
if (strcasecmp(name,"rfc822MailMember")==0) return &attmap_alias_rfc822MailMember;
}
else if (map==LM_ETHERS)
{
if (strcasecmp(name,"cn")==0) return &attmap_ether_cn;
if (strcasecmp(name,"macAddress")==0) return &attmap_ether_macAddress;
}
else if (map==LM_GROUP)
{
if (strcasecmp(name,"cn")==0) return &attmap_group_cn;
if (strcasecmp(name,"userPassword")==0) return &attmap_group_userPassword;
if (strcasecmp(name,"gidNumber")==0) return &attmap_group_gidNumber;
if (strcasecmp(name,"memberUid")==0) return &attmap_group_memberUid;
if (strcasecmp(name,"uniqueMember")==0) return &attmap_group_uniqueMember;
/* if (strcasecmp(name,"memberOf")==0) return &attmap_group_memberOf; */
}
else if (map==LM_HOSTS)
{
if (strcasecmp(name,"cn")==0) return &attmap_host_cn;
if (strcasecmp(name,"ipHostNumber")==0) return &attmap_host_ipHostNumber;
}
else if (map==LM_NETGROUP)
{
if (strcasecmp(name,"cn")==0) return &attmap_netgroup_cn;
if (strcasecmp(name,"nisNetgroupTriple")==0) return &attmap_netgroup_nisNetgroupTriple;
if (strcasecmp(name,"memberNisNetgroup")==0) return &attmap_netgroup_memberNisNetgroup;
}
else if (map==LM_NETWORKS)
{
if (strcasecmp(name,"cn")==0) return &attmap_network_cn;
if (strcasecmp(name,"ipNetworkNumber")==0) return &attmap_network_ipNetworkNumber;
}
else if (map==LM_PASSWD)
{
if (strcasecmp(name,"uid")==0) return &attmap_passwd_uid;
if (strcasecmp(name,"userPassword")==0) return &attmap_passwd_userPassword;
if (strcasecmp(name,"uidNumber")==0) return &attmap_passwd_uidNumber;
if (strcasecmp(name,"gidNumber")==0) return &attmap_passwd_gidNumber;
if (strcasecmp(name,"gecos")==0) return &attmap_passwd_gecos;
if (strcasecmp(name,"cn")==0) return &attmap_passwd_cn;
if (strcasecmp(name,"homeDirectory")==0) return &attmap_passwd_homeDirectory;
if (strcasecmp(name,"loginShell")==0) return &attmap_passwd_loginShell;
}
else if (map==LM_PROTOCOLS)
{
if (strcasecmp(name,"cn")==0) return &attmap_protocol_cn;
if (strcasecmp(name,"ipProtocolNumber")==0) return &attmap_protocol_ipProtocolNumber;
}
else if (map==LM_RPC)
{
if (strcasecmp(name,"cn")==0) return &attmap_rpc_cn;
if (strcasecmp(name,"oncRpcNumber")==0) return &attmap_rpc_oncRpcNumber;
}
else if (map==LM_SERVICES)
{
if (strcasecmp(name,"cn")==0) return &attmap_service_cn;
if (strcasecmp(name,"ipServicePort")==0) return &attmap_service_ipServicePort;
if (strcasecmp(name,"ipServiceProtocol")==0) return &attmap_service_ipServiceProtocol;
}
else if (map==LM_SHADOW)
{
if (strcasecmp(name,"uid")==0) return &attmap_shadow_uid;
if (strcasecmp(name,"userPassword")==0) return &attmap_shadow_userPassword;
if (strcasecmp(name,"shadowLastChange")==0) return &attmap_shadow_shadowLastChange;
if (strcasecmp(name,"shadowMin")==0) return &attmap_shadow_shadowMin;
if (strcasecmp(name,"shadowMax")==0) return &attmap_shadow_shadowMax;
if (strcasecmp(name,"shadowWarning")==0) return &attmap_shadow_shadowWarning;
if (strcasecmp(name,"shadowInactive")==0) return &attmap_shadow_shadowInactive;
if (strcasecmp(name,"shadowExpire")==0) return &attmap_shadow_shadowExpire;
if (strcasecmp(name,"shadowFlag")==0) return &attmap_shadow_shadowFlag;
}
return NULL;
}

View file

@ -1,86 +0,0 @@
/*
attmap.h - attribute mapping variables
This file is part of the nss-ldapd library.
Copyright (C) 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _ATTMAP_H
#define _ATTMAP_H 1
#include "cfg.h"
/* these are the attribute names per database */
extern const char *attmap_alias_cn;
extern const char *attmap_alias_rfc822MailMember;
extern const char *attmap_ether_cn;
extern const char *attmap_ether_macAddress;
extern const char *attmap_group_cn;
extern const char *attmap_group_userPassword;
extern const char *attmap_group_gidNumber;
extern const char *attmap_group_memberUid;
extern const char *attmap_group_uniqueMember;
/*extern const char *attmap_group_memberOf;*/
extern const char *attmap_host_cn;
extern const char *attmap_host_ipHostNumber;
extern const char *attmap_netgroup_cn;
extern const char *attmap_netgroup_nisNetgroupTriple;
extern const char *attmap_netgroup_memberNisNetgroup;
extern const char *attmap_network_cn;
extern const char *attmap_network_ipNetworkNumber;
/*extern const char *attmap_network_ipNetmaskNumber; */
extern const char *attmap_passwd_uid;
extern const char *attmap_passwd_userPassword;
extern const char *attmap_passwd_uidNumber;
extern const char *attmap_passwd_gidNumber;
extern const char *attmap_passwd_gecos;
extern const char *attmap_passwd_cn;
extern const char *attmap_passwd_homeDirectory;
extern const char *attmap_passwd_loginShell;
extern const char *attmap_protocol_cn;
extern const char *attmap_protocol_ipProtocolNumber;
extern const char *attmap_rpc_cn;
extern const char *attmap_rpc_oncRpcNumber;
extern const char *attmap_service_cn;
extern const char *attmap_service_ipServicePort;
extern const char *attmap_service_ipServiceProtocol;
extern const char *attmap_shadow_uid;
extern const char *attmap_shadow_userPassword;
extern const char *attmap_shadow_shadowLastChange;
extern const char *attmap_shadow_shadowMin;
extern const char *attmap_shadow_shadowMax;
extern const char *attmap_shadow_shadowWarning;
extern const char *attmap_shadow_shadowInactive;
extern const char *attmap_shadow_shadowExpire;
extern const char *attmap_shadow_shadowFlag;
/* return a reference to the map specific base variable */
const char **base_get_var(enum ldap_map_selector map);
/* return a reference to the map specific scope variable */
int *scope_get_var(enum ldap_map_selector map);
/* return a reference to the map specific filter variable */
const char **filter_get_var(enum ldap_map_selector map);
/* return a reference to the attribute mapping variable for the specified name
the name is the name after the attmap_... variables above with the
underscode replaced by a dot (e.g passwd.homeDirectory) */
const char **attmap_get_var(enum ldap_map_selector map,const char *name);
#endif /* not _ATTMAP_H */

View file

@ -1,839 +0,0 @@
/*
cfg.c - functions for configuration information
This file contains parts that were part of the nss_ldap
library which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2007 West Consulting
Copyright (C) 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#ifdef HAVE_GSSAPI_H
#include <gssapi.h>
#endif /* HAVE_GSSAPI_H */
#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
#include <gssapi/gssapi.h>
#include <gssapi/gssapi_krb5.h>
#endif /* HAVE_GSSAPI_GSSAPI_KRB5_H */
#include "common.h"
#include "log.h"
#include "cfg.h"
#include "attmap.h"
struct ldap_config *nslcd_cfg=NULL;
/* the maximum line length in the configuration file */
#define MAX_LINE_LENGTH 4096
/* the delimiters of tokens */
#define TOKEN_DELIM " \t\n\r"
/* set the configuration information to the defaults */
static void cfg_defaults(struct ldap_config *cfg)
{
int i;
memset(cfg,0,sizeof(struct ldap_config));
cfg->ldc_threads=5;
for (i=0;i<(NSS_LDAP_CONFIG_URI_MAX+1);i++)
{
cfg->ldc_uris[i].uri=NULL;
cfg->ldc_uris[i].lastok=0;
cfg->ldc_uris[i].lastfail=0;
}
#ifdef LDAP_VERSION3
cfg->ldc_version=LDAP_VERSION3;
#else /* LDAP_VERSION3 */
cfg->ldc_version=LDAP_VERSION2;
#endif /* not LDAP_VERSION3 */
cfg->ldc_binddn=NULL;
cfg->ldc_bindpw=NULL;
cfg->ldc_saslid=NULL;
cfg->ldc_sasl_secprops=NULL;
cfg->ldc_usesasl=0;
cfg->ldc_base=NULL;
cfg->ldc_scope=LDAP_SCOPE_SUBTREE;
cfg->ldc_deref=LDAP_DEREF_NEVER;
cfg->ldc_referrals=1;
cfg->ldc_bind_timelimit=30;
cfg->ldc_timelimit=LDAP_NO_LIMIT;
cfg->ldc_idle_timelimit=0;
cfg->ldc_reconnect_sleeptime=1;
cfg->ldc_reconnect_maxsleeptime=30;
#ifdef LDAP_OPT_X_TLS
cfg->ldc_ssl_on=SSL_OFF;
cfg->ldc_sslpath=NULL;
cfg->ldc_tls_checkpeer=-1;
cfg->ldc_tls_cacertdir=NULL;
cfg->ldc_tls_cacertfile=NULL;
cfg->ldc_tls_randfile=NULL;
cfg->ldc_tls_ciphers=NULL;
cfg->ldc_tls_cert=NULL;
cfg->ldc_tls_key=NULL;
#endif /* LDAP_OPT_X_TLS */
cfg->ldc_restart=1;
cfg->ldc_pagesize=0;
cfg->ldc_debug=0;
}
/* simple strdup wrapper */
static char *xstrdup(const char *s)
{
char *tmp;
if (s==NULL)
{
log_log(LOG_CRIT,"xstrdup() called with NULL");
exit(EXIT_FAILURE);
}
tmp=strdup(s);
if (tmp==NULL)
{
log_log(LOG_CRIT,"strdup() failed to allocate memory");
exit(EXIT_FAILURE);
}
return tmp;
}
/* add a single URI to the list of URIs in the configuration */
static void add_uri(const char *filename,int lnr,
struct ldap_config *cfg,const char *uri)
{
int i;
log_log(LOG_DEBUG,"add_uri(%s)",uri);
/* find the place where to insert the URI */
for (i=0;cfg->ldc_uris[i].uri!=NULL;i++)
;
/* check for room */
if (i>=NSS_LDAP_CONFIG_URI_MAX)
{
log_log(LOG_ERR,"%s:%d: maximum number of URIs exceeded",filename,lnr);
exit(EXIT_FAILURE);
}
/* append URI to list */
cfg->ldc_uris[i].uri=xstrdup(uri);
}
#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 255
#endif /* not HOST_NAME_MAX */
#ifdef HAVE_LDAP_DOMAIN2HOSTLIST
/* return the domain name of the current host
we return part of the structure that is retured by gethostbyname()
so there should be no need to free() this entry, however we should
use the value before any other call to gethostbyname() */
static const char *cfg_getdomainname(const char *filename,int lnr)
{
char hostname[HOST_NAME_MAX],*domain;
struct hostent *host;
/* lookup the hostname and with that the fqdn to extract the domain */
if (gethostname(hostname,sizeof(hostname))<0)
{
log_log(LOG_ERR,"%s:%d: gethostname(): %s",filename,lnr,strerror(errno));
exit(EXIT_FAILURE);
}
if ((host=gethostbyname(hostname))==NULL)
{
log_log(LOG_ERR,"%s:%d: gethostbyname(%s): %s",filename,lnr,hostname,hstrerror(h_errno));
exit(EXIT_FAILURE);
}
/* TODO: this may fail if the fqdn is in h_aliases */
if ((domain=strchr(host->h_name,'.'))==NULL)
{
log_log(LOG_ERR,"%s:%d: host name %s is not in fqdn form",filename,lnr,host->h_name);
exit(EXIT_FAILURE);
}
/* we're done */
return domain+1;
}
/* add URIs by doing DNS queries for SRV records */
static void add_uris_from_dns(const char *filename,int lnr,
struct ldap_config *cfg)
{
int ret=0;
const char *domain;
char *hostlist=NULL,*nxt;
char buf[HOST_NAME_MAX+sizeof("ldap://")];
domain=cfg_getdomainname(filename,lnr);
ret=ldap_domain2hostlist(domain,&hostlist);
/* FIXME: have better error handling */
if ((hostlist==NULL)||(*hostlist=='\0'))
{
log_log(LOG_ERR,"%s:%d: no servers found in DNS zone %s",filename,lnr,domain);
exit(EXIT_FAILURE);
}
/* hostlist is a space-separated list of host names that we use to build
URIs */
while(hostlist!=NULL)
{
/* find the next space and split the string there */
nxt=strchr(hostlist,' ');
if (nxt!=NULL)
{
*nxt='\0';
nxt++;
}
/* add the URI */
mysnprintf(buf,sizeof(buf),"ldap://%s",hostlist);
log_log(LOG_DEBUG,"add_uris_from_dns(): found uri: %s",buf);
add_uri(filename,lnr,cfg,buf);
/* get next entry from list */
hostlist=nxt;
}
}
#endif /* HAVE_LDAP_DOMAIN2HOSTLIST */
static int parse_boolean(const char *filename,int lnr,const char *value)
{
if ( (strcasecmp(value,"on")==0) ||
(strcasecmp(value,"yes")==0) ||
(strcasecmp(value,"true")==0) ||
(strcasecmp(value,"1")==0) )
return 1;
else if ( (strcasecmp(value,"off")==0) ||
(strcasecmp(value,"no")==0) ||
(strcasecmp(value,"false")==0) ||
(strcasecmp(value,"0")==0) )
return 0;
else
{
log_log(LOG_ERR,"%s:%d: not a boolean argument: '%s'",filename,lnr,value);
exit(EXIT_FAILURE);
}
}
static int parse_scope(const char *filename,int lnr,const char *value)
{
if ( (strcasecmp(value,"sub")==0) || (strcasecmp(value,"subtree")==0) )
return LDAP_SCOPE_SUBTREE;
else if ( (strcasecmp(value,"one")==0) || (strcasecmp(value,"onelevel")==0) )
return LDAP_SCOPE_ONELEVEL;
else if (strcasecmp(value,"base")==0)
return LDAP_SCOPE_BASE;
else
{
log_log(LOG_ERR,"%s:%d: not a scope argument: '%s'",filename,lnr,value);
exit(EXIT_FAILURE);
}
}
/* This function works like strtok() except that the original string is
not modified and a pointer within str to where the next token begins
is returned (this can be used to pass to the function on the next
iteration). If no more tokens are found or the token will not fit in
the buffer, NULL is returned. */
static char *get_token(char **line,char *buf,size_t buflen)
{
size_t len;
if ((line==NULL)||(*line==NULL)||(**line=='\0')||(buf==NULL))
return NULL;
/* find the beginning and length of the token */
*line+=strspn(*line,TOKEN_DELIM);
len=strcspn(*line,TOKEN_DELIM);
/* check if there is a token */
if (len==0)
{
*line=NULL;
return NULL;
}
/* limit the token length */
if (len>=buflen)
len=buflen-1;
/* copy the token */
strncpy(buf,*line,len);
buf[len]='\0';
/* skip to the next token */
*line+=len;
*line+=strspn(*line,TOKEN_DELIM);
/* return the token */
return buf;
}
static enum ldap_map_selector parse_map(const char *value)
{
if ( (strcasecmp(value,"alias")==0) || (strcasecmp(value,"aliases")==0) )
return LM_ALIASES;
else if ( (strcasecmp(value,"ether")==0) || (strcasecmp(value,"ethers")==0) )
return LM_ETHERS;
else if (strcasecmp(value,"group")==0)
return LM_GROUP;
else if ( (strcasecmp(value,"host")==0) || (strcasecmp(value,"hosts")==0) )
return LM_HOSTS;
else if (strcasecmp(value,"netgroup")==0)
return LM_NETGROUP;
else if ( (strcasecmp(value,"network")==0) || (strcasecmp(value,"networks")==0) )
return LM_NETWORKS;
else if (strcasecmp(value,"passwd")==0)
return LM_PASSWD;
else if ( (strcasecmp(value,"protocol")==0) || (strcasecmp(value,"protocols")==0) )
return LM_PROTOCOLS;
else if (strcasecmp(value,"rpc")==0)
return LM_RPC;
else if ( (strcasecmp(value,"service")==0) || (strcasecmp(value,"services")==0) )
return LM_SERVICES;
else if (strcasecmp(value,"shadow")==0)
return LM_SHADOW;
else
return LM_NONE;
}
/* check to see if the line begins with a named map */
static enum ldap_map_selector get_map(char **line)
{
char token[32];
char *old;
enum ldap_map_selector map;
/* get the token */
old=*line;
if (get_token(line,token,sizeof(token))==NULL)
return LM_NONE;
/* find the map if any */
map=parse_map(token);
/* unknown map, return to the previous state */
if (map==LM_NONE)
*line=old;
return map;
}
/* check that the condition is true and otherwise log an error
and bail out */
static inline void check_argumentcount(const char *filename,int lnr,
const char *keyword,int condition)
{
if (!condition)
{
log_log(LOG_ERR,"%s:%d: %s: wrong number of arguments",filename,lnr,keyword);
exit(EXIT_FAILURE);
}
}
static void get_int(const char *filename,int lnr,
const char *keyword,char **line,
int *var)
{
/* TODO: refactor to have less overhead */
char token[32];
check_argumentcount(filename,lnr,keyword,get_token(line,token,sizeof(token))!=NULL);
/* TODO: replace with correct numeric parse */
*var=atoi(token);
}
static void get_boolean(const char *filename,int lnr,
const char *keyword,char **line,
int *var)
{
/* TODO: refactor to have less overhead */
char token[32];
check_argumentcount(filename,lnr,keyword,get_token(line,token,sizeof(token))!=NULL);
*var=parse_boolean(filename,lnr,token);
}
static void get_strdup(const char *filename,int lnr,
const char *keyword,char **line,
char **var)
{
/* TODO: refactor to have less overhead */
char token[64];
check_argumentcount(filename,lnr,keyword,get_token(line,token,sizeof(token))!=NULL);
if ((*var==NULL)||(strcmp(*var,token)!=0))
{
/* Note: we have a memory leak here if a single mapping is changed
multiple times in one config (deemed not a problem) */
*var=xstrdup(token);
}
}
static void get_restdup(const char *filename,int lnr,
const char *keyword,char **line,
char **var)
{
check_argumentcount(filename,lnr,keyword,(*line!=NULL)&&(**line!='\0'));
if ((*var==NULL)||(strcmp(*var,*line)!=0))
{
/* Note: we have a memory leak here if a single mapping is changed
multiple times in one config (deemed not a problem) */
*var=xstrdup(*line);
}
*line=NULL;
}
static void get_eol(const char *filename,int lnr,
const char *keyword,char **line)
{
if ((line!=NULL)&&(*line!=NULL)&&(**line!='\0'))
{
log_log(LOG_ERR,"%s:%d: %s: too may arguments",filename,lnr,keyword);
exit(EXIT_FAILURE);
}
}
static void parse_krb5_ccname_statement(const char *filename,int lnr,
const char *keyword,char *line)
{
char token[80];
const char *ccname;
const char *ccfile;
size_t ccenvlen;
char *ccenv;
#ifdef HAVE_GSS_KRB5_CCACHE_NAME
OM_uint32 minor_status;
# endif /* HAVE_GSS_KRB5_CCACHE_NAME */
/* get token */
check_argumentcount(filename,lnr,keyword,
(get_token(&line,token,sizeof(token))!=NULL)&&(*line=='\0'));
/* set default kerberos ticket cache for SASL-GSSAPI */
ccname=token;
/* check that cache exists and is readable if it is a file */
if ( (strncasecmp(ccname,"FILE:",sizeof("FILE:")-1)==0) ||
(strncasecmp(ccname,"WRFILE:",sizeof("WRFILE:")-1)==0))
{
ccfile=strchr(ccname,':')+1;
if (access(ccfile,R_OK)!=0)
{
log_log(LOG_ERR,"%s:%d: error accessing %s: %s",filename,lnr,ccfile,strerror(errno));
exit(EXIT_FAILURE);
}
}
/* set the environment variable (we have a memory leak if this option
is set multiple times) */
ccenvlen=strlen(ccname)+sizeof("KRB5CCNAME=");
ccenv=(char *)malloc(ccenvlen);
if (ccenv==NULL)
{
log_log(LOG_CRIT,"malloc() failed to allocate memory");
exit(EXIT_FAILURE);
}
mysnprintf(ccenv,ccenvlen,"KRB5CCNAME=%s",ccname);
putenv(ccenv);
#ifdef HAVE_GSS_KRB5_CCACHE_NAME
/* set the name with gss_krb5_ccache_name() */
if (gss_krb5_ccache_name(&minor_status,ccname,NULL)!=GSS_S_COMPLETE)
{
log_log(LOG_ERR,"%s:%d: unable to set default credential cache: %s",filename,lnr,ccname);
exit(EXIT_FAILURE);
}
# endif /* HAVE_GSS_KRB5_CCACHE_NAME */
}
/* assigns the base to the specified variable doing domain expansion
and a simple check to avoid overwriting duplicate values */
static void set_base(const char *filename,int lnr,
const char *value,const char **var)
{
#ifdef HAVE_LDAP_DOMAIN2DN
char *domaindn=NULL;
#endif /* HAVE_LDAP_DOMAIN2DN */
/* if the base is "DOMAIN" use the domain name */
if (strcasecmp(value,"domain")==0)
{
#ifdef HAVE_LDAP_DOMAIN2DN
ldap_domain2dn(cfg_getdomainname(filename,lnr),&domaindn);
log_log(LOG_DEBUG,"set_base(): setting base to %s from domain",domaindn);
value=domaindn;
#else /* not HAVE_LDAP_DOMAIN2DN */
log_log(LOG_ERR,"%s:%d: value %s not supported on platform",filename,lnr,value);
exit(EXIT_FAILURE);
#endif /* not HAVE_LDAP_DOMAIN2DN */
}
/* check if the value will be changed */
if ((*var==NULL)||(strcmp(*var,value)!=0))
{
/* Note: we have a memory leak here if a single mapping is changed
multiple times in one config (deemed not a problem) */
*var=xstrdup(value);
}
}
static void parse_base_statement(const char *filename,int lnr,
const char *keyword,char *line,
struct ldap_config *cfg)
{
const char **var;
var=base_get_var(get_map(&line));
if (var==NULL)
var=(const char **)&(cfg->ldc_base);
check_argumentcount(filename,lnr,keyword,(line!=NULL)&&(*line!='\0'));
set_base(filename,lnr,line,var);
}
static void parse_scope_statement(const char *filename,int lnr,
const char *keyword,char *line,
struct ldap_config *cfg)
{
int *var;
var=scope_get_var(get_map(&line));
if (var==NULL)
var=&cfg->ldc_scope;
check_argumentcount(filename,lnr,keyword,(line!=NULL)&&(*line!='\0'));
*var=parse_scope(filename,lnr,line);
}
static void parse_filter_statement(const char *filename,int lnr,
const char *keyword,char *line)
{
const char **var;
const char *map=line;
var=filter_get_var(get_map(&line));
if (var==NULL)
{
log_log(LOG_ERR,"%s:%d: unknown map: '%s'",filename,lnr,map);
exit(EXIT_FAILURE);
}
check_argumentcount(filename,lnr,keyword,(line!=NULL)&&(*line!='\0'));
/* check if the value will be changed */
if (strcmp(*var,line)!=0)
{
/* Note: we have a memory leak here if a single mapping is changed
multiple times in one config (deemed not a problem) */
*var=xstrdup(line);
}
}
/* this function modifies the statement argument passed */
static void parse_map_statement(const char *filename,int lnr,
const char *keyword,char *line)
{
enum ldap_map_selector map;
const char **var;
char oldatt[32], newatt[32];
/* get the map */
if ((map=get_map(&line))==LM_NONE)
{
log_log(LOG_ERR,"%s:%d: unknown map: '%s'",filename,lnr,line);
exit(EXIT_FAILURE);
}
/* read the other tokens */
check_argumentcount(filename,lnr,keyword,
(get_token(&line,oldatt,sizeof(oldatt))!=NULL)&&
(get_token(&line,newatt,sizeof(newatt))!=NULL));
/* check that there are no more tokens left on the line */
get_eol(filename,lnr,keyword,&line);
/* get the attribute variable to set */
var=attmap_get_var(map,oldatt);
if (var==NULL)
{
log_log(LOG_ERR,"%s:%d: unknown attribute to map: '%s'",filename,lnr,oldatt);
exit(EXIT_FAILURE);
}
/* check if the value will be changed */
if ( (*var==NULL) || (strcmp(*var,newatt)!=0) )
{
/* Note: we have a memory leak here if a single mapping is changed
multiple times in one config (deemed not a problem) */
*var=xstrdup(newatt);
}
}
static void cfg_read(const char *filename,struct ldap_config *cfg)
{
FILE *fp;
int lnr=0;
char linebuf[MAX_LINE_LENGTH];
char *line;
char keyword[32];
char token[64];
int i;
/* open config file */
if ((fp=fopen(filename,"r"))==NULL)
{
log_log(LOG_ERR,"cannot open config file (%s): %s",filename,strerror(errno));
exit(EXIT_FAILURE);
}
/* read file and parse lines */
while (fgets(linebuf,MAX_LINE_LENGTH,fp)!=NULL)
{
lnr++;
line=linebuf;
/* strip newline */
i=(int)strlen(line);
if ((i<=0)||(line[i-1]!='\n'))
{
log_log(LOG_ERR,"%s:%d: line too long or last line missing newline",filename,lnr);
exit(EXIT_FAILURE);
}
line[i-1]='\0';
/* ignore comment lines */
if (line[0]=='#')
continue;
/* strip trailing spaces */
for (i--;(i>0)&&isspace(line[i-1]);i--)
line[i-1]='\0';
/* get keyword from line and ignore empty lines */
if (get_token(&line,keyword,sizeof(keyword))==NULL)
continue;
/* runtime options */
if (strcasecmp(keyword,"threads")==0)
{
get_int(filename,lnr,keyword,&line,&cfg->ldc_threads);
get_eol(filename,lnr,keyword,&line);
}
/* general connection options */
else if (strcasecmp(keyword,"uri")==0)
{
check_argumentcount(filename,lnr,keyword,(line!=NULL)&&(*line!='\0'));
while (get_token(&line,token,sizeof(token))!=NULL)
{
if (strcasecmp(token,"dns")==0)
{
#ifdef HAVE_LDAP_DOMAIN2HOSTLIST
add_uris_from_dns(filename,lnr,cfg);
#else /* not HAVE_LDAP_DOMAIN2HOSTLIST */
log_log(LOG_ERR,"%s:%d: value %s not supported on platform",filename,lnr,token);
exit(EXIT_FAILURE);
#endif /* not HAVE_LDAP_DOMAIN2HOSTLIST */
}
else
add_uri(filename,lnr,cfg,token);
}
}
else if (strcasecmp(keyword,"ldap_version")==0)
{
get_int(filename,lnr,keyword,&line,&cfg->ldc_version);
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"binddn")==0)
{
get_restdup(filename,lnr,keyword,&line,&cfg->ldc_binddn);
}
else if (strcasecmp(keyword,"bindpw")==0)
{
get_restdup(filename,lnr,keyword,&line,&cfg->ldc_bindpw);
}
/* SASL authentication options */
else if (strcasecmp(keyword,"sasl_authid")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_strdup(filename,lnr,keyword,&line,&cfg->ldc_saslid);
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"sasl_secprops")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_strdup(filename,lnr,keyword,&line,&cfg->ldc_sasl_secprops);
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"use_sasl")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_boolean(filename,lnr,keyword,&line,&cfg->ldc_usesasl);
get_eol(filename,lnr,keyword,&line);
}
/* Kerberos authentication options */
else if (strcasecmp(keyword,"krb5_ccname")==0)
{
parse_krb5_ccname_statement(filename,lnr,keyword,line);
}
/* search/mapping options */
else if (strcasecmp(keyword,"base")==0)
{
parse_base_statement(filename,lnr,keyword,line,cfg);
}
else if (strcasecmp(keyword,"scope")==0)
{
parse_scope_statement(filename,lnr,keyword,line,cfg);
}
else if (strcasecmp(keyword,"deref")==0)
{
check_argumentcount(filename,lnr,keyword,
(get_token(&line,token,sizeof(token))!=NULL));
if (strcasecmp(token,"never")==0)
cfg->ldc_deref=LDAP_DEREF_NEVER;
else if (strcasecmp(token,"searching")==0)
cfg->ldc_deref=LDAP_DEREF_SEARCHING;
else if (strcasecmp(token,"finding")==0)
cfg->ldc_deref=LDAP_DEREF_FINDING;
else if (strcasecmp(token,"always")==0)
cfg->ldc_deref=LDAP_DEREF_ALWAYS;
else
{
log_log(LOG_ERR,"%s:%d: wrong argument: '%s'",filename,lnr,token);
exit(EXIT_FAILURE);
}
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"referrals")==0)
{
get_boolean(filename,lnr,keyword,&line,&cfg->ldc_referrals);
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"filter")==0)
{
parse_filter_statement(filename,lnr,keyword,line);
}
else if (strcasecmp(keyword,"map")==0)
{
parse_map_statement(filename,lnr,keyword,line);
}
/* timing/reconnect options */
else if (strcasecmp(keyword,"bind_timelimit")==0)
{
get_int(filename,lnr,keyword,&line,&cfg->ldc_bind_timelimit);
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"timelimit")==0)
{
get_int(filename,lnr,keyword,&line,&cfg->ldc_timelimit);
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"idle_timelimit")==0)
{
get_int(filename,lnr,keyword,&line,&cfg->ldc_idle_timelimit);
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"reconnect_tries")==0)
log_log(LOG_WARNING,"%s:%d: option %s has been removed and will be ignored",filename,lnr,keyword);
else if (!strcasecmp(keyword,"reconnect_sleeptime"))
{
get_int(filename,lnr,keyword,&line,&cfg->ldc_reconnect_sleeptime);
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"reconnect_maxsleeptime")==0)
{
get_int(filename,lnr,keyword,&line,&cfg->ldc_reconnect_maxsleeptime);
get_eol(filename,lnr,keyword,&line);
}
#ifdef LDAP_OPT_X_TLS
/* SSL/TLS options */
else if (strcasecmp(keyword,"ssl")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
check_argumentcount(filename,lnr,keyword,
(get_token(&line,token,sizeof(token))!=NULL));
if (strcasecmp(token,"start_tls")==0)
cfg->ldc_ssl_on=SSL_START_TLS;
else if (parse_boolean(filename,lnr,token))
cfg->ldc_ssl_on=SSL_LDAPS;
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"sslpath")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_strdup(filename,lnr,keyword,&line,&cfg->ldc_sslpath);
get_eol(filename,lnr,keyword,&line);
/* TODO: check that the path is valid */
}
else if (strcasecmp(keyword,"tls_checkpeer")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_boolean(filename,lnr,keyword,&line,&cfg->ldc_tls_checkpeer);
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"tls_cacertdir")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_strdup(filename,lnr,keyword,&line,&cfg->ldc_tls_cacertdir);
get_eol(filename,lnr,keyword,&line);
/* TODO: check that the path is valid */
}
else if (strcasecmp(keyword,"tls_cacertfile")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_strdup(filename,lnr,keyword,&line,&cfg->ldc_tls_cacertfile);
get_eol(filename,lnr,keyword,&line);
/* TODO: check that the path is valid */
}
else if (strcasecmp(keyword,"tls_randfile")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_strdup(filename,lnr,keyword,&line,&cfg->ldc_tls_randfile);
get_eol(filename,lnr,keyword,&line);
/* TODO: check that the path is valid */
}
else if (strcasecmp(keyword,"tls_ciphers")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_restdup(filename,lnr,keyword,&line,&cfg->ldc_tls_ciphers);
}
else if (strcasecmp(keyword,"tls_cert")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_strdup(filename,lnr,keyword,&line,&cfg->ldc_tls_cert);
get_eol(filename,lnr,keyword,&line);
/* TODO: check that the path is valid */
}
else if (strcasecmp(keyword,"tls_key")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (please report any successes)",filename,lnr,keyword);
get_strdup(filename,lnr,keyword,&line,&cfg->ldc_tls_key);
get_eol(filename,lnr,keyword,&line);
/* TODO: check that the path is valid */
}
#endif /* LDAP_OPT_X_TLS */
/* other options */
else if (strcasecmp(keyword,"restart")==0)
{
log_log(LOG_WARNING,"%s:%d: option %s is currently untested (and may be removed in an upcoming release)",filename,lnr,keyword);
get_boolean(filename,lnr,keyword,&line,&cfg->ldc_restart);
get_eol(filename,lnr,keyword,&line);
}
else if (strcasecmp(keyword,"pagesize")==0)
{
get_int(filename,lnr,keyword,&line,&cfg->ldc_pagesize);
get_eol(filename,lnr,keyword,&line);
}
/* fallthrough */
else
{
log_log(LOG_ERR,"%s:%d: unknown keyword: '%s'",filename,lnr,keyword);
exit(EXIT_FAILURE);
}
}
/* we're done reading file, close */
fclose(fp);
}
void cfg_init(const char *fname)
{
/* check if we were called before */
if (nslcd_cfg!=NULL)
{
log_log(LOG_CRIT,"cfg_init() may only be called once");
exit(EXIT_FAILURE);
}
/* allocate the memory (this memory is not freed anywhere) */
nslcd_cfg=(struct ldap_config *)malloc(sizeof(struct ldap_config));
if (nslcd_cfg==NULL)
{
log_log(LOG_CRIT,"malloc() failed to allocate memory");
exit(EXIT_FAILURE);
}
/* clear configuration */
cfg_defaults(nslcd_cfg);
/* read configfile */
cfg_read(fname,nslcd_cfg);
/* do some sanity checks */
if (nslcd_cfg->ldc_uris[0].uri==NULL)
{
log_log(LOG_ERR,"no URIs defined in config");
exit(EXIT_FAILURE);
}
}

View file

@ -1,140 +0,0 @@
/*
cfg.h - definition of configuration information
This file contains parts that were part of the nss_ldap
library which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2007 West Consulting
Copyright (C) 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _CFG_H
#define _CFG_H
#include "compat/attrs.h"
/* maximum number of URIs */
#define NSS_LDAP_CONFIG_URI_MAX 31
enum ldap_ssl_options
{
SSL_OFF,
SSL_LDAPS,
SSL_START_TLS
};
/* selectors for different maps */
enum ldap_map_selector
{
LM_PASSWD,
LM_SHADOW,
LM_GROUP,
LM_HOSTS,
LM_SERVICES,
LM_NETWORKS,
LM_PROTOCOLS,
LM_RPC,
LM_ETHERS,
LM_ALIASES,
LM_NETGROUP,
LM_NONE
};
struct myldap_uri
{
char *uri;
/* timestamp of last ok search */
time_t lastok;
/* timestamp of last ok search */
time_t lastfail;
};
struct ldap_config
{
/* the number of threads to start */
int ldc_threads;
/* NULL terminated list of URIs */
struct myldap_uri ldc_uris[NSS_LDAP_CONFIG_URI_MAX+1];
/* protocol version */
int ldc_version;
/* bind DN */
char *ldc_binddn;
/* bind cred */
char *ldc_bindpw;
/* sasl auth id */
char *ldc_saslid;
/* sasl security */
char *ldc_sasl_secprops;
/* do we use sasl when binding? */
int ldc_usesasl;
/* base DN, eg. dc=gnu,dc=org */
char *ldc_base;
/* scope for searches */
int ldc_scope;
/* dereference aliases/links */
int ldc_deref;
/* chase referrals */
int ldc_referrals;
/* bind timelimit */
int ldc_bind_timelimit;
/* search timelimit */
int ldc_timelimit;
/* idle timeout */
int ldc_idle_timelimit;
/* seconds to sleep; doubled until max */
int ldc_reconnect_sleeptime;
/* maximum seconds to sleep */
int ldc_reconnect_maxsleeptime;
#ifdef LDAP_OPT_X_TLS
/* SSL enabled */
enum ldap_ssl_options ldc_ssl_on;
/* SSL certificate path */
char *ldc_sslpath;
/* tls check peer */
int ldc_tls_checkpeer;
/* tls ca certificate dir */
char *ldc_tls_cacertdir;
/* tls ca certificate file */
char *ldc_tls_cacertfile;
/* tls randfile */
char *ldc_tls_randfile;
/* tls ciphersuite */
char *ldc_tls_ciphers;
/* tls certificate */
char *ldc_tls_cert;
/* tls key */
char *ldc_tls_key;
#endif /* LDAP_OPT_X_TLS */
/* whether the LDAP library should restart the select(2) system call when interrupted */
int ldc_restart;
/* set to a greater than 0 to enable handling of paged results with the specified size */
int ldc_pagesize;
/* LDAP debug level */
int ldc_debug;
};
/* this is a pointer to the global configuration, it should be available
once cfg_init() was called */
extern struct ldap_config *nslcd_cfg;
/* Initialize the configuration in nslcd_cfg. This method
will read the default configuration file and call exit()
if an error occurs. */
void cfg_init(const char *fname);
#endif /* _CFG_H */

View file

@ -1,139 +0,0 @@
/*
common.c - common server code routines
This file is part of the nss-ldapd library.
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdarg.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <strings.h>
#include "nslcd.h"
#include "common.h"
#include "log.h"
/* simple wrapper around snptintf() to return non-0 in case
of any failure (but always keep string 0-terminated) */
int mysnprintf(char *buffer,size_t buflen,const char *format, ...)
{
int res;
va_list ap;
/* do snprintf */
va_start(ap,format);
res=vsnprintf(buffer,buflen,format,ap);
/* NULL-terminate the string just to be on the safe side */
buffer[buflen-1]='\0';
/* check if the string was completely written */
return ((res<0)||(((size_t)res)>=buflen));
}
const char *get_userpassword(MYLDAP_ENTRY *entry,const char *attr)
{
const char **values;
int i;
/* get the entries */
values=myldap_get_values(entry,attr);
if ((values==NULL)||(values[0]==NULL))
return NULL;
/* go over the entries and return the remainder of the value if it
starts with {crypt} or crypt$ */
for (i=0;values[i]!=NULL;i++)
{
if (strncasecmp(values[i],"{crypt}",7)==0)
return values[i]+7;
if (strncasecmp(values[i],"crypt$",6)==0)
return values[i]+6;
}
/* just return the first value completely */
return values[0];
/* TODO: support more password formats e.g. SMD5
(which is $1$ but in a different format)
(any code for this is more than welcome) */
}
/* this writes a single address to the stream */
int write_address(TFILE *fp,const char *addr)
{
int32_t tmpint32;
struct in_addr ipv4addr;
struct in6_addr ipv6addr;
/* try to parse the address as IPv4 first, fall back to IPv6 */
if (inet_pton(AF_INET,addr,&ipv4addr)>0)
{
/* write address type */
WRITE_INT32(fp,AF_INET);
/* write the address length */
WRITE_INT32(fp,sizeof(struct in_addr));
/* write the address itself (in network byte order) */
WRITE_TYPE(fp,ipv4addr,struct in_addr);
}
else if (inet_pton(AF_INET6,addr,&ipv6addr)>0)
{
/* write address type */
WRITE_INT32(fp,AF_INET6);
/* write the address length */
WRITE_INT32(fp,sizeof(struct in6_addr));
/* write the address itself (in network byte order) */
WRITE_TYPE(fp,ipv6addr,struct in6_addr);
}
else
{
/* failure, log but write simple invalid address
(otherwise the address list is messed up) */
/* TODO: have error message in correct format */
log_log(LOG_WARNING,"unparseble address: %s",addr);
/* write an illegal address type */
WRITE_INT32(fp,-1);
/* write an emtpy address */
WRITE_INT32(fp,0);
}
/* we're done */
return 0;
}
int read_address(TFILE *fp,char *addr,int *addrlen,int *af)
{
int32_t tmpint32;
int len;
/* read address family */
READ_INT32(fp,*af);
if ((*af!=AF_INET)&&(*af!=AF_INET6))
{
log_log(LOG_WARNING,"incorrect address family specified: %d",*af);
return -1;
}
/* read address length */
READ_INT32(fp,len);
if ((len>*addrlen)||(len<=0))
{
log_log(LOG_WARNING,"address length incorrect: %d",len);
return -1;
}
*addrlen=len;
/* read address */
READ(fp,addr,len);
/* we're done */
return 0;
}

View file

@ -1,162 +0,0 @@
/*
common.h - common server code routines
This file is part of the nss-ldapd library.
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _SERVER_COMMON_H
#define _SERVER_COMMON_H 1
#include "nslcd.h"
#include "nslcd-common.h"
#include "common/tio.h"
#include "compat/attrs.h"
#include "myldap.h"
/* macros for basic read and write operations, the following
ERROR_OUT* marcos define the action taken on errors
the stream is not closed because the caller closes the
stream */
#define ERROR_OUT_WRITEERROR(fp) \
log_log(LOG_WARNING,"error writing to client"); \
return -1;
#define ERROR_OUT_READERROR(fp) \
log_log(LOG_WARNING,"error reading from client"); \
return -1;
#define ERROR_OUT_BUFERROR(fp) \
log_log(LOG_WARNING,"client supplied argument too large"); \
return -1;
/* a simple wrapper around snprintf,
returns 0 if ok, -1 on error */
int mysnprintf(char *buffer,size_t buflen,const char *format, ...)
LIKE_PRINTF(3,4);
/* This tries to get the user password attribute from the entry.
It will try to return an encrypted password as it is used in /etc/passwd,
/etc/group or /etc/shadow depending upon what is in the directory.
This function will return NULL if no passwd is found and will return the
literal value in the directory if conversion is not possible. */
const char *get_userpassword(MYLDAP_ENTRY *entry,const char *attr);
/* write out an address, parsing the addr value */
int write_address(TFILE *fp,const char *addr);
/* a helper macro to write out addresses and bail out on errors */
#define WRITE_ADDRESS(fp,addr) \
if (write_address(fp,addr)) \
return -1;
/* read an address from the stream */
int read_address(TFILE *fp,char *addr,int *addrlen,int *af);
/* helper macro to read an address from the stream */
#define READ_ADDRESS(fp,addr,len,af) \
len=(int)sizeof(addr); \
if (read_address(fp,addr,&(len),&(af))) \
return -1;
/* checks to see if the specified string is a valid username */
MUST_USE int isvalidusername(const char *name);
/* transforms the DN info a uid doing an LDAP lookup if needed */
MUST_USE char *dn2uid(MYLDAP_SESSION *session,const char *dn,char *buf,size_t buflen);
/* transforms the uid into a DN by doing an LDAP lookup */
MUST_USE char *uid2dn(MYLDAP_SESSION *session,const char *uid,char *buf,size_t buflen);
/* these are the different functions that handle the database
specific actions, see nslcd.h for the action descriptions */
int nslcd_alias_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_alias_all(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_ether_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_ether_byether(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_ether_all(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_group_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_group_bygid(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_group_bymember(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_group_all(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_host_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_host_byaddr(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_host_all(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_netgroup_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_network_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_network_byaddr(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_network_all(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_passwd_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_passwd_byuid(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_passwd_all(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_protocol_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_protocol_bynumber(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_protocol_all(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_rpc_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_rpc_bynumber(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_rpc_all(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_service_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_service_bynumber(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_service_all(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_shadow_byname(TFILE *fp,MYLDAP_SESSION *session);
int nslcd_shadow_all(TFILE *fp,MYLDAP_SESSION *session);
/* macro for generating service handling code */
#define NSLCD_HANDLE(db,fn,readfn,logcall,action,mkfilter,writefn) \
int nslcd_##db##_##fn(TFILE *fp,MYLDAP_SESSION *session) \
{ \
/* define common variables */ \
int32_t tmpint32; \
MYLDAP_SEARCH *search; \
MYLDAP_ENTRY *entry; \
int rc; \
/* read request parameters */ \
readfn; \
/* log call */ \
logcall; \
/* write the response header */ \
WRITE_INT32(fp,NSLCD_VERSION); \
WRITE_INT32(fp,action); \
/* prepare the search filter */ \
if (mkfilter) \
{ \
log_log(LOG_WARNING,"nslcd_" __STRING(db) "_" __STRING(fn) "(): filter buffer too small"); \
return -1; \
} \
/* build the list of attributes */ \
db##_init(); \
/* do the LDAP search */ \
if ((search=myldap_search(session,db##_base,db##_scope,filter,db##_attrs))==NULL) \
return -1; \
/* go over results */ \
while ((entry=myldap_get_entry(search,&rc))!=NULL) \
{ \
if (writefn) \
return -1; \
} \
/* write the final result code */ \
if (rc==LDAP_SUCCESS) \
{ \
WRITE_INT32(fp,NSLCD_RESULT_END); \
} \
return 0; \
}
#endif /* not _SERVER_COMMON_H */

View file

@ -1,203 +0,0 @@
/*
ether.c - ethernet address entry lookup routines
Parts of this file were part of the nss_ldap library (as ldap-ethers.c)
which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif /* HAVE_STDINT_H */
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
#include "compat/ether.h"
/* ( nisSchema.2.11 NAME 'ieee802Device' SUP top AUXILIARY
* DESC 'A device with a MAC address; device SHOULD be
* used as a structural class'
* MAY macAddress )
*/
/* the search base for searches */
const char *ether_base = NULL;
/* the search scope for searches */
int ether_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *ether_filter = "(objectClass=ieee802Device)";
/* the attributes to request with searches */
const char *attmap_ether_cn = "cn";
const char *attmap_ether_macAddress = "macAddress";
/* the attribute list to request with searches */
static const char *ether_attrs[3];
/* create a search filter for searching an ethernet address
by name, return -1 on errors */
static int mkfilter_ether_byname(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if(myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
ether_filter,
attmap_ether_cn,buf2);
}
static int mkfilter_ether_byether(const struct ether_addr *addr,
char *buffer,size_t buflen)
{
char buf2[20];
/* transform into string */
if (ether_ntoa_r(addr,buf2)==NULL)
return -1;
/* FIXME: this has a bug when the directory has 01:00:0e:...
and we're looking for 1:0:e:... (leading zeros) */
/* there should be no characters that need escaping */
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
ether_filter,
attmap_ether_macAddress,buf2);
}
static void ether_init(void)
{
/* set up base */
if (ether_base==NULL)
ether_base=nslcd_cfg->ldc_base;
/* set up scope */
if (ether_scope==LDAP_SCOPE_DEFAULT)
ether_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
ether_attrs[0]=attmap_ether_cn;
ether_attrs[1]=attmap_ether_macAddress;
ether_attrs[2]=NULL;
}
/* TODO: check for errors in aton() */
#define WRITE_ETHER(fp,addr) \
ether_aton_r(addr,&tmpaddr); \
WRITE_TYPE(fp,tmpaddr,uint8_t[6]);
static int write_ether(TFILE *fp,MYLDAP_ENTRY *entry,
const char *reqname,const char *reqether)
{
int32_t tmpint32;
struct ether_addr tmpaddr;
const char *tmparr[2];
const char **names,**ethers;
int i,j;
/* get the name of the ether entry */
if (reqname!=NULL)
{
names=tmparr;
names[0]=reqname;
names[1]=NULL;
}
else
{
names=myldap_get_values(entry,attmap_ether_cn);
if ((names==NULL)||(names[0]==NULL))
{
log_log(LOG_WARNING,"ether entry %s does not contain %s value",
myldap_get_dn(entry),attmap_ether_cn);
return 0;
}
}
/* get the addresses */
if (reqether!=NULL)
{
ethers=tmparr;
ethers[0]=reqether;
ethers[1]=NULL;
}
else
{
ethers=myldap_get_values(entry,attmap_ether_macAddress);
if ((ethers==NULL)||(ethers[0]==NULL))
{
log_log(LOG_WARNING,"ether entry %s does not contain %s value",
myldap_get_dn(entry),attmap_ether_macAddress);
return 0;
}
/* TODO: move parsing of addresses up here */
}
/* write entries for all names and addresses */
for (i=0;names[i]!=NULL;i++)
for (j=0;ethers[j]!=NULL;j++)
{
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_STRING(fp,names[i]);
WRITE_ETHER(fp,ethers[j]);
}
return 0;
}
NSLCD_HANDLE(
ether,byname,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));,
log_log(LOG_DEBUG,"nslcd_ether_byname(%s)",name);,
NSLCD_ACTION_ETHER_BYNAME,
mkfilter_ether_byname(name,filter,sizeof(filter)),
write_ether(fp,entry,name,NULL)
)
NSLCD_HANDLE(
ether,byether,
struct ether_addr addr;
char ether[20];
char filter[1024];
READ_TYPE(fp,addr,uint8_t[6]);
if (ether_ntoa_r(&addr,ether)==NULL)
return -1;,
log_log(LOG_DEBUG,"nslcd_ether_byether(%s)",ether);,
NSLCD_ACTION_ETHER_BYETHER,
mkfilter_ether_byether(&addr,filter,sizeof(filter)),
write_ether(fp,entry,NULL,ether)
)
NSLCD_HANDLE(
ether,all,
const char *filter;
/* no parameters to read */,
log_log(LOG_DEBUG,"nslcd_ether_all()");,
NSLCD_ACTION_ETHER_ALL,
(filter=ether_filter,0),
write_ether(fp,entry,NULL,NULL)
)

View file

@ -1,384 +0,0 @@
/*
group.c - group entry lookup routines
Parts of this file were part of the nss_ldap library (as ldap-grp.c) which
has been forked into the nss-ldapd library.
Copyright (C) 1997-2006 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* for gid_t */
#include <grp.h>
#include "common/set.h"
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
/* ( nisSchema.2.2 NAME 'posixGroup' SUP top STRUCTURAL
* DESC 'Abstraction of a group of accounts'
* MUST ( cn $ gidNumber )
* MAY ( userPassword $ memberUid $ description ) )
*
* apart from that the above the uniqueMember attributes may be
* supported in a coming release (they map to DNs, which is an extra
* lookup step)
*
* using nested groups (groups that are member of a group) is currently
* not supported, this may be added in a later release
*/
/* the search base for searches */
const char *group_base = NULL;
/* the search scope for searches */
int group_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *group_filter = "(objectClass=posixGroup)";
/* the attributes to request with searches */
const char *attmap_group_cn = "cn";
const char *attmap_group_userPassword = "userPassword";
const char *attmap_group_gidNumber = "gidNumber";
const char *attmap_group_memberUid = "memberUid";
const char *attmap_group_uniqueMember = "uniqueMember";
/*const char *attmap_group_memberOf = "memberOf";*/
/* default values for attributes */
static const char *default_group_userPassword = "*"; /* unmatchable */
/* the attribute list to request with searches */
static const char *group_attrs[6];
/* create a search filter for searching a group entry
by name, return -1 on errors */
static int mkfilter_group_byname(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if(myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
group_filter,
attmap_group_cn,buf2);
}
/* create a search filter for searching a group entry
by gid, return -1 on errors */
static int mkfilter_group_bygid(gid_t gid,
char *buffer,size_t buflen)
{
return mysnprintf(buffer,buflen,
"(&%s(%s=%d))",
group_filter,
attmap_group_gidNumber,gid);
}
/* create a search filter for searching a group entry
by member uid, return -1 on errors */
static int mkfilter_group_bymember(MYLDAP_SESSION *session,
const char *uid,
char *buffer,size_t buflen)
{
char buf[80],*dn;
/* try to translate uid to DN */
dn=uid2dn(session,uid,buf,sizeof(buf));
if (dn==NULL)
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
group_filter,
attmap_group_memberUid,uid);
else /* also lookup using user DN */
return mysnprintf(buffer,buflen,
"(&%s(|(%s=%s)(%s=%s)))",
group_filter,
attmap_group_memberUid,uid,
attmap_group_uniqueMember,dn);
}
static void group_init(void)
{
/* set up base */
if (group_base==NULL)
group_base=nslcd_cfg->ldc_base;
/* set up scope */
if (group_scope==LDAP_SCOPE_DEFAULT)
group_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
group_attrs[0]=attmap_group_cn;
group_attrs[1]=attmap_group_userPassword;
group_attrs[2]=attmap_group_memberUid;
group_attrs[3]=attmap_group_gidNumber;
group_attrs[4]=attmap_group_uniqueMember;
group_attrs[5]=NULL;
}
/*
Checks to see if the specified name is a valid group name.
This test is based on the definition from POSIX (IEEE Std 1003.1, 2004,
3.189 Group Name and 3.276 Portable Filename Character Set):
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_189
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_276
The standard defines group names valid if they only contain characters from
the set [A-Za-z0-9._-] where the hyphen should not be used as first
character.
*/
static int isvalidgroupname(const char *name)
{
int i;
if ((name==NULL)||(name[0]=='\0'))
return 0;
/* check first character */
if ( ! ( (name[0]>='A' && name[0] <= 'Z') ||
(name[0]>='a' && name[0] <= 'z') ||
(name[0]>='0' && name[0] <= '9') ||
name[0]=='.' || name[0]=='_' ) )
return 0;
/* check other characters */
for (i=1;name[i]!='\0';i++)
{
if ( ! ( (name[i]>='A' && name[i] <= 'Z') ||
(name[i]>='a' && name[i] <= 'z') ||
(name[i]>='0' && name[i] <= '9') ||
name[i]=='.' || name[i]=='_' || name[i]=='-') )
return 0;
}
/* no test failed so it must be good */
return -1;
}
static int do_write_group(
TFILE *fp,MYLDAP_ENTRY *entry,const char **names,gid_t gids[],int numgids,
const char *passwd,SET *members)
{
int32_t tmpint32;
int i,j;
int nummembers;
const char *tmp;
/* count the number of members */
nummembers=0;
if (members!=NULL)
{
set_loop_first(members);
while (set_loop_next(members)!=NULL)
nummembers++;
}
/* write entries for all names and gids */
for (i=0;names[i]!=NULL;i++)
{
if (!isvalidgroupname(names[i]))
{
log_log(LOG_WARNING,"group entry %s contains invalid group name: \"%s\"",
myldap_get_dn(entry),names[i]);
}
else
{
for (j=0;j<numgids;j++)
{
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_STRING(fp,names[i]);
WRITE_STRING(fp,passwd);
WRITE_TYPE(fp,gids[j],gid_t);
/* write a list of values */
WRITE_INT32(fp,nummembers);
if (members!=NULL)
{
set_loop_first(members);
while ((tmp=set_loop_next(members))!=NULL)
{ WRITE_STRING(fp,tmp); }
}
}
}
}
return 0;
}
/* return the list of members as a \0 separated string with an extra \0
at the end (doing dn->uid lookups as needed) */
static SET *getmembers(MYLDAP_ENTRY *entry,MYLDAP_SESSION *session)
{
char buf[20];
int i;
const char **values;
SET *set;
set=set_new();
if (set==NULL)
return NULL;
/* add the memberUid values */
values=myldap_get_values(entry,attmap_group_memberUid);
if (values!=NULL)
for (i=0;values[i]!=NULL;i++)
{
/* only add valid usernames */
if (isvalidusername(values[i]))
set_add(set,values[i]);
}
/* add the uniqueMember values */
values=myldap_get_values(entry,attmap_group_uniqueMember);
if (values!=NULL)
for (i=0;values[i]!=NULL;i++)
{
/* transform the DN into a uid (dn2uid() already checks validity) */
if (dn2uid(session,values[i],buf,sizeof(buf))!=NULL)
set_add(set,buf);
}
/* return the members */
return set;
}
/* the maximum number of gidNumber attributes per entry */
#define MAXGIDS_PER_ENTRY 5
static int write_group(TFILE *fp,MYLDAP_ENTRY *entry,const char *reqname,
const gid_t *reqgid,int wantmembers,
MYLDAP_SESSION *session)
{
const char *tmparr[2];
const char **names,**gidvalues;
const char *passwd;
SET *members;
gid_t gids[MAXGIDS_PER_ENTRY];
int numgids;
char *tmp;
int rc;
/* get group name (cn) */
if (reqname!=NULL)
{
names=tmparr;
names[0]=reqname;
names[1]=NULL;
}
else
{
names=myldap_get_values(entry,attmap_group_cn);
if ((names==NULL)||(names[0]==NULL))
{
log_log(LOG_WARNING,"group entry %s does not contain %s value",
myldap_get_dn(entry),attmap_group_cn);
return 0;
}
}
/* get the group id(s) */
if (reqgid!=NULL)
{
gids[0]=*reqgid;
numgids=1;
}
else
{
gidvalues=myldap_get_values(entry,attmap_group_gidNumber);
if ((gidvalues==NULL)||(gidvalues[0]==NULL))
{
log_log(LOG_WARNING,"group entry %s does not contain %s value",
myldap_get_dn(entry),attmap_group_gidNumber);
return 0;
}
for (numgids=0;(gidvalues[numgids]!=NULL)&&(numgids<=MAXGIDS_PER_ENTRY);numgids++)
{
gids[numgids]=(gid_t)strtol(gidvalues[numgids],&tmp,0);
if ((*(gidvalues[numgids])=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"group entry %s contains non-numeric %s value",
myldap_get_dn(entry),attmap_group_gidNumber);
return 0;
}
}
}
/* get group passwd (userPassword) (use only first entry) */
passwd=get_userpassword(entry,attmap_group_userPassword);
if (passwd==NULL)
passwd=default_group_userPassword;
/* get group memebers (memberUid&uniqueMember) */
if (wantmembers)
members=getmembers(entry,session);
else
members=NULL;
/* write entries (split to a separate function so we can ensure the call
to free() below in case a write fails) */
rc=do_write_group(fp,entry,names,gids,numgids,passwd,members);
/* free and return */
if (members!=NULL)
set_free(members);
return rc;
}
NSLCD_HANDLE(
group,byname,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));
if (!isvalidgroupname(name)) {
log_log(LOG_WARNING,"nslcd_group_byname(%s): invalid group name",name);
return -1;
},
log_log(LOG_DEBUG,"nslcd_group_byname(%s)",name);,
NSLCD_ACTION_GROUP_BYNAME,
mkfilter_group_byname(name,filter,sizeof(filter)),
write_group(fp,entry,name,NULL,1,session)
)
NSLCD_HANDLE(
group,bygid,
gid_t gid;
char filter[1024];
READ_TYPE(fp,gid,gid_t);,
log_log(LOG_DEBUG,"nslcd_group_bygid(%d)",(int)gid);,
NSLCD_ACTION_GROUP_BYGID,
mkfilter_group_bygid(gid,filter,sizeof(filter)),
write_group(fp,entry,NULL,&gid,1,session)
)
NSLCD_HANDLE(
group,bymember,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));
if (!isvalidusername(name)) {
log_log(LOG_WARNING,"nslcd_group_bymember(%s): invalid user name",name);
return -1;
},
log_log(LOG_DEBUG,"nslcd_group_bymember(%s)",name);,
NSLCD_ACTION_GROUP_BYMEMBER,
mkfilter_group_bymember(session,name,filter,sizeof(filter)),
write_group(fp,entry,NULL,NULL,0,session)
)
NSLCD_HANDLE(
group,all,
const char *filter;
/* no parameters to read */,
log_log(LOG_DEBUG,"nslcd_group_all()");,
NSLCD_ACTION_GROUP_ALL,
(filter=group_filter,0),
write_group(fp,entry,NULL,NULL,1,session)
)

View file

@ -1,191 +0,0 @@
/*
host.c - host name lookup routines
Parts of this file were part of the nss_ldap library (as ldap-hosts.c)
which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
/* ( nisSchema.2.6 NAME 'ipHost' SUP top AUXILIARY
* DESC 'Abstraction of a host, an IP device. The distinguished
* value of the cn attribute denotes the host's canonical
* name. Device SHOULD be used as a structural class'
* MUST ( cn $ ipHostNumber )
* MAY ( l $ description $ manager ) )
*/
/* the search base for searches */
const char *host_base = NULL;
/* the search scope for searches */
int host_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *host_filter = "(objectClass=ipHost)";
/* the attributes to request with searches */
const char *attmap_host_cn = "cn";
const char *attmap_host_ipHostNumber = "ipHostNumber";
/* the attribute list to request with searches */
static const char *host_attrs[3];
/* create a search filter for searching a host entry
by name, return -1 on errors */
static int mkfilter_host_byname(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if (myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
host_filter,
attmap_host_cn,buf2);
}
static int mkfilter_host_byaddr(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if (myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
host_filter,
attmap_host_ipHostNumber,buf2);
}
static void host_init(void)
{
/* set up base */
if (host_base==NULL)
host_base=nslcd_cfg->ldc_base;
/* set up scope */
if (host_scope==LDAP_SCOPE_DEFAULT)
host_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
host_attrs[0]=attmap_host_cn;
host_attrs[1]=attmap_host_ipHostNumber;
host_attrs[2]=NULL;
}
/* write a single host entry to the stream */
static int write_host(TFILE *fp,MYLDAP_ENTRY *entry)
{
int32_t tmpint32,tmp2int32,tmp3int32;
int numaddr,i;
const char *hostname;
const char **hostnames;
const char **addresses;
/* get the most canonical name */
hostname=myldap_get_rdn_value(entry,attmap_host_cn);
/* get the other names for the host */
hostnames=myldap_get_values(entry,attmap_host_cn);
if ((hostnames==NULL)||(hostnames[0]==NULL))
{
log_log(LOG_WARNING,"host entry %s does not contain %s value",
myldap_get_dn(entry),attmap_host_cn);
return 0;
}
/* if the hostname is not yet found, get the first entry from hostnames */
if (hostname==NULL)
hostname=hostnames[0];
/* get the addresses */
addresses=myldap_get_values(entry,attmap_host_ipHostNumber);
if ((addresses==NULL)||(addresses[0]==NULL))
{
log_log(LOG_WARNING,"host entry %s does not contain %s value",
myldap_get_dn(entry),attmap_host_ipHostNumber);
return 0;
}
/* write the entry */
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_STRING(fp,hostname);
WRITE_STRINGLIST_EXCEPT(fp,hostnames,hostname);
for (numaddr=0;addresses[numaddr]!=NULL;numaddr++)
/*noting*/ ;
WRITE_INT32(fp,numaddr);
for (i=0;i<numaddr;i++)
{
WRITE_ADDRESS(fp,addresses[i]);
}
return 0;
}
NSLCD_HANDLE(
host,byname,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));,
log_log(LOG_DEBUG,"nslcd_host_byname(%s)",name);,
NSLCD_ACTION_HOST_BYNAME,
mkfilter_host_byname(name,filter,sizeof(filter)),
write_host(fp,entry)
)
NSLCD_HANDLE(
host,byaddr,
int af;
char addr[64];
int len=sizeof(addr);
char name[1024];
char filter[1024];
READ_ADDRESS(fp,addr,len,af);
/* translate the address to a string */
if (inet_ntop(af,addr,name,sizeof(name))==NULL)
{
log_log(LOG_WARNING,"unable to convert address to string");
return -1;
},
log_log(LOG_DEBUG,"nslcd_host_byaddr(%s)",name);,
NSLCD_ACTION_HOST_BYADDR,
mkfilter_host_byaddr(name,filter,sizeof(filter)),
write_host(fp,entry)
)
NSLCD_HANDLE(
host,all,
const char *filter;
/* no parameters to read */,
log_log(LOG_DEBUG,"nslcd_host_all()");,
NSLCD_ACTION_HOST_ALL,
(filter=host_filter,0),
write_host(fp,entry)
)

View file

@ -1,193 +0,0 @@
/*
log.c - logging funtions
Copyright (C) 2002, 2003 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <syslog.h>
#include <stdarg.h>
#include <errno.h>
#include <string.h>
#include "log.h"
/* set the logname */
#undef PACKAGE
#define PACKAGE "nslcd"
/* storage for logging modes */
static struct cvsd_log {
FILE *fp; /* NULL==syslog */
int loglevel;
struct cvsd_log *next;
} *cvsd_loglist=NULL;
/* default loglevel when no logging is configured */
static int prelogging_loglevel=LOG_INFO;
/* set loglevel when no logging is configured */
void log_setdefaultloglevel(int loglevel)
{
prelogging_loglevel=loglevel;
}
/* add logging method to configuration list */
static void log_addlogging_fp(FILE *fp,int loglevel)
{
struct cvsd_log *tmp,*lst;
/* create new logstruct */
tmp=(struct cvsd_log *)malloc(sizeof(struct cvsd_log));
if (tmp==NULL)
{
fprintf(stderr,"malloc() failed: %s",strerror(errno));
/* since this is done during initialisation it's best to bail out */
exit(EXIT_FAILURE);
}
tmp->fp=fp;
tmp->loglevel=loglevel;
tmp->next=NULL;
/* save the struct in the list */
if (cvsd_loglist==NULL)
cvsd_loglist=tmp;
else
{
for (lst=cvsd_loglist;lst->next!=NULL;lst=lst->next);
lst->next=tmp;
}
}
/* configure logging to a file */
void log_addlogging_file(const char *filename,int loglevel)
{
FILE *fp;
fp=fopen(filename,"a");
if (fp==NULL)
{
log_log(LOG_ERR,"cannot open logfile (%s) for appending: %s",filename,strerror(errno));
exit(EXIT_FAILURE);
}
log_addlogging_fp(fp,loglevel);
}
/* configure logging to syslog */
void log_addlogging_syslog(int loglevel)
{
openlog(PACKAGE,LOG_PID,LOG_DAEMON);
log_addlogging_fp(NULL,loglevel);
}
/* configure a null logging mode (no logging) */
void log_addlogging_none()
{
/* this is a hack, but it's so easy */
log_addlogging_fp(NULL,LOG_EMERG);
}
/* start the logging with the configured logging methods
if no method is configured yet, logging is done to syslog */
void log_startlogging(void)
{
if (cvsd_loglist==NULL)
log_addlogging_syslog(LOG_INFO);
prelogging_loglevel=-1;
}
/* log the given message using the configured logging method */
void log_log(int pri,const char *format, ...)
{
int res;
struct cvsd_log *lst;
/* TODO: make this something better */
#define maxbufferlen 200
char buffer[maxbufferlen];
va_list ap;
/* make the message */
va_start(ap,format);
res=vsnprintf(buffer,maxbufferlen,format,ap);
if ((res<0)||(res>=maxbufferlen))
{
/* truncate with "..." */
buffer[maxbufferlen-2]='.';
buffer[maxbufferlen-3]='.';
buffer[maxbufferlen-4]='.';
}
buffer[maxbufferlen-1]='\0';
va_end(ap);
/* do the logging */
if (prelogging_loglevel>=0)
{
/* if logging is not yet defined, log to stderr */
if (pri<=prelogging_loglevel)
fprintf(stderr,"%s: %s%s\n",PACKAGE,pri==LOG_DEBUG?"DEBUG: ":"",buffer);
}
else
{
for (lst=cvsd_loglist;lst!=NULL;lst=lst->next)
{
if (pri<=lst->loglevel)
{
if (lst->fp==NULL) /* syslog */
syslog(pri,"%s",buffer);
else /* file */
{
fprintf(lst->fp,"%s: %s\n",PACKAGE,buffer);
fflush(lst->fp);
}
}
}
}
}
/* return the syslog loglevel represented by the string
return -1 on unknown */
int log_getloglevel(const char *lvl)
{
if ( strcmp(lvl,"crit")==0 )
return LOG_CRIT;
else if ( (strcmp(lvl,"error")==0) ||
(strcmp(lvl,"err")==0) )
return LOG_ERR;
else if ( strcmp(lvl,"warning")==0 )
return LOG_WARNING;
else if ( strcmp(lvl,"notice")==0 )
return LOG_NOTICE;
else if ( strcmp(lvl,"info")==0 )
return LOG_INFO;
else if ( strcmp(lvl,"debug")==0 )
return LOG_DEBUG;
else
return -1; /* unknown */
}

View file

@ -1,63 +0,0 @@
/*
log.h - definitions of logging funtions
Copyright (C) 2002, 2003, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _LOG_H
#define _LOG_H 1
#include <syslog.h>
#include "compat/attrs.h"
/* set loglevel when no logging is configured */
void log_setdefaultloglevel(int loglevel);
/* configure logging to a file */
void log_addlogging_file(const char *filename,int loglevel);
/* configure logging to syslog */
void log_addlogging_syslog(int loglevel);
/* configure a null logging mode (no logging) */
void log_addlogging_none(void);
/* start the logging with the configured logging methods
if no method is configured yet, logging is done to syslog */
void log_startlogging(void);
/* log the given message using the configured logging method */
void log_log(int pri,const char *format, ...)
LIKE_PRINTF(2,3);
/* return the syslog loglevel represented by the string
return -1 on unknown */
int log_getloglevel(const char *lvl)
MUST_USE;
#endif /* not _LOG_H */

File diff suppressed because it is too large Load diff

View file

@ -1,125 +0,0 @@
/*
myldap.h - simple interface to do LDAP requests
This file is part of the nss-ldapd library.
Copyright (C) 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
This file describes the API of the myldap module which takes the complexity
out of using the OpenLDAP library. Memory management, paging, reconnect
logic, idle timeout of connections, etc is taken care of by the module.
Use of this module is very straightforeward. You first have to create a
session (with myldap_create_session()), with this session you can start
searches (with myldap_search()), from a search you can get entries (with
myldap_get_entry()) from the LDAP database and from these entries you can
get attribute values (with myldap_get_values()).
*/
#ifndef _MYLDAP_H
#define _MYLDAP_H
/* for size_t */
#include <stdlib.h>
/* for LDAP_SCOPE_* */
#include <lber.h>
#include <ldap.h>
#include "compat/attrs.h"
#ifndef LDAP_SCOPE_DEFAULT
#define LDAP_SCOPE_DEFAULT LDAP_SCOPE_SUBTREE
#endif /* not LDAP_SCOPE_DEFAULT */
/* This a a generic session handle. */
typedef struct ldap_session MYLDAP_SESSION;
/* Note that this session handle may be used within one thread only. No
locking is performed to prevent concurrent modifications. Most LDAP
libraries also are not thread-safe in that a single connection may be
shared by multiple threads. It seems however that OpenLDAP at least does
not have any problems with an LDAP *ld per thread.
http://www.openldap.org/lists/openldap-software/200606/msg00252.html */
/* A result set as returned by myldap_search(). */
typedef struct myldap_search MYLDAP_SEARCH;
/* A single entry from the LDAP database as returned by myldap_get_entry(). */
typedef struct myldap_entry MYLDAP_ENTRY;
/* Create a new session, this does not yet connect to the LDAP server. The
connection to the server is made on-demand when a search is performed. This
uses the configuration to find the URLs to attempt connections to. */
MUST_USE MYLDAP_SESSION *myldap_create_session(void);
/* Closes all pending searches and deallocates any memory that is allocated
with these searches. This does not close the session. */
void myldap_session_cleanup(MYLDAP_SESSION *session);
/* Close the session and free all the resources allocated for the session.
After a call to this function the referenced handle is invalid. */
void myldap_session_close(MYLDAP_SESSION *session);
/* Do an LDAP search and return a reference to the results (returns NULL on
error). This function uses paging, and does reconnects to the configured
URLs transparently. */
MUST_USE MYLDAP_SEARCH *myldap_search(
MYLDAP_SESSION *session,
const char *base,int scope,const char *filter,const char **attrs);
/* Close the specified search. This frees all the memory that was allocated
for the search and its results. */
void myldap_search_close(MYLDAP_SEARCH *search);
/* Get an entry from the result set, going over all results (returns NULL if
no more entries are available). Note that any memory allocated to return
information about the previous entry (e.g. with myldap_get_values()) is
freed with this call. The search is autoamtically closed when no more
results are available. The function returns an LDAP status code in the
location pointed to by rcp if it is non-NULL. */
MUST_USE MYLDAP_ENTRY *myldap_get_entry(MYLDAP_SEARCH *search,int *rcp);
/* Get the DN from the entry. This function does not return NULL (on error
"unknown" is returned). */
MUST_USE const char *myldap_get_dn(MYLDAP_ENTRY *entry);
/* Get the attribute values from a certain entry as a NULL terminated list.
May return NULL or an empty array. */
MUST_USE const char **myldap_get_values(MYLDAP_ENTRY *entry,const char *attr);
/* Checks to see if the entry has the specified object class. */
MUST_USE int myldap_has_objectclass(MYLDAP_ENTRY *entry,const char *objectclass);
/* Get the RDN's value: eg. if the RDN was cn=lukeh, getrdnvalue(entry,cn)
would return lukeh. If the attribute was not found in the DN or on error
NULL is returned. This method may be used to get the "most authorative"
value for an attribute. */
MUST_USE const char *myldap_get_rdn_value(MYLDAP_ENTRY *entry,const char *attr);
/* Just like myldap_get_rdn_value() but use the supplied character sequence
and copy the result into the buffer.
Returns a pointer to the start of the string on success and NULL on
failure. */
MUST_USE const char *myldap_cpy_rdn_value(const char *dn,const char *attr,
char *buf,size_t buflen);
/* Escapes characters in a string for use in a search filter. */
MUST_USE int myldap_escape(const char *src,char *buffer,size_t buflen);
#endif /* not _MYLDAP_H */

View file

@ -1,240 +0,0 @@
/*
netgroup.c - netgroup lookup routines
Parts of this file were part of the nss_ldap library (as ldap-netgrp.c)
which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/param.h>
#include <string.h>
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
/* ( nisSchema.2.8 NAME 'nisNetgroup' SUP top STRUCTURAL
* DESC 'Abstraction of a netgroup. May refer to other netgroups'
* MUST cn
* MAY ( nisNetgroupTriple $ memberNisNetgroup $ description ) )
*/
/* the search base for searches */
const char *netgroup_base = NULL;
/* the search scope for searches */
int netgroup_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *netgroup_filter = "(objectClass=nisNetgroup)";
/* the attributes to request with searches */
const char *attmap_netgroup_cn = "cn";
const char *attmap_netgroup_nisNetgroupTriple = "nisNetgroupTriple";
const char *attmap_netgroup_memberNisNetgroup = "memberNisNetgroup";
/* the attribute list to request with searches */
static const char *netgroup_attrs[4];
static int mkfilter_netgroup_byname(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if (myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
netgroup_filter,
attmap_netgroup_cn,buf2);
}
static void netgroup_init(void)
{
/* set up base */
if (netgroup_base==NULL)
netgroup_base=nslcd_cfg->ldc_base;
/* set up scope */
if (netgroup_scope==LDAP_SCOPE_DEFAULT)
netgroup_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
netgroup_attrs[0]=attmap_netgroup_cn;
netgroup_attrs[1]=attmap_netgroup_nisNetgroupTriple;
netgroup_attrs[2]=attmap_netgroup_memberNisNetgroup;
netgroup_attrs[3]=NULL;
}
static int write_string_stripspace_len(TFILE *fp,const char *str,int len)
{
int32_t tmpint32;
int i,j;
DEBUG_PRINT("WRITE_STRING: var="__STRING(str)" string=\"%s\"",str);
if (str==NULL)
{
WRITE_INT32(fp,0);
}
else
{
/* skip leading spaces */
for (i=0;(str[i]!='\0')&&(isspace(str[i]));i++)
/* nothing else to do */ ;
/* skip trailing spaces */
for (j=len;(j>i)&&(isspace(str[j-1]));j--)
/* nothing else to do */ ;
/* write length of string */
WRITE_INT32(fp,j-i);
/* write string itself */
if (j>i)
{
WRITE(fp,str+i,j-i);
}
}
/* we're done */
return 0;
}
#define WRITE_STRING_STRIPSPACE_LEN(fp,str,len) \
if (write_string_stripspace_len(fp,str,len)) \
return -1;
#define WRITE_STRING_STRIPSPACE(fp,str) \
WRITE_STRING_STRIPSPACE_LEN(fp,str,strlen(str))
static int write_netgroup_triple(TFILE *fp,const char *triple)
{
int32_t tmpint32;
int i;
int hostb,hoste,userb,usere,domainb,domaine;
/* skip leading spaces */
for (i=0;(triple[i]!='\0')&&(isspace(triple[i]));i++)
/* nothing else to do */ ;
/* we should have a bracket now */
if (triple[i]!='(')
{
log_log(LOG_WARNING,"write_netgroup_triple(): entry does not begin with '(' (entry skipped)");
return 0;
}
i++;
hostb=i;
/* find comma (end of host string) */
for (;(triple[i]!='\0')&&(triple[i]!=',');i++)
/* nothing else to do */ ;
if (triple[i]!=',')
{
log_log(LOG_WARNING,"write_netgroup_triple(): missing ',' (entry skipped)");
return 0;
}
hoste=i;
i++;
userb=i;
/* find comma (end of user string) */
for (;(triple[i]!='\0')&&(triple[i]!=',');i++)
/* nothing else to do */ ;
if (triple[i]!=',')
{
log_log(LOG_WARNING,"write_netgroup_triple(): missing ',' (entry skipped)");
return 0;
}
usere=i;
i++;
domainb=i;
/* find closing bracket (end of domain string) */
for (;(triple[i]!='\0')&&(triple[i]!=')');i++)
/* nothing else to do */ ;
if (triple[i]!=')')
{
log_log(LOG_WARNING,"write_netgroup_triple(): missing ')' (entry skipped)");
return 0;
}
domaine=i;
i++;
/* skip trailing spaces */
for (;(triple[i]!='\0')&&(isspace(triple[i]));i++)
/* nothing else to do */ ;
/* if anything is left in the string we have a problem */
if (triple[i]!='\0')
{
log_log(LOG_WARNING,"write_netgroup_triple(): string contains trailing data (entry skipped)");
return 0;
}
/* write strings */
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_INT32(fp,NETGROUP_TYPE_TRIPLE);
WRITE_STRING_STRIPSPACE_LEN(fp,triple+hostb,hoste-hostb)
WRITE_STRING_STRIPSPACE_LEN(fp,triple+userb,usere-userb)
WRITE_STRING_STRIPSPACE_LEN(fp,triple+domainb,domaine-domainb)
/* we're done */
return 0;
}
#define WRITE_NETGROUP_TRIPLE(fp,triple) \
if (write_netgroup_triple(fp,triple)) \
return -1;
static int write_netgroup(TFILE *fp,MYLDAP_ENTRY *entry)
{
int32_t tmpint32;
int i;
const char **triples;
const char **members;
/* get the netgroup triples and member */
triples=myldap_get_values(entry,attmap_netgroup_nisNetgroupTriple);
members=myldap_get_values(entry,attmap_netgroup_memberNisNetgroup);
/* write the netgroup triples */
if (triples!=NULL)
for (i=0;triples[i]!=NULL;i++)
{
WRITE_NETGROUP_TRIPLE(fp,triples[i]);
}
/* write netgroup members */
if (members!=NULL)
for (i=0;members[i]!=NULL;i++)
{
/* write the result code */
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
/* write triple indicator */
WRITE_INT32(fp,NETGROUP_TYPE_NETGROUP);
/* write netgroup name */
WRITE_STRING_STRIPSPACE(fp,members[i]);
}
/* we're done */
return 0;
}
NSLCD_HANDLE(
netgroup,byname,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));,
log_log(LOG_DEBUG,"nslcd_netgroup_byname(%s)",name);,
NSLCD_ACTION_NETGROUP_BYNAME,
mkfilter_netgroup_byname(name,filter,sizeof(filter)),
write_netgroup(fp,entry)
)

View file

@ -1,190 +0,0 @@
/*
network.c - network address entry lookup routines
Parts of this file were part of the nss_ldap library (as ldap-network.c)
which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
/* ( nisSchema.2.7 NAME 'ipNetwork' SUP top STRUCTURAL
* DESC 'Abstraction of a network. The distinguished value of
* MUST ( cn $ ipNetworkNumber )
* MAY ( ipNetmaskNumber $ l $ description $ manager ) )
*/
/* the search base for searches */
const char *network_base = NULL;
/* the search scope for searches */
int network_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *network_filter = "(objectClass=ipNetwork)";
/* the attributes used in searches */
const char *attmap_network_cn = "cn";
const char *attmap_network_ipNetworkNumber = "ipNetworkNumber";
/*const char *attmap_network_ipNetmaskNumber = "ipNetmaskNumber"; */
/* the attribute list to request with searches */
static const char *network_attrs[3];
/* create a search filter for searching a network entry
by name, return -1 on errors */
static int mkfilter_network_byname(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if (myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
network_filter,
attmap_network_cn,buf2);
}
static int mkfilter_network_byaddr(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if (myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
network_filter,
attmap_network_ipNetworkNumber,buf2);
}
static void network_init(void)
{
/* set up base */
if (network_base==NULL)
network_base=nslcd_cfg->ldc_base;
/* set up scope */
if (network_scope==LDAP_SCOPE_DEFAULT)
network_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
network_attrs[0]=attmap_network_cn;
network_attrs[1]=attmap_network_ipNetworkNumber;
network_attrs[2]=NULL;
}
/* write a single network entry to the stream */
static int write_network(TFILE *fp,MYLDAP_ENTRY *entry)
{
int32_t tmpint32,tmp2int32,tmp3int32;
int numaddr,i;
const char *networkname;
const char **networknames;
const char **addresses;
/* get the most canonical name */
networkname=myldap_get_rdn_value(entry,attmap_network_cn);
/* get the other names for the network */
networknames=myldap_get_values(entry,attmap_network_cn);
if ((networknames==NULL)||(networknames[0]==NULL))
{
log_log(LOG_WARNING,"network entry %s does not contain %s value",
myldap_get_dn(entry),attmap_network_cn);
return 0;
}
/* if the networkname is not yet found, get the first entry from networknames */
if (networkname==NULL)
networkname=networknames[0];
/* get the addresses */
addresses=myldap_get_values(entry,attmap_network_ipNetworkNumber);
if ((addresses==NULL)||(addresses[0]==NULL))
{
log_log(LOG_WARNING,"network entry %s does not contain %s value",
myldap_get_dn(entry),attmap_network_ipNetworkNumber);
return 0;
}
/* write the entry */
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_STRING(fp,networkname);
WRITE_STRINGLIST_EXCEPT(fp,networknames,networkname);
for (numaddr=0;addresses[numaddr]!=NULL;numaddr++)
/*noting*/ ;
WRITE_INT32(fp,numaddr);
for (i=0;i<numaddr;i++)
{
WRITE_ADDRESS(fp,addresses[i]);
}
return 0;
}
NSLCD_HANDLE(
network,byname,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));,
log_log(LOG_DEBUG,"nslcd_network_byname(%s)",name);,
NSLCD_ACTION_NETWORK_BYNAME,
mkfilter_network_byname(name,filter,sizeof(filter)),
write_network(fp,entry)
)
NSLCD_HANDLE(
network,byaddr,
int af;
char addr[64];
int len=sizeof(addr);
char name[1024];
char filter[1024];
READ_ADDRESS(fp,addr,len,af);
/* translate the address to a string */
if (inet_ntop(af,addr,name,sizeof(name))==NULL)
{
log_log(LOG_WARNING,"unable to convert address to string");
return -1;
},
log_log(LOG_DEBUG,"nslcd_network_byaddr(%s)",name);,
NSLCD_ACTION_NETWORK_BYADDR,
mkfilter_network_byaddr(name,filter,sizeof(filter)),
write_network(fp,entry)
)
NSLCD_HANDLE(
network,all,
const char *filter;
/* no parameters to read */,
log_log(LOG_DEBUG,"nslcd_network_all()");,
NSLCD_ACTION_NETWORK_ALL,
(filter=network_filter,0),
write_network(fp,entry)
)

View file

@ -1,634 +0,0 @@
/*
nslcd.c - ldap local connection daemon
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif /* HAVE_STDINT_H */
#include <sys/types.h>
#include <sys/param.h>
#include <sys/wait.h>
#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif /* HAVE_GETOPT_H */
#include <assert.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/un.h>
#ifdef HAVE_GRP_H
#include <grp.h>
#endif /* HAVE_GRP_H */
#ifdef HAVE_NSS_H
#include <nss.h>
#endif /* HAVE_NSS_H */
#include <pthread.h>
#ifndef HAVE_GETOPT_LONG
#include "compat/getopt_long.h"
#endif /* not HAVE_GETOPT_LONG */
#ifndef HAVE_DAEMON
#include "compat/daemon.h"
#endif /* not HAVE_DAEMON */
#include "nslcd.h"
#include "log.h"
#include "cfg.h"
#include "common.h"
#include "compat/attrs.h"
#include "compat/getpeercred.h"
/* buffer sizes for I/O */
#define READBUFFER_MINSIZE 32
#define READBUFFER_MAXSIZE 64
#define WRITEBUFFER_MINSIZE 64
#define WRITEBUFFER_MAXSIZE 64*1024
/* the definition of the environment */
extern char **environ;
/* flag to indictate if we are in debugging mode */
static int nslcd_debugging=0;
/* the exit flag to indicate that a signal was received */
static volatile int nslcd_exitsignal=0;
/* the server socket used for communication */
static int nslcd_serversocket=-1;
/* thread ids of all running threads */
static pthread_t *nslcd_threads;
/* display version information */
static void display_version(FILE *fp)
{
fprintf(fp,"%s\n",PACKAGE_STRING);
fprintf(fp,"Written by Luke Howard and Arthur de Jong.\n\n");
fprintf(fp,"Copyright (C) 1997-2008 Luke Howard, Arthur de Jong and West Consulting\n"
"This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
}
/* display usage information to stdout and exit(status) */
static void display_usage(FILE *fp,const char *program_name)
{
fprintf(fp,"Usage: %s [OPTION]...\n",program_name);
fprintf(fp,"Name Service LDAP connection daemon.\n");
fprintf(fp," -d, --debug don't fork and print debugging to stderr\n");
fprintf(fp," --help display this help and exit\n");
fprintf(fp," --version output version information and exit\n");
fprintf(fp,"\n"
"Report bugs to <%s>.\n",PACKAGE_BUGREPORT);
}
/* the definition of options for getopt(). see getopt(2) */
static struct option const nslcd_options[] =
{
{ "debug", no_argument, NULL, 'd' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
{ NULL, 0, NULL, 0 }
};
#define NSLCD_OPTIONSTRING "dhV"
/* parse command line options and save settings in struct */
static void parse_cmdline(int argc,char *argv[])
{
int optc;
while ((optc=getopt_long(argc,argv,NSLCD_OPTIONSTRING,nslcd_options,NULL))!=-1)
{
switch (optc)
{
case 'd': /* -d, --debug don't fork and print debugging to stderr */
nslcd_debugging++;
log_setdefaultloglevel(LOG_DEBUG);
break;
case 'h': /* --help display this help and exit */
display_usage(stdout,argv[0]);
exit(EXIT_SUCCESS);
case 'V': /* --version output version information and exit */
display_version(stdout);
exit(EXIT_SUCCESS);
case ':': /* missing required parameter */
case '?': /* unknown option character or extraneous parameter */
default:
fprintf(stderr,"Try '%s --help' for more information.\n",
argv[0]);
exit(EXIT_FAILURE);
}
}
/* check for remaining arguments */
if (optind<argc)
{
fprintf(stderr,"%s: unrecognized option '%s'\n",
argv[0],argv[optind]);
fprintf(stderr,"Try '%s --help' for more information.\n",
argv[0]);
exit(EXIT_FAILURE);
}
}
/* get a name of a signal with a given signal number */
static const char *signame(int signum)
{
switch (signum)
{
case SIGHUP: return "SIGHUP"; /* Hangup detected */
case SIGINT: return "SIGINT"; /* Interrupt from keyboard */
case SIGQUIT: return "SIGQUIT"; /* Quit from keyboard */
case SIGILL: return "SIGILL"; /* Illegal Instruction */
case SIGABRT: return "SIGABRT"; /* Abort signal from abort(3) */
case SIGFPE: return "SIGFPE"; /* Floating point exception */
case SIGKILL: return "SIGKILL"; /* Kill signal */
case SIGSEGV: return "SIGSEGV"; /* Invalid memory reference */
case SIGPIPE: return "SIGPIPE"; /* Broken pipe */
case SIGALRM: return "SIGALRM"; /* Timer signal from alarm(2) */
case SIGTERM: return "SIGTERM"; /* Termination signal */
case SIGUSR1: return "SIGUSR1"; /* User-defined signal 1 */
case SIGUSR2: return "SIGUSR2"; /* User-defined signal 2 */
case SIGCHLD: return "SIGCHLD"; /* Child stopped or terminated */
case SIGCONT: return "SIGCONT"; /* Continue if stopped */
case SIGSTOP: return "SIGSTOP"; /* Stop process */
case SIGTSTP: return "SIGTSTP"; /* Stop typed at tty */
case SIGTTIN: return "SIGTTIN"; /* tty input for background process */
case SIGTTOU: return "SIGTTOU"; /* tty output for background process */
#ifdef SIGBUS
case SIGBUS: return "SIGBUS"; /* Bus error */
#endif
#ifdef SIGPOLL
case SIGPOLL: return "SIGPOLL"; /* Pollable event */
#endif
#ifdef SIGPROF
case SIGPROF: return "SIGPROF"; /* Profiling timer expired */
#endif
#ifdef SIGSYS
case SIGSYS: return "SIGSYS"; /* Bad argument to routine */
#endif
#ifdef SIGTRAP
case SIGTRAP: return "SIGTRAP"; /* Trace/breakpoint trap */
#endif
#ifdef SIGURG
case SIGURG: return "SIGURG"; /* Urgent condition on socket */
#endif
#ifdef SIGVTALRM
case SIGVTALRM: return "SIGVTALRM"; /* Virtual alarm clock */
#endif
#ifdef SIGXCPU
case SIGXCPU: return "SIGXCPU"; /* CPU time limit exceeded */
#endif
#ifdef SIGXFSZ
case SIGXFSZ: return "SIGXFSZ"; /* File size limit exceeded */
#endif
default: return "UNKNOWN";
}
}
/* signal handler for closing down */
static RETSIGTYPE sigexit_handler(int signum)
{
int i;
nslcd_exitsignal=signum;
/* cancel all running threads */
for (i=0;i<nslcd_cfg->ldc_threads;i++)
if (pthread_cancel(nslcd_threads[i]))
{
/* TODO: figure out if we can actually log from within a signal handler */
log_log(LOG_WARNING,"failed to stop thread %d (ignored): %s",i,strerror(errno));
}
}
/* do some cleaning up before terminating */
static void exithandler(void)
{
/* close socket if it's still in use */
if (nslcd_serversocket >= 0)
{
if (close(nslcd_serversocket))
log_log(LOG_WARNING,"problem closing server socket (ignored): %s",strerror(errno));
}
/* remove existing named socket */
if (unlink(NSLCD_SOCKET)<0)
{
log_log(LOG_DEBUG,"unlink() of "NSLCD_SOCKET" failed (ignored): %s",
strerror(errno));
}
/* remove pidfile */
if (unlink(NSLCD_PIDFILE)<0)
{
log_log(LOG_DEBUG,"unlink() of "NSLCD_PIDFILE" failed (ignored): %s",
strerror(errno));
}
/* log exit */
log_log(LOG_INFO,"version %s bailing out",VERSION);
}
/* returns a socket ready to answer requests from the client,
exit()s on error */
static int open_socket(void)
{
int sock;
struct sockaddr_un addr;
/* create a socket */
if ( (sock=socket(PF_UNIX,SOCK_STREAM,0))<0 )
{
log_log(LOG_ERR,"cannot create socket: %s",strerror(errno));
exit(EXIT_FAILURE);
}
/* remove existing named socket */
if (unlink(NSLCD_SOCKET)<0)
{
log_log(LOG_DEBUG,"unlink() of "NSLCD_SOCKET" failed (ignored): %s",
strerror(errno));
}
/* create socket address structure */
memset(&addr,0,sizeof(struct sockaddr_un));
addr.sun_family=AF_UNIX;
strncpy(addr.sun_path,NSLCD_SOCKET,sizeof(addr.sun_path));
addr.sun_path[sizeof(addr.sun_path)-1]='\0';
/* bind to the named socket */
if (bind(sock,(struct sockaddr *)&addr,sizeof(struct sockaddr_un)))
{
log_log(LOG_ERR,"bind() to "NSLCD_SOCKET" failed: %s",
strerror(errno));
if (close(sock))
log_log(LOG_WARNING,"problem closing socket: %s",strerror(errno));
exit(EXIT_FAILURE);
}
/* close the file descriptor on exit */
if (fcntl(sock,F_SETFD,FD_CLOEXEC)<0)
{
log_log(LOG_ERR,"fctnl(F_SETFL,O_NONBLOCK) failed: %s",strerror(errno));
if (close(sock))
log_log(LOG_WARNING,"problem closing socket: %s",strerror(errno));
exit(EXIT_FAILURE);
}
/* set permissions of socket so anybody can do requests */
/* Note: we use chmod() here instead of fchmod() because
fchmod does not work on sockets
http://www.opengroup.org/onlinepubs/009695399/functions/fchmod.html
http://lkml.org/lkml/2005/5/16/11 */
if (chmod(NSLCD_SOCKET,(mode_t)0666))
{
log_log(LOG_ERR,"chmod(0666) failed: %s",strerror(errno));
if (close(sock))
log_log(LOG_WARNING,"problem closing socket: %s",strerror(errno));
exit(EXIT_FAILURE);
}
/* start listening for connections */
if (listen(sock,SOMAXCONN)<0)
{
log_log(LOG_ERR,"listen() failed: %s",strerror(errno));
if (close(sock))
log_log(LOG_WARNING,"problem closing socket: %s",strerror(errno));
exit(EXIT_FAILURE);
}
/* we're done */
return sock;
}
/* read the version information and action from the stream
this function returns the read action in location pointer to by action */
static int read_header(TFILE *fp,int32_t *action)
{
int32_t tmpint32;
/* read the protocol version */
READ_TYPE(fp,tmpint32,int32_t);
if (tmpint32 != (int32_t)NSLCD_VERSION)
{
log_log(LOG_DEBUG,"wrong nslcd version id (%d)",(int)tmpint32);
return -1;
}
/* read the request type */
READ(fp,action,sizeof(int32_t));
return 0;
}
/* read a request message, returns <0 in case of errors,
this function closes the socket */
static void handleconnection(int sock,MYLDAP_SESSION *session)
{
TFILE *fp;
int32_t action;
struct timeval readtimeout,writetimeout;
uid_t uid;
gid_t gid;
pid_t pid;
/* log connection */
if (getpeercred(sock,&uid,&gid,&pid))
log_log(LOG_DEBUG,"connection from unknown client: %s",strerror(errno));
else
log_log(LOG_DEBUG,"connection from pid=%d uid=%d gid=%d",
(int)pid,(int)uid,(int)gid);
/* set the timeouts */
readtimeout.tv_sec=0; /* clients should send their request quickly */
readtimeout.tv_usec=500000;
writetimeout.tv_sec=5; /* clients could be taking some time to process the results */
writetimeout.tv_usec=0;
/* create a stream object */
if ((fp=tio_fdopen(sock,&readtimeout,&writetimeout,
READBUFFER_MINSIZE,READBUFFER_MAXSIZE,
WRITEBUFFER_MINSIZE,WRITEBUFFER_MAXSIZE))==NULL)
{
log_log(LOG_WARNING,"cannot create stream for writing: %s",strerror(errno));
(void)close(sock);
return;
}
/* read request */
if (read_header(fp,&action))
{
(void)tio_close(fp);
return;
}
/* handle request */
switch (action)
{
case NSLCD_ACTION_ALIAS_BYNAME: (void)nslcd_alias_byname(fp,session); break;
case NSLCD_ACTION_ALIAS_ALL: (void)nslcd_alias_all(fp,session); break;
case NSLCD_ACTION_ETHER_BYNAME: (void)nslcd_ether_byname(fp,session); break;
case NSLCD_ACTION_ETHER_BYETHER: (void)nslcd_ether_byether(fp,session); break;
case NSLCD_ACTION_ETHER_ALL: (void)nslcd_ether_all(fp,session); break;
case NSLCD_ACTION_GROUP_BYNAME: (void)nslcd_group_byname(fp,session); break;
case NSLCD_ACTION_GROUP_BYGID: (void)nslcd_group_bygid(fp,session); break;
case NSLCD_ACTION_GROUP_BYMEMBER: (void)nslcd_group_bymember(fp,session); break;
case NSLCD_ACTION_GROUP_ALL: (void)nslcd_group_all(fp,session); break;
case NSLCD_ACTION_HOST_BYNAME: (void)nslcd_host_byname(fp,session); break;
case NSLCD_ACTION_HOST_BYADDR: (void)nslcd_host_byaddr(fp,session); break;
case NSLCD_ACTION_HOST_ALL: (void)nslcd_host_all(fp,session); break;
case NSLCD_ACTION_NETGROUP_BYNAME: (void)nslcd_netgroup_byname(fp,session); break;
case NSLCD_ACTION_NETWORK_BYNAME: (void)nslcd_network_byname(fp,session); break;
case NSLCD_ACTION_NETWORK_BYADDR: (void)nslcd_network_byaddr(fp,session); break;
case NSLCD_ACTION_NETWORK_ALL: (void)nslcd_network_all(fp,session); break;
case NSLCD_ACTION_PASSWD_BYNAME: (void)nslcd_passwd_byname(fp,session); break;
case NSLCD_ACTION_PASSWD_BYUID: (void)nslcd_passwd_byuid(fp,session); break;
case NSLCD_ACTION_PASSWD_ALL: (void)nslcd_passwd_all(fp,session); break;
case NSLCD_ACTION_PROTOCOL_BYNAME: (void)nslcd_protocol_byname(fp,session); break;
case NSLCD_ACTION_PROTOCOL_BYNUMBER:(void)nslcd_protocol_bynumber(fp,session); break;
case NSLCD_ACTION_PROTOCOL_ALL: (void)nslcd_protocol_all(fp,session); break;
case NSLCD_ACTION_RPC_BYNAME: (void)nslcd_rpc_byname(fp,session); break;
case NSLCD_ACTION_RPC_BYNUMBER: (void)nslcd_rpc_bynumber(fp,session); break;
case NSLCD_ACTION_RPC_ALL: (void)nslcd_rpc_all(fp,session); break;
case NSLCD_ACTION_SERVICE_BYNAME: (void)nslcd_service_byname(fp,session); break;
case NSLCD_ACTION_SERVICE_BYNUMBER: (void)nslcd_service_bynumber(fp,session); break;
case NSLCD_ACTION_SERVICE_ALL: (void)nslcd_service_all(fp,session); break;
case NSLCD_ACTION_SHADOW_BYNAME: if (uid==0) (void)nslcd_shadow_byname(fp,session); break;
case NSLCD_ACTION_SHADOW_ALL: if (uid==0) (void)nslcd_shadow_all(fp,session); break;
default:
log_log(LOG_WARNING,"invalid request id: %d",(int)action);
break;
}
/* we're done with the request */
myldap_session_cleanup(session);
(void)tio_close(fp);
return;
}
/* accept a connection on the socket */
static void acceptconnection(MYLDAP_SESSION *session)
{
int csock;
int j;
struct sockaddr_storage addr;
socklen_t alen;
/* accept a new connection */
alen=(socklen_t)sizeof(struct sockaddr_storage);
csock=accept(nslcd_serversocket,(struct sockaddr *)&addr,&alen);
if (csock<0)
{
if ((errno==EINTR)||(errno==EAGAIN)||(errno==EWOULDBLOCK))
{
log_log(LOG_DEBUG,"accept() failed (ignored): %s",strerror(errno));
return;
}
log_log(LOG_ERR,"accept() failed: %s",strerror(errno));
return;
}
/* make sure O_NONBLOCK is not inherited */
if ((j=fcntl(csock,F_GETFL,0))<0)
{
log_log(LOG_ERR,"fctnl(F_GETFL) failed: %s",strerror(errno));
if (close(csock))
log_log(LOG_WARNING,"problem closing socket: %s",strerror(errno));
return;
}
if (fcntl(csock,F_SETFL,j&~O_NONBLOCK)<0)
{
log_log(LOG_ERR,"fctnl(F_SETFL,~O_NONBLOCK) failed: %s",strerror(errno));
if (close(csock))
log_log(LOG_WARNING,"problem closing socket: %s",strerror(errno));
return;
}
/* handle the connection */
handleconnection(csock,session);
}
/* write the current process id to the specified file */
static void write_pidfile(const char *filename)
{
FILE *fp;
if (filename!=NULL)
{
if ((fp=fopen(filename,"w"))==NULL)
{
log_log(LOG_ERR,"cannot open pid file (%s): %s",filename,strerror(errno));
exit(EXIT_FAILURE);
}
if (fprintf(fp,"%d\n",(int)getpid())<=0)
{
log_log(LOG_ERR,"error writing pid file (%s)",filename);
exit(EXIT_FAILURE);
}
if (fclose(fp))
{
log_log(LOG_ERR,"error writing pid file (%s): %s",filename,strerror(errno));
exit(EXIT_FAILURE);
}
}
}
/* try to install signal handler and check result */
static void install_sighandler(int signum,RETSIGTYPE (*handler) (int))
{
struct sigaction act;
memset(&act,0,sizeof(struct sigaction));
act.sa_handler=handler;
sigemptyset(&act.sa_mask);
act.sa_flags=SA_RESTART|SA_NOCLDSTOP;
if (sigaction(signum,&act,NULL)!=0)
{
log_log(LOG_ERR,"error installing signal handler for '%s': %s",signame(signum),strerror(errno));
exit(EXIT_FAILURE);
}
}
static void worker_cleanup(void *arg)
{
MYLDAP_SESSION *session=(MYLDAP_SESSION *)arg;
myldap_session_close(session);
}
static void *worker(void UNUSED(*arg))
{
MYLDAP_SESSION *session;
/* create a new LDAP session */
session=myldap_create_session();
/* clean up the session if we're done */
pthread_cleanup_push(worker_cleanup,session);
/* start waiting for incoming connections */
while (1)
{
/* wait for a new connection */
acceptconnection(session);
}
pthread_cleanup_pop(1);
return NULL;
}
/* the main program... */
int main(int argc,char *argv[])
{
gid_t mygid=(gid_t)-1;
uid_t myuid=(uid_t)-1;
int i;
/* parse the command line */
parse_cmdline(argc,argv);
/* clear the environment */
/* TODO:implement */
/* check if we are already running */
/* FIXME: implement (maybe pass along options or commands) */
/* disable ldap lookups of host names to avoid lookup loop
and fall back to files dns (a sensible default) */
/* TODO: parse /etc/nsswitch ourselves and just remove ldap from the list */
#ifdef HAVE___NSS_CONFIGURE_LOOKUP
if (__nss_configure_lookup("hosts","files dns"))
log_log(LOG_ERR,"unable to override hosts lookup method: %s",strerror(errno));
#endif /* HAVE___NSS_CONFIGURE_LOOKUP */
/* FIXME: have some other mechanism for systems that don't have this */
/* read configuration file */
cfg_init(NSS_LDAP_PATH_CONF);
nslcd_cfg->ldc_debug=nslcd_debugging?nslcd_debugging-1:0;
/* daemonize */
if ((!nslcd_debugging)&&(daemon(0,0)<0))
{
log_log(LOG_ERR,"unable to daemonize: %s",strerror(errno));
exit(EXIT_FAILURE);
}
/* set default mode for pidfile and socket */
(void)umask((mode_t)0022);
/* intilialize logging */
if (!nslcd_debugging)
log_startlogging();
log_log(LOG_INFO,"version %s starting",VERSION);
/* install handler to close stuff off on exit and log notice */
if (atexit(exithandler))
{
log_log(LOG_ERR,"atexit() failed: %s",strerror(errno));
exit(EXIT_FAILURE);
}
/* write pidfile */
write_pidfile(NSLCD_PIDFILE);
/* create socket */
nslcd_serversocket=open_socket();
#ifdef HAVE_SETGROUPS
/* drop all supplemental groups */
if (setgroups(0,NULL)<0)
log_log(LOG_WARNING,"cannot setgroups(0,NULL) (ignored): %s",strerror(errno));
else
log_log(LOG_DEBUG,"setgroups(0,NULL) done");
#else /* HAVE_SETGROUPS */
log_log(LOG_DEBUG,"setgroups() not available");
#endif /* not HAVE_SETGROUPS */
/* change to nslcd gid */
if (mygid!=((gid_t)-1))
{
if (setgid(mygid)!=0)
{
log_log(LOG_ERR,"cannot setgid(%d): %s",(int)mygid,strerror(errno));
exit(EXIT_FAILURE);
}
log_log(LOG_DEBUG,"setgid(%d) done",(int)mygid);
}
/* change to nslcd uid */
if (myuid!=((uid_t)-1))
{
if (setuid(myuid)!=0)
{
log_log(LOG_ERR,"cannot setuid(%d): %s",(int)myuid,strerror(errno));
exit(EXIT_FAILURE);
}
log_log(LOG_DEBUG,"setuid(%d) done",(int)myuid);
}
/* install signalhandlers for some signals */
install_sighandler(SIGHUP, sigexit_handler);
install_sighandler(SIGINT, sigexit_handler);
install_sighandler(SIGQUIT,sigexit_handler);
install_sighandler(SIGABRT,sigexit_handler);
install_sighandler(SIGPIPE,SIG_IGN);
install_sighandler(SIGTERM,sigexit_handler);
install_sighandler(SIGUSR1,sigexit_handler);
install_sighandler(SIGUSR2,sigexit_handler);
/* TODO: install signal handlers for reloading configuration */
log_log(LOG_INFO,"accepting connections");
/* start worker threads */
nslcd_threads=(pthread_t *)malloc(nslcd_cfg->ldc_threads*sizeof(pthread_t));
if (nslcd_threads==NULL)
{
log_log(LOG_CRIT,"main(): malloc() failed to allocate memory");
exit(EXIT_FAILURE);
}
for (i=0;i<nslcd_cfg->ldc_threads;i++)
{
if (pthread_create(&nslcd_threads[i],NULL,worker,NULL))
{
log_log(LOG_ERR,"unable to start worker thread %d: %s",i,strerror(errno));
exit(EXIT_FAILURE);
}
}
/* wait for all threads to die */
/* BUG: this causes problems if for some reason we want to exit but one
of our threads hangs (e.g. has one of the LDAP locks)
Other than that it may be a good idea to keep this thread more or less alive
to do general house keeping things (e.g. checking signals etc) */
/* it is also better to always do thread_cancel() here instead of in the signal
handler */
for (i=0;i<nslcd_cfg->ldc_threads;i++)
{
if (pthread_join(nslcd_threads[i],NULL))
{
log_log(LOG_ERR,"unable to wait for worker thread %d: %s",i,strerror(errno));
exit(EXIT_FAILURE);
}
}
free(nslcd_threads);
/* print something about received signals */
if (nslcd_exitsignal!=0)
{
log_log(LOG_INFO,"caught signal %s (%d), shutting down",
signame(nslcd_exitsignal),nslcd_exitsignal);
}
return EXIT_FAILURE;
}

View file

@ -1,520 +0,0 @@
/*
passwd.c - password entry lookup routines
Parts of this file were part of the nss_ldap library (as ldap-pwd.c)
which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <pthread.h>
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
#include "common/dict.h"
/* ( nisSchema.2.0 NAME 'posixAccount' SUP top AUXILIARY
* DESC 'Abstraction of an account with POSIX attributes'
* MUST ( cn $ uid $ uidNumber $ gidNumber $ homeDirectory )
* MAY ( userPassword $ loginShell $ gecos $ description ) )
*/
/* the search base for searches */
const char *passwd_base = NULL;
/* the search scope for searches */
int passwd_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *passwd_filter = "(objectClass=posixAccount)";
/* the attributes used in searches */
const char *attmap_passwd_uid = "uid";
const char *attmap_passwd_userPassword = "userPassword";
const char *attmap_passwd_uidNumber = "uidNumber";
const char *attmap_passwd_gidNumber = "gidNumber";
const char *attmap_passwd_gecos = "gecos";
const char *attmap_passwd_cn = "cn";
const char *attmap_passwd_homeDirectory = "homeDirectory";
const char *attmap_passwd_loginShell = "loginShell";
/* default values for attributes */
static const char *default_passwd_userPassword = "*"; /* unmatchable */
static const char *default_passwd_homeDirectory = "";
static const char *default_passwd_loginShell = "";
/* the attribute list to request with searches */
static const char *passwd_attrs[10];
/* create a search filter for searching a passwd entry
by name, return -1 on errors */
static int mkfilter_passwd_byname(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if(myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
passwd_filter,
attmap_passwd_uid,buf2);
}
/* create a search filter for searching a passwd entry
by uid, return -1 on errors */
static int mkfilter_passwd_byuid(uid_t uid,
char *buffer,size_t buflen)
{
return mysnprintf(buffer,buflen,
"(&%s(%s=%d))",
passwd_filter,
attmap_passwd_uidNumber,uid);
}
static void passwd_init(void)
{
/* set up base */
if (passwd_base==NULL)
passwd_base=nslcd_cfg->ldc_base;
/* set up scope */
if (passwd_scope==LDAP_SCOPE_DEFAULT)
passwd_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
passwd_attrs[0]=attmap_passwd_uid;
passwd_attrs[1]=attmap_passwd_userPassword;
passwd_attrs[2]=attmap_passwd_uidNumber;
passwd_attrs[3]=attmap_passwd_gidNumber;
passwd_attrs[4]=attmap_passwd_cn;
passwd_attrs[5]=attmap_passwd_homeDirectory;
passwd_attrs[6]=attmap_passwd_loginShell;
passwd_attrs[7]=attmap_passwd_gecos;
passwd_attrs[8]="objectClass";
passwd_attrs[9]=NULL;
}
/*
Checks to see if the specified name is a valid user name.
This test is based on the definition from POSIX (IEEE Std 1003.1, 2004, 3.426 User Name
and 3.276 Portable Filename Character Set):
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_426
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html#tag_03_276
The standard defines user names valid if they contain characters from
the set [A-Za-z0-9._-] where the hyphen should not be used as first
character. As an extension this test allows the dolar '$' sign as the last
character to support Samba special accounts.
*/
int isvalidusername(const char *name)
{
int i;
if ((name==NULL)||(name[0]=='\0'))
return 0;
/* check first character */
if ( ! ( (name[0]>='A' && name[0] <= 'Z') ||
(name[0]>='a' && name[0] <= 'z') ||
(name[0]>='0' && name[0] <= '9') ||
name[0]=='.' || name[0]=='_' ) )
return 0;
/* check other characters */
for (i=1;name[i]!='\0';i++)
{
if ( name[i]=='$' )
{
/* if the char is $ we require it to be the last char */
if (name[i+1]!='\0')
return 0;
}
else if ( ! ( (name[i]>='A' && name[i] <= 'Z') ||
(name[i]>='a' && name[i] <= 'z') ||
(name[i]>='0' && name[i] <= '9') ||
name[i]=='.' || name[i]=='_' || name[i]=='-') )
return 0;
}
/* no test failed so it must be good */
return -1;
}
/* the cache that is used in dn2uid() */
static pthread_mutex_t dn2uid_cache_mutex=PTHREAD_MUTEX_INITIALIZER;
static DICT *dn2uid_cache=NULL;
struct dn2uid_cache_entry
{
time_t timestamp;
char *uid;
};
#define DN2UID_CACHE_TIMEOUT (15*60)
/* Perform an LDAP lookup to translate the DN into a uid.
This function either returns NULL or a strdup()ed string. */
static char *lookup_dn2uid(MYLDAP_SESSION *session,const char *dn)
{
MYLDAP_SEARCH *search;
MYLDAP_ENTRY *entry;
static const char *attrs[2];
int rc;
const char **values;
char *uid;
/* we have to look up the entry */
attrs[0]=attmap_passwd_uid;
attrs[1]=NULL;
search=myldap_search(session,dn,LDAP_SCOPE_BASE,passwd_filter,attrs);
if (search==NULL)
{
log_log(LOG_WARNING,"lookup of user %s failed",dn);
return NULL;
}
entry=myldap_get_entry(search,&rc);
if (entry==NULL)
{
if (rc!=LDAP_SUCCESS)
log_log(LOG_WARNING,"lookup of user %s failed: %s",dn,ldap_err2string(rc));
return NULL;
}
/* get uid (just use first one) */
values=myldap_get_values(entry,attmap_passwd_uid);
/* check the result for presence and validity */
if ((values!=NULL)&&(values[0]!=NULL)&&isvalidusername(values[0]))
uid=strdup(values[0]);
else
uid=NULL;
myldap_search_close(search);
return uid;
}
char *dn2uid(MYLDAP_SESSION *session,const char *dn,char *buf,size_t buflen)
{
struct dn2uid_cache_entry *cacheentry=NULL;
char *uid;
/* check for empty string */
if ((dn==NULL)||(*dn=='\0'))
return NULL;
/* try to look up uid within DN string */
if (myldap_cpy_rdn_value(dn,attmap_passwd_uid,buf,buflen)!=NULL)
{
/* check if it is valid */
if (!isvalidusername(buf))
return NULL;
return buf;
}
/* see if we have a cached entry */
pthread_mutex_lock(&dn2uid_cache_mutex);
if (dn2uid_cache==NULL)
dn2uid_cache=dict_new();
if ((dn2uid_cache!=NULL) && ((cacheentry=dict_get(dn2uid_cache,dn))!=NULL))
{
/* if the cached entry is still valid, return that */
if (time(NULL) < (cacheentry->timestamp+DN2UID_CACHE_TIMEOUT))
{
if ((cacheentry->uid!=NULL)&&(strlen(cacheentry->uid)<buflen))
strcpy(buf,cacheentry->uid);
else
buf=NULL;
pthread_mutex_unlock(&dn2uid_cache_mutex);
return buf;
}
/* leave the entry intact, just replace the uid below */
}
pthread_mutex_unlock(&dn2uid_cache_mutex);
/* look up the uid using an LDAP query */
uid=lookup_dn2uid(session,dn);
/* store the result in the cache */
pthread_mutex_lock(&dn2uid_cache_mutex);
if (cacheentry==NULL)
{
/* allocate a new entry in the cache */
cacheentry=(struct dn2uid_cache_entry *)malloc(sizeof(struct dn2uid_cache_entry));
if (cacheentry!=NULL)
dict_put(dn2uid_cache,dn,cacheentry);
}
else if (cacheentry->uid!=NULL)
free(cacheentry->uid);
/* update the cache entry */
if (cacheentry!=NULL)
{
cacheentry->timestamp=time(NULL);
cacheentry->uid=uid;
}
pthread_mutex_unlock(&dn2uid_cache_mutex);
/* copy the result into the buffer */
if ((uid!=NULL)&&(strlen(uid)<buflen))
strcpy(buf,uid);
else
buf=NULL;
return buf;
}
char *uid2dn(MYLDAP_SESSION *session,const char *uid,char *buf,size_t buflen)
{
MYLDAP_SEARCH *search;
MYLDAP_ENTRY *entry;
static const char *attrs[1];
int rc;
const char *dn;
char filter[1024];
/* if it isn't a valid username, just bail out now */
if (!isvalidusername(uid))
return NULL;
/* set up attributes (we don't care, we just want the DN) */
attrs[0]=NULL;
/* initialize default base, scrope, etc */
passwd_init();
/* we have to look up the entry */
mkfilter_passwd_byname(uid,filter,sizeof(filter));
search=myldap_search(session,passwd_base,passwd_scope,filter,attrs);
if (search==NULL)
return NULL;
entry=myldap_get_entry(search,&rc);
if (entry==NULL)
return NULL;
/* get DN */
dn=myldap_get_dn(entry);
if (strcasecmp(dn,"unknown")==0)
{
myldap_search_close(search);
return NULL;
}
/* copy into buffer */
if (strlen(dn)<buflen)
strcpy(buf,dn);
else
buf=NULL;
myldap_search_close(search);
return buf;
}
/* the maximum number of uidNumber attributes per entry */
#define MAXUIDS_PER_ENTRY 5
static int write_passwd(TFILE *fp,MYLDAP_ENTRY *entry,const char *requser,
const uid_t *requid)
{
int32_t tmpint32;
const char *tmparr[2];
const char **tmpvalues;
char *tmp;
const char **usernames;
const char *passwd;
uid_t uids[MAXUIDS_PER_ENTRY];
int numuids;
gid_t gid;
const char *gecos;
const char *homedir;
const char *shell;
int i,j;
/* get the usernames for this entry */
if (requser!=NULL)
{
usernames=tmparr;
usernames[0]=requser;
usernames[1]=NULL;
}
else
{
usernames=myldap_get_values(entry,attmap_passwd_uid);
if ((usernames==NULL)||(usernames[0]==NULL))
{
log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
myldap_get_dn(entry),attmap_passwd_uid);
return 0;
}
}
/* get the password for this entry */
if (myldap_has_objectclass(entry,"shadowAccount"))
{
/* if the entry has a shadowAccount entry, point to that instead */
passwd="x";
}
else
{
passwd=get_userpassword(entry,attmap_passwd_userPassword);
if (passwd==NULL)
passwd=default_passwd_userPassword;
}
/* get the uids for this entry */
if (requid!=NULL)
{
uids[0]=*requid;
numuids=1;
}
else
{
tmpvalues=myldap_get_values(entry,attmap_passwd_uidNumber);
if ((tmpvalues==NULL)||(tmpvalues[0]==NULL))
{
log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
myldap_get_dn(entry),attmap_passwd_uidNumber);
return 0;
}
for (numuids=0;(numuids<=MAXUIDS_PER_ENTRY)&&(tmpvalues[numuids]!=NULL);numuids++)
{
uids[numuids]=(uid_t)strtol(tmpvalues[numuids],&tmp,0);
if ((*(tmpvalues[numuids])=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"passwd entry %s contains non-numeric %s value",
myldap_get_dn(entry),attmap_passwd_uidNumber);
return 0;
}
}
}
/* get the gid for this entry */
tmpvalues=myldap_get_values(entry,attmap_passwd_gidNumber);
if ((tmpvalues==NULL)||(tmpvalues[0]==NULL))
{
log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
myldap_get_dn(entry),attmap_passwd_gidNumber);
return 0;
}
else if (tmpvalues[1]!=NULL)
{
log_log(LOG_WARNING,"passwd entry %s contains multiple %s values",
myldap_get_dn(entry),attmap_passwd_gidNumber);
}
gid=(gid_t)strtol(tmpvalues[0],&tmp,0);
if ((*(tmpvalues[0])=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"passwd entry %s contains non-numeric %s value",
myldap_get_dn(entry),attmap_passwd_gidNumber);
return 0;
}
/* get the gecos for this entry (fall back to cn) */
tmpvalues=myldap_get_values(entry,attmap_passwd_gecos);
if ((tmpvalues==NULL)||(tmpvalues[0]==NULL))
tmpvalues=myldap_get_values(entry,attmap_passwd_cn);
if ((tmpvalues==NULL)||(tmpvalues[0]==NULL))
{
log_log(LOG_WARNING,"passwd entry %s does not contain %s or %s value",
myldap_get_dn(entry),attmap_passwd_gecos,attmap_passwd_cn);
return 0;
}
else if (tmpvalues[1]!=NULL)
{
log_log(LOG_WARNING,"passwd entry %s contains multiple %s or %s values",
myldap_get_dn(entry),attmap_passwd_gecos,attmap_passwd_cn);
}
gecos=tmpvalues[0];
/* get the home directory for this entry */
tmpvalues=myldap_get_values(entry,attmap_passwd_homeDirectory);
if ((tmpvalues==NULL)||(tmpvalues[0]==NULL))
{
log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
myldap_get_dn(entry),attmap_passwd_homeDirectory);
homedir=default_passwd_homeDirectory;
}
else
{
if (tmpvalues[1]!=NULL)
{
log_log(LOG_WARNING,"passwd entry %s contains multiple %s values",
myldap_get_dn(entry),attmap_passwd_homeDirectory);
}
homedir=tmpvalues[0];
if (*homedir=='\0')
homedir=default_passwd_homeDirectory;
}
/* get the shell for this entry */
tmpvalues=myldap_get_values(entry,attmap_passwd_loginShell);
if ((tmpvalues==NULL)||(tmpvalues[0]==NULL))
{
shell=default_passwd_loginShell;
}
else
{
if (tmpvalues[1]!=NULL)
{
log_log(LOG_WARNING,"passwd entry %s contains multiple %s values",
myldap_get_dn(entry),attmap_passwd_loginShell);
}
shell=tmpvalues[0];
if (*shell=='\0')
shell=default_passwd_loginShell;
}
/* write the entries */
for (i=0;usernames[i]!=NULL;i++)
{
if (!isvalidusername(usernames[i]))
{
log_log(LOG_WARNING,"passwd entry %s contains invalid user name: \"%s\"",
myldap_get_dn(entry),usernames[i]);
}
else
{
for (j=0;j<numuids;j++)
{
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_STRING(fp,usernames[i]);
WRITE_STRING(fp,passwd);
WRITE_TYPE(fp,uids[j],uid_t);
WRITE_TYPE(fp,gid,gid_t);
WRITE_STRING(fp,gecos);
WRITE_STRING(fp,homedir);
WRITE_STRING(fp,shell);
}
}
}
return 0;
}
NSLCD_HANDLE(
passwd,byname,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));
if (!isvalidusername(name)) {
log_log(LOG_WARNING,"nslcd_passwd_byname(%s): invalid user name",name);
return -1;
},
log_log(LOG_DEBUG,"nslcd_passwd_byname(%s)",name);,
NSLCD_ACTION_PASSWD_BYNAME,
mkfilter_passwd_byname(name,filter,sizeof(filter)),
write_passwd(fp,entry,name,NULL)
)
NSLCD_HANDLE(
passwd,byuid,
uid_t uid;
char filter[1024];
READ_TYPE(fp,uid,uid_t);,
log_log(LOG_DEBUG,"nslcd_passwd_byuid(%d)",(int)uid);,
NSLCD_ACTION_PASSWD_BYUID,
mkfilter_passwd_byuid(uid,filter,sizeof(filter)),
write_passwd(fp,entry,NULL,&uid)
)
NSLCD_HANDLE(
passwd,all,
const char *filter;
/* no parameters to read */,
log_log(LOG_DEBUG,"nslcd_passwd_all()");,
NSLCD_ACTION_PASSWD_ALL,
(filter=passwd_filter,0),
write_passwd(fp,entry,NULL,NULL)
)

View file

@ -1,180 +0,0 @@
/*
protocol.c - network address entry lookup routines
Parts of this file were part of the nss_ldap library (as ldap-proto.c)
which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
/* ( nisSchema.2.4 NAME 'ipProtocol' SUP top STRUCTURAL
* DESC 'Abstraction of an IP protocol. Maps a protocol number
* to one or more names. The distinguished value of the cn
* attribute denotes the protocol's canonical name'
* MUST ( cn $ ipProtocolNumber )
* MAY description )
*/
/* the search base for searches */
const char *protocol_base = NULL;
/* the search scope for searches */
int protocol_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *protocol_filter = "(objectClass=ipProtocol)";
/* the attributes used in searches */
const char *attmap_protocol_cn = "cn";
const char *attmap_protocol_ipProtocolNumber = "ipProtocolNumber";
/* the attribute list to request with searches */
static const char *protocol_attrs[3];
static int mkfilter_protocol_byname(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if (myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
protocol_filter,
attmap_protocol_cn,buf2);
}
/* create a search filter for searching a protocol entry
by uid, return -1 on errors */
static int mkfilter_protocol_bynumber(int protocol,
char *buffer,size_t buflen)
{
return mysnprintf(buffer,buflen,
"(&%s(%s=%d))",
protocol_filter,
attmap_protocol_ipProtocolNumber,protocol);
}
static void protocol_init(void)
{
/* set up base */
if (protocol_base==NULL)
protocol_base=nslcd_cfg->ldc_base;
/* set up scope */
if (protocol_scope==LDAP_SCOPE_DEFAULT)
protocol_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
protocol_attrs[0]=attmap_protocol_cn;
protocol_attrs[1]=attmap_protocol_ipProtocolNumber;
protocol_attrs[2]=NULL;
}
static int write_protocol(TFILE *fp,MYLDAP_ENTRY *entry)
{
int32_t tmpint32,tmp2int32,tmp3int32;
const char *name;
const char **aliases;
const char **protos;
char *tmp;
int proto;
/* get the most canonical name */
name=myldap_get_rdn_value(entry,attmap_protocol_cn);
/* get the other names for the protocol */
aliases=myldap_get_values(entry,attmap_protocol_cn);
if ((aliases==NULL)||(aliases[0]==NULL))
{
log_log(LOG_WARNING,"protocol entry %s does not contain %s value",
myldap_get_dn(entry),attmap_protocol_cn);
return 0;
}
/* if the protocol name is not yet found, get the first entry */
if (name==NULL)
name=aliases[0];
/* get the protocol number */
protos=myldap_get_values(entry,attmap_protocol_ipProtocolNumber);
if ((protos==NULL)||(protos[0]==NULL))
{
log_log(LOG_WARNING,"protocol entry %s does not contain %s value",
myldap_get_dn(entry),attmap_protocol_ipProtocolNumber);
return 0;
}
else if (protos[1]!=NULL)
{
log_log(LOG_WARNING,"protocol entry %s contains multiple %s values",
myldap_get_dn(entry),attmap_protocol_ipProtocolNumber);
}
proto=(int)strtol(protos[0],&tmp,0);
if ((*(protos[0])=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"protocol entry %s contains non-numeric %s value",
myldap_get_dn(entry),attmap_protocol_ipProtocolNumber);
return 0;
}
/* write entry */
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_STRING(fp,name);
WRITE_STRINGLIST_EXCEPT(fp,aliases,name);
WRITE_INT32(fp,proto);
return 0;
}
NSLCD_HANDLE(
protocol,byname,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));,
log_log(LOG_DEBUG,"nslcd_protocol_byname(%s)",name);,
NSLCD_ACTION_PROTOCOL_BYNAME,
mkfilter_protocol_byname(name,filter,sizeof(filter)),
write_protocol(fp,entry)
)
NSLCD_HANDLE(
protocol,bynumber,
int protocol;
char filter[1024];
READ_INT32(fp,protocol);,
log_log(LOG_DEBUG,"nslcd_protocol_bynumber(%d)",protocol);,
NSLCD_ACTION_PROTOCOL_BYNUMBER,
mkfilter_protocol_bynumber(protocol,filter,sizeof(filter)),
write_protocol(fp,entry)
)
NSLCD_HANDLE(
protocol,all,
const char *filter;
/* no parameters to read */,
log_log(LOG_DEBUG,"nslcd_protocol_all()");,
NSLCD_ACTION_PROTOCOL_ALL,
(filter=protocol_filter,0),
write_protocol(fp,entry)
)

View file

@ -1,181 +0,0 @@
/*
rpc.c - rpc name lookup routines
Parts of this file were part of the nss_ldap library (as ldap-rpc.c) which
has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
/* ( nisSchema.2.5 NAME 'oncRpc' SUP top STRUCTURAL
* DESC 'Abstraction of an Open Network Computing (ONC)
* [RFC1057] Remote Procedure Call (RPC) binding.
* This class maps an ONC RPC number to a name.
* The distinguished value of the cn attribute denotes
* the RPC service's canonical name'
* MUST ( cn $ oncRpcNumber )
* MAY description )
*/
/* the search base for searches */
const char *rpc_base = NULL;
/* the search scope for searches */
int rpc_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *rpc_filter = "(objectClass=oncRpc)";
/* the attributes to request with searches */
const char *attmap_rpc_cn = "cn";
const char *attmap_rpc_oncRpcNumber = "oncRpcNumber";
/* the attribute list to request with searches */
static const char *rpc_attrs[3];
static int mkfilter_rpc_byname(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if (myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
rpc_filter,
attmap_rpc_cn,buf2);
}
static int mkfilter_rpc_bynumber(int number,
char *buffer,size_t buflen)
{
return mysnprintf(buffer,buflen,
"(&%s(%s=%d))",
rpc_filter,
attmap_rpc_oncRpcNumber,number);
}
static void rpc_init(void)
{
/* set up base */
if (rpc_base==NULL)
rpc_base=nslcd_cfg->ldc_base;
/* set up scope */
if (rpc_scope==LDAP_SCOPE_DEFAULT)
rpc_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
rpc_attrs[0]=attmap_rpc_cn;
rpc_attrs[1]=attmap_rpc_oncRpcNumber;
rpc_attrs[2]=NULL;
}
/* write a single rpc entry to the stream */
static int write_rpc(TFILE *fp,MYLDAP_ENTRY *entry)
{
int32_t tmpint32,tmp2int32,tmp3int32;
const char *name;
const char **aliases;
const char **numbers;
char *tmp;
int number;
/* get the most canonical name */
name=myldap_get_rdn_value(entry,attmap_rpc_cn);
/* get the other names for the rpc entries */
aliases=myldap_get_values(entry,attmap_rpc_cn);
if ((aliases==NULL)||(aliases[0]==NULL))
{
log_log(LOG_WARNING,"rpc entry %s does not contain %s value",
myldap_get_dn(entry),attmap_rpc_cn);
return 0;
}
/* if the rpc name is not yet found, get the first entry */
if (name==NULL)
name=aliases[0];
/* get the rpc number */
numbers=myldap_get_values(entry,attmap_rpc_oncRpcNumber);
if ((numbers==NULL)||(numbers[0]==NULL))
{
log_log(LOG_WARNING,"rpc entry %s does not contain %s value",
myldap_get_dn(entry),attmap_rpc_oncRpcNumber);
return 0;
}
else if (numbers[1]!=NULL)
{
log_log(LOG_WARNING,"rpc entry %s contains multiple %s values",
myldap_get_dn(entry),attmap_rpc_oncRpcNumber);
}
number=(int)strtol(numbers[0],&tmp,0);
if ((*(numbers[0])=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"rpc entry %s contains non-numeric %s value",
myldap_get_dn(entry),attmap_rpc_oncRpcNumber);
return 0;
}
/* write the entry */
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_STRING(fp,name);
WRITE_STRINGLIST_EXCEPT(fp,aliases,name);
WRITE_INT32(fp,number);
return 0;
}
NSLCD_HANDLE(
rpc,byname,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));,
log_log(LOG_DEBUG,"nslcd_rpc_byname(%s)",name);,
NSLCD_ACTION_RPC_BYNAME,
mkfilter_rpc_byname(name,filter,sizeof(filter)),
write_rpc(fp,entry)
)
NSLCD_HANDLE(
rpc,bynumber,
int number;
char filter[1024];
READ_INT32(fp,number);,
log_log(LOG_DEBUG,"nslcd_rpc_bynumber(%d)",number);,
NSLCD_ACTION_RPC_BYNUMBER,
mkfilter_rpc_bynumber(number,filter,sizeof(filter)),
write_rpc(fp,entry)
)
NSLCD_HANDLE(
rpc,all,
const char *filter;
/* no parameters to read */,
log_log(LOG_DEBUG,"nslcd_rpc_all()");,
NSLCD_ACTION_RPC_ALL,
(filter=rpc_filter,0),
write_rpc(fp,entry)
)

View file

@ -1,235 +0,0 @@
/*
service.c - service entry lookup routines
Parts of this file were part of the nss_ldap library (as ldap-service.c)
which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
/* ( nisSchema.2.3 NAME 'ipService' SUP top STRUCTURAL
* DESC 'Abstraction an Internet Protocol service.
* Maps an IP port and protocol (such as tcp or udp)
* to one or more names; the distinguished value of
* the cn attribute denotes the service's canonical
* name'
* MUST ( cn $ ipServicePort $ ipServiceProtocol )
* MAY ( description ) )
*/
/* the search base for searches */
const char *service_base = NULL;
/* the search scope for searches */
int service_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *service_filter = "(objectClass=ipService)";
/* the attributes to request with searches */
const char *attmap_service_cn = "cn";
const char *attmap_service_ipServicePort = "ipServicePort";
const char *attmap_service_ipServiceProtocol = "ipServiceProtocol";
/* the attribute list to request with searches */
static const char *service_attrs[4];
static int mkfilter_service_byname(const char *name,
const char *protocol,
char *buffer,size_t buflen)
{
char buf2[1024],buf3[1024];
/* escape attributes */
if (myldap_escape(name,buf2,sizeof(buf2)))
return -1;
if (*protocol!='\0')
if (myldap_escape(protocol,buf3,sizeof(buf3)))
return -1;
/* build filter */
if (*protocol!='\0')
return mysnprintf(buffer,buflen,
"(&%s(%s=%s)(%s=%s))",
service_filter,
attmap_service_cn,buf2,
attmap_service_ipServiceProtocol,buf3);
else
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
service_filter,
attmap_service_cn,buf2);
}
static int mkfilter_service_bynumber(int number,
const char *protocol,
char *buffer,size_t buflen)
{
char buf3[1024];
/* escape attribute */
if (*protocol!='\0')
if (myldap_escape(protocol,buf3,sizeof(buf3)))
return -1;
/* build filter */
if (*protocol!='\0')
return mysnprintf(buffer,buflen,
"(&%s(%s=%d)(%s=%s))",
service_filter,
attmap_service_ipServicePort,number,
attmap_service_ipServiceProtocol,buf3);
else
return mysnprintf(buffer,buflen,
"(&%s(%s=%d))",
service_filter,
attmap_service_ipServicePort,number);
}
static void service_init(void)
{
/* set up base */
if (service_base==NULL)
service_base=nslcd_cfg->ldc_base;
/* set up scope */
if (service_scope==LDAP_SCOPE_DEFAULT)
service_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
service_attrs[0]=attmap_service_cn;
service_attrs[1]=attmap_service_ipServicePort;
service_attrs[2]=attmap_service_ipServiceProtocol;
service_attrs[3]=NULL;
}
static int write_service(TFILE *fp,MYLDAP_ENTRY *entry,const char *reqprotocol)
{
int32_t tmpint32,tmp2int32,tmp3int32;
const char *name;
const char **aliases;
const char **ports;
const char **protocols;
const char *tmparr[2];
char *tmp;
int port;
int i;
/* get the most canonical name */
name=myldap_get_rdn_value(entry,attmap_service_cn);
/* get the other names for the service entries */
aliases=myldap_get_values(entry,attmap_service_cn);
if ((aliases==NULL)||(aliases[0]==NULL))
{
log_log(LOG_WARNING,"service entry %s does not contain %s value",
myldap_get_dn(entry),attmap_service_cn);
return 0;
}
/* if the service name is not yet found, get the first entry */
if (name==NULL)
name=aliases[0];
/* get the service number */
ports=myldap_get_values(entry,attmap_service_ipServicePort);
if ((ports==NULL)||(ports[0]==NULL))
{
log_log(LOG_WARNING,"service entry %s does not contain %s value",
myldap_get_dn(entry),attmap_service_ipServicePort);
return 0;
}
else if (ports[1]!=NULL)
{
log_log(LOG_WARNING,"service entry %s contains multiple %s values",
myldap_get_dn(entry),attmap_service_ipServicePort);
}
port=(int)strtol(ports[0],&tmp,0);
if ((*(ports[0])=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"service entry %s contains non-numeric %s value",
myldap_get_dn(entry),attmap_service_ipServicePort);
return 0;
}
/* get protocols */
if ((reqprotocol!=NULL)&&(*reqprotocol!='\0'))
{
protocols=tmparr;
protocols[0]=reqprotocol;
protocols[1]=NULL;
}
else
{
protocols=myldap_get_values(entry,attmap_service_ipServiceProtocol);
if ((protocols==NULL)||(protocols[0]==NULL))
{
log_log(LOG_WARNING,"service entry %s does not contain %s value",
myldap_get_dn(entry),attmap_service_ipServiceProtocol);
return 0;
}
}
/* write the entries */
for (i=0;protocols[i]!=NULL;i++)
{
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_STRING(fp,name);
WRITE_STRINGLIST_EXCEPT(fp,aliases,name);
WRITE_INT32(fp,port);
WRITE_STRING(fp,protocols[i]);
}
return 0;
}
NSLCD_HANDLE(
service,byname,
char name[256];
char protocol[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));
READ_STRING_BUF2(fp,protocol,sizeof(protocol));,
log_log(LOG_DEBUG,"nslcd_service_byname(%s,%s)",name,protocol);,
NSLCD_ACTION_SERVICE_BYNAME,
mkfilter_service_byname(name,protocol,filter,sizeof(filter)),
write_service(fp,entry,protocol)
)
NSLCD_HANDLE(
service,bynumber,
int number;
char protocol[256];
char filter[1024];
READ_INT32(fp,number);
READ_STRING_BUF2(fp,protocol,sizeof(protocol));,
log_log(LOG_DEBUG,"nslcd_service_bynumber(%d,%s)",number,protocol);,
NSLCD_ACTION_SERVICE_BYNUMBER,
mkfilter_service_bynumber(number,protocol,filter,sizeof(filter)),
write_service(fp,entry,protocol)
)
NSLCD_HANDLE(
service,all,
const char *filter;
/* no parameters to read */,
log_log(LOG_DEBUG,"nslcd_service_all()");,
NSLCD_ACTION_SERVICE_ALL,
(filter=service_filter,0),
write_service(fp,entry,NULL)
)

View file

@ -1,284 +0,0 @@
/*
shadow.c - service entry lookup routines
Parts of this file were part of the nss_ldap library (as ldap-spwd.c)
which has been forked into the nss-ldapd library.
Copyright (C) 1997-2005 Luke Howard
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#include "log.h"
#include "myldap.h"
#include "cfg.h"
#include "attmap.h"
/* ( nisSchema.2.1 NAME 'shadowAccount' SUP top AUXILIARY
* DESC 'Additional attributes for shadow passwords'
* MUST uid
* MAY ( userPassword $ shadowLastChange $ shadowMin
* shadowMax $ shadowWarning $ shadowInactive $
* shadowExpire $ shadowFlag $ description ) )
*/
/* the search base for searches */
const char *shadow_base = NULL;
/* the search scope for searches */
int shadow_scope = LDAP_SCOPE_DEFAULT;
/* the basic search filter for searches */
const char *shadow_filter = "(objectClass=shadowAccount)";
/* the attributes to request with searches */
const char *attmap_shadow_uid = "uid";
const char *attmap_shadow_userPassword = "userPassword";
const char *attmap_shadow_shadowLastChange = "shadowLastChange";
const char *attmap_shadow_shadowMin = "shadowMin";
const char *attmap_shadow_shadowMax = "shadowMax";
const char *attmap_shadow_shadowWarning = "shadowWarning";
const char *attmap_shadow_shadowInactive = "shadowInactive";
const char *attmap_shadow_shadowExpire = "shadowExpire";
const char *attmap_shadow_shadowFlag = "shadowFlag";
/* default values for attributes */
static const char *default_shadow_userPassword = "*"; /* unmatchable */
static const char *default_shadow_shadowLastChange = "-1";
static const char *default_shadow_shadowMin = "-1";
static const char *default_shadow_shadowMax = "-1";
static const char *default_shadow_shadowWarning = "-1";
static const char *default_shadow_shadowInactive = "-1";
static const char *default_shadow_shadowExpire = "-1";
static const char *default_shadow_shadowFlag = "0";
/* the attribute list to request with searches */
static const char *shadow_attrs[10];
static int mkfilter_shadow_byname(const char *name,
char *buffer,size_t buflen)
{
char buf2[1024];
/* escape attribute */
if(myldap_escape(name,buf2,sizeof(buf2)))
return -1;
/* build filter */
return mysnprintf(buffer,buflen,
"(&%s(%s=%s))",
shadow_filter,
attmap_shadow_uid,buf2);
}
static void shadow_init(void)
{
/* set up base */
if (shadow_base==NULL)
shadow_base=nslcd_cfg->ldc_base;
/* set up scope */
if (shadow_scope==LDAP_SCOPE_DEFAULT)
shadow_scope=nslcd_cfg->ldc_scope;
/* set up attribute list */
shadow_attrs[0]=attmap_shadow_uid;
shadow_attrs[1]=attmap_shadow_userPassword;
shadow_attrs[2]=attmap_shadow_shadowLastChange;
shadow_attrs[3]=attmap_shadow_shadowMax;
shadow_attrs[4]=attmap_shadow_shadowMin;
shadow_attrs[5]=attmap_shadow_shadowWarning;
shadow_attrs[6]=attmap_shadow_shadowInactive;
shadow_attrs[7]=attmap_shadow_shadowExpire;
shadow_attrs[8]=attmap_shadow_shadowFlag;
shadow_attrs[9]=NULL;
}
static long to_date(const char *date,const char *attr)
{
char buffer[8];
long value;
char *tmp;
size_t l;
/* do some special handling for date values on AD */
if (strcasecmp(attr,"pwdLastSet")==0)
{
/* we expect an AD 64-bit datetime value;
we should do date=date/864000000000-134774
but that causes problems on 32-bit platforms,
first we devide by 1000000000 by stripping the
last 9 digits from the string and going from there */
l=strlen(date)-9;
if (l>(sizeof(buffer)-1))
return 0; /* error */
strncpy(buffer,date,l);
buffer[l]='\0';
value=strtol(date,&tmp,0);
if ((*date=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"shadow entry contains non-numeric %s value",attr);
return 0;
}
return value/864-134774;
/* note that AD does not have expiry dates but a lastchangeddate
and some value that needs to be added */
}
value=strtol(date,&tmp,0);
if ((*date=='\0')||(*tmp!='\0'))
{
log_log(LOG_WARNING,"shadow entry contains non-numeric %s value",attr);
return 0;
}
return value;
}
#ifndef UF_DONT_EXPIRE_PASSWD
#define UF_DONT_EXPIRE_PASSWD 0x10000
#endif
#define GET_OPTIONAL_LONG(var,att) \
tmpvalues=myldap_get_values(entry,attmap_shadow_##att); \
if ((tmpvalues==NULL)||(tmpvalues[0]==NULL)) \
var=strtol(default_shadow_##att,NULL,0); \
else \
{ \
if (tmpvalues[1]!=NULL) \
{ \
log_log(LOG_WARNING,"shadow entry %s contains multiple %s values", \
myldap_get_dn(entry),attmap_shadow_##att); \
} \
var=strtol(tmpvalues[0],&tmp,0); \
if ((*(tmpvalues[0])=='\0')||(*tmp!='\0')) \
{ \
log_log(LOG_WARNING,"shadow entry %s contains non-numeric %s value", \
myldap_get_dn(entry),attmap_shadow_##att); \
return 0; \
} \
}
#define GET_OPTIONAL_DATE(var,att) \
tmpvalues=myldap_get_values(entry,attmap_shadow_##att); \
if ((tmpvalues==NULL)||(tmpvalues[0]==NULL)) \
var=to_date(default_shadow_##att,attmap_shadow_##att); \
else \
{ \
if (tmpvalues[1]!=NULL) \
{ \
log_log(LOG_WARNING,"shadow entry %s contains multiple %s values", \
myldap_get_dn(entry),attmap_shadow_##att); \
} \
var=to_date(tmpvalues[0],attmap_shadow_##att); \
}
static int write_shadow(TFILE *fp,MYLDAP_ENTRY *entry,const char *requser)
{
int32_t tmpint32;
const char *tmparr[2];
const char **tmpvalues;
char *tmp;
const char **usernames;
const char *passwd;
long lastchangedate;
long mindays;
long maxdays;
long warndays;
long inactdays;
long expiredate;
unsigned long flag;
int i;
/* get username */
if (requser!=NULL)
{
usernames=tmparr;
usernames[0]=requser;
usernames[1]=NULL;
}
else
{
usernames=myldap_get_values(entry,attmap_shadow_uid);
if ((usernames==NULL)||(usernames[0]==NULL))
{
log_log(LOG_WARNING,"passwd entry %s does not contain %s value",
myldap_get_dn(entry),attmap_shadow_uid);
return 0;
}
}
/* get password */
passwd=get_userpassword(entry,attmap_shadow_userPassword);
if (passwd==NULL)
passwd=default_shadow_userPassword;
/* get lastchange date */
GET_OPTIONAL_DATE(lastchangedate,shadowLastChange);
/* get mindays */
GET_OPTIONAL_LONG(mindays,shadowMin);
/* get maxdays */
GET_OPTIONAL_LONG(maxdays,shadowMax);
/* get warndays */
GET_OPTIONAL_LONG(warndays,shadowWarning);
/* get inactdays */
GET_OPTIONAL_LONG(inactdays,shadowInactive);
/* get expire date */
GET_OPTIONAL_LONG(expiredate,shadowExpire);
/* get flag */
GET_OPTIONAL_LONG(flag,shadowFlag);
/* if we're using AD handle the flag specially */
if (strcasecmp(attmap_shadow_shadowLastChange,"pwdLastSet")==0)
{
if (flag&UF_DONT_EXPIRE_PASSWD)
maxdays=99999;
flag=0;
}
/* write the entries */
for (i=0;usernames[i]!=NULL;i++)
{
WRITE_INT32(fp,NSLCD_RESULT_SUCCESS);
WRITE_STRING(fp,usernames[i]);
WRITE_STRING(fp,passwd);
WRITE_INT32(fp,lastchangedate);
WRITE_INT32(fp,mindays);
WRITE_INT32(fp,maxdays);
WRITE_INT32(fp,warndays);
WRITE_INT32(fp,inactdays);
WRITE_INT32(fp,expiredate);
WRITE_INT32(fp,flag);
}
return 0;
}
NSLCD_HANDLE(
shadow,byname,
char name[256];
char filter[1024];
READ_STRING_BUF2(fp,name,sizeof(name));,
log_log(LOG_DEBUG,"nslcd_shadow_byname(%s)",name);,
NSLCD_ACTION_SHADOW_BYNAME,
mkfilter_shadow_byname(name,filter,sizeof(filter)),
write_shadow(fp,entry,name)
)
NSLCD_HANDLE(
shadow,all,
const char *filter;
/* no parameters to read */,
log_log(LOG_DEBUG,"nslcd_shadow_all()");,
NSLCD_ACTION_SHADOW_ALL,
(filter=shadow_filter,0),
write_shadow(fp,entry,NULL)
)

View file

@ -1,138 +0,0 @@
# This is the configuration file for the LDAP nameservice
# switch library's nslcd daemon. It configures the mapping
# between NSS names (see /etc/nsswitch.conf) and LDAP
# information in the directory.
# See the manual page nss-ldapd.conf(5) for more information.
# The uri pointing to the LDAP server to use for name lookups.
# Mulitple entries may be specified. The address that is used
# here should be resolvable without using LDAP (obviously).
#uri ldap://127.0.0.1/
#uri ldaps://127.0.0.1/
#uri ldapi://%2fvar%2frun%2fldapi_sock/
# Note: %2f encodes the '/' used as directory separator
uri ldap://127.0.0.1/
# The LDAP version to use (defaults to 3
# if supported by client library)
#ldap_version 3
# The distinguished name of the search base.
base dc=example,dc=net
# The distinguished name to bind to the server with.
# Optional: default is to bind anonymously.
#binddn cn=proxyuser,dc=padl,dc=com
# The credentials to bind with.
# Optional: default is no credentials.
#bindpw secret
# The default search scope.
#scope sub
#scope one
#scope base
# Customize certain database lookups.
#base group ou=Groups,dc=example,dc=net
#base passwd ou=People,dc=example,dc=net
#base shadow ou=People,dc=example,dc=net
#scope group onelevel
#scope hosts sub
# Bind/connect timelimit.
#bind_timelimit 30
# Search timelimit.
#timelimit 30
# Idle timelimit. nslcd will close connections if the
# server has not been contacted for the number of seconds.
#idle_timelimit 3600
# Netscape SDK LDAPS
#ssl on
# Netscape SDK SSL options
#sslpath /etc/ssl/certs
# OpenLDAP SSL mechanism
# start_tls mechanism uses the normal LDAP port, LDAPS typically 636
#ssl start_tls
#ssl on
# OpenLDAP SSL options
# Require and verify server certificate (yes/no)
# Default is to use libldap's default behavior, which can be configured in
# /etc/openldap/ldap.conf using the TLS_REQCERT setting. The default for
# OpenLDAP 2.0 and earlier is "no", for 2.1 and later is "yes".
#tls_checkpeer yes
# CA certificates for server certificate verification
# At least one of these are required if tls_checkpeer is "yes"
#tls_cacertdir /etc/ssl/certs
#tls_cacertfile /etc/ssl/ca.cert
# Seed the PRNG if /dev/urandom is not provided
#tls_randfile /var/run/egd-pool
# SSL cipher suite
# See man ciphers for syntax
#tls_ciphers TLSv1
# Client certificate and key
# Use these, if your server requires client authentication.
#tls_cert
#tls_key
# NDS mappings
#map group uniqueMember member
# Mappings for Services for UNIX 3.5
#filter passwd (objectClass=User)
#map passwd uid msSFU30Name
#map passwd userPassword msSFU30Password
#map passwd homeDirectory msSFU30HomeDirectory
#map passwd homeDirectory msSFUHomeDirectory
#filter shadow (objectClass=User)
#map shadow uid msSFU30Name
#map shadow userPassword msSFU30Password
#filter group (objectClass=Group)
#map group uniqueMember msSFU30PosixMember
# Mappings for Services for UNIX 2.0
#filter passwd (objectClass=User)
#map passwd uid msSFUName
#map passwd userPassword msSFUPassword
#map passwd homeDirectory msSFUHomeDirectory
#map passwd cn msSFUName
#filter shadow (objectClass=User)
#map shadow uid msSFUName
#map shadow userPassword msSFUPassword
#map shadow shadowLastChange pwdLastSet
#filter group (objectClass=Group)
#map group uniqueMember posixMember
# Mappings for Active Directory
#pagesize 1000
#referrals off
#filter passwd (objectClass=user)
#map passwd uid sAMAccountName
#map passwd homeDirectory unixHomeDirectory
#map passwd gecos name
#filter shadow (objectClass=user)
#map shadow uid sAMAccountName
#map shadow shadowLastChange pwdLastSet
#filter group (objectClass=group)
#map group uniqueMember member
# Mappings for AIX SecureWay
#filter passwd (objectClass=aixAccount)
#map passwd uid userName
#map passwd userPassword passwordChar
#map passwd uidNumber uid
#map passwd gidNumber gid
#filter group (objectClass=aixAccessGroup)
#map group cn groupName
#map group uniqueMember member
#map group gidNumber gid

View file

@ -1,50 +0,0 @@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2006 Luke Howard
# Copyright (C) 2006 West Consulting
# Copyright (C) 2006, 2007 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
noinst_PROGRAMS = nss_ldap.so
AM_CPPFLAGS=-I$(top_srcdir)
AM_CFLAGS = -fPIC
# determin version numbers to use in installed files
NSS_VERS = 2
NSS_LDAP_NSS_VERSIONED = libnss_ldap.so.$(NSS_VERS)
nss_ldap_so_SOURCES = common.c common.h prototypes.h \
../nslcd.h ../nslcd-common.h \
../compat/attrs.h \
aliases.c ethers.c group.c hosts.c netgroup.c \
networks.c passwd.c protocols.c rpc.c services.c \
shadow.c pam.c
nss_ldap_so_LDFLAGS = -shared -Wl,-soname,$(NSS_LDAP_NSS_VERSIONED) \
-Wl,--version-script,\$(srcdir)/exports.linux
nss_ldap_so_LDADD = @nss_ldap_so_LIBS@ ../common/libtio.a -lpam
EXTRA_DIST = exports.linux
install-exec-local: install-nss_ldap_so
uninstall-local: uninstall-nss_ldap_so
# install libnss_ldap.so.2
install-nss_ldap_so: nss_ldap.so
$(INSTALL_PROGRAM) -D nss_ldap.so $(DESTDIR)$(libdir)/$(NSS_LDAP_NSS_VERSIONED)
uninstall-nss_ldap_so:
-rm -f $(DESTDIR)$(libdir)/$(NSS_LDAP_NSS_VERSIONED)

View file

@ -1,474 +0,0 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2006 Luke Howard
# Copyright (C) 2006 West Consulting
# Copyright (C) 2006, 2007 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
noinst_PROGRAMS = nss_ldap.so$(EXEEXT)
subdir = nss
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(noinst_PROGRAMS)
am_nss_ldap_so_OBJECTS = common.$(OBJEXT) aliases.$(OBJEXT) \
ethers.$(OBJEXT) group.$(OBJEXT) hosts.$(OBJEXT) \
netgroup.$(OBJEXT) networks.$(OBJEXT) passwd.$(OBJEXT) \
protocols.$(OBJEXT) rpc.$(OBJEXT) services.$(OBJEXT) \
shadow.$(OBJEXT) pam.$(OBJEXT)
nss_ldap_so_OBJECTS = $(am_nss_ldap_so_OBJECTS)
nss_ldap_so_DEPENDENCIES = ../common/libtio.a
nss_ldap_so_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(nss_ldap_so_LDFLAGS) $(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(nss_ldap_so_SOURCES)
DIST_SOURCES = $(nss_ldap_so_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOCBOOK2X_MAN = @DOCBOOK2X_MAN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NSLCD_PIDFILE = @NSLCD_PIDFILE@
NSLCD_SOCKET = @NSLCD_SOCKET@
NSS_LDAP_PATH_CONF = @NSS_LDAP_PATH_CONF@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RELEASE_MONTH = @RELEASE_MONTH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
acx_pthread_config = @acx_pthread_config@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
nslcd_LIBS = @nslcd_LIBS@
nss_ldap_so_LIBS = @nss_ldap_so_LIBS@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = -fPIC
# determin version numbers to use in installed files
NSS_VERS = 2
NSS_LDAP_NSS_VERSIONED = libnss_ldap.so.$(NSS_VERS)
nss_ldap_so_SOURCES = common.c common.h prototypes.h \
../nslcd.h ../nslcd-common.h \
../compat/attrs.h \
aliases.c ethers.c group.c hosts.c netgroup.c \
networks.c passwd.c protocols.c rpc.c services.c \
shadow.c pam.c
nss_ldap_so_LDFLAGS = -shared -Wl,-soname,$(NSS_LDAP_NSS_VERSIONED) \
-Wl,--version-script,\$(srcdir)/exports.linux
nss_ldap_so_LDADD = @nss_ldap_so_LIBS@ ../common/libtio.a -lpam
EXTRA_DIST = exports.linux
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu nss/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu nss/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
nss_ldap.so$(EXEEXT): $(nss_ldap_so_OBJECTS) $(nss_ldap_so_DEPENDENCIES)
@rm -f nss_ldap.so$(EXEEXT)
$(nss_ldap_so_LINK) $(nss_ldap_so_OBJECTS) $(nss_ldap_so_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aliases.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ethers.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hosts.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netgroup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pam.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passwd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocols.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/services.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shadow.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am: install-exec-local
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-local
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstPROGRAMS ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-exec-local install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-local
install-exec-local: install-nss_ldap_so
uninstall-local: uninstall-nss_ldap_so
# install libnss_ldap.so.2
install-nss_ldap_so: nss_ldap.so
$(INSTALL_PROGRAM) -D nss_ldap.so $(DESTDIR)$(libdir)/$(NSS_LDAP_NSS_VERSIONED)
uninstall-nss_ldap_so:
-rm -f $(DESTDIR)$(libdir)/$(NSS_LDAP_NSS_VERSIONED)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View file

@ -1,73 +0,0 @@
/*
aliases.c - NSS lookup functions for aliases database
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <nss.h>
#include <errno.h>
#include "prototypes.h"
#include "common.h"
static enum nss_status read_aliasent(
TFILE *fp,struct aliasent *result,
char *buffer,size_t buflen,int *errnop)
{
int32_t tmpint32,tmp2int32;
size_t bufptr=0;
/* auto-genereted read code */
READ_STRING_BUF(fp,result->alias_name);
READ_STRINGLIST_NUM(fp,result->alias_members,result->alias_members_len);
/* fill in remaining gaps in struct */
result->alias_local=0;
/* we're done */
return NSS_STATUS_SUCCESS;
}
enum nss_status _nss_ldap_getaliasbyname_r(
const char *name,struct aliasent *result,
char *buffer,size_t buflen,int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_ALIAS_BYNAME,
name,
read_aliasent(fp,result,buffer,buflen,errnop));
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *aliasentfp;
enum nss_status _nss_ldap_setaliasent(void)
{
NSS_SETENT(aliasentfp);
}
enum nss_status _nss_ldap_getaliasent_r(struct aliasent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(aliasentfp,NSLCD_ACTION_ALIAS_ALL,
read_aliasent(aliasentfp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_endaliasent(void)
{
NSS_ENDENT(aliasentfp);
}

View file

@ -1,85 +0,0 @@
/*
common.c - common functions for NSS lookups
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif /* HAVE_STDINT_H */
#include <unistd.h>
#include <stdio.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <nss.h>
#include <string.h>
#include "nslcd.h"
#include "common.h"
#include "common/tio.h"
/* buffer sizes for I/O */
#define READBUFFER_MINSIZE 1024
#define READBUFFER_MAXSIZE 32*1024
#define WRITEBUFFER_MINSIZE 32
#define WRITEBUFFER_MAXSIZE 32
/* returns a socket to the server or NULL on error (see errno),
socket should be closed with fclose() */
TFILE *nslcd_client_open()
{
int sock;
struct sockaddr_un addr;
struct timeval readtimeout,writetimeout;
TFILE *fp;
/* create a socket */
if ( (sock=socket(PF_UNIX,SOCK_STREAM,0))<0 )
return NULL;
/* create socket address structure */
memset(&addr,0,sizeof(struct sockaddr_un));
addr.sun_family=AF_UNIX;
strncpy(addr.sun_path,NSLCD_SOCKET,sizeof(addr.sun_path));
addr.sun_path[sizeof(addr.sun_path)-1]='\0';
/* connect to the socket */
if (connect(sock,(struct sockaddr *)&addr,(socklen_t)sizeof(struct sockaddr_un))<0)
{
(void)close(sock);
return NULL;
}
/* set the timeouts */
readtimeout.tv_sec=20; /* looking up stuff may take some time */
readtimeout.tv_usec=0;
writetimeout.tv_sec=10; /* nslcd could be loaded with requests */
writetimeout.tv_usec=0;
/* create a stream object */
if ((fp=tio_fdopen(sock,&readtimeout,&writetimeout,
READBUFFER_MINSIZE,READBUFFER_MAXSIZE,
WRITEBUFFER_MINSIZE,WRITEBUFFER_MAXSIZE))==NULL)
{
(void)close(sock);
return NULL;
}
/* return the stream */
return fp;
}

View file

@ -1,211 +0,0 @@
/*
common.h - common functions for NSS lookups
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _NSS_COMMON_H
#define _NSS_COMMON_H 1
#include <stdio.h>
#include <nss.h>
#include "nslcd.h"
#include "nslcd-common.h"
#include "compat/attrs.h"
#include "common/tio.h"
/* returns a socket to the server or NULL on error (see errno),
socket should be closed with tio_close() */
TFILE *nslcd_client_open(void)
MUST_USE;
/* These are macors for performing common operations in the nslcd
request/response protocol, they are an extension for client
applications to the macros defined in nslcd-common.h. */
/* Open a client socket. */
#define OPEN_SOCK(fp) \
if ((fp=nslcd_client_open())==NULL) \
{ ERROR_OUT_OPENERROR }
/* Write a request header with a request code. */
#define WRITE_REQUEST(fp,req) \
WRITE_INT32(fp,(int32_t)NSLCD_VERSION) \
WRITE_INT32(fp,(int32_t)req)
/* Read a response header and check that the returned request
code equals the expected code. */
#define READ_RESPONSEHEADER(fp,req) \
READ_TYPE(fp,tmpint32,int32_t); \
if (tmpint32!=(int32_t)NSLCD_VERSION) \
{ ERROR_OUT_READERROR(fp) } \
READ_TYPE(fp,tmpint32,int32_t); \
if (tmpint32!=(int32_t)(req)) \
{ ERROR_OUT_READERROR(fp) }
/* Read the response code (the result code of the query) from
the stream. */
#define READ_RESPONSE_CODE(fp) \
READ_TYPE(fp,tmpint32,int32_t); \
if (tmpint32!=(int32_t)NSLCD_RESULT_SUCCESS) \
{ ERROR_OUT_NOSUCCESS(fp,tmpint32) }
/* These are macros for handling read and write problems, they are
NSS specific due to the return code so are defined here. They
genrally close the open file, set an error code and return with
an error status. */
/* Macro is called to handle errors in opening a client connection. */
#define ERROR_OUT_OPENERROR \
*errnop=ENOENT; \
return (errno==EAGAIN)?NSS_STATUS_TRYAGAIN:NSS_STATUS_UNAVAIL;
/* Macro is called to handle errors on read operations. */
#define ERROR_OUT_READERROR(fp) \
(void)tio_close(fp); \
fp=NULL; \
*errnop=ENOENT; \
return NSS_STATUS_UNAVAIL;
/* Macro is called to handle problems with too small a buffer.
This triggers the caller to call the function with a larger
buffer (see NSS_GETENT below). */
#define ERROR_OUT_BUFERROR(fp) \
*errnop=ERANGE; \
return NSS_STATUS_TRYAGAIN;
/* This macro is called if there was a problem with a write
operation. */
#define ERROR_OUT_WRITEERROR(fp) \
ERROR_OUT_READERROR(fp)
/* This macro is called if the read status code is not
NSLCD_RESULT_SUCCESS. */
#define ERROR_OUT_NOSUCCESS(fp,retv) \
(void)tio_close(fp); \
fp=NULL; \
return NSS_STATUS_NOTFOUND;
/* The following macros to automatically generate get..byname(),
get..bynumber(), setent(), getent() and endent() function
bodies. These functions have very common code so this can
easily be reused. */
/* This is a generic get..by..() generation macro. The action
parameter is the NSLCD_ACTION_.. action, the param is the
operation for writing the parameter and readfn is the function
name for reading a single result entry. The function is assumed
to have result, buffer, buflen and errnop parameters that define
the result structure, the user buffer with length and the
errno to return. This macro should be called through some of
the customized ones below. */
#define NSS_BYGEN(action,writefn,readfn) \
TFILE *fp; \
int32_t tmpint32; \
enum nss_status retv; \
/* open socket and write request */ \
OPEN_SOCK(fp); \
WRITE_REQUEST(fp,action); \
writefn; \
WRITE_FLUSH(fp); \
/* read response header */ \
READ_RESPONSEHEADER(fp,action); \
/* read response */ \
READ_RESPONSE_CODE(fp); \
retv=readfn; \
/* close socket and we're done */ \
if ((retv==NSS_STATUS_SUCCESS)||(retv==NSS_STATUS_TRYAGAIN)) \
(void)tio_close(fp); \
return retv;
/* This macro can be used to generate a get..byname() function
body. */
#define NSS_BYNAME(action,name,readfn) \
NSS_BYGEN(action,WRITE_STRING(fp,name),readfn)
/* This macro can be used to generate a get..by..() function
body where the value that is the key has the specified type. */
#define NSS_BYTYPE(action,val,type,readfn) \
NSS_BYGEN(action,WRITE_TYPE(fp,val,type),readfn)
/* This macro can be used to generate a get..by..() function
body where the value should be passed as an int32_t. */
#define NSS_BYINT32(action,val,readfn) \
NSS_BYGEN(action,WRITE_INT32(fp,val),readfn)
/* This macro generates a simple setent() function body. A stream
is opened, a request is written and a check is done for
a response header. */
#define NSS_SETENT(fp) \
if (fp!=NULL) \
{ \
(void)tio_close(fp); \
fp=NULL; \
} \
return NSS_STATUS_SUCCESS;
/* This macro generates a getent() function body. A single entry
is read with the readfn() function. */
#define NSS_GETENT(fp,action,readfn) \
int32_t tmpint32; \
enum nss_status retv; \
/* check that we have a valid file descriptor */ \
if (fp==NULL) \
{ \
/* open a new stream and write the request */ \
OPEN_SOCK(fp); \
WRITE_REQUEST(fp,action); \
WRITE_FLUSH(fp); \
/* read response header */ \
READ_RESPONSEHEADER(fp,action); \
} \
/* prepare for buffer errors */ \
tio_mark(fp); \
/* read a response */ \
READ_RESPONSE_CODE(fp); \
retv=readfn; \
/* check read result */ \
if (retv==NSS_STATUS_TRYAGAIN) \
{ \
/* if we have a full buffer try to reset the stream */ \
if (tio_reset(fp)) \
{ \
tio_close(fp); \
fp=NULL; \
/* fail with permanent error to prevent retries */ \
*errnop=EINVAL; \
return NSS_STATUS_UNAVAIL; \
} \
} \
else if (retv!=NSS_STATUS_SUCCESS) \
fp=NULL; /* file should be closed by now */ \
return retv;
/* This macro generates a endent() function body. This just closes
the stream. */
#define NSS_ENDENT(fp) \
if (fp!=NULL) \
{ \
(void)tio_close(fp); \
fp=NULL; \
} \
return NSS_STATUS_SUCCESS;
#endif /* not _NSS_COMMON_H */

View file

@ -1,83 +0,0 @@
/*
ethers.c - NSS lookup functions for ethers database
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <nss.h>
#include <errno.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
static enum nss_status read_etherent(
TFILE *fp,struct etherent *result,
char *buffer,size_t buflen,int *errnop)
{
int32_t tmpint32;
size_t bufptr=0;
READ_STRING_BUF(fp,result->e_name);
READ_TYPE(fp,result->e_addr,uint8_t[6]);
return NSS_STATUS_SUCCESS;
}
/* map a hostname to the corresponding ethernet address */
enum nss_status _nss_ldap_gethostton_r(
const char *name,struct etherent *result,
char *buffer,size_t buflen,int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_ETHER_BYNAME,
name,
read_etherent(fp,result,buffer,buflen,errnop));
}
/* map an ethernet address to the corresponding hostname */
enum nss_status _nss_ldap_getntohost_r(
const struct ether_addr *addr,struct etherent *result,
char *buffer,size_t buflen,int *errnop)
{
NSS_BYTYPE(NSLCD_ACTION_ETHER_BYETHER,
*addr,uint8_t[6],
read_etherent(fp,result,buffer,buflen,errnop));
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *etherentfp;
enum nss_status _nss_ldap_setetherent(int UNUSED(stayopen))
{
NSS_SETENT(etherentfp);
}
enum nss_status _nss_ldap_getetherent_r(
struct etherent *result,
char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(etherentfp,NSLCD_ACTION_ETHER_ALL,
read_etherent(etherentfp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_endetherent(void)
{
NSS_ENDENT(etherentfp);
}

View file

@ -1,93 +0,0 @@
EXPORTED {
# published NSS service functions
global:
# aliases - mail aliases
_nss_ldap_getaliasbyname_r;
_nss_ldap_setaliasent;
_nss_ldap_getaliasent_r;
_nss_ldap_endaliasent;
# ethers - ethernet numbers
_nss_ldap_gethostton_r;
_nss_ldap_getntohost_r;
_nss_ldap_setetherent;
_nss_ldap_getetherent_r;
_nss_ldap_endetherent;
# group - groups of users
_nss_ldap_getgrnam_r;
_nss_ldap_getgrgid_r;
_nss_ldap_initgroups_dyn;
_nss_ldap_setgrent;
_nss_ldap_getgrent_r;
_nss_ldap_endgrent;
# hosts - host names and numbers
_nss_ldap_gethostbyname_r;
_nss_ldap_gethostbyname2_r;
_nss_ldap_gethostbyaddr_r;
_nss_ldap_sethostent;
_nss_ldap_gethostent_r;
_nss_ldap_endhostent;
# netgroup - list of host and users
_nss_ldap_setnetgrent;
_nss_ldap_getnetgrent_r;
_nss_ldap_endnetgrent;
# networks - network names and numbers
_nss_ldap_getnetbyname_r;
_nss_ldap_getnetbyaddr_r;
_nss_ldap_setnetent;
_nss_ldap_getnetent_r;
_nss_ldap_endnetent;
# passwd - user database and passwords
_nss_ldap_getpwnam_r;
_nss_ldap_getpwuid_r;
_nss_ldap_setpwent;
_nss_ldap_getpwent_r;
_nss_ldap_endpwent;
# protocols - network protocols
_nss_ldap_getprotobyname_r;
_nss_ldap_getprotobynumber_r;
_nss_ldap_setprotoent;
_nss_ldap_getprotoent_r;
_nss_ldap_endprotoent;
# rpc - remote procedure call names and numbers
_nss_ldap_getrpcbyname_r;
_nss_ldap_getrpcbynumber_r;
_nss_ldap_setrpcent;
_nss_ldap_getrpcent_r;
_nss_ldap_endrpcent;
# services - network services
_nss_ldap_getservbyname_r;
_nss_ldap_getservbyport_r;
_nss_ldap_setservent;
_nss_ldap_getservent_r;
_nss_ldap_endservent;
# shadow - extended user information
_nss_ldap_getspnam_r;
_nss_ldap_setspent;
_nss_ldap_getspent_r;
_nss_ldap_endspent;
# pam - pluggable auth
pam_sm_acct_mgmt;
pam_sm_authenticate;
pam_sm_chauthtok;
pam_sm_close_session;
pam_sm_open_session;
pam_sm_setcred;
# everything else should not be exported
local:
*;
};

View file

@ -1,159 +0,0 @@
/*
group.c - NSS lookup functions for group database
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <nss.h>
#include <errno.h>
#include <stdlib.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
static enum nss_status read_group(
TFILE *fp,struct group *result,
char *buffer,size_t buflen,int *errnop)
{
int32_t tmpint32,tmp2int32,tmp3int32;
size_t bufptr=0;
READ_STRING_BUF(fp,result->gr_name);
READ_STRING_BUF(fp,result->gr_passwd);
READ_TYPE(fp,result->gr_gid,gid_t);
READ_STRINGLIST_NULLTERM(fp,result->gr_mem);
return NSS_STATUS_SUCCESS;
}
/* read all group entries from the stream and add
gids of these groups to the list */
static enum nss_status read_gids(
TFILE *fp,gid_t skipgroup,long int *start,long int *size,
gid_t **groupsp,long int limit,int *errnop)
{
int32_t res=(int32_t)NSLCD_RESULT_SUCCESS;
int32_t tmpint32,tmp2int32,tmp3int32;
gid_t gid;
gid_t *newgroups;
long int newsize;
/* loop over results */
while (res==(int32_t)NSLCD_RESULT_SUCCESS)
{
/* skip group name */
SKIP_STRING(fp);
/* skip passwd entry */
SKIP_STRING(fp);
/* read gid */
READ_TYPE(fp,gid,gid_t);
/* skip members */
SKIP_STRINGLIST(fp);
/* only add the group to the list if it is not the specified group */
if (gid!=skipgroup)
{
/* check if we reached the limit */
if ( (limit>0) && (*start>=limit) )
return NSS_STATUS_TRYAGAIN;
/* check if our buffer is large enough */
if ((*start)>=(*size))
{
/* for some reason Glibc expects us to grow the array (completely
different from all other NSS functions) */
/* calculate new size */
newsize=2*(*size);
if ( (limit>0) && (*start>=limit) )
newsize=limit;
/* allocate new memory */
newgroups=realloc(*groupsp,newsize*sizeof(gid_t));
if (newgroups==NULL)
return NSS_STATUS_TRYAGAIN;
*groupsp=newgroups;
*size=newsize;
}
/* add gid to list */
(*groupsp)[(*start)++]=gid;
}
/* read next response code
(don't bail out on not success since we just want to build
up a list) */
READ_TYPE(fp,res,int32_t);
}
/* return the proper status code */
return NSS_STATUS_SUCCESS;
}
enum nss_status _nss_ldap_getgrnam_r(const char *name,struct group *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_GROUP_BYNAME,
name,
read_group(fp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_getgrgid_r(gid_t gid,struct group *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYTYPE(NSLCD_ACTION_GROUP_BYGID,
gid,gid_t,
read_group(fp,result,buffer,buflen,errnop));
}
/* this function returns a list of groups, documentation for the
interface is scarce (any pointers are welcome) but this is
what is assumed the parameters mean:
user IN - the user name to find groups for
skipgroup IN - a group to not include in the list
*start IN/OUT - where to write in the array, is incremented
*size IN/OUT - the size of the supplied array (gid_t entries, not bytes)
**groupsp IN/OUT - pointer to the array of returned groupids
limit IN - the maxium size of the array
*errnop OUT - for returning errno
This function cannot grow the array if it becomes too large
(and will return NSS_STATUS_TRYAGAIN on buffer problem)
because it has no way of free()ing the buffer.
*/
enum nss_status _nss_ldap_initgroups_dyn(
const char *user,gid_t skipgroup,long int *start,
long int *size,gid_t **groupsp,long int limit,int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_GROUP_BYMEMBER,
user,
read_gids(fp,skipgroup,start,size,groupsp,limit,errnop));
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *grentfp;
enum nss_status _nss_ldap_setgrent(int UNUSED(stayopen))
{
NSS_SETENT(grentfp);
}
enum nss_status _nss_ldap_getgrent_r(struct group *result,char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(grentfp,NSLCD_ACTION_GROUP_ALL,
read_group(grentfp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_endgrent(void)
{
NSS_ENDENT(grentfp);
}

View file

@ -1,233 +0,0 @@
/*
hosts.c - NSS lookup functions for hosts database
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <nss.h>
#include <errno.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
/* Redifine some ERROR_OUT macros as we also want to set h_errnop. */
#undef ERROR_OUT_OPENERROR
#define ERROR_OUT_OPENERROR \
*errnop=ENOENT; \
*h_errnop=HOST_NOT_FOUND; \
return (errno==EAGAIN)?NSS_STATUS_TRYAGAIN:NSS_STATUS_UNAVAIL;
#undef ERROR_OUT_READERROR
#define ERROR_OUT_READERROR(fp) \
(void)tio_close(fp); \
fp=NULL; \
*errnop=ENOENT; \
*h_errnop=NO_RECOVERY; \
return NSS_STATUS_UNAVAIL;
#undef ERROR_OUT_BUFERROR
#define ERROR_OUT_BUFERROR(fp) \
(void)tio_close(fp); \
fp=NULL; \
*errnop=ERANGE; \
*h_errnop=TRY_AGAIN; \
return NSS_STATUS_TRYAGAIN;
#undef ERROR_OUT_WRITEERROR
#define ERROR_OUT_WRITEERROR(fp) \
ERROR_OUT_READERROR(fp)
/* read a single host entry from the stream, filtering on the
specified address family, result is stored in result
it will an empty entry if no addresses in the address family
were available */
static enum nss_status read_hostent(
TFILE *fp,int af,struct hostent *result,
char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
int32_t tmpint32,tmp2int32,tmp3int32;
int32_t numaddr;
int i;
int readaf;
size_t bufptr=0;
/* read the host entry */
READ_STRING_BUF(fp,result->h_name);
READ_STRINGLIST_NULLTERM(fp,result->h_aliases);
result->h_addrtype=af;
result->h_length=0;
/* read number of addresses to follow */
READ_INT32(fp,numaddr);
/* allocate memory for array */
/* Note: this may allocate too much memory (e.g. also for
address records of other address families) but
this is a simple way to do it */
BUF_ALLOC(fp,result->h_addr_list,char *,numaddr+1);
/* go through the address list and filter on af */
i=0;
while (--numaddr>=0)
{
/* read address family and size */
READ_INT32(fp,readaf);
READ_INT32(fp,tmp2int32);
if (readaf==af)
{
/* read the address */
result->h_length=tmp2int32;
READ_BUF(fp,result->h_addr_list[i++],tmp2int32);
}
else
{
SKIP(fp,tmpint32);
}
}
/* null-terminate address list */
result->h_addr_list[i]=NULL;
return NSS_STATUS_SUCCESS;
}
/* this is a wrapper around read_hostent() that does error handling
if the read address list does not contain any addresses for the
specified address familiy */
static enum nss_status read_hostent_erronempty(
TFILE *fp,int af,struct hostent *result,
char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
enum nss_status retv;
retv=read_hostent(fp,af,result,buffer,buflen,errnop,h_errnop);
/* check result */
if (retv!=NSS_STATUS_SUCCESS)
return retv;
/* check empty address list
(note that we cannot do this in the read_hostent() function as closing
the socket there will cause problems with the {set,get,end}ent() functions
below)
*/
if (result->h_addr_list[0]==NULL)
{
*errnop=ENOENT;
*h_errnop=NO_ADDRESS;
(void)tio_close(fp);
return NSS_STATUS_NOTFOUND;
}
return NSS_STATUS_SUCCESS;
}
/* this is a wrapper around read_hostent() that skips to the
next address if the address list does not contain any addresses for the
specified address familiy */
static enum nss_status read_hostent_nextonempty(
TFILE *fp,int af,struct hostent *result,
char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
int32_t tmpint32;
enum nss_status retv;
/* check until we read an non-empty entry */
do
{
/* read a host entry */
retv=read_hostent(fp,af,result,buffer,buflen,errnop,h_errnop);
/* check result */
if (retv!=NSS_STATUS_SUCCESS)
return retv;
/* skip to the next entry if we read an empty address */
if (result->h_addr_list[0]==NULL)
{
retv=NSS_STATUS_NOTFOUND;
READ_RESPONSE_CODE(fp);
}
/* do another loop run if we read an empty address */
}
while (retv!=NSS_STATUS_SUCCESS);
return NSS_STATUS_SUCCESS;
}
/* this function looks up a single host entry and returns all the addresses
associated with the host in a single address familiy
name - IN - hostname to lookup
af - IN - address familty to present results for
result - OUT - entry found
buffer,buflen - OUT - buffer to store allocated stuff on
errnop,h_errnop - OUT - for reporting errors */
enum nss_status _nss_ldap_gethostbyname2_r(
const char *name,int af,struct hostent *result,
char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
NSS_BYNAME(NSLCD_ACTION_HOST_BYNAME,
name,
read_hostent_erronempty(fp,af,result,buffer,buflen,errnop,h_errnop));
}
/* this function just calls the gethostbyname2() variant with the address
familiy set */
enum nss_status _nss_ldap_gethostbyname_r(
const char *name,struct hostent *result,
char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
return _nss_ldap_gethostbyname2_r(name,AF_INET,result,buffer,buflen,errnop,h_errnop);
}
/* write an address value */
#define WRITE_ADDRESS(fp,af,len,addr) \
WRITE_INT32(fp,af); \
WRITE_INT32(fp,len); \
WRITE(fp,addr,len);
/* this function looks up a single host entry and returns all the addresses
associated with the host in a single address familiy
addr - IN - the address to look up
len - IN - the size of the addr struct
af - IN - address familty the address is specified as
result - OUT - entry found
buffer,buflen - OUT - buffer to store allocated stuff on
errnop,h_errnop - OUT - for reporting errors */
enum nss_status _nss_ldap_gethostbyaddr_r(
const void *addr,socklen_t len,int af,struct hostent *result,
char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
NSS_BYGEN(NSLCD_ACTION_HOST_BYADDR,
WRITE_ADDRESS(fp,af,len,addr),
read_hostent_erronempty(fp,af,result,buffer,buflen,errnop,h_errnop))
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *hostentfp;
enum nss_status _nss_ldap_sethostent(int UNUSED(stayopen))
{
NSS_SETENT(hostentfp);
}
/* this function only returns addresses of the AF_INET address family */
enum nss_status _nss_ldap_gethostent_r(
struct hostent *result,
char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
NSS_GETENT(hostentfp,NSLCD_ACTION_HOST_ALL,
read_hostent_nextonempty(hostentfp,AF_INET,result,buffer,buflen,errnop,h_errnop));
}
enum nss_status _nss_ldap_endhostent(void)
{
NSS_ENDENT(hostentfp);
}

View file

@ -1,123 +0,0 @@
/*
netgroup.c - NSS lookup functions for netgroup entries
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <nss.h>
#include <errno.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
/* we redefine this here because we need to return NSS_STATUS_RETURN
instead of NSS_STATUS_NOTFOUND */
#undef ERROR_OUT_NOSUCCESS
#define ERROR_OUT_NOSUCCESS(fp,retv) \
(void)tio_close(fp); \
fp=NULL; \
return NSS_STATUS_RETURN;
/* function for reading a single result entry */
static enum nss_status read_netgrent(
TFILE *fp,struct __netgrent *result,
char *buffer,size_t buflen,int *errnop)
{
int32_t tmpint32;
int type;
size_t bufptr=0;
/* read netgroup type */
READ_INT32(fp,type);
if (type==NETGROUP_TYPE_NETGROUP)
{
/* the response is a reference to another netgroup */
result->type=group_val;
READ_STRING_BUF(fp,result->val.group);
}
else if (type==NETGROUP_TYPE_TRIPLE)
{
/* the response is a host/user/domain triple */
result->type=triple_val;
/* read host and revert to NULL on empty string */
READ_STRING_BUF(fp,result->val.triple.host);
if (result->val.triple.host[0]=='\0')
{
result->val.triple.host=NULL;
bufptr--; /* free unused space */
}
/* read user and revert to NULL on empty string */
READ_STRING_BUF(fp,result->val.triple.user);
if (result->val.triple.user[0]=='\0')
{
result->val.triple.user=NULL;
bufptr--; /* free unused space */
}
/* read domain and revert to NULL on empty string */
READ_STRING_BUF(fp,result->val.triple.domain);
if (result->val.triple.domain[0]=='\0')
{
result->val.triple.domain=NULL;
bufptr--; /* free unused space */
}
}
else
return NSS_STATUS_UNAVAIL;
/* we're done */
return NSS_STATUS_SUCCESS;
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *netgrentfp;
enum nss_status _nss_ldap_setnetgrent(const char *group,struct __netgrent UNUSED(*result))
{
/* we cannot use NSS_SETENT() here because we have a parameter that is only
available in this function */
int32_t tmpint32;
int errnocp;
int *errnop;
errnop=&errnocp;
/* check parameter */
if ((group==NULL)||(group[0]=='\0'))
return NSS_STATUS_UNAVAIL;
/* open a new stream and write the request */
OPEN_SOCK(netgrentfp);
WRITE_REQUEST(netgrentfp,NSLCD_ACTION_NETGROUP_BYNAME);
WRITE_STRING(netgrentfp,group);
WRITE_FLUSH(netgrentfp);
/* read response header */
READ_RESPONSEHEADER(netgrentfp,NSLCD_ACTION_NETGROUP_BYNAME);
return NSS_STATUS_SUCCESS;
}
enum nss_status _nss_ldap_getnetgrent_r(struct __netgrent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(netgrentfp,NSLCD_ACTION_NETGROUP_BYNAME,
read_netgrent(netgrentfp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_endnetgrent(struct __netgrent UNUSED(* result))
{
NSS_ENDENT(netgrentfp);
}

View file

@ -1,142 +0,0 @@
/*
networks.c - NSS lookup functions for networks database
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <nss.h>
#include <errno.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
/* Redifine some ERROR_OUT macros as we also want to set h_errnop. */
#undef ERROR_OUT_OPENERROR
#define ERROR_OUT_OPENERROR \
*errnop=ENOENT; \
*h_errnop=HOST_NOT_FOUND; \
return (errno==EAGAIN)?NSS_STATUS_TRYAGAIN:NSS_STATUS_UNAVAIL;
#undef ERROR_OUT_READERROR
#define ERROR_OUT_READERROR(fp) \
(void)tio_close(fp); \
fp=NULL; \
*errnop=ENOENT; \
*h_errnop=NO_RECOVERY; \
return NSS_STATUS_UNAVAIL;
#undef ERROR_OUT_BUFERROR
#define ERROR_OUT_BUFERROR(fp) \
(void)tio_close(fp); \
fp=NULL; \
*errnop=ERANGE; \
*h_errnop=TRY_AGAIN; \
return NSS_STATUS_TRYAGAIN;
#undef ERROR_OUT_WRITEERROR
#define ERROR_OUT_WRITEERROR(fp) \
ERROR_OUT_READERROR(fp)
/* read a single network entry from the stream, ignoring entries
that are not AF_INET (IPv4), result is stored in result */
static enum nss_status read_netent(
TFILE *fp,struct netent *result,
char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
int32_t tmpint32,tmp2int32,tmp3int32;
int32_t numaddr,i;
int readaf;
size_t bufptr=0;
enum nss_status retv=NSS_STATUS_NOTFOUND;
/* read the network entry */
READ_STRING_BUF(fp,result->n_name);
READ_STRINGLIST_NULLTERM(fp,result->n_aliases);
result->n_addrtype=AF_INET;
/* read number of addresses to follow */
READ_TYPE(fp,numaddr,int32_t);
/* go through the address list and filter on af */
i=0;
while (--numaddr>=0)
{
/* read address family and size */
READ_INT32(fp,readaf);
READ_INT32(fp,tmp2int32);
if ((readaf==AF_INET)&&(tmp2int32==4))
{
/* read address and translate to host byte order */
READ_TYPE(fp,tmpint32,int32_t);
result->n_net=ntohl((uint32_t)tmpint32);
/* signal that we've read a proper entry */
retv=NSS_STATUS_SUCCESS;
/* don't return here to not upset the stream */
}
else
{
/* skip unsupported address families */
SKIP(fp,tmpint32);
}
}
return retv;
}
enum nss_status _nss_ldap_getnetbyname_r(const char *name,struct netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
NSS_BYNAME(NSLCD_ACTION_NETWORK_BYNAME,
name,
read_netent(fp,result,buffer,buflen,errnop,h_errnop));
}
/* write an address value */
#define WRITE_ADDRESS(fp,af,len,addr) \
WRITE_INT32(fp,af); \
WRITE_INT32(fp,len); \
WRITE(fp,addr,len);
/* Note: the af parameter is ignored and is assumed to be AF_INET */
/* TODO: implement handling of af parameter */
enum nss_status _nss_ldap_getnetbyaddr_r(uint32_t addr,int UNUSED(af),struct netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
NSS_BYGEN(NSLCD_ACTION_NETWORK_BYADDR,
WRITE_ADDRESS(fp,AF_INET,4,&addr),
read_netent(fp,result,buffer,buflen,errnop,h_errnop))
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *netentfp;
enum nss_status _nss_ldap_setnetent(int UNUSED(stayopen))
{
NSS_SETENT(netentfp);
}
enum nss_status _nss_ldap_getnetent_r(struct netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop)
{
NSS_GETENT(netentfp,NSLCD_ACTION_NETWORK_ALL,
read_netent(netentfp,result,buffer,buflen,errnop,h_errnop));
}
enum nss_status _nss_ldap_endnetent(void)
{
NSS_ENDENT(netentfp);
}

View file

@ -1,721 +0,0 @@
/*
pam.c - pam module functions
Copyright (C) 2009 Howard Chu
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <syslog.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
#ifndef HAVE_PAM_PAM_MODULES_H
#include <security/pam_modules.h>
#else
#include <pam/pam_modules.h>
#endif
#define CONST_ARG const
#define IGNORE_UNKNOWN 1
#define IGNORE_UNAVAIL 2
#define PLD_CTX "PAM_LDAPD_CTX"
#define NSS2PAM_RC(rc,ignore,ok) \
switch(rc) { \
case NSS_STATUS_SUCCESS: \
rc = ok; break; \
case NSS_STATUS_UNAVAIL: \
rc = (ignore & IGNORE_UNAVAIL) ? PAM_IGNORE : PAM_AUTHINFO_UNAVAIL; \
break; \
case NSS_STATUS_NOTFOUND: \
rc = (ignore & IGNORE_UNKNOWN) ? PAM_IGNORE: PAM_USER_UNKNOWN; \
break; \
default: \
rc = PAM_SYSTEM_ERR; break; \
}
typedef struct pld_ctx {
char *user;
char *dn;
char *tmpluser;
char *authzmsg;
char *oldpw;
int authok;
int authz;
int sessid;
char buf[1024];
} pld_ctx;
static int nslcd2pam_rc(int rc)
{
#define map(i) case NSLCD_##i : rc = i; break
switch(rc) {
map(PAM_SUCCESS);
map(PAM_PERM_DENIED);
map(PAM_AUTH_ERR);
map(PAM_CRED_INSUFFICIENT);
map(PAM_AUTHINFO_UNAVAIL);
map(PAM_USER_UNKNOWN);
map(PAM_MAXTRIES);
map(PAM_NEW_AUTHTOK_REQD);
map(PAM_ACCT_EXPIRED);
map(PAM_SESSION_ERR);
map(PAM_AUTHTOK_DISABLE_AGING);
map(PAM_IGNORE);
map(PAM_ABORT);
}
return rc;
}
static void pam_clr_ctx(
pld_ctx *ctx)
{
if (ctx->user) {
free(ctx->user);
ctx->user = NULL;
}
if (ctx->oldpw) {
memset(ctx->oldpw,0,strlen(ctx->oldpw));
free(ctx->oldpw);
ctx->oldpw = NULL;
}
ctx->dn = NULL;
ctx->tmpluser = NULL;
ctx->authzmsg = NULL;
ctx->authok = 0;
ctx->authz = 0;
}
static void pam_del_ctx(
pam_handle_t *pamh, void *data, int err)
{
pld_ctx *ctx = data;
pam_clr_ctx(ctx);
free(ctx);
}
static int pam_get_ctx(
pam_handle_t *pamh, const char *user, pld_ctx **pctx)
{
pld_ctx *ctx = NULL;
int rc;
if (pam_get_data(pamh, PLD_CTX, (CONST_ARG void **)&ctx) == PAM_SUCCESS) {
if (ctx->user && strcmp(ctx->user, user)) {
pam_clr_ctx(ctx);
}
rc = PAM_SUCCESS;
}
if (!ctx) {
ctx = calloc(1, sizeof(*ctx));
if (!ctx)
return PAM_BUF_ERR;
rc = pam_set_data(pamh, PLD_CTX, ctx, pam_del_ctx);
if (rc != PAM_SUCCESS)
pam_del_ctx(pamh, ctx, 0);
}
if (rc == PAM_SUCCESS)
*pctx = ctx;
return rc;
}
static int pam_get_authtok(
pam_handle_t *pamh, int flags, char *prompt1, char *prompt2, char **pwd)
{
int rc;
char *p;
struct pam_message msg[1], *pmsg[1];
struct pam_response *resp;
struct pam_conv *conv;
*pwd = NULL;
rc = pam_get_item (pamh, PAM_CONV, (CONST_ARG void **) &conv);
if (rc == PAM_SUCCESS) {
pmsg[0] = &msg[0];
msg[0].msg_style = PAM_PROMPT_ECHO_OFF;
msg[0].msg = prompt1;
resp = NULL;
rc = conv->conv (1,
(CONST_ARG struct pam_message **) pmsg,
&resp, conv->appdata_ptr);
} else {
return rc;
}
if (resp != NULL) {
if ((flags & PAM_DISALLOW_NULL_AUTHTOK) && resp[0].resp == NULL)
{
free (resp);
return PAM_AUTH_ERR;
}
p = resp[0].resp;
resp[0].resp = NULL;
free (resp);
} else {
return PAM_CONV_ERR;
}
if (prompt2) {
msg[0].msg = prompt2;
resp = NULL;
rc = conv->conv (1,
(CONST_ARG struct pam_message **) pmsg,
&resp, conv->appdata_ptr);
if (resp && resp[0].resp && !strcmp(resp[0].resp, p))
rc = PAM_SUCCESS;
else
rc = PAM_AUTHTOK_RECOVERY_ERR;
if (resp) {
if (resp[0].resp) {
(void) memset(resp[0].resp, 0, strlen(resp[0].resp));
free(resp[0].resp);
}
free(resp);
}
}
if (rc == PAM_SUCCESS)
*pwd = p;
else if (p) {
memset(p, 0, strlen(p));
free(p);
}
return rc;
}
static enum nss_status pam_read_authc(
TFILE *fp,pld_ctx *ctx,int *errnop)
{
char *buffer = ctx->buf, *user;
size_t buflen = sizeof(ctx->buf);
size_t bufptr = 0;
int32_t tmpint32;
READ_STRING_BUF(fp,user);
READ_STRING_BUF(fp,ctx->dn);
READ_INT32(fp,ctx->authok);
READ_INT32(fp,ctx->authz);
READ_STRING_BUF(fp,ctx->authzmsg);
ctx->authok = nslcd2pam_rc(ctx->authok);
ctx->authz = nslcd2pam_rc(ctx->authz);
return NSS_STATUS_SUCCESS;
}
static enum nss_status pam_do_authc(
pld_ctx *ctx, const char *user, const char *svc,const char *pwd,int *errnop)
{
NSS_BYGEN(NSLCD_ACTION_PAM_AUTHC,
WRITE_STRING(fp,user);
WRITE_STRING(fp,"" /* DN */);
WRITE_STRING(fp,svc);
WRITE_STRING(fp,pwd),
pam_read_authc(fp,ctx,errnop));
}
#define USE_FIRST 1
#define TRY_FIRST 2
#define USE_TOKEN 4
int pam_sm_authenticate(
pam_handle_t *pamh, int flags, int argc, const char **argv)
{
int err, rc;
const char *username, *svc;
char *p = NULL;
int first_pass = 0, ignore_flags = 0;
int i;
pld_ctx *ctx;
for (i = 0; i < argc; i++) {
if (!strcmp (argv[i], "use_first_pass"))
first_pass |= USE_FIRST;
else if (!strcmp (argv[i], "try_first_pass"))
first_pass |= TRY_FIRST;
else if (!strcmp (argv[i], "ignore_unknown_user"))
ignore_flags |= IGNORE_UNKNOWN;
else if (!strcmp (argv[i], "ignore_authinfo_unavail"))
ignore_flags |= IGNORE_UNAVAIL;
else if (!strcmp (argv[i], "no_warn"))
;
else if (!strcmp (argv[i], "debug"))
;
else
syslog (LOG_ERR, "illegal option %s", argv[i]);
}
rc = pam_get_user (pamh, (CONST_ARG char **) &username, NULL);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_get_ctx(pamh, username, &ctx);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_get_item (pamh, PAM_SERVICE, (CONST_ARG void **) &svc);
if (rc != PAM_SUCCESS)
return rc;
for (i=0;i<2;i++) {
if (!first_pass) {
rc = pam_get_authtok(pamh, flags, i ? "LDAP Password: " :
"Password: ", NULL, &p);
i = 2;
if (rc == PAM_SUCCESS) {
pam_set_item(pamh, PAM_AUTHTOK, p);
memset(p, 0, strlen(p));
free(p);
} else {
break;
}
}
rc = pam_get_item (pamh, PAM_AUTHTOK, (CONST_ARG void **) &p);
if (rc == PAM_SUCCESS) {
rc = pam_do_authc(ctx, username, svc, p, &err);
NSS2PAM_RC(rc, ignore_flags, ctx->authok);
}
if (rc == PAM_SUCCESS || (first_pass & USE_FIRST)) {
break;
}
first_pass = 0;
}
if (rc == PAM_SUCCESS) {
ctx->user = strdup(username);
if (ctx->authz == PAM_NEW_AUTHTOK_REQD)
ctx->oldpw = strdup(p);
}
return rc;
}
int pam_sm_setcred(
pam_handle_t *pamh, int flags, int argc, const char **argv)
{
return PAM_SUCCESS;
}
static int
pam_warn(
struct pam_conv *aconv, const char *message, int style, int no_warn)
{
struct pam_message msg, *pmsg;
struct pam_response *resp;
if (no_warn)
return PAM_SUCCESS;
pmsg = &msg;
msg.msg_style = style;
msg.msg = (char *) message;
resp = NULL;
return aconv->conv (1,
(CONST_ARG struct pam_message **) &pmsg,
&resp, aconv->appdata_ptr);
}
static enum nss_status pam_read_authz(
TFILE *fp,pld_ctx *ctx,int *errnop)
{
char *buffer = ctx->buf;
size_t buflen = sizeof(ctx->buf);
size_t bufptr = 0;
int32_t tmpint32;
READ_STRING_BUF(fp,ctx->tmpluser);
READ_STRING_BUF(fp,ctx->dn);
READ_INT32(fp,ctx->authz);
READ_STRING_BUF(fp,ctx->authzmsg);
ctx->authz = nslcd2pam_rc(ctx->authz);
return NSS_STATUS_SUCCESS;
}
static enum nss_status pam_do_authz(
pld_ctx *ctx, const char *svc, const char *ruser, const char *rhost,
const char *tty, int *errnop)
{
NSS_BYGEN(NSLCD_ACTION_PAM_AUTHZ,
WRITE_STRING(fp,ctx->user);
WRITE_STRING(fp,ctx->dn);
WRITE_STRING(fp,svc);
WRITE_STRING(fp,ruser);
WRITE_STRING(fp,rhost);
WRITE_STRING(fp,tty),
pam_read_authz(fp,ctx,errnop));
}
int pam_sm_acct_mgmt(
pam_handle_t *pamh, int flags, int argc, const char **argv)
{
int rc, err;
const char *username, *svc, *ruser, *rhost, *tty;
int no_warn = 0, ignore_flags = 0;
int i;
struct pam_conv *appconv;
pld_ctx *ctx = NULL, ctx2;
for (i = 0; i < argc; i++)
{
if (!strcmp (argv[i], "use_first_pass"))
;
else if (!strcmp (argv[i], "try_first_pass"))
;
else if (!strcmp (argv[i], "no_warn"))
no_warn = 1;
else if (!strcmp (argv[i], "ignore_unknown_user"))
ignore_flags |= IGNORE_UNKNOWN;
else if (!strcmp (argv[i], "ignore_authinfo_unavail"))
ignore_flags |= IGNORE_UNAVAIL;
else if (!strcmp (argv[i], "debug"))
;
else
syslog (LOG_ERR, "illegal option %s", argv[i]);
}
if (flags & PAM_SILENT)
no_warn = 1;
rc = pam_get_item (pamh, PAM_CONV, (CONST_ARG void **) &appconv);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_get_user (pamh, (CONST_ARG char **) &username, NULL);
if (rc != PAM_SUCCESS)
return rc;
if (username == NULL)
return PAM_USER_UNKNOWN;
rc = pam_get_ctx(pamh, username, &ctx);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_get_item (pamh, PAM_SERVICE, (CONST_ARG void **) &svc);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_get_item (pamh, PAM_RUSER, (CONST_ARG void **) &ruser);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_get_item (pamh, PAM_RHOST, (CONST_ARG void **) &rhost);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_get_item (pamh, PAM_TTY, (CONST_ARG void **) &tty);
if (rc != PAM_SUCCESS)
return rc;
ctx2.dn = ctx->dn;
ctx2.user = ctx->user;
rc = pam_do_authz(&ctx2, svc, ruser, rhost, tty, &err);
NSS2PAM_RC(rc, ignore_flags, PAM_SUCCESS);
if (rc != PAM_SUCCESS) {
if (rc != PAM_IGNORE)
pam_warn(appconv, "LDAP authorization failed", PAM_ERROR_MSG, no_warn);
} else {
rc = ctx2.authz;
if (ctx2.authzmsg && ctx2.authzmsg[0])
pam_warn(appconv, ctx2.authzmsg, PAM_TEXT_INFO, no_warn);
if (ctx2.authz == PAM_SUCCESS) {
rc = ctx->authz;
if (ctx->authzmsg && ctx->authzmsg[0])
pam_warn(appconv, ctx->authzmsg, PAM_TEXT_INFO, no_warn);
}
}
if ( rc == PAM_SUCCESS && ctx->tmpluser && ctx->tmpluser[0] ) {
rc = pam_set_item(pamh, PAM_USER, ctx->tmpluser);
}
return rc;
}
static enum nss_status pam_read_sess(
TFILE *fp,pld_ctx *ctx,int *errnop)
{
int tmpint32;
READ_INT32(fp,ctx->sessid);
return NSS_STATUS_SUCCESS;
}
static enum nss_status pam_do_sess(
pam_handle_t *pamh,pld_ctx *ctx,int action,int *errnop)
{
const char *svc = NULL, *tty = NULL, *rhost = NULL, *ruser = NULL;
pam_get_item (pamh, PAM_SERVICE, (CONST_ARG void **) &svc);
pam_get_item (pamh, PAM_TTY, (CONST_ARG void **) &tty);
pam_get_item (pamh, PAM_RHOST, (CONST_ARG void **) &rhost);
pam_get_item (pamh, PAM_RUSER, (CONST_ARG void **) &ruser);
{
NSS_BYGEN(action,
WRITE_STRING(fp,ctx->user);
WRITE_STRING(fp,ctx->dn);
WRITE_STRING(fp,svc);
WRITE_STRING(fp,tty);
WRITE_STRING(fp,rhost);
WRITE_STRING(fp,ruser);
WRITE_INT32(fp,ctx->sessid),
pam_read_sess(fp,ctx,errnop));
}
}
static int pam_sm_session(
pam_handle_t *pamh, int flags, int argc, const char **argv,
int action, int *no_warn)
{
int rc, err;
const char *username;
int ignore_flags = 0;
int i, success = PAM_SUCCESS;
pld_ctx *ctx = NULL;
for (i = 0; i < argc; i++)
{
if (!strcmp (argv[i], "use_first_pass"))
;
else if (!strcmp (argv[i], "try_first_pass"))
;
else if (!strcmp (argv[i], "no_warn"))
*no_warn = 1;
else if (!strcmp (argv[i], "ignore_unknown_user"))
ignore_flags |= IGNORE_UNKNOWN;
else if (!strcmp (argv[i], "ignore_authinfo_unavail"))
ignore_flags |= IGNORE_UNAVAIL;
else if (!strcmp (argv[i], "debug"))
;
else
syslog (LOG_ERR, "illegal option %s", argv[i]);
}
if (flags & PAM_SILENT)
*no_warn = 1;
rc = pam_get_user (pamh, (CONST_ARG char **) &username, NULL);
if (rc != PAM_SUCCESS)
return rc;
if (username == NULL)
return PAM_USER_UNKNOWN;
rc = pam_get_ctx(pamh, username, &ctx);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_do_sess(pamh, ctx, action, &err);
NSS2PAM_RC(rc, ignore_flags, PAM_SUCCESS);
return rc;
}
int pam_sm_open_session(
pam_handle_t *pamh, int flags, int argc, const char **argv)
{
int rc, no_warn = 0;
struct pam_conv *appconv;
rc = pam_get_item (pamh, PAM_CONV, (CONST_ARG void **) &appconv);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_sm_session(pamh,flags,argc,argv,NSLCD_ACTION_PAM_SESS_O,&no_warn);
if (rc != PAM_SUCCESS && rc != PAM_IGNORE)
pam_warn(appconv, "LDAP open_session failed", PAM_ERROR_MSG, no_warn);
return rc;
}
int pam_sm_close_session(
pam_handle_t *pamh, int flags, int argc, const char **argv)
{
int rc, no_warn = 0;;
struct pam_conv *appconv;
rc = pam_get_item (pamh, PAM_CONV, (CONST_ARG void **) &appconv);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_sm_session(pamh,flags,argc,argv,NSLCD_ACTION_PAM_SESS_C,&no_warn);
if (rc != PAM_SUCCESS && rc != PAM_IGNORE)
pam_warn(appconv, "LDAP close_session failed", PAM_ERROR_MSG, no_warn);
return rc;
}
static enum nss_status pam_read_pwmod(
TFILE *fp,pld_ctx *ctx,int *errnop)
{
char *buffer = ctx->buf, *user;
size_t buflen = sizeof(ctx->buf);
size_t bufptr = 0;
int32_t tmpint32;
READ_STRING_BUF(fp,user);
READ_STRING_BUF(fp,ctx->dn);
READ_INT32(fp,ctx->authz);
READ_STRING_BUF(fp,ctx->authzmsg);
ctx->authz = nslcd2pam_rc(ctx->authz);
return NSS_STATUS_SUCCESS;
}
static enum nss_status pam_do_pwmod(
pld_ctx *ctx, const char *user, const char *svc,
const char *oldpw, const char *newpw, int *errnop)
{
NSS_BYGEN(NSLCD_ACTION_PAM_PWMOD,
WRITE_STRING(fp,user);
WRITE_STRING(fp,ctx->dn);
WRITE_STRING(fp,svc);
WRITE_STRING(fp,oldpw);
WRITE_STRING(fp,newpw),
pam_read_pwmod(fp,ctx,errnop));
}
int pam_sm_chauthtok(
pam_handle_t *pamh, int flags, int argc, const char **argv)
{
int rc, err;
const char *username, *p = NULL, *q = NULL, *svc;
int first_pass = 0, no_warn = 0, ignore_flags = 0;
int i, success = PAM_SUCCESS;
struct pam_conv *appconv;
pld_ctx *ctx = NULL;
for (i = 0; i < argc; i++)
{
if (!strcmp (argv[i], "use_first_pass"))
first_pass |= USE_FIRST;
else if (!strcmp (argv[i], "try_first_pass"))
first_pass |= TRY_FIRST;
else if (!strcmp (argv[i], "use_authtok"))
first_pass |= USE_TOKEN;
else if (!strcmp (argv[i], "no_warn"))
no_warn = 1;
else if (!strcmp (argv[i], "ignore_unknown_user"))
ignore_flags |= IGNORE_UNKNOWN;
else if (!strcmp (argv[i], "ignore_authinfo_unavail"))
ignore_flags |= IGNORE_UNAVAIL;
else if (!strcmp (argv[i], "debug"))
;
else
syslog (LOG_ERR, "illegal option %s", argv[i]);
}
if (flags & PAM_SILENT)
no_warn = 1;
rc = pam_get_item (pamh, PAM_CONV, (CONST_ARG void **) &appconv);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_get_user (pamh, (CONST_ARG char **) &username, NULL);
if (rc != PAM_SUCCESS)
return rc;
if (username == NULL)
return PAM_USER_UNKNOWN;
rc = pam_get_ctx(pamh, username, &ctx);
if (rc != PAM_SUCCESS)
return rc;
rc = pam_get_item (pamh, PAM_SERVICE, (CONST_ARG void **) &svc);
if (rc != PAM_SUCCESS)
return rc;
if (flags & PAM_PRELIM_CHECK) {
if (getuid()) {
if (!first_pass) {
rc = pam_get_authtok(pamh, flags, "(current) LDAP Password: ",
NULL, &p);
if (rc == PAM_SUCCESS) {
pam_set_item(pamh, PAM_OLDAUTHTOK, p);
memset(p, 0, strlen(p));
free(p);
}
}
rc = pam_get_item(pamh, PAM_OLDAUTHTOK, &p);
if (rc) return rc;
} else {
rc = PAM_SUCCESS;
}
if (!ctx->dn) {
rc = pam_do_pwmod(ctx, username, svc, p, NULL, &err);
NSS2PAM_RC(rc, ignore_flags, PAM_SUCCESS);
}
return rc;
}
rc = pam_get_item(pamh, PAM_OLDAUTHTOK, &p);
if (rc) return rc;
if (!p)
p = ctx->oldpw;
if (first_pass) {
rc = pam_get_item(pamh, PAM_AUTHTOK, &q);
if ((rc != PAM_SUCCESS || !q) && (first_pass & (USE_FIRST|USE_TOKEN))) {
if (rc == PAM_SUCCESS)
rc = PAM_AUTHTOK_RECOVERY_ERR;
return rc;
}
}
if (!q) {
rc = pam_get_authtok(pamh, flags, "Enter new LDAP Password: ",
"Retype new LDAP Password: ", &q);
if (rc == PAM_SUCCESS) {
pam_set_item(pamh, PAM_AUTHTOK, q);
memset(q, 0, strlen(q));
free(q);
rc = pam_get_item(pamh, PAM_AUTHTOK, &q);
}
if (rc != PAM_SUCCESS)
return rc;
}
rc = pam_do_pwmod(ctx, username, svc, p, q, &err);
p = NULL; q = NULL;
NSS2PAM_RC(rc, ignore_flags, PAM_SUCCESS);
if (rc == PAM_SUCCESS) {
rc = ctx->authz;
if (rc != PAM_SUCCESS)
pam_warn(appconv, ctx->authzmsg, PAM_ERROR_MSG, no_warn);
} else if (rc != PAM_IGNORE)
pam_warn(appconv, "LDAP pwmod failed", PAM_ERROR_MSG, no_warn);
return rc;
}
#ifdef PAM_STATIC
struct pam_module _modstruct = {
"pam_ldapd",
pam_sm_authenticate,
pam_sm_setcred,
pam_sm_acct_mgmt,
pam_sm_open_session,
pam_sm_close_session,
pam_sm_chauthtok
};
#endif /* PAM_STATIC */

View file

@ -1,83 +0,0 @@
/*
passwd.c - NSS lookup functions for passwd database
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <nss.h>
#include <errno.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
static enum nss_status read_passwd(
TFILE *fp,struct passwd *result,
char *buffer,size_t buflen,int *errnop)
{
int32_t tmpint32;
size_t bufptr=0;
READ_STRING_BUF(fp,result->pw_name);
READ_STRING_BUF(fp,result->pw_passwd);
READ_TYPE(fp,result->pw_uid,uid_t);
READ_TYPE(fp,result->pw_gid,gid_t);
READ_STRING_BUF(fp,result->pw_gecos);
READ_STRING_BUF(fp,result->pw_dir);
READ_STRING_BUF(fp,result->pw_shell);
return NSS_STATUS_SUCCESS;
}
enum nss_status _nss_ldap_getpwnam_r(const char *name,struct passwd *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_PASSWD_BYNAME,
name,
read_passwd(fp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_getpwuid_r(uid_t uid,struct passwd *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYTYPE(NSLCD_ACTION_PASSWD_BYUID,
uid,uid_t,
read_passwd(fp,result,buffer,buflen,errnop));
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *pwentfp;
/* open a connection to the nslcd and write the request */
enum nss_status _nss_ldap_setpwent(int UNUSED(stayopen))
{
NSS_SETENT(pwentfp);
}
/* read password data from an opened stream */
enum nss_status _nss_ldap_getpwent_r(struct passwd *result,char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(pwentfp,NSLCD_ACTION_PASSWD_ALL,
read_passwd(pwentfp,result,buffer,buflen,errnop));
}
/* close the stream opened with setpwent() above */
enum nss_status _nss_ldap_endpwent(void)
{
NSS_ENDENT(pwentfp);
}

View file

@ -1,76 +0,0 @@
/*
protocols.c - NSS lookup functions for protocol database
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <nss.h>
#include <errno.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
static enum nss_status read_protoent(
TFILE *fp,struct protoent *result,
char *buffer,size_t buflen,int *errnop)
{
int32_t tmpint32,tmp2int32,tmp3int32;
size_t bufptr=0;
READ_STRING_BUF(fp,result->p_name);
READ_STRINGLIST_NULLTERM(fp,result->p_aliases);
READ_INT32(fp,result->p_proto);
return NSS_STATUS_SUCCESS;
}
enum nss_status _nss_ldap_getprotobyname_r(const char *name,struct protoent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_PROTOCOL_BYNAME,
name,
read_protoent(fp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_getprotobynumber_r(int number,struct protoent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYINT32(NSLCD_ACTION_PROTOCOL_BYNUMBER,
number,
read_protoent(fp,result,buffer,buflen,errnop));
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *protoentfp;
enum nss_status _nss_ldap_setprotoent(int UNUSED(stayopen))
{
NSS_SETENT(protoentfp);
}
enum nss_status _nss_ldap_getprotoent_r(struct protoent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(protoentfp,NSLCD_ACTION_PROTOCOL_ALL,
read_protoent(protoentfp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_endprotoent(void)
{
NSS_ENDENT(protoentfp);
}

View file

@ -1,169 +0,0 @@
/*
prototypes.h - all functions exported by the NSS library
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#ifndef _NSS_EXPORTS_H
#define _NSS_EXPORTS_H 1
#include <nss.h>
#include <aliases.h>
#include <netinet/ether.h>
#include <sys/types.h>
#include <grp.h>
#include <netdb.h>
#include <pwd.h>
#include <shadow.h>
/* We define struct etherent here because it does not seem to
be defined in any publicly available header file exposed
by glibc. This is taken from include/netinet/ether.h
of the glibc (2.3.6) source tarball. */
struct etherent
{
const char *e_name;
struct ether_addr e_addr;
};
/* We also define struct __netgrent because it's definition is
not publically available. This is taken from inet/netgroup.h
of the glibc (2.3.6) source tarball.
The first part of the struct is the only part that is modified
by the getnetgrent() function, all the other fields are not
touched at all. */
struct __netgrent
{
enum { triple_val, group_val } type;
union
{
struct
{
const char *host;
const char *user;
const char *domain;
} triple;
const char *group;
} val;
/* the following stuff is used by some NSS services
but not by ours (it's not completely clear how these
are shared between different services) or is used
by our caller */
char *data;
size_t data_size;
union
{
char *cursor;
unsigned long int position;
} insertedname; /* added name to union to avoid warning */
int first;
struct name_list *known_groups;
struct name_list *needed_groups;
void *nip; /* changed from `service_user *nip' */
};
/*
These are prototypes for functions exported from the ldap NSS module.
For more complete definitions of these functions check the GLIBC
documentation.
Other services than those mentioned here are currently not implemented.
These definitions partially came from examining the GLIBC source code
as no complete documentation of the NSS interface is available.
This however is a useful pointer:
http://www.gnu.org/software/libc/manual/html_node/Name-Service-Switch.html
*/
/* aliases - mail aliases */
enum nss_status _nss_ldap_getaliasbyname_r(const char *name,struct aliasent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_setaliasent(void);
enum nss_status _nss_ldap_getaliasent_r(struct aliasent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_endaliasent(void);
/* ethers - ethernet numbers */
enum nss_status _nss_ldap_gethostton_r(const char *name,struct etherent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_getntohost_r(const struct ether_addr *addr,struct etherent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_setetherent(int stayopen);
enum nss_status _nss_ldap_getetherent_r(struct etherent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_endetherent(void);
/* group - groups of users */
enum nss_status _nss_ldap_getgrnam_r(const char *name,struct group *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_getgrgid_r(gid_t gid,struct group *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_initgroups_dyn(const char *user,gid_t group,long int *start,long int *size,gid_t **groupsp,long int limit,int *errnop);
enum nss_status _nss_ldap_setgrent(int stayopen);
enum nss_status _nss_ldap_getgrent_r(struct group *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_endgrent(void);
/* hosts - host names and numbers */
enum nss_status _nss_ldap_gethostbyname_r(const char *name,struct hostent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop);
enum nss_status _nss_ldap_gethostbyname2_r(const char *name,int af,struct hostent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop);
enum nss_status _nss_ldap_gethostbyaddr_r(const void *addr,socklen_t len,int af,struct hostent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop);
enum nss_status _nss_ldap_sethostent(int stayopen);
enum nss_status _nss_ldap_gethostent_r(struct hostent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop);
enum nss_status _nss_ldap_endhostent(void);
/* netgroup - list of host and users */
enum nss_status _nss_ldap_setnetgrent(const char *group,struct __netgrent *result);
enum nss_status _nss_ldap_getnetgrent_r(struct __netgrent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_endnetgrent(struct __netgrent *result);
/* networks - network names and numbers */
enum nss_status _nss_ldap_getnetbyname_r(const char *name,struct netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop);
enum nss_status _nss_ldap_getnetbyaddr_r(uint32_t addr,int af,struct netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop);
enum nss_status _nss_ldap_setnetent(int stayopen);
enum nss_status _nss_ldap_getnetent_r(struct netent *result,char *buffer,size_t buflen,int *errnop,int *h_errnop);
enum nss_status _nss_ldap_endnetent(void);
/* passwd - user database and passwords */
enum nss_status _nss_ldap_getpwnam_r(const char *name,struct passwd *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_getpwuid_r(uid_t uid,struct passwd *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_setpwent(int stayopen);
enum nss_status _nss_ldap_getpwent_r(struct passwd *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_endpwent(void);
/* protocols - network protocols */
enum nss_status _nss_ldap_getprotobyname_r(const char *name,struct protoent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_getprotobynumber_r(int number,struct protoent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_setprotoent(int stayopen);
enum nss_status _nss_ldap_getprotoent_r(struct protoent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_endprotoent(void);
/* rpc - remote procedure call names and numbers */
enum nss_status _nss_ldap_getrpcbyname_r(const char *name,struct rpcent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_getrpcbynumber_r(int number,struct rpcent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_setrpcent(int stayopen);
enum nss_status _nss_ldap_getrpcent_r(struct rpcent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_endrpcent(void);
/* services - network services */
enum nss_status _nss_ldap_getservbyname_r(const char *name,const char *protocol,struct servent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_getservbyport_r(int port,const char *protocol,struct servent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_setservent(int stayopen);
enum nss_status _nss_ldap_getservent_r(struct servent *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_endservent(void);
/* shadow - extended user information */
enum nss_status _nss_ldap_getspnam_r(const char *name,struct spwd *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_setspent(int stayopen);
enum nss_status _nss_ldap_getspent_r(struct spwd *result,char *buffer,size_t buflen,int *errnop);
enum nss_status _nss_ldap_endspent(void);
#endif /* not NSS_EXPORTS */

View file

@ -1,76 +0,0 @@
/*
rpc.c - NSS lookup functions for rpc database
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <nss.h>
#include <errno.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
static enum nss_status read_rpcent(
TFILE *fp,struct rpcent *result,
char *buffer,size_t buflen,int *errnop)
{
int32_t tmpint32,tmp2int32,tmp3int32;
size_t bufptr=0;
READ_STRING_BUF(fp,result->r_name);
READ_STRINGLIST_NULLTERM(fp,result->r_aliases);
READ_INT32(fp,result->r_number);
return NSS_STATUS_SUCCESS;
}
enum nss_status _nss_ldap_getrpcbyname_r(const char *name,struct rpcent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_RPC_BYNAME,
name,
read_rpcent(fp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_getrpcbynumber_r(int number,struct rpcent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYINT32(NSLCD_ACTION_RPC_BYNUMBER,
number,
read_rpcent(fp,result,buffer,buflen,errnop));
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *protoentfp;
enum nss_status _nss_ldap_setrpcent(int UNUSED(stayopen))
{
NSS_SETENT(protoentfp);
}
enum nss_status _nss_ldap_getrpcent_r(struct rpcent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(protoentfp,NSLCD_ACTION_RPC_ALL,
read_rpcent(protoentfp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_endrpcent(void)
{
NSS_ENDENT(protoentfp);
}

View file

@ -1,81 +0,0 @@
/*
service.c - NSS lookup functions for services database
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <nss.h>
#include <errno.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
static enum nss_status read_servent(
TFILE *fp,struct servent *result,
char *buffer,size_t buflen,int *errnop)
{
int32_t tmpint32,tmp2int32,tmp3int32;
size_t bufptr=0;
READ_STRING_BUF(fp,result->s_name);
READ_STRINGLIST_NULLTERM(fp,result->s_aliases);
/* store port number in network byte order */
READ_TYPE(fp,tmpint32,int32_t);
result->s_port=ntohs((uint16_t)tmpint32);
READ_STRING_BUF(fp,result->s_proto);
/* we're done */
return NSS_STATUS_SUCCESS;
}
enum nss_status _nss_ldap_getservbyname_r(const char *name,const char *protocol,struct servent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYGEN(NSLCD_ACTION_SERVICE_BYNAME,
WRITE_STRING(fp,name);WRITE_STRING(fp,protocol),
read_servent(fp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_getservbyport_r(int port,const char *protocol,struct servent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYGEN(NSLCD_ACTION_SERVICE_BYNUMBER,
WRITE_INT32(fp,ntohs(port));WRITE_STRING(fp,protocol),
read_servent(fp,result,buffer,buflen,errnop));
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *protoentfp;
enum nss_status _nss_ldap_setservent(int UNUSED(stayopen))
{
NSS_SETENT(protoentfp);
}
enum nss_status _nss_ldap_getservent_r(struct servent *result,char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(protoentfp,NSLCD_ACTION_SERVICE_ALL,
read_servent(protoentfp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_endservent(void)
{
NSS_ENDENT(protoentfp);
}

View file

@ -1,75 +0,0 @@
/*
shadow.c - NSS lookup functions for shadow database
Copyright (C) 2006 West Consulting
Copyright (C) 2006, 2007, 2008 Arthur de Jong
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include "config.h"
#include <string.h>
#include <nss.h>
#include <errno.h>
#include "prototypes.h"
#include "common.h"
#include "compat/attrs.h"
static enum nss_status read_spwd(
TFILE *fp,struct spwd *result,
char *buffer,size_t buflen,int *errnop)
{
int32_t tmpint32;
size_t bufptr=0;
READ_STRING_BUF(fp,result->sp_namp);
READ_STRING_BUF(fp,result->sp_pwdp);
READ_INT32(fp,result->sp_lstchg);
READ_INT32(fp,result->sp_min);
READ_INT32(fp,result->sp_max);
READ_INT32(fp,result->sp_warn);
READ_INT32(fp,result->sp_inact);
READ_INT32(fp,result->sp_expire);
READ_INT32(fp,result->sp_flag);
return NSS_STATUS_SUCCESS;
}
enum nss_status _nss_ldap_getspnam_r(const char *name,struct spwd *result,char *buffer,size_t buflen,int *errnop)
{
NSS_BYNAME(NSLCD_ACTION_SHADOW_BYNAME,
name,
read_spwd(fp,result,buffer,buflen,errnop));
}
/* thread-local file pointer to an ongoing request */
static __thread TFILE *spentfp;
enum nss_status _nss_ldap_setspent(int UNUSED(stayopen))
{
NSS_SETENT(spentfp);
}
enum nss_status _nss_ldap_getspent_r(struct spwd *result,char *buffer,size_t buflen,int *errnop)
{
NSS_GETENT(spentfp,NSLCD_ACTION_SHADOW_ALL,
read_spwd(spentfp,result,buffer,buflen,errnop));
}
enum nss_status _nss_ldap_endspent(void)
{
NSS_ENDENT(spentfp);
}

View file

@ -1,90 +0,0 @@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2006 West Consulting
# Copyright (C) 2006, 2007, 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
TESTS = test_dict test_set test_tio test_cfg test_myldap.sh test_nsscmds.sh
check_PROGRAMS = test_dict test_set test_tio test_cfg test_myldap
EXTRA_PROGRAMS = test_aliases test_ethers test_group test_hosts \
test_netgroup test_networks test_passwd test_protocols \
test_rpc test_services test_shadow \
test_nslcd_group
EXTRA_DIST = nss-ldapd-test.conf test_myldap.sh test_nsscmds.sh usernames.txt
CLEANFILES = $(EXTRA_PROGRAMS)
AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = $(PTHREAD_CFLAGS) -g
# the following enables verbose protocol debugging information to be dumped
#AM_CPPFLAGS += -DDEBUG_PROT -DDEBUG_PROT_DUMP
# the following enabled verbose tio stats logging
#AM_CPPFLAGS += -DDEBUG_TIO_STATS
test_dict_SOURCES = test_dict.c ../common/dict.h ../common/dict.c
#test_dict_LDADD = ../common/dict.o
test_set_SOURCES = test_set.c ../common/set.h
test_set_LDADD = ../common/libdict.a
test_tio_SOURCES = test_tio.c ../common/tio.h ../common/tio.c
test_tio_LDFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
test_cfg_SOURCES = test_cfg.c
test_cfg_LDADD = ../nslcd/log.o ../nslcd/attmap.o \
../nslcd/common.o ../nslcd/myldap.o \
../nslcd/alias.o ../nslcd/ether.o ../nslcd/group.o \
../nslcd/host.o ../nslcd/netgroup.o ../nslcd/network.o \
../nslcd/passwd.o ../nslcd/protocol.o ../nslcd/rpc.o \
../nslcd/service.o ../nslcd/shadow.o \
@nslcd_LIBS@ ../common/libtio.a ../common/libdict.a \
../compat/libcompat.a
test_myldap_SOURCES = test_myldap.c
test_myldap_LDADD = ../nslcd/log.o ../nslcd/common.o ../nslcd/cfg.o \
../nslcd/myldap.o @nslcd_LIBS@ ../common/libtio.a \
../common/libdict.a ../compat/libcompat.a
common_SOURCES = ../nss/common.c ../nslcd.h ../nss/prototypes.h \
../common/tio.c ../common/tio.h
test_aliases_SOURCES = test_aliases.c ../nss/aliases.c $(common_SOURCES)
test_ethers_SOURCES = test_ethers.c ../nss/ethers.c $(common_SOURCES)
test_group_SOURCES = test_group.c ../nss/group.c $(common_SOURCES)
test_hosts_SOURCES = test_hosts.c ../nss/hosts.c $(common_SOURCES)
test_netgroup_SOURCES = test_netgroup.c ../nss/netgroup.c $(common_SOURCES)
test_networks_SOURCES = test_networks.c ../nss/networks.c $(common_SOURCES)
test_passwd_SOURCES = test_passwd.c ../nss/passwd.c $(common_SOURCES)
test_protocols_SOURCES = test_protocols.c ../nss/protocols.c $(common_SOURCES)
test_rpc_SOURCES = test_rpc.c ../nss/rpc.c $(common_SOURCES)
test_services_SOURCES = test_services.c ../nss/services.c $(common_SOURCES)
test_shadow_SOURCES = test_shadow.c ../nss/shadow.c $(common_SOURCES)
test_nslcd_group_SOURCES = test_nslcd_group.c
test_nslcd_group_LDADD = ../nslcd/log.o ../nslcd/attmap.o ../common/dict.o \
../nslcd/common.o ../nslcd/myldap.o \
../nslcd/alias.o ../nslcd/ether.o \
../nslcd/host.o ../nslcd/netgroup.o ../nslcd/network.o \
../nslcd/passwd.o ../nslcd/protocol.o ../nslcd/rpc.o \
../nslcd/service.o ../nslcd/shadow.o \
@nslcd_LIBS@ ../common/libtio.a ../common/libdict.a \
../compat/libcompat.a ../nslcd/cfg.o

View file

@ -1,930 +0,0 @@
# Makefile.in generated by automake 1.10.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
# Makefile.am - use automake to generate Makefile.in
#
# Copyright (C) 2006 West Consulting
# Copyright (C) 2006, 2007, 2008 Arthur de Jong
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
TESTS = test_dict$(EXEEXT) test_set$(EXEEXT) test_tio$(EXEEXT) \
test_cfg$(EXEEXT) test_myldap.sh test_nsscmds.sh
check_PROGRAMS = test_dict$(EXEEXT) test_set$(EXEEXT) \
test_tio$(EXEEXT) test_cfg$(EXEEXT) test_myldap$(EXEEXT)
EXTRA_PROGRAMS = test_aliases$(EXEEXT) test_ethers$(EXEEXT) \
test_group$(EXEEXT) test_hosts$(EXEEXT) test_netgroup$(EXEEXT) \
test_networks$(EXEEXT) test_passwd$(EXEEXT) \
test_protocols$(EXEEXT) test_rpc$(EXEEXT) \
test_services$(EXEEXT) test_shadow$(EXEEXT) \
test_nslcd_group$(EXEEXT)
subdir = tests
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
am__objects_1 = common.$(OBJEXT) tio.$(OBJEXT)
am_test_aliases_OBJECTS = test_aliases.$(OBJEXT) aliases.$(OBJEXT) \
$(am__objects_1)
test_aliases_OBJECTS = $(am_test_aliases_OBJECTS)
test_aliases_LDADD = $(LDADD)
am_test_cfg_OBJECTS = test_cfg.$(OBJEXT)
test_cfg_OBJECTS = $(am_test_cfg_OBJECTS)
test_cfg_DEPENDENCIES = ../nslcd/log.o ../nslcd/attmap.o \
../nslcd/common.o ../nslcd/myldap.o ../nslcd/alias.o \
../nslcd/ether.o ../nslcd/group.o ../nslcd/host.o \
../nslcd/netgroup.o ../nslcd/network.o ../nslcd/passwd.o \
../nslcd/protocol.o ../nslcd/rpc.o ../nslcd/service.o \
../nslcd/shadow.o ../common/libtio.a ../common/libdict.a \
../compat/libcompat.a
am_test_dict_OBJECTS = test_dict.$(OBJEXT) dict.$(OBJEXT)
test_dict_OBJECTS = $(am_test_dict_OBJECTS)
test_dict_LDADD = $(LDADD)
am_test_ethers_OBJECTS = test_ethers.$(OBJEXT) ethers.$(OBJEXT) \
$(am__objects_1)
test_ethers_OBJECTS = $(am_test_ethers_OBJECTS)
test_ethers_LDADD = $(LDADD)
am_test_group_OBJECTS = test_group.$(OBJEXT) group.$(OBJEXT) \
$(am__objects_1)
test_group_OBJECTS = $(am_test_group_OBJECTS)
test_group_LDADD = $(LDADD)
am_test_hosts_OBJECTS = test_hosts.$(OBJEXT) hosts.$(OBJEXT) \
$(am__objects_1)
test_hosts_OBJECTS = $(am_test_hosts_OBJECTS)
test_hosts_LDADD = $(LDADD)
am_test_myldap_OBJECTS = test_myldap.$(OBJEXT)
test_myldap_OBJECTS = $(am_test_myldap_OBJECTS)
test_myldap_DEPENDENCIES = ../nslcd/log.o ../nslcd/common.o \
../nslcd/cfg.o ../nslcd/myldap.o ../common/libtio.a \
../common/libdict.a ../compat/libcompat.a
am_test_netgroup_OBJECTS = test_netgroup.$(OBJEXT) netgroup.$(OBJEXT) \
$(am__objects_1)
test_netgroup_OBJECTS = $(am_test_netgroup_OBJECTS)
test_netgroup_LDADD = $(LDADD)
am_test_networks_OBJECTS = test_networks.$(OBJEXT) networks.$(OBJEXT) \
$(am__objects_1)
test_networks_OBJECTS = $(am_test_networks_OBJECTS)
test_networks_LDADD = $(LDADD)
am_test_nslcd_group_OBJECTS = test_nslcd_group.$(OBJEXT)
test_nslcd_group_OBJECTS = $(am_test_nslcd_group_OBJECTS)
test_nslcd_group_DEPENDENCIES = ../nslcd/log.o ../nslcd/attmap.o \
../common/dict.o ../nslcd/common.o ../nslcd/myldap.o \
../nslcd/alias.o ../nslcd/ether.o ../nslcd/host.o \
../nslcd/netgroup.o ../nslcd/network.o ../nslcd/passwd.o \
../nslcd/protocol.o ../nslcd/rpc.o ../nslcd/service.o \
../nslcd/shadow.o ../common/libtio.a ../common/libdict.a \
../compat/libcompat.a ../nslcd/cfg.o
am_test_passwd_OBJECTS = test_passwd.$(OBJEXT) passwd.$(OBJEXT) \
$(am__objects_1)
test_passwd_OBJECTS = $(am_test_passwd_OBJECTS)
test_passwd_LDADD = $(LDADD)
am_test_protocols_OBJECTS = test_protocols.$(OBJEXT) \
protocols.$(OBJEXT) $(am__objects_1)
test_protocols_OBJECTS = $(am_test_protocols_OBJECTS)
test_protocols_LDADD = $(LDADD)
am_test_rpc_OBJECTS = test_rpc.$(OBJEXT) rpc.$(OBJEXT) \
$(am__objects_1)
test_rpc_OBJECTS = $(am_test_rpc_OBJECTS)
test_rpc_LDADD = $(LDADD)
am_test_services_OBJECTS = test_services.$(OBJEXT) services.$(OBJEXT) \
$(am__objects_1)
test_services_OBJECTS = $(am_test_services_OBJECTS)
test_services_LDADD = $(LDADD)
am_test_set_OBJECTS = test_set.$(OBJEXT)
test_set_OBJECTS = $(am_test_set_OBJECTS)
test_set_DEPENDENCIES = ../common/libdict.a
am_test_shadow_OBJECTS = test_shadow.$(OBJEXT) shadow.$(OBJEXT) \
$(am__objects_1)
test_shadow_OBJECTS = $(am_test_shadow_OBJECTS)
test_shadow_LDADD = $(LDADD)
am_test_tio_OBJECTS = test_tio.$(OBJEXT) tio.$(OBJEXT)
test_tio_OBJECTS = $(am_test_tio_OBJECTS)
test_tio_LDADD = $(LDADD)
test_tio_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(test_tio_LDFLAGS) \
$(LDFLAGS) -o $@
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(test_aliases_SOURCES) $(test_cfg_SOURCES) \
$(test_dict_SOURCES) $(test_ethers_SOURCES) \
$(test_group_SOURCES) $(test_hosts_SOURCES) \
$(test_myldap_SOURCES) $(test_netgroup_SOURCES) \
$(test_networks_SOURCES) $(test_nslcd_group_SOURCES) \
$(test_passwd_SOURCES) $(test_protocols_SOURCES) \
$(test_rpc_SOURCES) $(test_services_SOURCES) \
$(test_set_SOURCES) $(test_shadow_SOURCES) $(test_tio_SOURCES)
DIST_SOURCES = $(test_aliases_SOURCES) $(test_cfg_SOURCES) \
$(test_dict_SOURCES) $(test_ethers_SOURCES) \
$(test_group_SOURCES) $(test_hosts_SOURCES) \
$(test_myldap_SOURCES) $(test_netgroup_SOURCES) \
$(test_networks_SOURCES) $(test_nslcd_group_SOURCES) \
$(test_passwd_SOURCES) $(test_protocols_SOURCES) \
$(test_rpc_SOURCES) $(test_services_SOURCES) \
$(test_set_SOURCES) $(test_shadow_SOURCES) $(test_tio_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DOCBOOK2X_MAN = @DOCBOOK2X_MAN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NSLCD_PIDFILE = @NSLCD_PIDFILE@
NSLCD_SOCKET = @NSLCD_SOCKET@
NSS_LDAP_PATH_CONF = @NSS_LDAP_PATH_CONF@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RELEASE_MONTH = @RELEASE_MONTH@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
acx_pthread_config = @acx_pthread_config@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
nslcd_LIBS = @nslcd_LIBS@
nss_ldap_so_LIBS = @nss_ldap_so_LIBS@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = nss-ldapd-test.conf test_myldap.sh test_nsscmds.sh usernames.txt
CLEANFILES = $(EXTRA_PROGRAMS)
AM_CPPFLAGS = -I$(top_srcdir)
AM_CFLAGS = $(PTHREAD_CFLAGS) -g
# the following enables verbose protocol debugging information to be dumped
#AM_CPPFLAGS += -DDEBUG_PROT -DDEBUG_PROT_DUMP
# the following enabled verbose tio stats logging
#AM_CPPFLAGS += -DDEBUG_TIO_STATS
test_dict_SOURCES = test_dict.c ../common/dict.h ../common/dict.c
#test_dict_LDADD = ../common/dict.o
test_set_SOURCES = test_set.c ../common/set.h
test_set_LDADD = ../common/libdict.a
test_tio_SOURCES = test_tio.c ../common/tio.h ../common/tio.c
test_tio_LDFLAGS = $(PTHREAD_CFLAGS) $(PTHREAD_LIBS)
test_cfg_SOURCES = test_cfg.c
test_cfg_LDADD = ../nslcd/log.o ../nslcd/attmap.o \
../nslcd/common.o ../nslcd/myldap.o \
../nslcd/alias.o ../nslcd/ether.o ../nslcd/group.o \
../nslcd/host.o ../nslcd/netgroup.o ../nslcd/network.o \
../nslcd/passwd.o ../nslcd/protocol.o ../nslcd/rpc.o \
../nslcd/service.o ../nslcd/shadow.o \
@nslcd_LIBS@ ../common/libtio.a ../common/libdict.a \
../compat/libcompat.a
test_myldap_SOURCES = test_myldap.c
test_myldap_LDADD = ../nslcd/log.o ../nslcd/common.o ../nslcd/cfg.o \
../nslcd/myldap.o @nslcd_LIBS@ ../common/libtio.a \
../common/libdict.a ../compat/libcompat.a
common_SOURCES = ../nss/common.c ../nslcd.h ../nss/prototypes.h \
../common/tio.c ../common/tio.h
test_aliases_SOURCES = test_aliases.c ../nss/aliases.c $(common_SOURCES)
test_ethers_SOURCES = test_ethers.c ../nss/ethers.c $(common_SOURCES)
test_group_SOURCES = test_group.c ../nss/group.c $(common_SOURCES)
test_hosts_SOURCES = test_hosts.c ../nss/hosts.c $(common_SOURCES)
test_netgroup_SOURCES = test_netgroup.c ../nss/netgroup.c $(common_SOURCES)
test_networks_SOURCES = test_networks.c ../nss/networks.c $(common_SOURCES)
test_passwd_SOURCES = test_passwd.c ../nss/passwd.c $(common_SOURCES)
test_protocols_SOURCES = test_protocols.c ../nss/protocols.c $(common_SOURCES)
test_rpc_SOURCES = test_rpc.c ../nss/rpc.c $(common_SOURCES)
test_services_SOURCES = test_services.c ../nss/services.c $(common_SOURCES)
test_shadow_SOURCES = test_shadow.c ../nss/shadow.c $(common_SOURCES)
test_nslcd_group_SOURCES = test_nslcd_group.c
test_nslcd_group_LDADD = ../nslcd/log.o ../nslcd/attmap.o ../common/dict.o \
../nslcd/common.o ../nslcd/myldap.o \
../nslcd/alias.o ../nslcd/ether.o \
../nslcd/host.o ../nslcd/netgroup.o ../nslcd/network.o \
../nslcd/passwd.o ../nslcd/protocol.o ../nslcd/rpc.o \
../nslcd/service.o ../nslcd/shadow.o \
@nslcd_LIBS@ ../common/libtio.a ../common/libdict.a \
../compat/libcompat.a ../nslcd/cfg.o
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
&& exit 0; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --gnu tests/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
clean-checkPROGRAMS:
-test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS)
test_aliases$(EXEEXT): $(test_aliases_OBJECTS) $(test_aliases_DEPENDENCIES)
@rm -f test_aliases$(EXEEXT)
$(LINK) $(test_aliases_OBJECTS) $(test_aliases_LDADD) $(LIBS)
test_cfg$(EXEEXT): $(test_cfg_OBJECTS) $(test_cfg_DEPENDENCIES)
@rm -f test_cfg$(EXEEXT)
$(LINK) $(test_cfg_OBJECTS) $(test_cfg_LDADD) $(LIBS)
test_dict$(EXEEXT): $(test_dict_OBJECTS) $(test_dict_DEPENDENCIES)
@rm -f test_dict$(EXEEXT)
$(LINK) $(test_dict_OBJECTS) $(test_dict_LDADD) $(LIBS)
test_ethers$(EXEEXT): $(test_ethers_OBJECTS) $(test_ethers_DEPENDENCIES)
@rm -f test_ethers$(EXEEXT)
$(LINK) $(test_ethers_OBJECTS) $(test_ethers_LDADD) $(LIBS)
test_group$(EXEEXT): $(test_group_OBJECTS) $(test_group_DEPENDENCIES)
@rm -f test_group$(EXEEXT)
$(LINK) $(test_group_OBJECTS) $(test_group_LDADD) $(LIBS)
test_hosts$(EXEEXT): $(test_hosts_OBJECTS) $(test_hosts_DEPENDENCIES)
@rm -f test_hosts$(EXEEXT)
$(LINK) $(test_hosts_OBJECTS) $(test_hosts_LDADD) $(LIBS)
test_myldap$(EXEEXT): $(test_myldap_OBJECTS) $(test_myldap_DEPENDENCIES)
@rm -f test_myldap$(EXEEXT)
$(LINK) $(test_myldap_OBJECTS) $(test_myldap_LDADD) $(LIBS)
test_netgroup$(EXEEXT): $(test_netgroup_OBJECTS) $(test_netgroup_DEPENDENCIES)
@rm -f test_netgroup$(EXEEXT)
$(LINK) $(test_netgroup_OBJECTS) $(test_netgroup_LDADD) $(LIBS)
test_networks$(EXEEXT): $(test_networks_OBJECTS) $(test_networks_DEPENDENCIES)
@rm -f test_networks$(EXEEXT)
$(LINK) $(test_networks_OBJECTS) $(test_networks_LDADD) $(LIBS)
test_nslcd_group$(EXEEXT): $(test_nslcd_group_OBJECTS) $(test_nslcd_group_DEPENDENCIES)
@rm -f test_nslcd_group$(EXEEXT)
$(LINK) $(test_nslcd_group_OBJECTS) $(test_nslcd_group_LDADD) $(LIBS)
test_passwd$(EXEEXT): $(test_passwd_OBJECTS) $(test_passwd_DEPENDENCIES)
@rm -f test_passwd$(EXEEXT)
$(LINK) $(test_passwd_OBJECTS) $(test_passwd_LDADD) $(LIBS)
test_protocols$(EXEEXT): $(test_protocols_OBJECTS) $(test_protocols_DEPENDENCIES)
@rm -f test_protocols$(EXEEXT)
$(LINK) $(test_protocols_OBJECTS) $(test_protocols_LDADD) $(LIBS)
test_rpc$(EXEEXT): $(test_rpc_OBJECTS) $(test_rpc_DEPENDENCIES)
@rm -f test_rpc$(EXEEXT)
$(LINK) $(test_rpc_OBJECTS) $(test_rpc_LDADD) $(LIBS)
test_services$(EXEEXT): $(test_services_OBJECTS) $(test_services_DEPENDENCIES)
@rm -f test_services$(EXEEXT)
$(LINK) $(test_services_OBJECTS) $(test_services_LDADD) $(LIBS)
test_set$(EXEEXT): $(test_set_OBJECTS) $(test_set_DEPENDENCIES)
@rm -f test_set$(EXEEXT)
$(LINK) $(test_set_OBJECTS) $(test_set_LDADD) $(LIBS)
test_shadow$(EXEEXT): $(test_shadow_OBJECTS) $(test_shadow_DEPENDENCIES)
@rm -f test_shadow$(EXEEXT)
$(LINK) $(test_shadow_OBJECTS) $(test_shadow_LDADD) $(LIBS)
test_tio$(EXEEXT): $(test_tio_OBJECTS) $(test_tio_DEPENDENCIES)
@rm -f test_tio$(EXEEXT)
$(test_tio_LINK) $(test_tio_OBJECTS) $(test_tio_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aliases.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dict.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ethers.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/group.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hosts.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netgroup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passwd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocols.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rpc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/services.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shadow.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_aliases.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_cfg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_dict.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_ethers.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_group.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_hosts.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_myldap.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_netgroup.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_networks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_nslcd_group.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_passwd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_protocols.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_rpc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_services.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_set.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_shadow.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_tio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tio.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
aliases.o: ../nss/aliases.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT aliases.o -MD -MP -MF $(DEPDIR)/aliases.Tpo -c -o aliases.o `test -f '../nss/aliases.c' || echo '$(srcdir)/'`../nss/aliases.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/aliases.Tpo $(DEPDIR)/aliases.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/aliases.c' object='aliases.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o aliases.o `test -f '../nss/aliases.c' || echo '$(srcdir)/'`../nss/aliases.c
aliases.obj: ../nss/aliases.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT aliases.obj -MD -MP -MF $(DEPDIR)/aliases.Tpo -c -o aliases.obj `if test -f '../nss/aliases.c'; then $(CYGPATH_W) '../nss/aliases.c'; else $(CYGPATH_W) '$(srcdir)/../nss/aliases.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/aliases.Tpo $(DEPDIR)/aliases.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/aliases.c' object='aliases.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o aliases.obj `if test -f '../nss/aliases.c'; then $(CYGPATH_W) '../nss/aliases.c'; else $(CYGPATH_W) '$(srcdir)/../nss/aliases.c'; fi`
common.o: ../nss/common.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT common.o -MD -MP -MF $(DEPDIR)/common.Tpo -c -o common.o `test -f '../nss/common.c' || echo '$(srcdir)/'`../nss/common.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/common.Tpo $(DEPDIR)/common.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/common.c' object='common.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o common.o `test -f '../nss/common.c' || echo '$(srcdir)/'`../nss/common.c
common.obj: ../nss/common.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT common.obj -MD -MP -MF $(DEPDIR)/common.Tpo -c -o common.obj `if test -f '../nss/common.c'; then $(CYGPATH_W) '../nss/common.c'; else $(CYGPATH_W) '$(srcdir)/../nss/common.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/common.Tpo $(DEPDIR)/common.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/common.c' object='common.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o common.obj `if test -f '../nss/common.c'; then $(CYGPATH_W) '../nss/common.c'; else $(CYGPATH_W) '$(srcdir)/../nss/common.c'; fi`
tio.o: ../common/tio.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tio.o -MD -MP -MF $(DEPDIR)/tio.Tpo -c -o tio.o `test -f '../common/tio.c' || echo '$(srcdir)/'`../common/tio.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/tio.Tpo $(DEPDIR)/tio.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/tio.c' object='tio.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tio.o `test -f '../common/tio.c' || echo '$(srcdir)/'`../common/tio.c
tio.obj: ../common/tio.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tio.obj -MD -MP -MF $(DEPDIR)/tio.Tpo -c -o tio.obj `if test -f '../common/tio.c'; then $(CYGPATH_W) '../common/tio.c'; else $(CYGPATH_W) '$(srcdir)/../common/tio.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/tio.Tpo $(DEPDIR)/tio.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/tio.c' object='tio.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tio.obj `if test -f '../common/tio.c'; then $(CYGPATH_W) '../common/tio.c'; else $(CYGPATH_W) '$(srcdir)/../common/tio.c'; fi`
dict.o: ../common/dict.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dict.o -MD -MP -MF $(DEPDIR)/dict.Tpo -c -o dict.o `test -f '../common/dict.c' || echo '$(srcdir)/'`../common/dict.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dict.Tpo $(DEPDIR)/dict.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/dict.c' object='dict.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dict.o `test -f '../common/dict.c' || echo '$(srcdir)/'`../common/dict.c
dict.obj: ../common/dict.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dict.obj -MD -MP -MF $(DEPDIR)/dict.Tpo -c -o dict.obj `if test -f '../common/dict.c'; then $(CYGPATH_W) '../common/dict.c'; else $(CYGPATH_W) '$(srcdir)/../common/dict.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/dict.Tpo $(DEPDIR)/dict.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/dict.c' object='dict.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dict.obj `if test -f '../common/dict.c'; then $(CYGPATH_W) '../common/dict.c'; else $(CYGPATH_W) '$(srcdir)/../common/dict.c'; fi`
ethers.o: ../nss/ethers.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ethers.o -MD -MP -MF $(DEPDIR)/ethers.Tpo -c -o ethers.o `test -f '../nss/ethers.c' || echo '$(srcdir)/'`../nss/ethers.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ethers.Tpo $(DEPDIR)/ethers.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/ethers.c' object='ethers.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ethers.o `test -f '../nss/ethers.c' || echo '$(srcdir)/'`../nss/ethers.c
ethers.obj: ../nss/ethers.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT ethers.obj -MD -MP -MF $(DEPDIR)/ethers.Tpo -c -o ethers.obj `if test -f '../nss/ethers.c'; then $(CYGPATH_W) '../nss/ethers.c'; else $(CYGPATH_W) '$(srcdir)/../nss/ethers.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ethers.Tpo $(DEPDIR)/ethers.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/ethers.c' object='ethers.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o ethers.obj `if test -f '../nss/ethers.c'; then $(CYGPATH_W) '../nss/ethers.c'; else $(CYGPATH_W) '$(srcdir)/../nss/ethers.c'; fi`
group.o: ../nss/group.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT group.o -MD -MP -MF $(DEPDIR)/group.Tpo -c -o group.o `test -f '../nss/group.c' || echo '$(srcdir)/'`../nss/group.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/group.Tpo $(DEPDIR)/group.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/group.c' object='group.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o group.o `test -f '../nss/group.c' || echo '$(srcdir)/'`../nss/group.c
group.obj: ../nss/group.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT group.obj -MD -MP -MF $(DEPDIR)/group.Tpo -c -o group.obj `if test -f '../nss/group.c'; then $(CYGPATH_W) '../nss/group.c'; else $(CYGPATH_W) '$(srcdir)/../nss/group.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/group.Tpo $(DEPDIR)/group.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/group.c' object='group.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o group.obj `if test -f '../nss/group.c'; then $(CYGPATH_W) '../nss/group.c'; else $(CYGPATH_W) '$(srcdir)/../nss/group.c'; fi`
hosts.o: ../nss/hosts.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hosts.o -MD -MP -MF $(DEPDIR)/hosts.Tpo -c -o hosts.o `test -f '../nss/hosts.c' || echo '$(srcdir)/'`../nss/hosts.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/hosts.Tpo $(DEPDIR)/hosts.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/hosts.c' object='hosts.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hosts.o `test -f '../nss/hosts.c' || echo '$(srcdir)/'`../nss/hosts.c
hosts.obj: ../nss/hosts.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT hosts.obj -MD -MP -MF $(DEPDIR)/hosts.Tpo -c -o hosts.obj `if test -f '../nss/hosts.c'; then $(CYGPATH_W) '../nss/hosts.c'; else $(CYGPATH_W) '$(srcdir)/../nss/hosts.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/hosts.Tpo $(DEPDIR)/hosts.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/hosts.c' object='hosts.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hosts.obj `if test -f '../nss/hosts.c'; then $(CYGPATH_W) '../nss/hosts.c'; else $(CYGPATH_W) '$(srcdir)/../nss/hosts.c'; fi`
netgroup.o: ../nss/netgroup.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT netgroup.o -MD -MP -MF $(DEPDIR)/netgroup.Tpo -c -o netgroup.o `test -f '../nss/netgroup.c' || echo '$(srcdir)/'`../nss/netgroup.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/netgroup.Tpo $(DEPDIR)/netgroup.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/netgroup.c' object='netgroup.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o netgroup.o `test -f '../nss/netgroup.c' || echo '$(srcdir)/'`../nss/netgroup.c
netgroup.obj: ../nss/netgroup.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT netgroup.obj -MD -MP -MF $(DEPDIR)/netgroup.Tpo -c -o netgroup.obj `if test -f '../nss/netgroup.c'; then $(CYGPATH_W) '../nss/netgroup.c'; else $(CYGPATH_W) '$(srcdir)/../nss/netgroup.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/netgroup.Tpo $(DEPDIR)/netgroup.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/netgroup.c' object='netgroup.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o netgroup.obj `if test -f '../nss/netgroup.c'; then $(CYGPATH_W) '../nss/netgroup.c'; else $(CYGPATH_W) '$(srcdir)/../nss/netgroup.c'; fi`
networks.o: ../nss/networks.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT networks.o -MD -MP -MF $(DEPDIR)/networks.Tpo -c -o networks.o `test -f '../nss/networks.c' || echo '$(srcdir)/'`../nss/networks.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/networks.Tpo $(DEPDIR)/networks.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/networks.c' object='networks.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o networks.o `test -f '../nss/networks.c' || echo '$(srcdir)/'`../nss/networks.c
networks.obj: ../nss/networks.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT networks.obj -MD -MP -MF $(DEPDIR)/networks.Tpo -c -o networks.obj `if test -f '../nss/networks.c'; then $(CYGPATH_W) '../nss/networks.c'; else $(CYGPATH_W) '$(srcdir)/../nss/networks.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/networks.Tpo $(DEPDIR)/networks.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/networks.c' object='networks.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o networks.obj `if test -f '../nss/networks.c'; then $(CYGPATH_W) '../nss/networks.c'; else $(CYGPATH_W) '$(srcdir)/../nss/networks.c'; fi`
passwd.o: ../nss/passwd.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT passwd.o -MD -MP -MF $(DEPDIR)/passwd.Tpo -c -o passwd.o `test -f '../nss/passwd.c' || echo '$(srcdir)/'`../nss/passwd.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/passwd.Tpo $(DEPDIR)/passwd.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/passwd.c' object='passwd.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o passwd.o `test -f '../nss/passwd.c' || echo '$(srcdir)/'`../nss/passwd.c
passwd.obj: ../nss/passwd.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT passwd.obj -MD -MP -MF $(DEPDIR)/passwd.Tpo -c -o passwd.obj `if test -f '../nss/passwd.c'; then $(CYGPATH_W) '../nss/passwd.c'; else $(CYGPATH_W) '$(srcdir)/../nss/passwd.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/passwd.Tpo $(DEPDIR)/passwd.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/passwd.c' object='passwd.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o passwd.obj `if test -f '../nss/passwd.c'; then $(CYGPATH_W) '../nss/passwd.c'; else $(CYGPATH_W) '$(srcdir)/../nss/passwd.c'; fi`
protocols.o: ../nss/protocols.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT protocols.o -MD -MP -MF $(DEPDIR)/protocols.Tpo -c -o protocols.o `test -f '../nss/protocols.c' || echo '$(srcdir)/'`../nss/protocols.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/protocols.Tpo $(DEPDIR)/protocols.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/protocols.c' object='protocols.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o protocols.o `test -f '../nss/protocols.c' || echo '$(srcdir)/'`../nss/protocols.c
protocols.obj: ../nss/protocols.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT protocols.obj -MD -MP -MF $(DEPDIR)/protocols.Tpo -c -o protocols.obj `if test -f '../nss/protocols.c'; then $(CYGPATH_W) '../nss/protocols.c'; else $(CYGPATH_W) '$(srcdir)/../nss/protocols.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/protocols.Tpo $(DEPDIR)/protocols.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/protocols.c' object='protocols.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o protocols.obj `if test -f '../nss/protocols.c'; then $(CYGPATH_W) '../nss/protocols.c'; else $(CYGPATH_W) '$(srcdir)/../nss/protocols.c'; fi`
rpc.o: ../nss/rpc.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rpc.o -MD -MP -MF $(DEPDIR)/rpc.Tpo -c -o rpc.o `test -f '../nss/rpc.c' || echo '$(srcdir)/'`../nss/rpc.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/rpc.Tpo $(DEPDIR)/rpc.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/rpc.c' object='rpc.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rpc.o `test -f '../nss/rpc.c' || echo '$(srcdir)/'`../nss/rpc.c
rpc.obj: ../nss/rpc.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rpc.obj -MD -MP -MF $(DEPDIR)/rpc.Tpo -c -o rpc.obj `if test -f '../nss/rpc.c'; then $(CYGPATH_W) '../nss/rpc.c'; else $(CYGPATH_W) '$(srcdir)/../nss/rpc.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/rpc.Tpo $(DEPDIR)/rpc.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/rpc.c' object='rpc.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rpc.obj `if test -f '../nss/rpc.c'; then $(CYGPATH_W) '../nss/rpc.c'; else $(CYGPATH_W) '$(srcdir)/../nss/rpc.c'; fi`
services.o: ../nss/services.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT services.o -MD -MP -MF $(DEPDIR)/services.Tpo -c -o services.o `test -f '../nss/services.c' || echo '$(srcdir)/'`../nss/services.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/services.Tpo $(DEPDIR)/services.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/services.c' object='services.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o services.o `test -f '../nss/services.c' || echo '$(srcdir)/'`../nss/services.c
services.obj: ../nss/services.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT services.obj -MD -MP -MF $(DEPDIR)/services.Tpo -c -o services.obj `if test -f '../nss/services.c'; then $(CYGPATH_W) '../nss/services.c'; else $(CYGPATH_W) '$(srcdir)/../nss/services.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/services.Tpo $(DEPDIR)/services.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/services.c' object='services.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o services.obj `if test -f '../nss/services.c'; then $(CYGPATH_W) '../nss/services.c'; else $(CYGPATH_W) '$(srcdir)/../nss/services.c'; fi`
shadow.o: ../nss/shadow.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shadow.o -MD -MP -MF $(DEPDIR)/shadow.Tpo -c -o shadow.o `test -f '../nss/shadow.c' || echo '$(srcdir)/'`../nss/shadow.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/shadow.Tpo $(DEPDIR)/shadow.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/shadow.c' object='shadow.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shadow.o `test -f '../nss/shadow.c' || echo '$(srcdir)/'`../nss/shadow.c
shadow.obj: ../nss/shadow.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT shadow.obj -MD -MP -MF $(DEPDIR)/shadow.Tpo -c -o shadow.obj `if test -f '../nss/shadow.c'; then $(CYGPATH_W) '../nss/shadow.c'; else $(CYGPATH_W) '$(srcdir)/../nss/shadow.c'; fi`
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/shadow.Tpo $(DEPDIR)/shadow.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../nss/shadow.c' object='shadow.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o shadow.obj `if test -f '../nss/shadow.c'; then $(CYGPATH_W) '../nss/shadow.c'; else $(CYGPATH_W) '$(srcdir)/../nss/shadow.c'; fi`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
srcdir=$(srcdir); export srcdir; \
list=' $(TESTS) '; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
elif test -f $$tst; then dir=; \
else dir="$(srcdir)/"; fi; \
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*$$ws$$tst$$ws*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
echo "XPASS: $$tst"; \
;; \
*) \
echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
*$$ws$$tst$$ws*) \
xfail=`expr $$xfail + 1`; \
echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
echo "SKIP: $$tst"; \
fi; \
done; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
banner="All $$all tests passed"; \
else \
banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
banner="$$failed of $$all tests failed"; \
else \
banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
skipped="($$skip tests were not run)"; \
test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
echo "$$dashes"; \
echo "$$banner"; \
test -z "$$skipped" || echo "$$skipped"; \
test -z "$$report" || echo "$$report"; \
echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
check-am: all-am
$(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-checkPROGRAMS clean-generic mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-exec-am:
install-html: install-html-am
install-info: install-info-am
install-man:
install-pdf: install-pdf-am
install-ps: install-ps-am
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic ctags distclean \
distclean-compile distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

Some files were not shown because too many files have changed in this diff Show more